[Goodies-commits] r6121 - in xfce4-sensors-plugin/trunk: . include lib panel-plugin src

Fabian Nowak timystery at xfce.org
Sun Nov 16 19:25:55 CET 2008


Author: timystery
Date: 2008-11-16 18:25:55 +0000 (Sun, 16 Nov 2008)
New Revision: 6121

Modified:
   xfce4-sensors-plugin/trunk/ChangeLog
   xfce4-sensors-plugin/trunk/TODO
   xfce4-sensors-plugin/trunk/configure.in.in
   xfce4-sensors-plugin/trunk/include/hddtemp.h
   xfce4-sensors-plugin/trunk/include/middlelayer.h
   xfce4-sensors-plugin/trunk/include/sensors-interface-common.h
   xfce4-sensors-plugin/trunk/include/sensors-interface.h
   xfce4-sensors-plugin/trunk/lib/hddtemp.c
   xfce4-sensors-plugin/trunk/lib/middlelayer.c
   xfce4-sensors-plugin/trunk/lib/sensors-interface.c
   xfce4-sensors-plugin/trunk/panel-plugin/sensors-plugin.c
   xfce4-sensors-plugin/trunk/src/main.c
Log:
- fixed moving between vertical and horizontal panels
- nicer/less crowded application's dialog
- error messages only when not suppressed (now fully supported)



Modified: xfce4-sensors-plugin/trunk/ChangeLog
===================================================================
--- xfce4-sensors-plugin/trunk/ChangeLog	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/ChangeLog	2008-11-16 18:25:55 UTC (rev 6121)
@@ -1,3 +1,11 @@
+2008-11-16 timystery
+  * 
+  * Removed invalid columns such as color and "show" from application's treeview
+  * fixed orientation-switching bug
+  * version bump to 0.10.99.7
+  * switched -v to -V for version information
+  * Tried to hide dialogs completely on desired settings
+
 2008-11-03 timystery
   * Addded support for sysfs for linux 2.6.24++ but still without good checks
   in configure.in.in

Modified: xfce4-sensors-plugin/trunk/TODO
===================================================================
--- xfce4-sensors-plugin/trunk/TODO	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/TODO	2008-11-16 18:25:55 UTC (rev 6121)
@@ -1,8 +1,6 @@
 TODO
 ======
 
-- when moving from vertical to horizontal panel or vice versa, the orientation is not regarded for aligning the labels
-
 - Use notfication messages when alert is on; when maximum is reached.
 
 - fix error: doesn't find all sensors when newly adding plugin to panel - sensors library problem?
@@ -11,9 +9,8 @@
 
 - switch to sysfs completely for everythin?
 
-- decrease size of entries in min/max valu fields
+- decrease size of entries in min/max value fields... would have to change renderer for double values...
 
-- switch -v, --version to -V, --version
 
 Known bugs or user requests
 ---------------------------
@@ -21,4 +18,3 @@
 
 - Respect "suppress messages" for error dialogs with acpi/sysfs
 
-- Remove invalid columns such as color and "show" from application's treeview

Modified: xfce4-sensors-plugin/trunk/configure.in.in
===================================================================
--- xfce4-sensors-plugin/trunk/configure.in.in	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/configure.in.in	2008-11-16 18:25:55 UTC (rev 6121)
@@ -8,7 +8,7 @@
 dnl
 
 m4_define([libxfce4sensors_verinfo], [1:0:0])
-m4_define([plugin_version],[0.10.99.6])
+m4_define([plugin_version],[0.10.99.7])
 
 AC_INIT([xfce4-sensors-plugin], [plugin_version], [timystery at arcor.de])
 AC_PREREQ([2.50])

Modified: xfce4-sensors-plugin/trunk/include/hddtemp.h
===================================================================
--- xfce4-sensors-plugin/trunk/include/hddtemp.h	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/include/hddtemp.h	2008-11-16 18:25:55 UTC (rev 6121)
@@ -28,18 +28,19 @@
 #define ZERO_KELVIN -273 /*.15 */
 
 
-/*
+/**
  * Initialize hddtemp by finding disks to monitor
- * @Return: Number of initialized chips
- * @Param: Pointer to array of chips
+ * @Param Pointer to array of chips
+ * @Return Number of initialized chips
  */
 int initialize_hddtemp (GPtrArray *chips, gboolean *suppressmessage);
 
 
