[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 02/03: Refactoring in callback handling for stand-alone application

noreply at xfce.org noreply at xfce.org
Sun Apr 16 22:37:42 CEST 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 3fb6c5fd25cd7545d602a0acf03eaae3f09b3011
Author: Fabian <timystery at arcor.de>
Date:   Sun Apr 16 22:36:58 2017 +0200

    Refactoring in callback handling for stand-alone application
---
 src/actions.c   |   2 +-
 src/callbacks.c | 365 +++++++++++++++++++++++++-------------------------------
 2 files changed, 165 insertions(+), 202 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index d27f7dd..e77fc19 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -59,7 +59,7 @@ refresh_sensor_data (t_sensors_dialog *sd);
 gboolean
 refresh_sensor_data (t_sensors_dialog *ptr_sensors_dialog_structure)
 {
-  t_sensors *sensors;
+    t_sensors *sensors;
     int idx_chip, idx_feature, result;
     double val_sensor_feature;
     gchar *tmp;
diff --git a/src/callbacks.c b/src/callbacks.c
index 73216be..1c62284 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -38,30 +38,34 @@
 #include "actions.h"
 
 
+enum
+{
+    eTreeColumn_Name = 0,
+    eTreeColumn_Value = 1,
+    eTreeColumn_Show = 2,
+    eTreeColumn_Color = 3,
+    eTreeColumn_Min = 4,
+    eTreeColumn_Max = 5
+};
+
 /* -------------------------------------------------------------------------- */
-void on_font_set (GtkWidget *widget, gpointer data)
+void on_font_set (GtkWidget *ptr_widget, gpointer data)
 {
     if (font!=NULL)
         g_free (font);
 
-    font = g_strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget)));
+    font = g_strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(ptr_widget)));
     refresh_view(data); /* data is pointer to sensors_dialog */
 }
 
 
 /* -------------------------------------------------------------------------- */
 void
-on_main_window_response (GtkWidget *dlg, int response, t_sensors_dialog *sd)
+on_main_window_response (GtkWidget *ptr_dialog, int response, t_sensors_dialog *ptr_sensorsdialog)
 {
     TRACE ("enters on_main_window_response");
 
-    DBG("quitting gtk main routine");
-        gtk_main_quit();
-
-    // dialog OK button or close keybinding or window close button
-    if (response==GTK_RESPONSE_OK) // || response==GTK_RESPONSE_DELETE_EVENT)
-    {
-    }
+    gtk_main_quit();
 
     TRACE ("leaves on_main_window_response");
 }
@@ -69,83 +73,95 @@ on_main_window_response (GtkWidget *dlg, int response, t_sensors_dialog *sd)
 
 /* -------------------------------------------------------------------------- */
 void
-sensor_entry_changed_ (GtkWidget *widget, t_sensors_dialog *sd)
+sensor_entry_changed_ (GtkWidget *ptr_comboboxwidget, t_sensors_dialog *ptr_sensorsdialog)
 {
-    gint gtk_combo_box_active;
-    t_chip *chip;
+    gint idx_active_combobox;
+    t_chip *ptr_chip;
 
     TRACE ("enters sensor_entry_changed");
 
-    gtk_combo_box_active = gtk_combo_box_get_active(GTK_COMBO_BOX (widget));
+    idx_active_combobox = gtk_combo_box_get_active(GTK_COMBO_BOX (ptr_comboboxwidget));
 
-    chip = (t_chip *) g_ptr_array_index (sd->sensors->chips,
-                                         gtk_combo_box_active);
+    ptr_chip = (t_chip *) g_ptr_array_index (ptr_sensorsdialog->sensors->chips,
+                                         idx_active_combobox);
 
-    gtk_label_set_label (GTK_LABEL(sd->mySensorLabel), chip->description);
+    gtk_label_set_label (GTK_LABEL(ptr_sensorsdialog->mySensorLabel), ptr_chip->description);
 
-    gtk_tree_view_set_model (GTK_TREE_VIEW (sd->myTreeView),
-                    GTK_TREE_MODEL ( sd->myListStore[gtk_combo_box_active] ) );
+    gtk_tree_view_set_model (GTK_TREE_VIEW (ptr_sensorsdialog->myTreeView),
+                    GTK_TREE_MODEL ( ptr_sensorsdialog->myListStore[idx_active_combobox] ) );
 
     TRACE ("leaves sensor_entry_changed");
 }
 
 
