Skip to content

Commit e88c26a

Browse files
committed
avoid deprecated 'gtk_style_context_get_background_color'
1 parent df750ae commit e88c26a

8 files changed

+87
-16
lines changed

eel/eel-background.c

+16-4
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ eel_background_ensure_realized (EelBackground *self)
326326
int width, height;
327327
GdkWindow *window;
328328
GtkStyleContext *style;
329+
GdkRGBA *c;
329330

330331
/* Set the default color */
331332
style = gtk_widget_get_style_context (self->details->widget);
@@ -334,9 +335,13 @@ eel_background_ensure_realized (EelBackground *self)
334335
if (self->details->use_base) {
335336
gtk_style_context_add_class (style, GTK_STYLE_CLASS_VIEW);
336337
}
337-
gtk_style_context_get_background_color (style,
338-
gtk_style_context_get_state (style),
339-
&self->details->default_color);
338+
339+
gtk_style_context_get (style, gtk_style_context_get_state (style),
340+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
341+
&c, NULL);
342+
self->details->default_color = *c;
343+
gdk_rgba_free (c);
344+
340345
gtk_style_context_restore (style);
341346

342347
/* If the window size is the same as last time, don't update */
@@ -1079,7 +1084,14 @@ eel_background_set_dropped_color (EelBackground *self,
10791084

10801085
GtkStyleContext *style = gtk_widget_get_style_context (widget);
10811086
GdkRGBA bg;
1082-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &bg);
1087+
GdkRGBA *c;
1088+
1089+
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
1090+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
1091+
&c, NULL);
1092+
bg = *c;
1093+
gdk_rgba_free (c);
1094+
10831095
gradient_spec = gdk_rgba_to_string (&bg);
10841096

10851097
}

eel/eel-canvas.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -3024,14 +3024,21 @@ eel_canvas_draw_background (EelCanvas *canvas,
30243024
cairo_rectangle_int_t rect;
30253025
GtkStyleContext *style_context;
30263026
GdkRGBA color;
3027+
GdkRGBA *c;
30273028

30283029
if (!gdk_cairo_get_clip_rectangle (cr, &rect))
30293030
return;
30303031

30313032
cairo_save (cr);
30323033
/* By default, we use the style background. */
30333034
style_context = gtk_widget_get_style_context (GTK_WIDGET (canvas));
3034-
gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_NORMAL, &color);
3035+
3036+
gtk_style_context_get (style_context, GTK_STATE_FLAG_NORMAL,
3037+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
3038+
&c, NULL);
3039+
color = *c;
3040+
gdk_rgba_free (c);
3041+
30353042
gdk_cairo_set_source_rgba (cr, &color);
30363043
gdk_cairo_rectangle (cr, &rect);
30373044
cairo_fill (cr);

eel/eel-editable-label.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,7 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff
15171517
if (!block_at_line_end)
15181518
{
15191519
GdkRGBA color;
1520+
GdkRGBA *c;
15201521

15211522
clip = gdk_pango_layout_get_clip_region (label->layout,
15221523
xoffset, yoffset,
@@ -1525,8 +1526,11 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff
15251526
gdk_cairo_region (cr, clip);
15261527
cairo_clip (cr);
15271528

1528-
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_FOCUSED,
1529-
&color);
1529+
gtk_style_context_get (context, GTK_STATE_FLAG_FOCUSED,
1530+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
1531+
&c, NULL);
1532+
color = *c;
1533+
gdk_rgba_free (c);
15301534

15311535
gdk_cairo_set_source_rgba (cr,
15321536
&color);
@@ -1580,6 +1584,7 @@ eel_editable_label_draw (GtkWidget *widget,
15801584
GtkStateType state;
15811585

15821586
GdkRGBA background_color;
1587+
GdkRGBA *c;
15831588

15841589
range[0] = label->selection_anchor;
15851590
range[1] = label->selection_end;
@@ -1612,7 +1617,12 @@ eel_editable_label_draw (GtkWidget *widget,
16121617
state = gtk_widget_get_state_flags (widget);
16131618
state |= GTK_STATE_FLAG_SELECTED;
16141619

1615-
gtk_style_context_get_background_color (style, state, &background_color);
1620+
gtk_style_context_get (style, state,
1621+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
1622+
&c, NULL);
1623+
background_color = *c;
1624+
gdk_rgba_free (c);
1625+
16161626
gdk_cairo_set_source_rgba (cr, &background_color);
16171627
cairo_paint (cr);
16181628

libcaja-private/caja-icon-canvas-item.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,7 @@ real_map_surface (CajaIconCanvasItem *icon_item)
17011701
int emblem_size;
17021702
GtkStyleContext *style;
17031703
GdkRGBA color;
1704+
GdkRGBA *c;
17041705
cairo_surface_t *surface;
17051706

17061707
temp_pixbuf = icon_item->details->pixbuf;
@@ -1768,11 +1769,18 @@ real_map_surface (CajaIconCanvasItem *icon_item)
17681769
style = gtk_widget_get_style_context (GTK_WIDGET (canvas));
17691770

17701771
if (gtk_widget_has_focus (GTK_WIDGET (canvas))) {
1771-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color);
1772+
gtk_style_context_get (style, GTK_STATE_FLAG_SELECTED,
1773+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
1774+
&c, NULL);
17721775
} else {
1773-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color);
1776+
gtk_style_context_get (style, GTK_STATE_FLAG_ACTIVE,
1777+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
1778+
&c, NULL);
17741779
}
17751780

1781+
color = *c;
1782+
gdk_rgba_free (c);
1783+
17761784
old_pixbuf = temp_pixbuf;
17771785
temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf, &color);
17781786

