pidgin/gtkblist-theme.c

branch
soc.2013.gobjectification
changeset 35060
195dbb3b6432
parent 35058
506740af931c
child 35075
3a3c90a0ec07
--- a/pidgin/gtkblist-theme.c	Sun Nov 17 02:06:03 2013 +0530
+++ b/pidgin/gtkblist-theme.c	Sun Nov 17 03:04:58 2013 +0530
@@ -346,6 +346,12 @@
 }
 
 static void
+pidgin_blist_theme_init(PidginBlistTheme *theme)
+{
+	PIDGIN_BLIST_THEME_GET_PRIVATE(theme)->opacity = 1.0;
+}
+
+static void
 pidgin_blist_theme_class_init(PidginBlistThemeClass *klass)
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
@@ -362,104 +368,85 @@
 	/* Buddy List */
 	pspec = g_param_spec_boxed("background-color", "Background Color",
 			"The background color for the buddy list",
-			GDK_TYPE_COLOR, G_PARAM_READWRITE);
+			GDK_TYPE_COLOR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_BACKGROUND_COLOR, pspec);
 
+	pspec = g_param_spec_double("opacity", "Opacity",
+			"The opacity of the buddy list",
+			0.0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+	g_object_class_install_property(obj_class, PROP_OPACITY, pspec);
+
 	pspec = g_param_spec_pointer("layout", "Layout",
 			"The layout of icons, name, and status of the buddy list",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
 	g_object_class_install_property(obj_class, PROP_LAYOUT, pspec);
 
 	/* Group */
-	/* Note to translators: These two strings refer to the background color
-	   of a buddy list group when in its expanded state */
 	pspec = g_param_spec_boxed("expanded-color", "Expanded Background Color",
 			"The background color of an expanded group",
-			GDK_TYPE_COLOR, G_PARAM_READWRITE);
+			GDK_TYPE_COLOR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_EXPANDED_COLOR, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list group when in its expanded state */
 	pspec = g_param_spec_pointer("expanded-text", "Expanded Text",
 			"The text information for when a group is expanded",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_EXPANDED_TEXT, pspec);
 
-	/* Note to translators: These two strings refer to the background color
-	   of a buddy list group when in its collapsed state */
 	pspec = g_param_spec_boxed("collapsed-color", "Collapsed Background Color",
 			"The background color of a collapsed group",
-			GDK_TYPE_COLOR, G_PARAM_READWRITE);
+			GDK_TYPE_COLOR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_COLLAPSED_COLOR, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list group when in its collapsed state */
 	pspec = g_param_spec_pointer("collapsed-text", "Collapsed Text",
 			"The text information for when a group is collapsed",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_COLLAPSED_TEXT, pspec);
 
 	/* Buddy */
-	/* Note to translators: These two strings refer to the background color
-	   of a buddy list contact or chat room */
 	pspec = g_param_spec_boxed("contact-color", "Contact/Chat Background Color",
 			"The background color of a contact or chat",
-			GDK_TYPE_COLOR, G_PARAM_READWRITE);
+			GDK_TYPE_COLOR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_CONTACT_COLOR, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list contact when in its expanded state */
 	pspec = g_param_spec_pointer("contact", "Contact Text",
 			"The text information for when a contact is expanded",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_CONTACT, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when it is online */
 	pspec = g_param_spec_pointer("online", "Online Text",
 			"The text information for when a buddy is online",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_ONLINE, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when it is away */
 	pspec = g_param_spec_pointer("away", "Away Text",
 			"The text information for when a buddy is away",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_AWAY, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when it is offline */
 	pspec = g_param_spec_pointer("offline", "Offline Text",
 			"The text information for when a buddy is offline",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_OFFLINE, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when it is idle */
 	pspec = g_param_spec_pointer("idle", "Idle Text",
 			"The text information for when a buddy is idle",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_IDLE, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when they have sent you a new message */
 	pspec = g_param_spec_pointer("message", "Message Text",
 			"The text information for when a buddy has an unread message",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_MESSAGE, pspec);
 
-	/* Note to translators: These two strings refer to the font and color
-	   of a buddy list buddy when they have sent you a new message */
-	pspec = g_param_spec_pointer("message_nick_said", "Message (Nick Said) Text",
+	pspec = g_param_spec_pointer("message-nick-said", "Message (Nick Said) Text",
 			"The text information for when a chat has an unread message that mentions your nickname",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_MESSAGE_NICK_SAID, pspec);
 
 	pspec = g_param_spec_pointer("status", "Status Text",
 			"The text information for a buddy's status",
-			G_PARAM_READWRITE);
+			G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 	g_object_class_install_property(obj_class, PROP_STATUS, pspec);
 }
 
@@ -477,7 +464,7 @@
 			NULL, /* class_data */
 			sizeof(PidginBlistTheme),
 			0, /* n_preallocs */
-			NULL, /* instance_init */
+			(GInstanceInitFunc)pidgin_blist_theme_init, /* instance_init */
 			NULL, /* value table */
 		};
 		type = g_type_register_static (PURPLE_TYPE_THEME,
@@ -698,6 +685,8 @@
 	if (priv->bgcolor)
 		gdk_color_free(priv->bgcolor);
 	priv->bgcolor = color ? gdk_color_copy(color) : NULL;
+
+	g_object_notify(G_OBJECT(theme), "background-color");
 }
 
 void
@@ -710,6 +699,8 @@
 	priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme);
 
 	priv->opacity = opacity;
+
+	g_object_notify(G_OBJECT(theme), "opacity");
 }
 
 void
@@ -723,6 +714,8 @@
 
 	g_free(priv->layout);
 	priv->layout = g_memdup(layout, sizeof(PidginBlistLayout));
+
+	g_object_notify(G_OBJECT(theme), "layout");
 }
 
 void
@@ -737,6 +730,8 @@
 	if (priv->expanded_color)
 		gdk_color_free(priv->expanded_color);
 	priv->expanded_color = color ? gdk_color_copy(color) : NULL;
+
+	g_object_notify(G_OBJECT(theme), "expanded-color");
 }
 
 void
@@ -750,6 +745,8 @@
 
 	pidgin_theme_font_free(priv->expanded);
 	priv->expanded = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "expanded-text");
 }
 
 void
