summaryrefslogtreecommitdiff
path: root/sensors-applet
diff options
context:
space:
mode:
Diffstat (limited to 'sensors-applet')
-rw-r--r--sensors-applet/active-sensor.c10
-rw-r--r--sensors-applet/main.c3
-rw-r--r--sensors-applet/prefs-dialog.c7
-rw-r--r--sensors-applet/sensor-config-dialog.c5
-rw-r--r--sensors-applet/sensors-applet-plugins.c4
-rw-r--r--sensors-applet/sensors-applet.c6
6 files changed, 22 insertions, 13 deletions
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c
index 7cf9df5..33ff761 100644
--- a/sensors-applet/active-sensor.c
+++ b/sensors-applet/active-sensor.c
@@ -211,7 +211,7 @@ static void active_sensor_update_icon(ActiveSensor *active_sensor,
GdkPixbuf *base_icon,
SensorType sensor_type) {
- GdkPixbuf *overlay_icon, *new_icon;
+ GdkPixbuf *new_icon;
const gchar *overlay_icon_filename = NULL;
SensorValueRange value_range;
@@ -231,6 +231,8 @@ static void active_sensor_update_icon(ActiveSensor *active_sensor,
/* only load overlay if required */
if (overlay_icon_filename) {
+ GdkPixbuf *overlay_icon;
+
overlay_icon = gdk_pixbuf_new_from_file_at_size(overlay_icon_filename,
DEFAULT_ICON_SIZE,
DEFAULT_ICON_SIZE,
@@ -360,7 +362,6 @@ static void active_sensor_set_graph_dimensions(ActiveSensor *as,
gint width,
gint height) {
- gdouble *old_values;
gint num_samples, old_num_samples;
gint graph_width, graph_height;
@@ -374,6 +375,8 @@ static void active_sensor_set_graph_dimensions(ActiveSensor *as,
num_samples = graph_width;
if (as->sensor_values) {
+ gdouble *old_values;
+
old_values = as->sensor_values;
old_num_samples = as->num_samples;
@@ -504,7 +507,6 @@ void active_sensor_update(ActiveSensor *active_sensor,
/* to build the list of labels as we go */
gchar *value_text = NULL;
- gchar *old_value_text;
TemperatureScale scale;
DisplayMode display_mode;
@@ -668,7 +670,7 @@ void active_sensor_update(ActiveSensor *active_sensor,
}
}
- old_value_text = value_text;
+ gchar *old_value_text = value_text;
if (sensor_alarm_enabled) {
if (sensor_value >= sensor_high_value || sensor_value <= sensor_low_value) {
diff --git a/sensors-applet/main.c b/sensors-applet/main.c
index 4b820ca..7be6464 100644
--- a/sensors-applet/main.c
+++ b/sensors-applet/main.c
@@ -28,10 +28,11 @@ static gboolean sensors_applet_fill(MatePanelApplet *applet,
const gchar *iid,
gpointer data) {
- SensorsApplet *sensors_applet;
gboolean retval = FALSE;
if (strcmp(iid, "SensorsApplet") == 0) {
+ SensorsApplet *sensors_applet;
+
sensors_applet = g_new0(SensorsApplet, 1);
sensors_applet->applet = applet;
sensors_applet_init(sensors_applet);
diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c
index a664fe0..98196d4 100644
--- a/sensors-applet/prefs-dialog.c
+++ b/sensors-applet/prefs-dialog.c
@@ -293,10 +293,11 @@ static void prefs_dialog_row_activated(GtkTreeView *view, GtkTreePath *path, Gtk
static void prefs_dialog_sensor_up_button_clicked(GtkButton *button, PrefsDialog *prefs_dialog) {
GtkTreeModel *model;
GtkTreeIter iter;
- GtkTreePath *path;
if (gtk_tree_selection_get_selected(prefs_dialog->sensors_applet->selection, &model, &iter)) {
/* if has no prev node set up button insentive */
+ GtkTreePath *path;
+
path = gtk_tree_model_get_path(model, &iter);
if (gtk_tree_path_prev(path)) {
@@ -349,10 +350,12 @@ static void prefs_dialog_selection_changed(GtkTreeSelection *selection,
PrefsDialog *prefs_dialog) {
GtkTreeIter iter;
- GtkTreePath *path;
GtkTreeModel *model;
+
/* if there is a selection with no children make config button sensitive */
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ GtkTreePath *path;
+
if (!gtk_tree_model_iter_has_child(model, &iter)) {
gtk_widget_set_sensitive(GTK_WIDGET(prefs_dialog->sensor_config_button), TRUE);
} else {
diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c
index 8a49f57..c417fb4 100644
--- a/sensors-applet/sensor-config-dialog.c
+++ b/sensors-applet/sensor-config-dialog.c
@@ -283,13 +283,13 @@ static void sensor_config_dialog_icon_type_changed(GtkComboBox *icon_type_combo_
GtkTreeModel *model;
GtkTreeIter iter;
- GtkTreePath *path;
GdkPixbuf *new_icon;
IconType icon_type;
icons_model = gtk_combo_box_get_model(icon_type_combo_box);
if (gtk_combo_box_get_active_iter(icon_type_combo_box, &icons_iter)) {
+ GtkTreePath *path;
gtk_tree_model_get(icons_model, &icons_iter,
0, &new_icon,
@@ -351,7 +351,6 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) {
GtkListStore *icon_store;
IconType count;
- GdkPixbuf *pixbuf;
GdkRGBA graph_color;
gchar *sensor_label;
gchar *header_text;
@@ -452,6 +451,8 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) {
/* populate list with icons */
for (count = CPU_ICON; count < NUM_ICONS; count++) {
+ GdkPixbuf *pixbuf;
+
pixbuf = sensors_applet_load_icon(count);
if (pixbuf) {
gtk_list_store_insert(icon_store, &iter, count);
diff --git a/sensors-applet/sensors-applet-plugins.c b/sensors-applet/sensors-applet-plugins.c
index e90895a..c2e406c 100644
--- a/sensors-applet/sensors-applet-plugins.c
+++ b/sensors-applet/sensors-applet-plugins.c
@@ -39,13 +39,13 @@ static void load_all_plugins(SensorsApplet *sensors_applet, const gchar *path) {
/* try and open plugin */
gchar *plugin_file;
void *handle;
- SensorsAppletPluginName name_fn;
SensorsAppletPluginInit init_fn;
- SensorsAppletPluginGetSensorValue get_value_fn;
plugin_file = g_strdup_printf("%s/%s", path, file);
g_debug("found %s in plugin directory", plugin_file);
if ((handle = dlopen(plugin_file, RTLD_NOW)) != NULL) {
+ SensorsAppletPluginName name_fn;
+ SensorsAppletPluginGetSensorValue get_value_fn;
if ((name_fn = dlsym(handle, "sensors_applet_plugin_name")) != NULL &&
(init_fn = dlsym(handle, "sensors_applet_plugin_init")) != NULL &&
diff --git a/sensors-applet/sensors-applet.c b/sensors-applet/sensors-applet.c
index e67a82d..a1e421c 100644
--- a/sensors-applet/sensors-applet.c
+++ b/sensors-applet/sensors-applet.c
@@ -165,10 +165,8 @@ static void style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data)
/* update all icons in the sensors tree and update all active sensors */
GtkTreeIter interfaces_iter, sensors_iter;
- GtkTreePath *path;
gboolean not_end_of_interfaces = TRUE, not_end_of_sensors = TRUE;
IconType icon_type;
- GdkPixbuf *new_icon;
gboolean enabled;
SensorsApplet *sensors_applet;
DisplayMode display_mode;
@@ -188,6 +186,8 @@ static void style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data)
not_end_of_sensors;
not_end_of_sensors = gtk_tree_model_iter_next(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter)) {
+ GdkPixbuf *new_icon;
+
gtk_tree_model_get(GTK_TREE_MODEL(sensors_applet->sensors),
&sensors_iter,
ENABLE_COLUMN, &enabled,
@@ -207,6 +207,8 @@ static void style_set_cb(GtkWidget *widget, GtkStyle *old_style, gpointer data)
(display_mode == DISPLAY_ICON ||
display_mode == DISPLAY_ICON_WITH_VALUE)) {
+ GtkTreePath *path;
+
path = gtk_tree_model_get_path(GTK_TREE_MODEL(sensors_applet->sensors), &sensors_iter);
sensors_applet_icon_changed(sensors_applet, path);
gtk_tree_path_free(path);