diff options
author | monsta <[email protected]> | 2017-01-31 15:45:53 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2017-02-02 13:34:29 +0300 |
commit | 66bfbc8094edf867b65ab9c575d1aa085b43daaf (patch) | |
tree | a461cc7f38f33263c270161a4536d7dbc9908072 /charpick | |
parent | 02a40fb1683e103eefd79a9874cf5d4cafb18c7d (diff) | |
download | mate-applets-66bfbc8094edf867b65ab9c575d1aa085b43daaf.tar.bz2 mate-applets-66bfbc8094edf867b65ab9c575d1aa085b43daaf.tar.xz |
charpick: fix runtime warnings with GTK+ 3.20/22
use modern padding and margin properties to fix deprecation warnings
use zero border width to fix negative allocation warning
similar to these fixes:
https://github.com/mate-desktop/mate-panel/commit/07b3132af934bd61629be064206d7d12e59baa88
https://github.com/mate-desktop/mate-panel/commit/d06d561dfca50f269c6113bf72fd10e063713942
Diffstat (limited to 'charpick')
-rw-r--r-- | charpick/charpick.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/charpick/charpick.c b/charpick/charpick.c index fffcfbda..fee85d59 100644 --- a/charpick/charpick.c +++ b/charpick/charpick.c @@ -393,6 +393,30 @@ chooser_button_clicked (GtkButton *button, charpick_data *curr_data) indication be drawn on the label itself when space is tight. Taken from the clock applet. FIXME : This is an Evil Hack and should be fixed when the focus padding can be overridden at the gtk+ level */ +#if GTK_CHECK_VERSION (3, 20, 0) +static inline void force_no_button_padding (GtkWidget *widget) +{ + GtkCssProvider *provider; + + provider = gtk_css_provider_new (); + + gtk_css_provider_load_from_data (provider, + "#charpick-applet-button {\n" + "border-width: 0px;\n" + "padding: 0px;\n" + "margin: 0px;\n" + "}", + -1, + NULL); + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + g_object_unref (provider); + + gtk_widget_set_name (widget, "charpick-applet-button"); +} +#else static inline void force_no_focus_padding (GtkWidget *widget) { #if GTK_CHECK_VERSION (3, 0, 0) @@ -436,6 +460,7 @@ static inline void force_no_focus_padding (GtkWidget *widget) gtk_widget_set_name (widget, "charpick-applet-button"); } +#endif /* creates table of buttons, sets up their callbacks, and packs the table in the event box */ @@ -500,7 +525,11 @@ build_table(charpick_data *p_curr_data) gtk_container_add (GTK_CONTAINER (button), arrow); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); /* FIXME : evil hack (see force_no_focus_padding) */ +#if GTK_CHECK_VERSION (3, 20, 0) + force_no_button_padding (button); +#else force_no_focus_padding (button); +#endif gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (chooser_button_clicked), @@ -539,7 +568,11 @@ build_table(charpick_data *p_curr_data) gtk_widget_show (toggle_button[i]); gtk_button_set_relief(GTK_BUTTON(toggle_button[i]), GTK_RELIEF_NONE); /* FIXME : evil hack (see force_no_focus_padding) */ +#if GTK_CHECK_VERSION (3, 20, 0) + force_no_button_padding (toggle_button[i]); +#else force_no_focus_padding (toggle_button[i]); +#endif gtk_widget_set_tooltip_text (toggle_button[i], name); g_free (name); |