diff options
author | lukefromdc <[email protected]> | 2017-01-09 19:50:44 -0500 |
---|---|---|
committer | monsta <[email protected]> | 2017-01-27 16:08:41 +0300 |
commit | 7c01782f529d0e55fbce6a3bbbd23318b6cc969e (patch) | |
tree | 48e5e1930ef3e46602d383a30ef675ad9c9f1818 /applets/clock | |
parent | a97dea0d4b8e1f2a7682bc7787e5b66143695070 (diff) | |
download | mate-panel-7c01782f529d0e55fbce6a3bbbd23318b6cc969e.tar.bz2 mate-panel-7c01782f529d0e55fbce6a3bbbd23318b6cc969e.tar.xz |
GTK 3.20/22 Clock button: force zero padding and margin
Stops negative allocation warnings unless theme sets a border
Diffstat (limited to 'applets/clock')
-rw-r--r-- | applets/clock/clock.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 35720bdf..ae45886c 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -1361,7 +1361,27 @@ clock_update_text_gravity (GtkWidget *label) } #if GTK_CHECK_VERSION (3, 0, 0) -#if !GTK_CHECK_VERSION (3, 19, 0) +#if GTK_CHECK_VERSION (3, 19, 0) +static inline void +force_no_button_padding (GtkWidget *widget) +{ + GtkCssProvider *provider; + + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "#clock-applet-button {\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, "clock-applet-button"); +} +#else static inline void force_no_focus_padding (GtkWidget *widget) { @@ -1416,7 +1436,7 @@ create_main_clock_button (void) gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); #if GTK_CHECK_VERSION (3, 19, 0) - gtk_widget_set_name (button, "clock-applet-button"); + force_no_button_padding (button); #else force_no_focus_padding (button); #endif |