-/* -------------------------------------------------------------------------- */
-void
-list_cell_text_edited_ (GtkCellRendererText *cellrenderertext,
-                      gchar *path_str, gchar *new_text, t_sensors_dialog *sd)
+gint set_value_in_treemodel_and_return_index_and_feature(t_sensors_dialog *ptr_sensorsdialog, gchar *ptr_str_cellpath, gint col_treeview, GValue *ptr_value, t_chipfeature **ptr_ptr_chipfeature)
 {
-    gint gtk_combo_box_active;
-    GtkTreeModel *model;
-    GtkTreePath *path;
-    GtkTreeIter iter;
-    t_chip *chip;
-    t_chipfeature *chipfeature;
+    gint idx_active_combobox = -1;
+    GtkTreeModel *ptr_treemodel;
+    GtkTreePath *ptr_treepath;
+    GtkTreeIter iter_treemodel;
+    t_chip *ptr_chip;
+    t_chipfeature *ptr_chipfeature;
 
     TRACE ("enters list_cell_text_edited");
 
-    /* if (sd->sensors->display_values_graphically == TRUE) {
-        DBG("removing graphical panel");
-        sensors_remove_graphical_panel(sd->sensors);
-        DBG("done removing grap. panel");
-    } */
-    /* better send a D-BUS message instead */
+    idx_active_combobox =
+        gtk_combo_box_get_active(GTK_COMBO_BOX (ptr_sensorsdialog->myComboBox));
 
-    gtk_combo_box_active =
-        gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
-
-    model =
-        (GtkTreeModel *) sd->myListStore [gtk_combo_box_active];
-    path = gtk_tree_path_new_from_string (path_str);
+    ptr_treemodel =
+        (GtkTreeModel *) ptr_sensorsdialog->myListStore [idx_active_combobox];
+    ptr_treepath = gtk_tree_path_new_from_string (ptr_str_cellpath);
 
     /* get model iterator */
-    gtk_tree_model_get_iter (model, &iter, path);
+    gtk_tree_model_get_iter (ptr_treemodel, &iter_treemodel, ptr_treepath);
 
     /* set new value */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, new_text, -1);
-    chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
-
-    /* if (chip->type!=ACPI) { */ /* No Bug. The cryptic filesystem names are
-                                  needed for the update in ACPI and hddtemp. */
-        chipfeature = (t_chipfeature *) g_ptr_array_index (chip->chip_features,
-                                                            atoi(path_str));
-        /* TODO: user gtk_sensorstacho_set_text */
-        if (chipfeature->name != NULL)
-            g_free(chipfeature->name);
-        chipfeature->name = g_strdup (new_text);
-    /* } */
+    ptr_chip = (t_chip *) g_ptr_array_index(ptr_sensorsdialog->sensors->chips, idx_active_combobox);
+
+    gtk_tree_store_set_value (GTK_TREE_STORE (ptr_treemodel), &iter_treemodel, col_treeview, ptr_value);
+    ptr_chip = (t_chip *) g_ptr_array_index(ptr_sensorsdialog->sensors->chips, idx_active_combobox);
+
+    ptr_chipfeature = (t_chipfeature *) g_ptr_array_index (ptr_chip->chip_features,
+                                                        atoi(ptr_str_cellpath));
 
     /* clean up */