-/*
+/**
  * Refreshs a hddtemp chip's feature in sense of raw and formatted value
 
  * @Param chip_feature: Pointer to feature
+ * @Param data: Pointer to t_sensors or NULL
  */
 void refresh_hddtemp (gpointer chip_feature, gpointer data);
 

Modified: xfce4-sensors-plugin/trunk/include/middlelayer.h
===================================================================
--- xfce4-sensors-plugin/trunk/include/middlelayer.h	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/include/middlelayer.h	2008-11-16 18:25:55 UTC (rev 6121)
@@ -33,8 +33,8 @@
 
 /**
  * Initialize all sensors detected by iterating and calling init-routines
- * @Return: Number of initialized features
- * @Param: Double-pointer to array of chips
+ * @Param chips: Double-pointer to array of chips
+ * @Return Number of initialized features
  */
 int initialize_all (GPtrArray **chips, gboolean *suppressmessage);
 
@@ -43,20 +43,23 @@
  * Refresh all features of a chip
  *
  * @Param chip: Pointer to chip
+ * @Param data: pointer to t_sensors or NULL;
  */
 void refresh_chip (gpointer chip, gpointer data);
 
 
 /**
  * Refresh all features of a chip
- * @Param: Pointer to chip pointers
+ * @Param chips: Pointer to chip pointers
+ * @Param sensors: valid pointer to sensors structure or NULL
  */
-void refresh_all_chips (GPtrArray *chips);
+/* seems to be pretty unused meanwhile ... */
+/* void refresh_all_chips (GPtrArray *chips, t_sensors *sensors ); */
 
 
 /**
  * Classifies sensor type
- * @Param: Pointer to feature
+ * @Param chipfeature: Pointer to feature
  */
 void categorize_sensor_type (t_chipfeature *chipfeature);
 
@@ -67,9 +70,11 @@
  * the sensors chip feature
  * @Param number: number of chipfeature to look for
  * @Param value: address where double value can be stored
- * @Return: 0 on success, >0 else.
+ * @Param suppressmessage: valid pointer to boolean indicating suppression of
+ *                         messages, or NULL.
+ * @Return 0 on success, >0 else.
  */
-int sensor_get_value (t_chip *chip, int number, double *value);
+int sensor_get_value (t_chip *chip, int number, double *value, gboolean *suppressmessage);
 
 
 /**

Modified: xfce4-sensors-plugin/trunk/include/sensors-interface-common.h
===================================================================
--- xfce4-sensors-plugin/trunk/include/sensors-interface-common.h	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/include/sensors-interface-common.h	2008-11-16 18:25:55 UTC (rev 6121)
@@ -116,7 +116,7 @@
     /* use the progress-bar UI */
     gboolean display_values_graphically;
 
-    /* suppress the Hddtemp message in case of failure */
+    /* suppress Hddtemp failure messages and any other messages */
     gboolean suppressmessage;
 
     /* sensor update time */
@@ -199,6 +199,8 @@
     /* the sensors structure */
     t_sensors *sensors;
 
+    gboolean plugin_dialog;
+
     /* controls dialog */
     GtkWidget *dialog;
 

Modified: xfce4-sensors-plugin/trunk/include/sensors-interface.h
===================================================================
--- xfce4-sensors-plugin/trunk/include/sensors-interface.h	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/include/sensors-interface.h	2008-11-16 18:25:55 UTC (rev 6121)
@@ -28,7 +28,7 @@
 #include "sensors-interface-common.h"
 
 /* Initializing and filling functions */
-void fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale);
+void fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_sensors_dialog *sd);
 
 void init_widgets (t_sensors_dialog *sd);
 

Modified: xfce4-sensors-plugin/trunk/lib/hddtemp.c
===================================================================
--- xfce4-sensors-plugin/trunk/lib/hddtemp.c	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/lib/hddtemp.c	2008-11-16 18:25:55 UTC (rev 6121)
@@ -26,6 +26,7 @@
 #include <hddtemp.h>
 #include <middlelayer.h>
 #include <types.h>
+#include <sensors-interface-common.h>
 
 /* Gtk/Glib includes */
 #include <glib.h>
