aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-07-07 18:51:41 +0800
committerMilan Crha <mcrha@redhat.com>2014-07-07 18:51:41 +0800
commit50bda1bad222082488d3d9bc9fe1d0fb3867e974 (patch)
tree27042fc0a39e4a7f79d920bae88cb29aa5677d10 /shell
parent534864b39850ea2354b87419da6dc77538867756 (diff)
downloadgsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar.gz
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar.bz2
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar.lz
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar.xz
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.tar.zst
gsoc2013-evolution-50bda1bad222082488d3d9bc9fe1d0fb3867e974.zip
Replace GtkStyle usages with GtkStyleContext
This makes evolution depend on theme-defined named colors, namely: theme_bg_color theme_base_color theme_fg_color theme_text_color theme_selected_bg_color theme_selected_fg_color theme_unfocused_selected_bg_color theme_unfocused_selected_fg_color If it's not defined, then a fallback color is used, in the worse case one of the fallbacks defined in evolution itself.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-sidebar.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 268eaf3373..3a4d791203 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -295,6 +295,21 @@ shell_sidebar_size_allocate (GtkWidget *widget,
}
static void
+shell_sidebar_style_updated (GtkWidget *widget)
+{
+ EShellSidebar *shell_sidebar;
+ GdkRGBA bg;
+
+ /* Chain up to parent's method. */
+ GTK_WIDGET_CLASS (e_shell_sidebar_parent_class)->style_updated (widget);
+
+ shell_sidebar = E_SHELL_SIDEBAR (widget);
+
+ e_utils_get_theme_color (shell_sidebar->priv->event_box, "theme_bg_color", E_UTILS_DEFAULT_THEME_BG_COLOR, &bg);
+ gtk_widget_override_background_color (shell_sidebar->priv->event_box, GTK_STATE_FLAG_NORMAL, &bg);
+}
+
+static void
shell_sidebar_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
@@ -351,6 +366,7 @@ e_shell_sidebar_class_init (EShellSidebarClass *class)
widget_class->get_preferred_width = shell_sidebar_get_preferred_width;
widget_class->get_preferred_height = shell_sidebar_get_preferred_height;
widget_class->size_allocate = shell_sidebar_size_allocate;
+ widget_class->style_updated = shell_sidebar_style_updated;
container_class = GTK_CONTAINER_CLASS (class);
container_class->forall = shell_sidebar_forall;
@@ -431,12 +447,11 @@ e_shell_sidebar_alert_sink_init (EAlertSinkInterface *iface)
static void
e_shell_sidebar_init (EShellSidebar *shell_sidebar)
{
- GtkStyle *style;
GtkWidget *widget;
GtkWidget *container;
PangoAttribute *attribute;
PangoAttrList *attribute_list;
- const GdkColor *color;
+ GdkRGBA bg;
const gchar *icon_name;
shell_sidebar->priv = E_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -444,9 +459,8 @@ e_shell_sidebar_init (EShellSidebar *shell_sidebar)
gtk_widget_set_has_window (GTK_WIDGET (shell_sidebar), FALSE);
widget = gtk_event_box_new ();
- style = gtk_widget_get_style (widget);
- color = &style->bg[GTK_STATE_ACTIVE];
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
+ e_utils_get_theme_color (widget, "theme_bg_color", E_UTILS_DEFAULT_THEME_BG_COLOR, &bg);
+ gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &bg);
gtk_widget_set_parent (widget, GTK_WIDGET (shell_sidebar));
shell_sidebar->priv->event_box = g_object_ref (widget);
gtk_widget_show (widget);