-    gtk_tree_path_free (path);
+    gtk_tree_path_free (ptr_treepath);
+
+    *ptr_ptr_chipfeature = ptr_chipfeature;
+
+    return idx_active_combobox;
+}
+
+
+/* -------------------------------------------------------------------------- */
+void
+list_cell_text_edited_ (GtkCellRendererText *ptr_cellrenderertext,
+                      gchar *ptr_str_cellpath, gchar *ptr_str_newtext, t_sensors_dialog *ptr_sensorsdialog)
+{
+    gint idx_active_combobox;
+    t_chipfeature *ptr_chipfeature = NULL;
+    GValue val_textstring = G_VALUE_INIT;
+
+    TRACE ("enters list_cell_text_edited");
+
+    g_value_init(&val_textstring, G_TYPE_STRING);
+    g_value_set_static_string(&val_textstring, ptr_str_newtext);
+    idx_active_combobox = set_value_in_treemodel_and_return_index_and_feature(
+        ptr_sensorsdialog, ptr_str_cellpath, eTreeColumn_Name, &val_textstring,
+        &ptr_chipfeature);
+
+        if (ptr_chipfeature->name != NULL)
+            g_free(ptr_chipfeature->name);
+        ptr_chipfeature->name = g_strdup (ptr_str_newtext);
+    /* } */
 
     /* update panel */
-    /* sensors_show_panel ((gpointer) sd->sensors); */
-    /* better send a D-BUS message instead or alter the configuration file */
+    GtkWidget *ptr_tacho = ptr_sensorsdialog->sensors->tachos [idx_active_combobox][atoi(ptr_str_cellpath)];
 
-    if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
-      gtk_sensorstacho_set_text (GTK_SENSORSTACHO(sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]), new_text);
+    if (ptr_tacho!=NULL)
+        gtk_sensorstacho_set_text (GTK_SENSORSTACHO(ptr_tacho), ptr_str_newtext);
 
-    refresh_view ((gpointer) sd);
+    refresh_view ((gpointer) ptr_sensorsdialog);
 
     TRACE ("leaves list_cell_text_edited");
 }
