/soc/2013/ankitkv/gobjectification: 2c190f625652: Some refactori...

Ankit Vani a at nevitus.org
Sun Jul 21 05:05:49 EDT 2013


Changeset: 2c190f625652478a9a7e537c7109563e1c153906
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-21 14:35 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/2c190f625652

Description:

Some refactoring for GObject status API.
Connected callback for /purple/status/scores/idle_time

diffstat:

 libpurple/plugins/perl/common/Status.xs |   4 ----
 libpurple/presence.c                    |  10 ++++------
 libpurple/status.c                      |   4 ++++
 3 files changed, 8 insertions(+), 10 deletions(-)

diffs (69 lines):

diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs
--- a/libpurple/plugins/perl/common/Status.xs
+++ b/libpurple/plugins/perl/common/Status.xs
@@ -108,10 +108,6 @@ purple_status_compare(status1, status2)
 	Purple::Status status1
 	Purple::Status status2
 
-void
-purple_status_destroy(status)
-	Purple::Status status
-
 gboolean
 purple_status_get_attr_boolean(status, id)
 	Purple::Status status
diff --git a/libpurple/presence.c b/libpurple/presence.c
--- a/libpurple/presence.c
+++ b/libpurple/presence.c
@@ -359,8 +359,7 @@ purple_presence_set_property(GObject *ob
 #endif
 			break;
 		case PRES_PROP_ACTIVE_STATUS:
-#warning TODO: change get_pointer to get_object when PurpleStatus is a GObject
-			priv->active_status = g_value_get_pointer(value);
+			priv->active_status = g_value_get_object(value);
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -401,8 +400,7 @@ purple_presence_get_property(GObject *ob
 			g_value_set_pointer(value, purple_presence_get_statuses(presence));
 			break;
 		case PRES_PROP_ACTIVE_STATUS:
-#warning TODO: change set_pointer to set_object when PurpleStatus is a GObject
-			g_value_set_pointer(value, purple_presence_get_active_status(presence));
+			g_value_set_object(value, purple_presence_get_active_status(presence));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -513,8 +511,8 @@ static void purple_presence_class_init(P
 			);
 
 	g_object_class_install_property(obj_class, PRES_PROP_ACTIVE_STATUS,
-			g_param_spec_pointer(PRES_PROP_ACTIVE_STATUS_S, _("Active status"),
-				_("The active status for the presence."),
+			g_param_spec_object(PRES_PROP_ACTIVE_STATUS_S, _("Active status"),
+				_("The active status for the presence."), PURPLE_TYPE_STATUS,
 				G_PARAM_READWRITE)
 			);
 
diff --git a/libpurple/status.c b/libpurple/status.c
--- a/libpurple/status.c
+++ b/libpurple/status.c
@@ -1085,6 +1085,9 @@ purple_statuses_init(void)
 	purple_prefs_connect_callback(handle, "/purple/status/scores/idle",
 			score_pref_changed_cb,
 			GINT_TO_POINTER(SCORE_IDLE));
+	purple_prefs_connect_callback(handle, "/purple/status/scores/idle_time",
+			score_pref_changed_cb,
+			GINT_TO_POINTER(SCORE_IDLE_TIME));
 	purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg",
 			score_pref_changed_cb,
 			GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE));
@@ -1095,6 +1098,7 @@ purple_statuses_init(void)
 	purple_prefs_trigger_callback("/purple/status/scores/away");
 	purple_prefs_trigger_callback("/purple/status/scores/extended_away");
 	purple_prefs_trigger_callback("/purple/status/scores/idle");
+	purple_prefs_trigger_callback("/purple/status/scores/idle_time");
 	purple_prefs_trigger_callback("/purple/status/scores/offline_msg");
 }
 



More information about the Commits mailing list