[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 03/03: Use enum for tree columns throughout the project; increase library version number accordingly due to compatible interface extension

noreply at xfce.org noreply at xfce.org
Tue Apr 18 23:57:10 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 2728e295f1a784a91590f90c04c5c4a64fac277d
Author: Fabian <timystery at arcor.de>
Date:   Tue Apr 18 23:55:44 2017 +0200

    Use enum for tree columns throughout the project; increase library version number accordingly due to compatible interface extension
---
 configure.ac.in               |  2 +-
 include/sensors-interface.h   | 19 +++++++++++++++++++
 lib/sensors-interface.c       | 12 ++++++------
 panel-plugin/sensors-plugin.c | 10 +++++-----
 src/callbacks.c               | 18 ------------------
 5 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 5047ee5..fb6c29c 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -6,7 +6,7 @@ dnl 2003,2004, 2007 Benedikt Meurer <benny at xfce.org>
 dnl 2007-2011,2014-2017 Fabian Nowak <timystery at arcor.de>
 dnl
 
-m4_define([libxfce4sensors_verinfo], [4:0:0])
+m4_define([libxfce4sensors_verinfo], [4:1:0])
 
 m4_define([xfce4_sensors_version_major], [1])
 m4_define([xfce4_sensors_version_minor], [2])
diff --git a/include/sensors-interface.h b/include/sensors-interface.h
index 25fe982..9475b6f 100644
--- a/include/sensors-interface.h
+++ b/include/sensors-interface.h
@@ -31,6 +31,25 @@
 /* Initializing and filling functions */
 
 /**
+ * Enumeration of the colums for the used GtkTreeModel.
+ */
+enum Enum_TreeColumn
+{
+    /// User chosen name of the chipfeature
+    eTreeColumn_Name = 0,
+    /// non-writable value of the chipfeature
+    eTreeColumn_Value = 1,
+    /// whether to show the chipfeature in the display or panel
+    eTreeColumn_Show = 2,
+    /// color to use for the font or bar
+    eTreeColumn_Color = 3,
+    /// expected minimum value, used also for calculating 0 percent
+    eTreeColumn_Min = 4,
+    /// expected maximum value, used also for calculating 100 percent
+    eTreeColumn_Max = 5
+};
+
+/**
  * Populates the tree store from the obtained sensors data
  * @param ptr_treestore: Pointer to treestore that has to be filled
  * @param ptr_chip: Pointer to chip structure
diff --git a/lib/sensors-interface.c b/lib/sensors-interface.c
index 8c8b297..6e966f5 100644
--- a/lib/sensors-interface.c
+++ b/lib/sensors-interface.c
@@ -553,12 +553,12 @@ init_widgets (t_sensors_dialog *sd)
         //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 */
-                            4, 0.0,            /* chipfeature->min_value */
-                            5, 0.0,            /* chipfeature->max_value */
+                            eTreeColumn_Name, chipfeature->name,
+                            eTreeColumn_Value, "0.0",        /* chipfeature->formatted_value */
+                            eTreeColumn_Show, FALSE,        /* chipfeature->show */
+                            eTreeColumn_Color, "#000000",    /* chipfeature->color */
+                            eTreeColumn_Min, 0.0,            /* chipfeature->min_value */
+                            eTreeColumn_Max, 0.0,            /* chipfeature->max_value */
                             -1);
         //else
             //gtk_tree_store_set ( GTK_TREE_STORE (sd->myListStore[0]),
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 901fce1..d9d6b0a 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -1648,7 +1648,7 @@ minimum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
     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);
+    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, eTreeColumn_Min, value, -1);
     chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
 
     ptr_chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
@@ -1703,7 +1703,7 @@ maximum_changed_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
     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);
+    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, eTreeColumn_Max, value, -1);
     chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
 
     ptr_chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
@@ -1767,7 +1767,7 @@ list_cell_color_edited_ (GtkCellRendererText *cellrenderertext, gchar *path_str,
         gtk_tree_model_get_iter (model, &iter, path);
 
         /* set new value */
-        gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 3, new_color, -1);
+        gtk_tree_store_set (GTK_TREE_STORE (model), &iter, eTreeColumn_Color, new_color, -1);
         chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
 
         ptr_chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
@@ -1817,7 +1817,7 @@ list_cell_text_edited_ (GtkCellRendererText *cellrenderertext,
     gtk_tree_model_get_iter (model, &iter, path);
 
     /* set new value */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, new_text, -1);
+    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, eTreeColumn_Name, new_text, -1);
     chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
 
     ptr_chipfeature = (t_chipfeature *) g_ptr_array_index (chip->chip_features,
@@ -1879,7 +1879,7 @@ list_cell_toggle_ (GtkCellRendererToggle *cell, gchar *path_str,
     }
 
     /* set new value */
-    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 2, toggle_item, -1);
+    gtk_tree_store_set (GTK_TREE_STORE (model), &iter, eTreeColumn_Show, toggle_item, -1);
     chip = (t_chip *) g_ptr_array_index(sd->sensors->chips, gtk_combo_box_active);
 
     ptr_chipfeature = (t_chipfeature *) g_ptr_array_index(chip->chip_features, atoi(path_str));
diff --git a/src/callbacks.c b/src/callbacks.c
index 3d6f892..238929e 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -40,24 +40,6 @@
 /* Forward declarations */
 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);
 
-/**
- * Enumeration of the colums for the used GtkTreeModel.
- */
-enum Enum_TreeColumn
-{
-    /// User chosen name of the chipfeature
-    eTreeColumn_Name = 0,
-    /// non-writable value of the chipfeature
-    eTreeColumn_Value = 1,
-    /// whether to show the chipfeature in the display or panel
-    eTreeColumn_Show = 2,
-    /// color to use for the font or bar
-    eTreeColumn_Color = 3,
-    /// expected minimum value, used also for calculating 0 percent
-    eTreeColumn_Min = 4,
-    /// expected maximum value, used also for calculating 100 percent
-    eTreeColumn_Max = 5
-};
 
 /* -------------------------------------------------------------------------- */
 void on_font_set (GtkWidget *ptr_widget, gpointer data)

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


More information about the Xfce4-commits mailing list