[Xfce4-commits] [panel-plugins/xfce4-cpufreq-plugin] 16/20: Remove padding from panel button

noreply at xfce.org noreply at xfce.org
Sat May 6 21:01:17 CEST 2017


This is an automated email from the git hooks/post-receive script.

andre pushed a commit to branch master
in repository panel-plugins/xfce4-cpufreq-plugin.

commit 66cdecbf671dea625d709cb042ef78951b948e51
Author: Andre Miranda <andre42m at gmail.com>
Date:   Fri Nov 4 22:54:00 2016 -0300

    Remove padding from panel button
---
 panel-plugin/xfce4-cpufreq-plugin.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/xfce4-cpufreq-plugin.c b/panel-plugin/xfce4-cpufreq-plugin.c
index c40385f..9dd6d02 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.c
+++ b/panel-plugin/xfce4-cpufreq-plugin.c
@@ -467,11 +467,24 @@ cpufreq_prepare_label (CpuFreqPlugin *cpufreq)
 static void
 cpufreq_widgets (void)
 {
+	gchar *css;
+	GtkCssProvider *provider;
+
 	/* create panel toggle button which will contain all other widgets */
-	cpuFreq->button = xfce_create_panel_toggle_button ();
+	cpuFreq->button = xfce_panel_create_toggle_button ();
 	xfce_panel_plugin_add_action_widget (cpuFreq->plugin, cpuFreq->button);
 	gtk_container_add (GTK_CONTAINER (cpuFreq->plugin), cpuFreq->button);
 
+	css = g_strdup_printf("button { padding: 0px; }");
+
+	provider = gtk_css_provider_new ();
+	gtk_css_provider_load_from_data (provider, css, -1, NULL);
+	gtk_style_context_add_provider (
+			GTK_STYLE_CONTEXT (gtk_widget_get_style_context (GTK_WIDGET (cpuFreq->button))),
+			GTK_STYLE_PROVIDER(provider),
+			GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+	g_free(css);
+
 	cpuFreq->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, SPACING);
 	gtk_container_set_border_width (GTK_CONTAINER (cpuFreq->box), BORDER);
 	gtk_container_add (GTK_CONTAINER (cpuFreq->button), cpuFreq->box);
@@ -488,8 +501,7 @@ cpufreq_widgets (void)
 	g_signal_connect (G_OBJECT (cpuFreq->button), "query-tooltip",
 					  G_CALLBACK (cpufreq_update_tooltip), cpuFreq);
 
-	gtk_widget_show (cpuFreq->box);
-	gtk_widget_show (cpuFreq->button);
+	gtk_widget_show_all (cpuFreq->button);
 
 	cpufreq_update_plugin (TRUE);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list