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' --- src/caja-location-bar.c | 9 ++++++++- src/caja-sidebar-title.c | 20 +++++++++++++++++--- src/file-manager/fm-list-view.c | 9 ++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) (limited to 'src') 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