diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-25 19:38:26 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-25 22:39:40 +0800 |
commit | 70025f47f3087f7b5295c4a32648bef9806f7a36 (patch) | |
tree | 261a133c8adda12fc01af3e616309e434d98afe3 /libempathy-gtk | |
parent | 3aa77dd47ea6de9f281cbb401816532f83ad5764 (diff) | |
download | gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar.gz gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar.bz2 gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar.lz gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar.xz gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.tar.zst gsoc2013-empathy-70025f47f3087f7b5295c4a32648bef9806f7a36.zip |
Properly update the 'simple' theme
We have to call the callback manually to update the theme when it's changed.
Also make sure that style-set signal is only connected once and we update the
theme only if the 'simple' one is used.
https://bugzilla.gnome.org/show_bug.cgi?id=664795
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index 28cbbf3bc..1233509ec 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -188,6 +188,8 @@ theme_manager_create_irc_view (EmpathyThemeManager *manager) return theme; } +static void on_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, EmpathyThemeManager *self); + static EmpathyThemeBoxes * theme_manager_create_boxes_view (EmpathyThemeManager *manager) { @@ -200,6 +202,9 @@ theme_manager_create_boxes_view (EmpathyThemeManager *manager) theme_manager_view_weak_notify_cb, &priv->boxes_views); + g_signal_connect (G_OBJECT (theme), "style-set", + G_CALLBACK (on_style_set_cb), manager); + return theme; } @@ -298,14 +303,20 @@ theme_manager_update_boxes_tags (EmpathyThemeBoxes *theme, } static void -on_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, gpointer data) +on_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, EmpathyThemeManager *self) { + EmpathyThemeManagerPriv *priv = GET_PRIV (self); GtkStyle *style; gchar color1[10]; gchar color2[10]; gchar color3[10]; gchar color4[10]; + /* The simple theme depends on the current GTK+ theme so it has to be + * updated if the theme changes. */ + if (tp_strdiff (priv->name, "simple")) + return; + style = gtk_widget_get_style (GTK_WIDGET (widget)); theme_manager_gdk_color_to_hex (&style->base[GTK_STATE_SELECTED], color1); @@ -333,8 +344,7 @@ theme_manager_update_boxes_theme (EmpathyThemeManager *manager, EmpathyThemeManagerPriv *priv = GET_PRIV (manager); if (strcmp (priv->name, "simple") == 0) { - g_signal_connect (G_OBJECT (theme), "style-set", - G_CALLBACK (on_style_set_cb), theme); + on_style_set_cb (GTK_WIDGET (theme), NULL, manager); } else if (strcmp (priv->name, "clean") == 0) { theme_manager_update_boxes_tags (theme, |