@@ -764,6 +761,8 @@
 	if (priv->collapsed_color)
 		gdk_color_free(priv->collapsed_color);
 	priv->collapsed_color = color ? gdk_color_copy(color) : NULL;
+
+	g_object_notify(G_OBJECT(theme), "collapsed-color");
 }
 
 void
@@ -777,6 +776,8 @@
 
 	pidgin_theme_font_free(priv->collapsed);
 	priv->collapsed = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "collapsed-text");
 }
 
 void
@@ -791,6 +792,8 @@
 	if (priv->contact_color)
 		gdk_color_free(priv->contact_color);
 	priv->contact_color = color ? gdk_color_copy(color) : NULL;
+
+	g_object_notify(G_OBJECT(theme), "contact-color");
 }
 
 void
@@ -804,6 +807,8 @@
 
 	pidgin_theme_font_free(priv->contact);
 	priv->contact = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "contact");
 }
 
 void
@@ -817,6 +822,8 @@
 
 	pidgin_theme_font_free(priv->online);
 	priv->online = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "online");
 }
 
 void
@@ -830,6 +837,8 @@
 
 	pidgin_theme_font_free(priv->away);
 	priv->away = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "away");
 }
 
 void
@@ -843,6 +852,8 @@
 
 	pidgin_theme_font_free(priv->offline);
 	priv->offline = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "offline");
 }
 
 void
@@ -856,6 +867,8 @@
 
 	pidgin_theme_font_free(priv->idle);
 	priv->idle = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "idle");
 }
 
 void
@@ -869,6 +882,8 @@
 
 	pidgin_theme_font_free(priv->message);
 	priv->message = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "message");
 }
 
 void
@@ -882,6 +897,8 @@
 
 	pidgin_theme_font_free(priv->message_nick_said);
 	priv->message_nick_said = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "message-nick-said");
 }
 
 void
@@ -895,4 +912,6 @@
 
 	pidgin_theme_font_free(priv->status);
 	priv->status = copy_font_and_color(pair);
+
+	g_object_notify(G_OBJECT(theme), "status");
 }

mercurial