@@ -601,14 +602,22 @@
 {
     t_chipfeature *cf;
     double value;
+    t_sensors *sensors;
+    gboolean *suppress = NULL;
 
     g_assert (chip_feature!=NULL);
 
     TRACE ("enters refresh_hddtemp");
 
+    if (data != NULL)
+    {
+        sensors = (t_sensors *) data;
+        suppress = &(sensors->suppressmessage);
+    }
+
     cf = (t_chipfeature *) chip_feature;
 
-    value = get_hddtemp_value (cf->devicename, NULL);
+    value = get_hddtemp_value (cf->devicename, suppress);
 
     /* actually, that's done in the gui part */
     g_free (cf->formatted_value);

Modified: xfce4-sensors-plugin/trunk/lib/middlelayer.c
===================================================================
--- xfce4-sensors-plugin/trunk/lib/middlelayer.c	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/lib/middlelayer.c	2008-11-16 18:25:55 UTC (rev 6121)
@@ -40,6 +40,7 @@
 
 /* Package includes */
 #include <middlelayer.h>
+#include <sensors-interface-common.h>
 
 #ifdef HAVE_LIBSENSORS
     #include <lmsensors.h>
@@ -105,7 +106,7 @@
 
     #ifdef HAVE_HDDTEMP
         if (c->type==HDD) {
-            g_ptr_array_foreach (c->chip_features, refresh_hddtemp, NULL );
+            g_ptr_array_foreach (c->chip_features, refresh_hddtemp, data ); /* note that data is of *t_sensors! */
         return;
         }
     #endif
@@ -115,11 +116,11 @@
 
 
 void
-refresh_all_chips (GPtrArray *chips )
+refresh_all_chips (GPtrArray *chips, t_sensors *sensors )
 {
     TRACE ("enters refresh_all_chips");
 
-    g_ptr_array_foreach (chips, refresh_chip, NULL );
+    g_ptr_array_foreach (chips, refresh_chip, sensors);
 
     TRACE ("leaves refresh_all_chips");
 }
@@ -163,9 +164,10 @@
 
 
 int
-sensor_get_value (t_chip *chip, int number, double *value)
+sensor_get_value (t_chip *chip, int number, double *value, gboolean *suppressmessage)
 {
     t_chipfeature *feature;
+    gboolean *suppress = suppressmessage;
     /* TRACE ("enters sensor_get_value %d", number); */
 
     g_assert (chip!=NULL);
@@ -182,7 +184,7 @@
             g_assert (number<chip->num_features);
             feature = (t_chipfeature *) g_ptr_array_index (chip->chip_features, number);
             g_assert (feature!=NULL);
-            *value = get_hddtemp_value (feature->devicename, NULL);
+            *value = get_hddtemp_value (feature->devicename, suppress);
             if (*value==ZERO_KELVIN) {
                 return NO_VALID_HDDTEMP;
             }

Modified: xfce4-sensors-plugin/trunk/lib/sensors-interface.c
===================================================================
--- xfce4-sensors-plugin/trunk/lib/sensors-interface.c	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/lib/sensors-interface.c	2008-11-16 18:25:55 UTC (rev 6121)
@@ -49,11 +49,12 @@
 
 
 void
-fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale)
+fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_sensors_dialog *sd)
 {
     int featureindex, res;
     double sensorFeature;
     t_chipfeature *chipfeature;
+    gboolean *suppress;
     GtkTreeIter *iter;
     #ifdef HAVE_LIBNOTIFY
     NotifyNotification *nn;
@@ -70,6 +71,8 @@
 
     TRACE ("enters fill_gtkTreeStore");
 
+    suppress = &(sd->sensors->suppressmessage);
+
     for (featureindex=0; featureindex < chip->num_features; featureindex++)
     {
         chipfeature = (t_chipfeature *) g_ptr_array_index (chip->chip_features, featureindex);
@@ -79,8 +82,8 @@
 
         if ( chipfeature->valid == TRUE ) {
             res = sensor_get_value
-                    (chip, chipfeature->address, &sensorFeature);
-            if ( res!=0) {
+                    (chip, chipfeature->address, &sensorFeature, suppress);
+            if ( res!=0 && !suppress) {
 
                 #ifdef HAVE_LIBNOTIFY
                 if (!notify_is_initted())
@@ -101,7 +104,8 @@
                                  &(chipfeature->formatted_value));
             chipfeature->raw_value = sensorFeature;
             gtk_tree_store_append (model, iter, NULL);
-            gtk_tree_store_set ( model, iter,
+            if (sd->plugin_dialog)
+                gtk_tree_store_set ( model, iter,
                                  0, chipfeature->name,
                                 1, chipfeature->formatted_value,
                                 2, chipfeature->show,
@@ -109,6 +113,13 @@
                                 4, chipfeature->min_value,
                                 5, chipfeature->max_value,
                                  -1);
+            else
+                gtk_tree_store_set ( model, iter,
+                                 0, chipfeature->name,
+                                1, chipfeature->formatted_value,
+                                2, chipfeature->min_value,
+                                3, chipfeature->max_value,
+                                 -1);
         } /* end if sensors-valid */
         /* g_free(iter); ??? */
     }
@@ -191,11 +202,13 @@
         ( GTK_TREE_MODEL ( sd->myListStore[ gtk_combo_box_active ] ) );
 
     myCellRendererText = gtk_cell_renderer_text_new ();
-    g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
+    if (sd->plugin_dialog)
+        g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
 
     aTreeViewColumn = gtk_tree_view_column_new_with_attributes (_("Name"),
                         myCellRendererText, "text", 0, NULL);
-    g_signal_connect    (G_OBJECT (myCellRendererText), "edited",
+    if (sd->plugin_dialog)
+        g_signal_connect    (G_OBJECT (myCellRendererText), "edited",
                         G_CALLBACK (list_cell_text_edited), sd);
     gtk_tree_view_column_set_expand (aTreeViewColumn, TRUE);
     gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
@@ -207,38 +220,56 @@
     gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
                         GTK_TREE_VIEW_COLUMN (aTreeViewColumn));
 
-    myCellRendererToggle = gtk_cell_renderer_toggle_new();
-    aTreeViewColumn = gtk_tree_view_column_new_with_attributes (_("Show"),
-                        myCellRendererToggle, "active", 2, NULL);
-    g_signal_connect    (G_OBJECT (myCellRendererToggle), "toggled",
-                        G_CALLBACK (list_cell_toggle), sd );
-    gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
-                        GTK_TREE_VIEW_COLUMN (aTreeViewColumn));
+    if (sd->plugin_dialog)
+    {
+        myCellRendererToggle = gtk_cell_renderer_toggle_new();
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes (_("Show"),
+                            myCellRendererToggle, "active", 2, NULL);
+        g_signal_connect    (G_OBJECT (myCellRendererToggle), "toggled",
+                            G_CALLBACK (list_cell_toggle), sd );
+        gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
+                            GTK_TREE_VIEW_COLUMN (aTreeViewColumn));
 
-    myCellRendererText = gtk_cell_renderer_text_new ();
-    g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
-    aTreeViewColumn = gtk_tree_view_column_new_with_attributes (_("Color"),
-                        myCellRendererText, "text", 3, NULL);
-    g_signal_connect    (G_OBJECT (myCellRendererText), "edited",
-                        G_CALLBACK (list_cell_color_edited), sd);
-    gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
-                        GTK_TREE_VIEW_COLUMN (aTreeViewColumn));
+        myCellRendererText = gtk_cell_renderer_text_new ();
+        g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes (_("Color"),
+                            myCellRendererText, "text", 3, NULL);
+        g_signal_connect    (G_OBJECT (myCellRendererText), "edited",
+                            G_CALLBACK (list_cell_color_edited), sd);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (sd->myTreeView),
+                            GTK_TREE_VIEW_COLUMN (aTreeViewColumn));
+    }
 
     myCellRendererText = gtk_cell_renderer_text_new ();
