summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2015-12-01 16:38:29 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2015-12-02 11:59:01 +0100
commita0717ad8c078c07ea9d10aed385d30198fd24b03 (patch)
treec1c8749742efd72b1629ccbb58737e10d4a5c91c
parent7c1235591c4aa866b28c8b8dabdcb3b9084c5763 (diff)
downloadlibgd-a0717ad8c078c07ea9d10aed385d30198fd24b03.tar.gz
tagged-entry: Fix warnings with newer GTK+
The tagged entry was generating loads of errors following CSS changes in GTK+ 3.19. See https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/ for details and work-arounds. https://bugzilla.gnome.org/show_bug.cgi?id=758905
-rw-r--r--libgd/gd-tagged-entry.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/libgd/gd-tagged-entry.c b/libgd/gd-tagged-entry.c
index f278d12..47b3c5e 100644
--- a/libgd/gd-tagged-entry.c
+++ b/libgd/gd-tagged-entry.c
@@ -94,7 +94,10 @@ gd_tagged_entry_tag_get_margin (GdTaggedEntryTag *tag,
GtkStyleContext *context;
context = gd_tagged_entry_tag_get_context (tag, entry);
- gtk_style_context_get_margin (context, 0, margin);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ margin);
gtk_style_context_restore (context);
}
@@ -270,9 +273,16 @@ gd_tagged_entry_tag_get_width (GdTaggedEntryTag *tag,
context = gd_tagged_entry_tag_get_context (tag, entry);
state = gd_tagged_entry_tag_get_state (tag, entry);
- gtk_style_context_get_padding (context, state, &button_padding);
- gtk_style_context_get_border (context, state, &button_border);
- gtk_style_context_get_margin (context, state, &button_margin);
+ gtk_style_context_set_state (context, state);
+ gtk_style_context_get_padding (context,
+ gtk_style_context_get_state (context),
+ &button_padding);
+ gtk_style_context_get_border (context,
+ gtk_style_context_get_state (context),
+ &button_border);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ &button_margin);
gd_tagged_entry_tag_ensure_close_surface (tag, context);
@@ -329,7 +339,12 @@ gd_tagged_entry_tag_get_relative_allocations (GdTaggedEntryTag *tag,
scale_factor = gdk_window_get_scale_factor (tag->priv->window);
state = gd_tagged_entry_tag_get_state (tag, entry);
- gtk_style_context_get_margin (context, state, &padding);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ &padding);
+ gtk_style_context_restore (context);
width -= padding.left + padding.right;
height -= padding.top + padding.bottom;
@@ -343,8 +358,15 @@ gd_tagged_entry_tag_get_relative_allocations (GdTaggedEntryTag *tag,
layout_allocation = button_allocation = background_allocation;
- gtk_style_context_get_padding (context, state, &padding);
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
+ gtk_style_context_get_padding (context,
+ gtk_style_context_get_state (context),
+ &padding);
+ gtk_style_context_get_border (context,
+ gtk_style_context_get_state (context),
+ &border);
+ gtk_style_context_restore (context);
gd_tagged_entry_tag_ensure_layout (tag, entry);
pango_layout_get_pixel_size (tag->priv->layout, &layout_width, &layout_height);