[Xfce4-commits] [panel-plugins/xfce4-sensors-plugin] 02/05: - introduced DEFINEs for the numbers of chips and features - some cleanup in the main function with variable renaming, indenting mostly
noreply at xfce.org
noreply at xfce.org
Sat Feb 4 11:16:05 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 cdc0e909c62eaee851c1cdb738603b5c81d060da
Author: Fabian <timystery at arcor.de>
Date: Sun Mar 27 00:33:43 2016 +0100
- introduced DEFINEs for the numbers of chips and features
- some cleanup in the main function with variable renaming, indenting mostly
---
include/sensors-interface-plugin.h | 8 ++++++--
src/main.c | 39 +++++++++++++++++++-------------------
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/include/sensors-interface-plugin.h b/include/sensors-interface-plugin.h
index 2862c9f..3bf3a0e 100644
--- a/include/sensors-interface-plugin.h
+++ b/include/sensors-interface-plugin.h
@@ -37,6 +37,9 @@
#include "types.h"
#include "sensors-interface-types.h"
+#define MAX_NUM_CHIPS 10
+#define MAX_NUM_FEATURES 256
+
/**
* Sensors module
*/
@@ -117,12 +120,12 @@ typedef struct {
/* contains the progress bar panels */
/* FIXME: Might be replaced by GPtrArray as well */
- GtkWidget* panels[10][256];
+ GtkWidget* panels[MAX_NUM_CHIPS][MAX_NUM_FEATURES];
/* GArray *panels_array; */
/* contains the tacho panels */
/* FIXME: Might be replaced by GPtrArray as well */
- GtkWidget* tachos[10][256];
+ GtkWidget* tachos[MAX_NUM_CHIPS][MAX_NUM_FEATURES];
/* contains structure from libsensors */
/* const sensors_chip_name *chipName[SENSORS]; */
@@ -183,6 +186,7 @@ typedef struct {
gint preferred_height;
}
t_sensors;
+
/* Regularly included functions in library */
t_sensors * sensors_new (XfcePanelPlugin *plugin, gchar * plugin_config_file);
diff --git a/src/main.c b/src/main.c
index 53b56cd..c5cfc9e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,9 +27,7 @@
#include <string.h>
-/* #ifdef HAVE_CONFIG_H */
#include <config.h>
-/* #endif */
/* Package includes */
#include <sensors-interface.h>
@@ -44,7 +42,7 @@
void print_license (void);
void print_usage (void);
void print_version (void);
-t_sensors_dialog * initialize_sensors_struct (void);
+t_sensors_dialog * initialize_sensors_structures (void);
void
print_license (void)
@@ -63,7 +61,7 @@ print_usage (void)
{
printf (_("Xfce4 Sensors %s\n"
"Displays information about your hardware sensors, ACPI "
- "status, harddisk temperatures and Nvidia GPU's temperature.\n"
+ "status, harddisk temperatures and Nvidia GPU's temperature.\n"
"Synopsis: \n"
" xfce4-sensors options\n"
"where options are one or more of the following:\n"
@@ -84,24 +82,26 @@ print_version (void)
t_sensors_dialog *
-initialize_sensors_struct (void)
+initialize_sensors_structures (void)
{
- t_sensors *sensors;
- t_sensors_dialog *sd;
- int i, j;
+ t_sensors *ptr_sensors_structure;
+ t_sensors_dialog *ptr_sensors_dialog_structure;
+ int idx_chip, idx_feature;
- sensors = sensors_new (NULL, NULL);
- sd = g_new0 (t_sensors_dialog, 1);
- sd->sensors = sensors;
- sd->plugin_dialog = FALSE;
+ ptr_sensors_structure = sensors_new (NULL, NULL);
+ ptr_sensors_dialog_structure = g_new0 (t_sensors_dialog, 1);
+ ptr_sensors_dialog_structure->sensors = ptr_sensors_structure;
+ ptr_sensors_dialog_structure->plugin_dialog = FALSE;
- for (i=0; i<10; i++)
- for (j=0; j<256; j++)
- {
- sensors->tachos[i][j] = NULL;
- }
+ for (idx_chip=0; idx_chip<MAX_NUM_CHIPS; idx_chip++)
+ {
+ for (idx_feature=0; idx_feature<MAX_NUM_FEATURES; idx_feature++)
+ {
+ ptr_sensors_structure->tachos[idx_chip][idx_feature] = NULL;
+ }
+ }
- return sd;
+ return ptr_sensors_dialog_structure;
}
@@ -140,7 +140,7 @@ main (int argc, char **argv)
gtk_init (&argc, &argv);
/* initialize sensor stuff */
- sd = initialize_sensors_struct ();
+ sd = initialize_sensors_structures ();
/* build main application */
window = create_main_window (sd);
@@ -171,4 +171,3 @@ main (int argc, char **argv)
return 0;
}
-
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list