@@ -153,32 +169,28 @@ list_cell_text_edited_ (GtkCellRendererText *cellrenderertext,
 
 /* -------------------------------------------------------------------------- */
 void
-list_cell_toggle_ (GtkCellRendererToggle *cell, gchar *path_str,
-                  t_sensors_dialog *sd)
+list_cell_toggle_ (GtkCellRendererToggle *ptr_cellrenderertoggle, gchar *ptr_str_cellpath,
+                  t_sensors_dialog *ptr_sensorsdialog)
 {
-    t_chip *chip;
-    t_chipfeature *chipfeature;
-    gint gtk_combo_box_active;
-    GtkTreeModel *model;
-    GtkTreePath *path;
-    GtkTreeIter iter;
-    gboolean toggle_item; //, res;
-    //GtkWidget *tacho;
+    t_chip *ptr_chip;
+    t_chipfeature *ptr_chipfeature;
+    gint idx_active_combobox;
+    GtkTreeModel *ptr_treemodel;
+    GtkTreePath *ptr_treepath;
+    GtkTreeIter treeiter;
+    gboolean toggle_item;
 
     TRACE ("enters list_cell_toggle");
 
-    //if (sd->sensors->display_values_type != DISPLAY_TEXT) {
-        //sensors_remove_graphical_panel(sd->sensors);
-    //}
-    gtk_combo_box_active =
-        gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
+    idx_active_combobox =
+        gtk_combo_box_get_active(GTK_COMBO_BOX (ptr_sensorsdialog->myComboBox));
 
-    model = (GtkTreeModel *) sd->myListStore[gtk_combo_box_active];
-    path = gtk_tree_path_new_from_string (path_str);
+    ptr_treemodel = (GtkTreeModel *) ptr_sensorsdialog->myListStore[idx_active_combobox];
+    ptr_treepath = gtk_tree_path_new_from_string (ptr_str_cellpath);
 
     /* get toggled iter */
-    gtk_tree_model_get_iter (model, &iter, path);
-    gtk_tree_model_get (model, &iter, 2, &toggle_item, -1);
+    gtk_tree_model_get_iter (ptr_treemodel, &treeiter, ptr_treepath);
+    gtk_tree_model_get (ptr_treemodel, &treeiter, 2, &toggle_item, -1);
 
     /* do something with the value */
     toggle_item ^= 1;
@@ -186,77 +198,62 @@ list_cell_toggle_ (GtkCellRendererToggle *cell, gchar *path_str,
     DBG("toggle item is %d.", toggle_item);
 
     /* set new value */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 2, toggle_item, -1);
-    chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
-
-    chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
+    gtk_tree_store_set (GTK_TREE_STORE (ptr_treemodel), &treeiter, eTreeColumn_Show, toggle_item, -1);
+    ptr_chip = (t_chip *) g_ptr_array_index(ptr_sensorsdialog->sensors->chips, idx_active_combobox);
 
-    chipfeature->show = toggle_item;
+    ptr_chipfeature = (t_chipfeature *) g_ptr_array_index(ptr_chip->chip_features, atoi(ptr_str_cellpath));
 
     /* clean up */
-    gtk_tree_path_free (path);
+    gtk_tree_path_free (ptr_treepath);
+
+    ptr_chipfeature->show = toggle_item;
 
     /* update tooltip and panel widget */
-    refresh_view ((gpointer) sd);
+    refresh_view ((gpointer) ptr_sensorsdialog);
 
-    TRACE ("leaves list_cell_toggle");//~
+    TRACE ("leaves list_cell_toggle");
 }
 
 
 /* -------------------------------------------------------------------------- */
 void
-list_cell_color_edited_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
-                       gchar *new_color, t_sensors_dialog *sd)
+list_cell_color_edited_ (GtkCellRendererText *ptr_cellrenderertext, gchar *ptr_str_cellpath,
+                       gchar *ptr_str_newcolor, t_sensors_dialog *ptr_sensorsdialog)
 {
-    gint gtk_combo_box_active;
-    GtkTreeModel *model;
-    GtkTreePath *path;
-    GtkTreeIter iter;
-    gboolean hexColor;
-    t_chip *chip;
-    t_chipfeature *chipfeature;
-    //int res;
+    gint idx_active_combobox;
+    gboolean has_sharpprefix;
+    t_chipfeature *ptr_chipfeature;
+    GValue val_colorstring = G_VALUE_INIT;
 
     TRACE ("enters list_cell_color_edited");
 
     /* store new color in appropriate array */
-    hexColor = g_str_has_prefix (new_color, "#");
+    has_sharpprefix = g_str_has_prefix (ptr_str_newcolor, "#");
 
-    if (hexColor && strlen(new_color) == 7) {
+    if (has_sharpprefix && strlen(ptr_str_newcolor) == 7) {
         int i;
         for (i=1; i<7; i++) {
             /* only save hex numbers! */
-            if ( ! g_ascii_isxdigit (new_color[i]) )
+            if ( ! g_ascii_isxdigit (ptr_str_newcolor[i]) )
                 return;
         }
 
-        gtk_combo_box_active =
-            gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
-
-        /* get model and path */
-        model = (GtkTreeModel *) sd->myListStore
-            [gtk_combo_box_active];
-        path = gtk_tree_path_new_from_string (path_str);
-
-        /* get model iterator */
-        gtk_tree_model_get_iter (model, &iter, path);
+        g_value_init(&val_colorstring, G_TYPE_STRING);
+        g_value_set_static_string(&val_colorstring, ptr_str_newcolor);
+        idx_active_combobox = set_value_in_treemodel_and_return_index_and_feature(
+        ptr_sensorsdialog, ptr_str_cellpath, eTreeColumn_Color, &val_colorstring,
+        &ptr_chipfeature);
 
-        /* set new value */
-        gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 3, new_color, -1);
-        chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
+        if (ptr_chipfeature->color!=NULL)
+            g_free (ptr_chipfeature->color);
 
-        chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
-        if (chipfeature->color!=NULL)
-            g_free (chipfeature->color);
-
-        chipfeature->color = g_strdup(new_color);
-
-        /* clean up */
-        gtk_tree_path_free (path);
+        ptr_chipfeature->color = g_strdup(ptr_str_newcolor);
 
         /* update color value */
-        if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
-            gtk_sensorstacho_set_color(GTK_SENSORSTACHO(sd->sensors->tachos[gtk_combo_box_active][atoi(path_str)]), new_color);
+        GtkWidget *ptr_tacho = ptr_sensorsdialog->sensors->tachos [idx_active_combobox][atoi(ptr_str_cellpath)];
+
+        if (ptr_tacho!=NULL)
+            gtk_sensorstacho_set_color(GTK_SENSORSTACHO(ptr_sensorsdialog->sensors->tachos[idx_active_combobox][atoi(ptr_str_cellpath)]), ptr_str_newcolor);
     }
 
     TRACE ("leaves list_cell_color_edited");
@@ -265,48 +262,31 @@ list_cell_color_edited_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
 
 /* -------------------------------------------------------------------------- */
 void
-minimum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
-                 gchar *new_value, t_sensors_dialog *sd)
+minimum_changed_ (GtkCellRendererText *cellrenderertext, gchar *ptr_str_cellpath,
+                 gchar *new_value, t_sensors_dialog *ptr_sensorsdialog)
 {
-    gint gtk_combo_box_active;
-    float  value;
-    GtkTreeModel *model;
-    GtkTreePath *path;
-    GtkTreeIter iter;
-    t_chip *chip;
-    t_chipfeature *chipfeature;
-    //int res;
+    gint idx_active_combobox;
+    t_chipfeature *ptr_chipfeature;
+    gfloat val_float;
+    GValue val_minimum = G_VALUE_INIT;
 
     TRACE ("enters minimum_changed");
 
-    value = atof (new_value);
+    val_float = atof (new_value);
 
-    gtk_combo_box_active =
-        gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
+    g_value_init(&val_minimum, G_TYPE_FLOAT);
+    g_value_set_float(&val_minimum, val_float);
+    idx_active_combobox = set_value_in_treemodel_and_return_index_and_feature(
+        ptr_sensorsdialog, ptr_str_cellpath, eTreeColumn_Min, &val_minimum,
+        &ptr_chipfeature);
 
-    /* get model and path */
-    model = (GtkTreeModel *) sd->myListStore
-        [gtk_combo_box_active];
-    path = gtk_tree_path_new_from_string (path_str);
-
-    /* get model iterator */
-    gtk_tree_model_get_iter (model, &iter, path);
-
-    /* set new value according to chosen scale */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 4, value, -1);
-    chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
-
-    chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
-    if (sd->sensors->scale==FAHRENHEIT)
-        value = (value -32 ) * 5/9;
-    chipfeature->min_value = value;
-
-    /* clean up */
-    gtk_tree_path_free (path);
+    if (ptr_sensorsdialog->sensors->scale==FAHRENHEIT)
+        val_float = (val_float - 32) * 5/9;
+    ptr_chipfeature->min_value = val_float;
 
     /* update panel */
