From e88c26a010b0e3b06317680cdce397ef77c137d4 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Sat, 5 May 2018 20:52:06 +0200 Subject: avoid deprecated 'gtk_style_context_get_background_color' --- eel/eel-background.c | 20 ++++++++++++++++---- eel/eel-canvas.c | 9 ++++++++- eel/eel-editable-label.c | 16 +++++++++++++--- libcaja-private/caja-icon-canvas-item.c | 12 ++++++++++-- libcaja-private/caja-icon-container.c | 8 +++++++- src/caja-location-bar.c | 9 ++++++++- src/caja-sidebar-title.c | 20 +++++++++++++++++--- src/file-manager/fm-list-view.c | 9 ++++++++- 8 files changed, 87 insertions(+), 16 deletions(-) diff --git a/eel/eel-background.c b/eel/eel-background.c index 02b4d857..cb4ac2ae 100644 --- a/eel/eel-background.c +++ b/eel/eel-background.c @@ -326,6 +326,7 @@ eel_background_ensure_realized (EelBackground *self) int width, height; GdkWindow *window; GtkStyleContext *style; + GdkRGBA *c; /* Set the default color */ style = gtk_widget_get_style_context (self->details->widget); @@ -334,9 +335,13 @@ eel_background_ensure_realized (EelBackground *self) if (self->details->use_base) { gtk_style_context_add_class (style, GTK_STYLE_CLASS_VIEW); } - gtk_style_context_get_background_color (style, - gtk_style_context_get_state (style), - &self->details->default_color); + + gtk_style_context_get (style, gtk_style_context_get_state (style), + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + self->details->default_color = *c; + gdk_rgba_free (c); + gtk_style_context_restore (style); /* If the window size is the same as last time, don't update */ @@ -1079,7 +1084,14 @@ eel_background_set_dropped_color (EelBackground *self, GtkStyleContext *style = gtk_widget_get_style_context (widget); GdkRGBA bg; - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &bg); + GdkRGBA *c; + + gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + bg = *c; + gdk_rgba_free (c); + gradient_spec = gdk_rgba_to_string (&bg); } diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index 340f25e3..c7e31f3e 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -3024,6 +3024,7 @@ eel_canvas_draw_background (EelCanvas *canvas, cairo_rectangle_int_t rect; GtkStyleContext *style_context; GdkRGBA color; + GdkRGBA *c; if (!gdk_cairo_get_clip_rectangle (cr, &rect)) return; @@ -3031,7 +3032,13 @@ eel_canvas_draw_background (EelCanvas *canvas, cairo_save (cr); /* By default, we use the style background. */ style_context = gtk_widget_get_style_context (GTK_WIDGET (canvas)); - gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_NORMAL, &color); + + gtk_style_context_get (style_context, GTK_STATE_FLAG_NORMAL, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + gdk_rgba_free (c); + gdk_cairo_set_source_rgba (cr, &color); gdk_cairo_rectangle (cr, &rect); cairo_fill (cr); diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index da43cb0e..ec606302 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -1517,6 +1517,7 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff if (!block_at_line_end) { GdkRGBA color; + GdkRGBA *c; clip = gdk_pango_layout_get_clip_region (label->layout, xoffset, yoffset, @@ -1525,8 +1526,11 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff gdk_cairo_region (cr, clip); cairo_clip (cr); - gtk_style_context_get_background_color (context, GTK_STATE_FLAG_FOCUSED, - &color); + gtk_style_context_get (context, GTK_STATE_FLAG_FOCUSED, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + gdk_rgba_free (c); gdk_cairo_set_source_rgba (cr, &color); @@ -1580,6 +1584,7 @@ eel_editable_label_draw (GtkWidget *widget, GtkStateType state; GdkRGBA background_color; + GdkRGBA *c; range[0] = label->selection_anchor; range[1] = label->selection_end; @@ -1612,7 +1617,12 @@ eel_editable_label_draw (GtkWidget *widget, state = gtk_widget_get_state_flags (widget); state |= GTK_STATE_FLAG_SELECTED; - gtk_style_context_get_background_color (style, state, &background_color); + gtk_style_context_get (style, state, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + background_color = *c; + gdk_rgba_free (c); + gdk_cairo_set_source_rgba (cr, &background_color); cairo_paint (cr); diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index 6751628b..8f0630a9 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -1701,6 +1701,7 @@ real_map_surface (CajaIconCanvasItem *icon_item) int emblem_size; GtkStyleContext *style; GdkRGBA color; + GdkRGBA *c; cairo_surface_t *surface; temp_pixbuf = icon_item->details->pixbuf; @@ -1768,11 +1769,18 @@ real_map_surface (CajaIconCanvasItem *icon_item) style = gtk_widget_get_style_context (GTK_WIDGET (canvas)); if (gtk_widget_has_focus (GTK_WIDGET (canvas))) { - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color); + gtk_style_context_get (style, GTK_STATE_FLAG_SELECTED, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); } else { - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color); + gtk_style_context_get (style, GTK_STATE_FLAG_ACTIVE, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); } + color = *c; + gdk_rgba_free (c); + old_pixbuf = temp_pixbuf; temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf, &color); diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index cae3af44..17e671a0 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -2865,6 +2865,7 @@ start_rubberbanding (CajaIconContainer *container, CajaIconContainerDetails *details; CajaIconRubberbandInfo *band_info; GdkRGBA bg_color, border_color; + GdkRGBA *c; GList *p; CajaIcon *icon; GtkStyleContext *context; @@ -2888,7 +2889,12 @@ start_rubberbanding (CajaIconContainer *container, gtk_style_context_save (context); gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND); - gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color); + gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + bg_color = *c; + gdk_rgba_free (c); + gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, &border_color); gtk_style_context_restore (context); diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c index 89d095a9..9de909b3 100644 --- a/src/caja-location-bar.c +++ b/src/caja-location-bar.c @@ -605,9 +605,16 @@ caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active) { GtkStyleContext *style; GdkRGBA color; + GdkRGBA *c; style = gtk_widget_get_style_context (GTK_WIDGET (location_bar->details->entry)); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color); + + gtk_style_context_get (style, GTK_STATE_FLAG_INSENSITIVE, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + gdk_rgba_free (c); + gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_ACTIVE, &color); } } diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c index 2c2cebe1..516a58e4 100644 --- a/src/caja-sidebar-title.c +++ b/src/caja-sidebar-title.c @@ -244,6 +244,7 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, GdkRGBA *light_info_color, *dark_info_color; GtkStyleContext *style; GdkRGBA color; + GdkRGBA *c; g_assert (CAJA_IS_SIDEBAR_TITLE (sidebar_title)); g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (sidebar_title))); @@ -276,11 +277,19 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, gtk_style_context_get_color (style, GTK_STATE_FLAG_PRELIGHT, &color); setup_gc_with_fg (sidebar_title, LABEL_COLOR_PRELIGHT, &color); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color); + gtk_style_context_get (style, GTK_STATE_FLAG_SELECTED, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_HIGHLIGHT, eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color); + gtk_style_context_get (style, GTK_STATE_FLAG_ACTIVE, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE, eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color); @@ -293,7 +302,11 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color); setup_gc_with_fg (sidebar_title, LABEL_COLOR, &color); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &color); + gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &color, NULL); + color = *c; + setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color); @@ -315,6 +328,7 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title, setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, dark_info_color); } + gdk_rgba_free (c); gdk_rgba_free (dark_info_color); gdk_rgba_free (light_info_color); } diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index d2ef57f6..fe16fe44 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -3276,6 +3276,7 @@ real_set_is_active (FMDirectoryView *view, GtkWidget *tree_view; GtkStyleContext *style; GdkRGBA color; + GdkRGBA *c; tree_view = GTK_WIDGET (fm_list_view_get_tree_view (FM_LIST_VIEW (view))); @@ -3286,7 +3287,13 @@ real_set_is_active (FMDirectoryView *view, else { style = gtk_widget_get_style_context (tree_view); - gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color); + + gtk_style_context_get (style, GTK_STATE_FLAG_INSENSITIVE, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, + &c, NULL); + color = *c; + gdk_rgba_free (c); + gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, &color); } -- cgit v1.2.1