soc.2010.detachablepurple: f3416f0a: Added the capability to be remotely set ...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Sun Jul 11 17:48:04 EDT 2010


----------------------------------------------------------------------
Revision: f3416f0abea0d93e20fd2402175d3b4f2a75a8df
Parent:   ed93886bae41c0954a9bc55e3a23f1f06ab3a9eb
Author:   gillux at soc.pidgin.im
Date:     07/07/10 06:13:02
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/f3416f0abea0d93e20fd2402175d3b4f2a75a8df

Changelog: 

Added the capability to be remotely set for all the property where I found
it revelant.

Changes against parent ed93886bae41c0954a9bc55e3a23f1f06ab3a9eb

  patched  libpurple/account.c

-------------- next part --------------
============================================================
--- libpurple/account.c	5192e4722d173e770df0ad556122f680734b554e
+++ libpurple/account.c	f3ffd00ba664742d38740960487a808800b82aec
@@ -462,6 +462,17 @@ purple_account_set_property(GObject *obj
 		GParamSpec *pspec)
 {
 	PurpleAccount *account = PURPLE_ACCOUNT(obj);
+
+	/* In remote mode context, we don't want any property to be set until the
+	 * object have been published on dbus, or this would fail. This typically
+	 * happens when the properties flagged with G_PARAM_CONSTRUCT are
+	 * initialized.
+	 */
+	if (purple_core_get_remote_mode()) {
+		if(!purple_object_get_dbus_path(PURPLE_OBJECT(obj)))
+			return;
+	}
+
 	switch (param_id) {
 		case PROP_USERNAME:
 			purple_account_set_username(account, g_value_get_string(value));
@@ -1415,6 +1426,9 @@ purple_account_set_username(PurpleAccoun
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 	g_return_if_fail(username != NULL);
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_USERNAME_S, username);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	if (purple_util_strings_equal(priv->username, username))
 		return;
@@ -1456,6 +1470,9 @@ purple_account_set_alias(PurpleAccount *
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_PRIVATE_ALIAS_S, alias);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	if (purple_util_strings_equal(priv->alias, alias))
 		return;
@@ -1480,6 +1497,9 @@ purple_account_set_user_info(PurpleAccou
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_USER_INFO_S, user_info);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
 	if (purple_util_strings_equal(priv->user_info, user_info))
@@ -1496,6 +1516,9 @@ void purple_account_set_buddy_icon_path(
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_BUDDY_ICON_PATH_S, path);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
 	if (purple_util_strings_equal(priv->buddy_icon_path, path))
@@ -1535,6 +1558,9 @@ purple_account_set_remember_password(Pur
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_boolean, G_TYPE_BOOLEAN,
+								PROP_REMEMBER_PASSWORD_S, value);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	if (priv->remember_pass == value)
 		return;
@@ -1549,6 +1575,9 @@ purple_account_set_check_mail(PurpleAcco
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_boolean, G_TYPE_BOOLEAN,
+								PROP_CHECK_MAIL_S, value);
+
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	if (priv->check_mail == value)
 		return;
@@ -1565,6 +1594,9 @@ purple_account_set_enabled(PurpleAccount
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_boolean, G_TYPE_BOOLEAN,
+								PROP_ENABLED_S, value);
+
 	was_enabled = purple_account_get_enabled(account);
 	if (was_enabled == value)
 		return;
@@ -1717,6 +1749,10 @@ purple_account_set_public_alias(PurpleAc
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(purple_account_is_connected(account));
 
+	/* TODO: also handle the callbacks, probably with dbus signals */
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_PUBLIC_ALIAS_S, alias);
+
 	gc = purple_account_get_connection(account);
 	prpl = purple_connection_get_prpl(gc);
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);


More information about the Commits mailing list