-    if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
-        refresh_view ((gpointer) sd);
+    if (ptr_sensorsdialog->sensors->tachos [idx_active_combobox][atoi(ptr_str_cellpath)]!=NULL)
+        refresh_view ((gpointer) ptr_sensorsdialog);
 
     TRACE ("leaves minimum_changed");
 }
@@ -314,48 +294,31 @@ minimum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
 
 /* -------------------------------------------------------------------------- */
 void
-maximum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
-            gchar *new_value, t_sensors_dialog *sd)
+maximum_changed_ (GtkCellRendererText *cellrenderertext, gchar *ptr_str_cellpath,
+            gchar *new_value, t_sensors_dialog *ptr_sensorsdialog)
 {
-    gint gtk_combo_box_active;
-    float value;
-    GtkTreeModel *model;
-    GtkTreePath *path;
-    GtkTreeIter iter;
-    t_chip *chip;
-    t_chipfeature *chipfeature;
-    //int res;
+    gint idx_active_combobox;
+    t_chipfeature *ptr_chipfeature;
+    gfloat val_float;
+    GValue val_maximum = G_VALUE_INIT;
 
     TRACE ("enters maximum_changed");
 
-    value = atof (new_value);
-
-    gtk_combo_box_active =
-        gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
+    val_float = atof (new_value);
 
-    /* get model and path */
-    model = (GtkTreeModel *) sd->myListStore
-        [gtk_combo_box_active];
-    path = gtk_tree_path_new_from_string (path_str);
+    g_value_init(&val_maximum, G_TYPE_FLOAT);
+    g_value_set_float(&val_maximum, val_float);
+    idx_active_combobox = set_value_in_treemodel_and_return_index_and_feature(
+        ptr_sensorsdialog, ptr_str_cellpath, eTreeColumn_Max, &val_maximum,
+        &ptr_chipfeature);
 
-    /* get model iterator */
-    gtk_tree_model_get_iter (model, &iter, path);
-
-    /* set new value according to chosen scale */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 5, value, -1);
-    chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
-
-    chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
-    if (sd->sensors->scale==FAHRENHEIT)
-      value = (value -32 ) * 5/9;
-    chipfeature->max_value = value;
-
-    /* clean up */
-    gtk_tree_path_free (path);
+    if (ptr_sensorsdialog->sensors->scale==FAHRENHEIT)
+      val_float = (val_float - 32) * 5/9;
+    ptr_chipfeature->max_value = val_float;
 
     /* update panel */