libcaja-private/caja-icon-container.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,7 @@ start_rubberbanding (CajaIconContainer *container,
28652865
CajaIconContainerDetails *details;
28662866
CajaIconRubberbandInfo *band_info;
28672867
GdkRGBA bg_color, border_color;
2868+
GdkRGBA *c;
28682869
GList *p;
28692870
CajaIcon *icon;
28702871
GtkStyleContext *context;
@@ -2888,7 +2889,12 @@ start_rubberbanding (CajaIconContainer *container,
28882889
gtk_style_context_save (context);
28892890
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
28902891

2891-
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color);
2892+
gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL,
2893+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
2894+
&c, NULL);
2895+
bg_color = *c;
2896+
gdk_rgba_free (c);
2897+
28922898
gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, &border_color);
28932899

28942900
gtk_style_context_restore (context);

src/caja-location-bar.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,16 @@ caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
605605
{
606606
GtkStyleContext *style;
607607
GdkRGBA color;
608+
GdkRGBA *c;
608609

609610
style = gtk_widget_get_style_context (GTK_WIDGET (location_bar->details->entry));
610-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
611+
612+
gtk_style_context_get (style, GTK_STATE_FLAG_INSENSITIVE,
613+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
614+
&c, NULL);
615+
color = *c;
616+
gdk_rgba_free (c);
617+
611618
gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_ACTIVE, &color);
612619
}
613620
}

src/caja-sidebar-title.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
244244
GdkRGBA *light_info_color, *dark_info_color;
245245
GtkStyleContext *style;
246246
GdkRGBA color;
247+
GdkRGBA *c;
247248

248249
g_assert (CAJA_IS_SIDEBAR_TITLE (sidebar_title));
249250
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,
276277
gtk_style_context_get_color (style, GTK_STATE_FLAG_PRELIGHT, &color);
277278
setup_gc_with_fg (sidebar_title, LABEL_COLOR_PRELIGHT, &color);
278279

279-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color);
280+
gtk_style_context_get (style, GTK_STATE_FLAG_SELECTED,
281+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
282+
&c, NULL);
283+
color = *c;
284+
280285
setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_HIGHLIGHT,
281286
eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color);
282287

283-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color);
288+
gtk_style_context_get (style, GTK_STATE_FLAG_ACTIVE,
289+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
290+
&c, NULL);
291+
color = *c;
292+
284293
setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR_ACTIVE,
285294
eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color);
286295

@@ -293,7 +302,11 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
293302
gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color);
294303
setup_gc_with_fg (sidebar_title, LABEL_COLOR, &color);
295304

296-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &color);
305+
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
306+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
307+
&color, NULL);
308+
color = *c;
309+
297310
setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR,
298311
eel_gdk_rgba_is_dark (&color) ?
299312
light_info_color : dark_info_color);
@@ -315,6 +328,7 @@ caja_sidebar_title_select_text_color (CajaSidebarTitle *sidebar_title,
315328
setup_gc_with_fg (sidebar_title, LABEL_INFO_COLOR, dark_info_color);
316329
}
317330

331+
gdk_rgba_free (c);
318332
gdk_rgba_free (dark_info_color);
319333
gdk_rgba_free (light_info_color);
320334
}

src/file-manager/fm-list-view.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -3276,6 +3276,7 @@ real_set_is_active (FMDirectoryView *view,
32763276
GtkWidget *tree_view;
32773277
GtkStyleContext *style;
32783278
GdkRGBA color;
3279+
GdkRGBA *c;
32793280

32803281
tree_view = GTK_WIDGET (fm_list_view_get_tree_view (FM_LIST_VIEW (view)));
32813282

@@ -3286,7 +3287,13 @@ real_set_is_active (FMDirectoryView *view,
32863287
else
32873288
{
32883289
style = gtk_widget_get_style_context (tree_view);
3289-
gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
3290+
3291+
gtk_style_context_get (style, GTK_STATE_FLAG_INSENSITIVE,
3292+
GTK_STYLE_PROPERTY_BACKGROUND_COLOR,
3293+
&c, NULL);
3294+
color = *c;
3295+
gdk_rgba_free (c);
3296+
32903297
gtk_widget_override_background_color (tree_view, GTK_STATE_FLAG_NORMAL, &color);
32913298
}
32923299

0 commit comments

Comments
 (0)