[Xfce4-commits] [xfce/xfce4-power-manager] 01/03: battery-button: added support for multi-row panel layouts

noreply at xfce.org noreply at xfce.org
Mon Jun 2 08:33:00 CEST 2014


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

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit 2b3d589a8464b8913b6afb79658e42d349f94a57
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Sun Jun 1 23:24:37 2014 +0100

    battery-button: added support for multi-row panel layouts
---
 panel-plugins/battery/battery-button.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/panel-plugins/battery/battery-button.c b/panel-plugins/battery/battery-button.c
index 894f4ed..13d538b 100644
--- a/panel-plugins/battery/battery-button.c
+++ b/panel-plugins/battery/battery-button.c
@@ -511,8 +511,14 @@ battery_button_press_event (GtkWidget *widget, GdkEventButton *event)
 static gboolean
 battery_button_size_changed_cb (XfcePanelPlugin *plugin, gint size, BatteryButton *button)
 {
-    gint width = size -2 - 2* MAX(gtk_widget_get_style(GTK_WIDGET(button))->xthickness,
-                                  gtk_widget_get_style(GTK_WIDGET(button))->ythickness);
+    gint width;
+
+    g_return_val_if_fail (BATTERY_IS_BUTTON (button), FALSE);
+    g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), FALSE);
+
+    size /= xfce_panel_plugin_get_nrows (plugin);
+    width = size -2 - 2* MAX(gtk_widget_get_style(GTK_WIDGET(button))->xthickness,
+                             gtk_widget_get_style(GTK_WIDGET(button))->ythickness);
 
     gtk_widget_set_size_request (GTK_WIDGET(plugin), size, size);
     button->priv->panel_icon_width = width;
@@ -540,6 +546,7 @@ battery_button_show (BatteryButton *button)
     g_return_if_fail (BATTERY_IS_BUTTON (button));
 
     xfce_panel_plugin_add_action_widget (button->priv->plugin, GTK_WIDGET (button));
+    xfce_panel_plugin_set_small (button->priv->plugin, TRUE);
 
     button->priv->panel_icon_image = gtk_image_new ();
     gtk_container_add (GTK_CONTAINER (button), button->priv->panel_icon_image);

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


More information about the Xfce4-commits mailing list