-    g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
-    aTreeViewColumn = gtk_tree_view_column_new_with_attributes
+    if (sd->plugin_dialog)
+    {
+        g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes
                     (_("Min"), myCellRendererText, "text", 4, NULL);
-    g_signal_connect(G_OBJECT(myCellRendererText), "edited",
+        g_signal_connect(G_OBJECT(myCellRendererText), "edited",
                         G_CALLBACK(minimum_changed), sd);
+    }
+    else
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes
+                    (_("Min"), myCellRendererText, "text", 2, NULL);
+
+
     gtk_tree_view_append_column(GTK_TREE_VIEW(sd->myTreeView),
                         GTK_TREE_VIEW_COLUMN(aTreeViewColumn));
 
     myCellRendererText = gtk_cell_renderer_text_new ();
-    g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
-    aTreeViewColumn = gtk_tree_view_column_new_with_attributes
+    if (sd->plugin_dialog)
+    {
+        g_object_set ( (gpointer*) myCellRendererText, "editable", TRUE, NULL );
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes
                     (_("Max"), myCellRendererText, "text", 5, NULL);
-    g_signal_connect(G_OBJECT(myCellRendererText), "edited",
+        g_signal_connect(G_OBJECT(myCellRendererText), "edited",
                         G_CALLBACK(maximum_changed), sd);
+    }
+    else
+        aTreeViewColumn = gtk_tree_view_column_new_with_attributes
+                    (_("Max"), myCellRendererText, "text", 3, NULL);
+
     gtk_tree_view_append_column(GTK_TREE_VIEW(sd->myTreeView),
                         GTK_TREE_VIEW_COLUMN(aTreeViewColumn));
 
@@ -344,16 +375,21 @@
     sensors = sd->sensors;
 
     for (chipindex=0; chipindex < sensors->num_sensorchips; chipindex++) {
-        sd->myListStore[chipindex] = gtk_tree_store_new (6, G_TYPE_STRING,
+        if (sd->plugin_dialog)
+            sd->myListStore[chipindex] = gtk_tree_store_new (6, G_TYPE_STRING,
                         G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING,
                         G_TYPE_FLOAT, G_TYPE_FLOAT);
+        else
+            sd->myListStore[chipindex] = gtk_tree_store_new (4, G_TYPE_STRING,
+                        G_TYPE_STRING,
+                        G_TYPE_FLOAT, G_TYPE_FLOAT);
 
         chip = (t_chip *) g_ptr_array_index (sensors->chips, chipindex);
         gtk_combo_box_append_text ( GTK_COMBO_BOX(sd->myComboBox),
                                     chip->sensorId );
         model = GTK_TREE_STORE (sd->myListStore[chipindex]);
 
-        fill_gtkTreeStore (model, chip, sensors->scale);
+        fill_gtkTreeStore (model, chip, sensors->scale,  sd);
     }
 
     if(sd->sensors->num_sensorchips == 0) {
@@ -361,10 +397,16 @@
         g_assert (chip!=NULL);
         gtk_combo_box_append_text ( GTK_COMBO_BOX(sd->myComboBox),
                                 chip->sensorId );
-        sd->myListStore[0] = gtk_tree_store_new (6, G_TYPE_STRING,
+        if (sd->plugin_dialog)
+            sd->myListStore[0] = gtk_tree_store_new (6, G_TYPE_STRING,
                                                 G_TYPE_STRING, G_TYPE_BOOLEAN,
                                                 G_TYPE_STRING, G_TYPE_DOUBLE,
                                                 G_TYPE_DOUBLE);
+        else
+            sd->myListStore[0] = gtk_tree_store_new (4, G_TYPE_STRING,
+                                                G_TYPE_STRING,
+                                                G_TYPE_DOUBLE,
+                                                G_TYPE_DOUBLE);
         chipfeature = (t_chipfeature *) g_ptr_array_index (chip->chip_features, 0);
         g_assert (chipfeature!=NULL);
 
@@ -375,16 +417,24 @@
         iter = g_new0 (GtkTreeIter, 1);
         gtk_tree_store_append ( GTK_TREE_STORE (sd->myListStore[0]),
                             iter, NULL);
-        gtk_tree_store_set ( GTK_TREE_STORE (sd->myListStore[0]),
+        if (sd->plugin_dialog)
+            gtk_tree_store_set ( GTK_TREE_STORE (sd->myListStore[0]),
                             iter,
                             0, chipfeature->name,
                             1, "0.0",        /* chipfeature->formatted_value */
                             2, False,        /* chipfeature->show */
                             3, "#000000",    /* chipfeature->color */
-                            3, "#000000",    /* chipfeature->color */
                             4, 0.0,            /* chipfeature->min_value */
                             5, 0.0,            /* chipfeature->max_value */
                             -1);
+        else
+            gtk_tree_store_set ( GTK_TREE_STORE (sd->myListStore[0]),
+                            iter,
+                            0, chipfeature->name,
+                            1, "0.0",        /* chipfeature->formatted_value */
+                            2, 0.0,            /* chipfeature->min_value */
+                            3, 0.0,            /* chipfeature->max_value */
+                            -1);
     }
     TRACE ("leaves init_widgets");
 }
@@ -409,7 +459,7 @@
         model = sd->myListStore[chipindex];
         gtk_tree_store_clear (model);
 
-        fill_gtkTreeStore (model, chip, sensors->scale);
+        fill_gtkTreeStore (model, chip, sensors->scale, sd);
 
     }
     TRACE ("leaves reload_listbox");

Modified: xfce4-sensors-plugin/trunk/panel-plugin/sensors-plugin.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/sensors-plugin.c	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/panel-plugin/sensors-plugin.c	2008-11-16 18:25:55 UTC (rev 6121)
@@ -629,7 +629,8 @@
                 }
 
                 res = sensor_get_value (chip, chipfeature->address,
-                                                    &sensorFeature);
+                                                    &sensorFeature,
+                                                    &(sensors->suppressmessage));
 
                 if ( res!=0 ) {
                     /* FIXME: either print nothing, or undertake appropriate action,
@@ -706,51 +707,59 @@
     t_chipfeature *chipfeature;
     t_barpanel *panel;
 
-    TRACE ("enters sensors_set_orientation");
+    TRACE ("enters sensors_set_orientation: %d", orientation);
 
-    if (orientation == sensors->orientation || !sensors->display_values_graphically)
+    if (orientation == sensors->orientation) // || !sensors->display_values_graphically)
         return;
 
     sensors->orientation = orientation; /* now assign the new orientation */
 
-    if (orientation == GTK_ORIENTATION_HORIZONTAL)
-        newBox = gtk_hbox_new(FALSE, 0);
-    else
-        newBox = gtk_vbox_new(FALSE, 0);
-
+    newBox = orientation==GTK_ORIENTATION_HORIZONTAL ? gtk_hbox_new(FALSE, 0) : gtk_vbox_new(FALSE, 0);
     gtk_widget_show (newBox);
 
     gtk_widget_reparent (sensors->panel_label_text, newBox);
     gtk_widget_reparent (sensors->panel_label_data, newBox);
 
-    for (i=0; i < sensors->num_sensorchips; i++) {
-        chip = (t_chip *) g_ptr_array_index (sensors->chips, i);
-        g_assert (chip!=NULL);
+    if (sensors->display_values_graphically)
+    {
+        for (i=0; i < sensors->num_sensorchips; i++) {
+            chip = (t_chip *) g_ptr_array_index (sensors->chips, i);
+            g_assert (chip!=NULL);
 
-        for (feature = 0; feature<chip->num_features; feature++) {
-            chipfeature = g_ptr_array_index (chip->chip_features, feature);
-            g_assert (chipfeature!=NULL);
+            for (feature = 0; feature<chip->num_features; feature++)
+            {
+                chipfeature = g_ptr_array_index (chip->chip_features, feature);
+                g_assert (chipfeature!=NULL);
 
-            if (chipfeature->show == TRUE) {
-                panel = (t_barpanel*) sensors->panels[i][feature];
-                gtk_widget_reparent (panel->databox, newBox);
+                if (chipfeature->show == TRUE) {
+                    panel = (t_barpanel*) sensors->panels[i][feature];
+                    gtk_widget_reparent (panel->databox, newBox);
+                }
             }
         }
     }
+    else
+    {
+        /* we don't need a separate function for just one call. */
+    }
 
     gtk_widget_destroy (sensors->widget_sensors);
     sensors->widget_sensors = newBox;
 
     gtk_container_add (GTK_CONTAINER (sensors->eventbox),
-                       sensors->widget_sensors);
+                   sensors->widget_sensors);
 
-    sensors_remove_graphical_panel (sensors);
+    if (sensors->display_values_graphically)
+        sensors_remove_graphical_panel (sensors);
+
     sensors_show_panel (sensors);
 
     TRACE ("leaves sensors_set_orientation");
 }
 
 
+
+
 /* initialize box and label to pack them together */
 static void
 create_panel_widget (t_sensors * sensors)
@@ -1810,6 +1819,7 @@
 
     sd->sensors = sensors;
     sd->dialog = dlg;
+    sd->plugin_dialog = TRUE;
 
     sd->myComboBox = gtk_combo_box_new_text();
 

Modified: xfce4-sensors-plugin/trunk/src/main.c
===================================================================
--- xfce4-sensors-plugin/trunk/src/main.c	2008-11-16 18:09:40 UTC (rev 6120)
+++ xfce4-sensors-plugin/trunk/src/main.c	2008-11-16 18:25:55 UTC (rev 6121)
@@ -107,6 +107,7 @@
     sensors = sensors_new (NULL, NULL);
     sd = g_new0 (t_sensors_dialog, 1);
     sd->sensors = sensors;
+    sd->plugin_dialog = FALSE;
 
     /* build main application */
     window = create_main_window (sd);




More information about the Goodies-commits mailing list