+static void
+theme_manager_gdk_color_to_hex (GdkColor *gdk_color, gchar *str_color)
+{
+ g_snprintf (str_color, 10,
+ "#%02x%02x%02x",
+ gdk_color->red >> 8,
+ gdk_color->green >> 8,
+ gdk_color->blue >> 8);
+}
+
+ static void
+theme_manager_color_hash_notify_cb (EmpathyThemeManager *manager)
+{
+ EmpathyThemeManagerPriv *priv;
+ GtkStyle *style;
+ gchar color[10];
+
+ priv = GET_PRIV (manager);
+
+ style = gtk_widget_get_default_style ();
+
+ g_object_freeze_notify (G_OBJECT (priv->simple_theme));
+
+ theme_manager_gdk_color_to_hex (&style->base[GTK_STATE_SELECTED], color);
+ g_object_set (priv->simple_theme,
+ "action-foreground", color,
+ "link-foreground", color,
+ NULL);
+
+ theme_manager_gdk_color_to_hex (&style->bg[GTK_STATE_SELECTED], color);
+ g_object_set (priv->simple_theme,
+ "header-background", color,
+ NULL);
+
+ theme_manager_gdk_color_to_hex (&style->dark[GTK_STATE_SELECTED], color);
+ g_object_set (priv->simple_theme,
+ "header-line-background", color,
+ NULL);
+
+ theme_manager_gdk_color_to_hex (&style->fg[GTK_STATE_SELECTED], color);
+ g_object_set (priv->simple_theme,
+ "header-foreground", color,
+ NULL);
+
+ g_object_thaw_notify (G_OBJECT (priv->simple_theme));
+
+#if 0
+
+FIXME: Make that work, it should update color when theme changes but it
+ doesnt seems to work with all themes.
+
+ g_object_get (priv->settings,
+ "color-hash", &color_hash,
+ NULL);
+
+ /*
+ * base_color: #ffffffffffff
+ * fg_color: #000000000000
+ * bg_color: #e6e6e7e7e8e8
+ * text_color: #000000000000
+ * selected_bg_color: #58589a9adbdb
+ * selected_fg_color: #ffffffffffff
+ */
+
+ color = g_hash_table_lookup (color_hash, "base_color");
+ if (color) {
+ theme_manager_gdk_color_to_hex (color, color_str);
+ g_object_set (priv->simple_theme,
+ "action-foreground", color_str,
+ "link-foreground", color_str,
+ NULL);
+ }
+
+ color = g_hash_table_lookup (color_hash, "selected_bg_color");
+ if (color) {
+ theme_manager_gdk_color_to_hex (color, color_str);
+ g_object_set (priv->simple_theme,
+ "header-background", color_str,
+ NULL);
+ }
+
+ color = g_hash_table_lookup (color_hash, "bg_color");
+ if (color) {
+ GdkColor tmp;
+
+ tmp = *color;
+ tmp.red /= 2;
+ tmp.green /= 2;
+ tmp.blue /= 2;
+ theme_manager_gdk_color_to_hex (&tmp, color_str);
+ g_object_set (priv->simple_theme,
+ "header-line-background", color_str,
+ NULL);
+ }
+
+ color = g_hash_table_lookup (color_hash, "selected_fg_color");
+ if (color) {
+ theme_manager_gdk_color_to_hex (color, color_str);
+ g_object_set (priv->simple_theme,
+ "header-foreground", color_str,
+ NULL);
+ }
+
+ g_hash_table_unref (color_hash);
+
+#endif
+}
+