diff options
Diffstat (limited to 'mate-panel/panel-background.c')
-rw-r--r-- | mate-panel/panel-background.c | 74 |
1 files changed, 1 insertions, 73 deletions
diff --git a/mate-panel/panel-background.c b/mate-panel/panel-background.c index d7b61f64..31930bd3 100644 --- a/mate-panel/panel-background.c +++ b/mate-panel/panel-background.c @@ -1494,83 +1494,11 @@ panel_background_set_color_background_on_widget (PanelBackground *background, gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &color->gdk); } -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) -static GtkStyleProperties * -_panel_background_get_widget_style_properties (GtkWidget *widget, gboolean create_if_needed) -{ - GtkStyleProperties *properties; - - properties = g_object_get_data (G_OBJECT (widget), "panel-object-style-props"); - if (!properties && create_if_needed) { - properties = gtk_style_properties_new (); - g_object_set_data_full (G_OBJECT (widget), "panel-object-style-props", - properties, (GDestroyNotify) g_object_unref); - } - return properties; -} - -static void -_panel_background_reset_widget_style_properties (GtkWidget *widget) -{ - GtkStyleProperties *properties; - - properties = _panel_background_get_widget_style_properties (widget, FALSE); - - if (properties) - gtk_style_context_remove_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (properties)); - - g_object_set_data (G_OBJECT (widget), "panel-object-style-props", NULL); -} -#endif void panel_background_change_background_on_widget (PanelBackground *background, GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 0, 0) - GtkStyleProperties *properties; - - gtk_widget_reset_style (widget); - - switch (panel_background_get_type (background)) { - case PANEL_BACK_NONE: - _panel_background_reset_widget_style_properties (widget); - return; - case PANEL_BACK_COLOR: - properties = _panel_background_get_widget_style_properties (widget, TRUE); - gtk_style_properties_set (properties, GTK_STATE_FLAG_NORMAL, - "background-color", &background->color, - "background-image", NULL, - NULL); - break; - case PANEL_BACK_IMAGE: { - cairo_pattern_t *pattern; - - properties = _panel_background_get_widget_style_properties (widget, TRUE); - pattern = panel_background_get_pattern_for_widget (background, widget); - if (pattern) { - gtk_style_properties_set (properties, GTK_STATE_FLAG_NORMAL, - "background-image", pattern, - NULL); - cairo_pattern_destroy (pattern); - } else { - _panel_background_reset_widget_style_properties (widget); - return; - } - } - break; - default: - g_assert_not_reached (); - break; - } - - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (properties), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); -#else PanelBackgroundType type; panel_background_set_no_background_on_widget (background, widget); @@ -1592,6 +1520,6 @@ panel_background_change_background_on_widget (PanelBackground *background, g_assert_not_reached (); break; } -#endif } +#endif |