[Xfce4-commits] <xfce4-sensors-plugin:master> apply path for bug 8745 and further free the command_name before assigning a value

Fabian noreply at xfce.org
Sun May 13 16:40:01 CEST 2012


Updating branch refs/heads/master
         to f278edb46cf4205bf7576d7066f47bea4917f91e (commit)
       from 81b5d032734f3f2f7c9ddeab10e2fbe42575682e (commit)

commit f278edb46cf4205bf7576d7066f47bea4917f91e
Author: Fabian <timystery at arcor.de>
Date:   Sun May 13 15:26:45 2012 +0200

    apply path for bug 8745 and further free the command_name before assigning a value

 lib/configuration.c            |    3 +++
 lib/sensors-interface-common.c |    6 +++---
 panel-plugin/sensors-plugin.c  |    7 ++++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/configuration.c b/lib/configuration.c
index 065084f..7a14e91 100644
--- a/lib/configuration.c
+++ b/lib/configuration.c
@@ -209,10 +209,12 @@ sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
         sensors->scale = xfce_rc_read_int_entry (rc, "Scale", 0);
 
         if ((value = xfce_rc_read_entry (rc, "Font_Size", NULL)) && *value) {
+            g_free(sensors->font_size);
             sensors->font_size = g_strdup(value);
         }
         
         if ((value = xfce_rc_read_entry (rc, "Font", NULL)) && *value) {
+            //g_free(sensors->font); // font is initialized to NULL
             font = g_strdup(value); // in cpu.h for the tachometers
         }
 
@@ -231,6 +233,7 @@ sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
         sensors->show_smallspacings= xfce_rc_read_bool_entry (rc, "Small_Spacings", FALSE);
 
         if ((value = xfce_rc_read_entry (rc, "Command_Name", NULL)) && *value) {
+            g_free(sensors->command_name);
             sensors->command_name = g_strdup (value);
         }
 
diff --git a/lib/sensors-interface-common.c b/lib/sensors-interface-common.c
index 25701ad..aaf1818 100644
--- a/lib/sensors-interface-common.c
+++ b/lib/sensors-interface-common.c
@@ -54,8 +54,8 @@ sensors_new (XfcePanelPlugin *plugin, gchar *plugin_config_file)
 
     /* read all sensors from libraries */
     result = initialize_all (&(sensors->chips), &(sensors->suppressmessage));
-		if (result==0)
-			return NULL;
+    if (result==0)
+      return NULL;
 
     sensors->num_sensorchips = sensors->chips->len;
 
@@ -103,7 +103,7 @@ sensors_init_default_values  (t_sensors *sensors, XfcePanelPlugin *plugin)
     sensors->show_labels = TRUE;
     sensors->display_values_type = DISPLAY_TEXT;
     sensors->bars_created = FALSE;
-    sensors->font_size = "medium";
+    sensors->font_size = g_strdup("medium");
     sensors->font_size_numerical = 2;
     sensors->lines_size = 3;
 
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 618b82b..92176df 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -859,7 +859,7 @@ sensors_create_tooltip (gpointer data)
     /* #if GTK_VERSION < 2.11 */
     gtk_tooltips_set_tip (tooltips, GTK_WIDGET(sensors->eventbox),
                           myToolTipText, NULL);
-		DBG("tooltip text: %s.\n", myToolTipText);
+    DBG("tooltip text: %s.\n", myToolTipText);
     TRACE ("freeing myToolTipText");
     g_free (myToolTipText);
 
@@ -1023,7 +1023,7 @@ execute_command (GtkWidget *widget, GdkEventButton *event, gpointer data)
 
         g_return_val_if_fail ( sensors->exec_command, FALSE);
 
-				// screen NULL, command, terminal=no, startup=yes, error=NULL
+        // screen NULL, command, terminal=no, startup=yes, error=NULL
         xfce_spawn_command_line_on_screen (NULL, sensors->command_name, FALSE, TRUE, NULL);
 
         TRACE ("leaves execute_command with TRUE");
@@ -1278,7 +1278,8 @@ font_size_change (GtkWidget *widget, t_sensors_dialog *sd)
 {
     int rows;
     TRACE ("enters font_size_change");
-
+    
+    g_free(sd->sensors->font_size);
     switch ( gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) ) {
 
         case 0: sd->sensors->font_size = "x-small"; break;


More information about the Xfce4-commits mailing list