/soc/2013/ankitkv/gobjectification: 195dbb3b6432: pidgin: Use G_...
Ankit Vani
a at nevitus.org
Sat Nov 16 16:40:30 EST 2013
Changeset: 195dbb3b6432c871a8f74532034098702dbae7e6
Author: Ankit Vani <a at nevitus.org>
Date: 2013-11-17 03:04 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/195dbb3b6432
Description:
pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
diffstat:
pidgin/gtkblist-theme-loader.c | 2 +-
pidgin/gtkblist-theme.c | 101 +++++++++++++++++++++++---------------
pidgin/gtkcellrendererexpander.c | 2 +-
pidgin/gtkconv-theme.c | 8 ++-
pidgin/gtkimhtml.c | 24 ++++----
pidgin/gtkmedia.c | 4 +-
pidgin/gtkmenutray.c | 2 +-
pidgin/gtkstatusbox.c | 4 +-
pidgin/minidialog.c | 19 +++---
pidgin/plugins/themeedit.c | 2 +-
10 files changed, 95 insertions(+), 73 deletions(-)
diffs (truncated from 552 to 300 lines):
diff --git a/pidgin/gtkblist-theme-loader.c b/pidgin/gtkblist-theme-loader.c
--- a/pidgin/gtkblist-theme-loader.c
+++ b/pidgin/gtkblist-theme-loader.c
@@ -218,7 +218,7 @@ pidgin_blist_loader_build(const gchar *t
"offline", offline,
"idle", idle,
"message", message,
- "message_nick_said", message_nick_said,
+ "message-nick-said", message_nick_said,
"status", status, NULL);
for (i = 0; lookups[i].tag; i++) {
diff --git a/pidgin/gtkblist-theme.c b/pidgin/gtkblist-theme.c
--- a/pidgin/gtkblist-theme.c
+++ b/pidgin/gtkblist-theme.c
@@ -346,6 +346,12 @@ pidgin_blist_theme_finalize(GObject *obj
}
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 @@ pidgin_blist_theme_class_init(PidginBlis
/* 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 @@ pidgin_blist_theme_get_type (void)
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 @@ pidgin_blist_theme_set_background_color(
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 @@ pidgin_blist_theme_set_opacity(PidginBli
priv = PIDGIN_BLIST_THEME_GET_PRIVATE(theme);
priv->opacity = opacity;
+
+ g_object_notify(G_OBJECT(theme), "opacity");
}
void
@@ -723,6 +714,8 @@ pidgin_blist_theme_set_layout(PidginBlis
g_free(priv->layout);
priv->layout = g_memdup(layout, sizeof(PidginBlistLayout));
+
+ g_object_notify(G_OBJECT(theme), "layout");
}
void
@@ -737,6 +730,8 @@ pidgin_blist_theme_set_expanded_backgrou
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_blist_theme_set_expanded_text_inf
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 @@ pidgin_blist_theme_set_collapsed_backgro
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_blist_theme_set_collapsed_text_in
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 @@ pidgin_blist_theme_set_contact_color(Pid
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_blist_theme_set_contact_text_info
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_blist_theme_set_online_text_info(
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_blist_theme_set_away_text_info(Pi
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_blist_theme_set_offline_text_info
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_blist_theme_set_idle_text_info(Pi
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_blist_theme_set_unread_message_te
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_blist_theme_set_unread_message_ni
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_blist_theme_set_status_text_info(
More information about the Commits
mailing list