[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 01/02: Support deskbar mode and vertical mode properly, rotate labels for bars, don't set panels inverted in non-horizontal mode

noreply at xfce.org noreply at xfce.org
Thu Mar 2 15:07:37 CET 2017


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

timystery pushed a commit to branch master
in repository panel-plugins/xfce4-sensors-plugin.

commit 54e523cd081c345313e2a6e4a24e90b653119dbb
Author: Fabian <timystery at arcor.de>
Date:   Thu Mar 2 15:06:32 2017 +0100

    Support deskbar mode and vertical mode properly, rotate labels for bars, don't set panels inverted in non-horizontal mode
---
 lib/sensors-interface-common.c |  1 -
 panel-plugin/sensors-plugin.c  | 33 ++++++++++++++++++---------------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/lib/sensors-interface-common.c b/lib/sensors-interface-common.c
index 3b805a3..ab06113 100644
--- a/lib/sensors-interface-common.c
+++ b/lib/sensors-interface-common.c
@@ -94,7 +94,6 @@ sensors_new (XfcePanelPlugin *plugin, gchar *plugin_config_file)
 }
 
 
-
 void
 sensors_init_default_values  (t_sensors *sensors, XfcePanelPlugin *plugin)
 {
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 390b08e..0796ac4 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -97,7 +97,7 @@ sensors_set_levelbar_size (GtkWidget *ptr_levelbar, int siz_panelheight, int pan
     /* check arguments */
     g_return_if_fail (G_IS_OBJECT(ptr_levelbar));
 
-    if (panelorientation == GTK_ORIENTATION_HORIZONTAL) {
+    if (panelorientation == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) {
         gtk_widget_set_size_request (ptr_levelbar, BORDER+2, siz_panelheight-BORDER);
     }
     else {
@@ -386,16 +386,17 @@ sensors_add_graphical_display (t_sensors *sensors)
                 has_bars = TRUE;
 
                 widget_progbar = gtk_level_bar_new();
-                gtk_level_bar_set_inverted(GTK_LEVEL_BAR(widget_progbar), TRUE);
 
                 if (sensors->orientation == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) {
                     gtk_orientable_set_orientation (GTK_ORIENTABLE (widget_progbar),
                                                     GTK_ORIENTATION_VERTICAL);
+                    gtk_level_bar_set_inverted(GTK_LEVEL_BAR(widget_progbar), TRUE);
                     widget_databox = gtk_hbox_new (FALSE, 0);
                 }
                 else {
                     gtk_orientable_set_orientation (GTK_ORIENTABLE (widget_progbar),
                                                     GTK_ORIENTATION_HORIZONTAL);
+                    gtk_level_bar_set_inverted(GTK_LEVEL_BAR(widget_progbar), FALSE);
                     widget_databox = gtk_vbox_new (FALSE, 0);
                 }
 
@@ -424,12 +425,13 @@ sensors_add_graphical_display (t_sensors *sensors)
 
                     gtk_label_set_ellipsize (GTK_LABEL(widget_label), PANGO_ELLIPSIZE_END);
 
+                    gtk_widget_show (widget_label);
+
                     if (sensors->orientation == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
                         gtk_label_set_angle (GTK_LABEL(widget_label), 270);
                     else
                         gtk_label_set_angle (GTK_LABEL(widget_label), 0);
 
-                    gtk_widget_show (widget_label);
                     ptr_labelledlevelbar->label = widget_label;
 
                     gtk_box_pack_start (GTK_BOX(widget_databox), widget_label, FALSE, FALSE, INNER_BORDER);
@@ -863,6 +865,8 @@ sensors_set_text_panel_label (t_sensors *ptr_sensors, gint numCols, gint num_ite
 
     gtk_label_set_markup (GTK_LABEL(ptr_sensors->panel_label_data), myLabelText);
 
+    gtk_widget_show (ptr_sensors->panel_label_data);
+
     if (ptr_sensors->orientation == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
     {
         gtk_widget_set_halign(ptr_sensors->panel_label_data, GTK_ALIGN_CENTER);
@@ -878,7 +882,6 @@ sensors_set_text_panel_label (t_sensors *ptr_sensors, gint numCols, gint num_ite
         g_free(myLabelText);
     /* else: with sprintf, we cannot free the string. how bad. */
 
-    gtk_widget_show (ptr_sensors->panel_label_data);
 
     TRACE ("leaves sensors_set_text_panel_label");
 }
@@ -1062,17 +1065,6 @@ sensors_show_panel (gpointer data)
 
     sensors = (t_sensors *) data;
 
-    if (sensors->orientation == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
-    {
-        gtk_widget_set_halign(sensors->panel_label_text, GTK_ALIGN_CENTER);
-        gtk_label_set_angle(GTK_LABEL(sensors->panel_label_text), 270.0);
-    }
-    else
-    {
-        gtk_widget_set_valign(sensors->panel_label_text, GTK_ALIGN_CENTER);
-        gtk_label_set_angle(GTK_LABEL(sensors->panel_label_text), 0);
-    }
-
     switch (sensors->display_values_type)
     {
       case DISPLAY_TACHO:
@@ -1091,6 +1083,17 @@ sensors_show_panel (gpointer data)
         result = sensors_show_text_display (sensors);
     }
 
+    if (sensors->orientation == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
+    {
+        gtk_label_set_angle(GTK_LABEL(sensors->panel_label_text), 270.0);
+        gtk_widget_set_halign(sensors->panel_label_text, GTK_ALIGN_CENTER);
+    }
+    else
+    {
+        gtk_label_set_angle(GTK_LABEL(sensors->panel_label_text), 0);
+        gtk_widget_set_valign(sensors->panel_label_text, GTK_ALIGN_CENTER);
+    }
+
     sensors_create_tooltip ((gpointer) sensors);
 
     TRACE ("leaves sensors_show_panel\n");

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


More information about the Xfce4-commits mailing list