summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2017-01-09 19:50:44 -0500
committerlukefromdc <[email protected]>2017-01-09 20:42:28 -0500
commit07b3132af934bd61629be064206d7d12e59baa88 (patch)
treeebd183f050c54660cb4149554594cd99cb5f106c /applets
parent02b7511302cef8b527cbc45c1ac674ab28f2dc01 (diff)
downloadmate-panel-07b3132af934bd61629be064206d7d12e59baa88.tar.bz2
mate-panel-07b3132af934bd61629be064206d7d12e59baa88.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')
-rw-r--r--applets/clock/clock.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 6293a8b6..5fd67f38 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -1282,7 +1282,28 @@ clock_update_text_gravity (GtkWidget *label)
pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO);
}
-#if !GTK_CHECK_VERSION (3, 20, 0)
+#if GTK_CHECK_VERSION (3, 20, 0)
+static inline void
+force_no_button_padding (GtkWidget *widget)
+{
+ static gboolean first_time = TRUE;
+ 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)
{
@@ -1316,7 +1337,7 @@ create_main_clock_button (void)
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
#if GTK_CHECK_VERSION (3, 20, 0)
- gtk_widget_set_name (button, "clock-applet-button");
+ force_no_button_padding (button);
#else
force_no_focus_padding (button);
#endif