-    if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
-      refresh_view ((gpointer) sd);
+    if (ptr_sensorsdialog->sensors->tachos [idx_active_combobox][atoi(ptr_str_cellpath)]!=NULL)
+      refresh_view ((gpointer) ptr_sensorsdialog);
 
     TRACE ("leaves maximum_changed");
 }
@@ -363,19 +326,19 @@ maximum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
 
 /* -------------------------------------------------------------------------- */
 void
-adjustment_value_changed_ (GtkWidget *widget, t_sensors_dialog* sd)
+adjustment_value_changed_ (GtkWidget *ptr_adjustmentwidget, t_sensors_dialog* ptr_sensorsdialog)
 {
     TRACE ("enters adjustment_value_changed ");
 
-    sd->sensors->sensors_refresh_time =
-        (gint) gtk_adjustment_get_value ( GTK_ADJUSTMENT (widget) );
+    ptr_sensorsdialog->sensors->sensors_refresh_time =
+        (gint) gtk_adjustment_get_value ( GTK_ADJUSTMENT (ptr_adjustmentwidget) );
 
     /* stop the timeout functions ... */
-    g_source_remove (sd->sensors->timeout_id);
+    g_source_remove (ptr_sensorsdialog->sensors->timeout_id);
     /* ... and start them again */
-    sd->sensors->timeout_id  = g_timeout_add (
-        sd->sensors->sensors_refresh_time * 1000,
-        (GSourceFunc) refresh_view, (gpointer) sd);
+    ptr_sensorsdialog->sensors->timeout_id  = g_timeout_add (
+        ptr_sensorsdialog->sensors->sensors_refresh_time * 1000,
+        (GSourceFunc) refresh_view, (gpointer) ptr_sensorsdialog);
 
     TRACE ("leaves adjustment_value_changed ");
 }
@@ -383,15 +346,15 @@ adjustment_value_changed_ (GtkWidget *widget, t_sensors_dialog* sd)
 
 /* -------------------------------------------------------------------------- */
 void
-temperature_unit_change_ (GtkWidget *widget, t_sensors_dialog *sd)
+temperature_unit_change_ (GtkWidget *ptr_unused, t_sensors_dialog *ptr_sensorsdialog)
 {
     TRACE ("enters temperature_unit_change ");
 
     /* toggle celsius-fahrenheit by use of mathematics ;) */
-    sd->sensors->scale = 1 - sd->sensors->scale;
+    ptr_sensorsdialog->sensors->scale = 1 - ptr_sensorsdialog->sensors->scale;
 
     /* refresh the panel content */
-    reload_listbox (sd);
+    reload_listbox (ptr_sensorsdialog);
 
     TRACE ("laeves temperature_unit_change ");
 }

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


More information about the Xfce4-commits mailing list