[Goodies-commits] r5494 - xfce4-sensors-plugin/trunk/panel-plugin

Fabian Nowak timystery at xfce.org
Wed Oct 1 00:10:55 CEST 2008


Author: timystery
Date: 2008-09-30 22:10:55 +0000 (Tue, 30 Sep 2008)
New Revision: 5494

Modified:
   xfce4-sensors-plugin/trunk/panel-plugin/acpi.c
   xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c
   xfce4-sensors-plugin/trunk/panel-plugin/lmsensors.c
   xfce4-sensors-plugin/trunk/panel-plugin/sensors.c
Log:
- applied enrico's patch to g_strdup more
- added some more strdups to colors and free them properly
- tried to free memory from settings dialog when closing


Modified: xfce4-sensors-plugin/trunk/panel-plugin/acpi.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/acpi.c	2008-09-29 21:37:42 UTC (rev 5493)
+++ xfce4-sensors-plugin/trunk/panel-plugin/acpi.c	2008-09-30 22:10:55 UTC (rev 5494)
@@ -409,10 +409,10 @@
     TRACE ("enters initialize_ACPI");
 
     chip = g_new0 (t_chip, 1);
-    chip->name = _("ACPI"); /* to be displayed */
-    /* chip->description = _("Advanced Configuration and Power Interface"); */
+    chip->name = g_strdup(_("ACPI")); /* to be displayed */
+    /* chip->description = g_strdup(_("Advanced Configuration and Power Interface")); */
     chip->description = g_strdup_printf (_("ACPI v%s zones"), get_acpi_info());
-    chip->sensorId = "ACPI"; /* used internally */
+    chip->sensorId = g_strdup ("ACPI"); /* used internally */
 
     chip->type = ACPI;
 
@@ -473,20 +473,20 @@
 
         case STATE:
             file = g_strdup_printf ("%s/%s/%s/state", ACPI_PATH, ACPI_DIR_FAN, cf->devicename);
-            
+
             state = get_acpi_value(file);
             if (state==NULL)
             {
-            	DBG("Could not determine fan state.");
-            	cf->raw_value = 0.0;
-			}
-			else
-			{
-            	cf->raw_value = strncmp(state, "on", 2)==0 ? 1.0 : 0.0;
-            	/* g_free (state); Anyone with a fan state please check that, should be necessary to free this string as well */
-			}
+                DBG("Could not determine fan state.");
+                cf->raw_value = 0.0;
+            }
+            else
+            {
+                cf->raw_value = strncmp(state, "on", 2)==0 ? 1.0 : 0.0;
+                /* g_free (state); Anyone with a fan state please check that, should be necessary to free this string as well */
+            }
             g_free (file);
-            
+
             /* g_free (cf->formatted_value);
             cf->formatted_value = g_strdup_printf (_("%.0f"), cf->raw_value); */
             break;

Modified: xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c	2008-09-29 21:37:42 UTC (rev 5493)
+++ xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c	2008-09-30 22:10:55 UTC (rev 5494)
@@ -271,9 +271,9 @@
 
     chip->chip_features = g_ptr_array_new ();
     chip->num_features = 0;
-    chip->description = _("S.M.A.R.T. harddisk temperatures");
-    chip->name = _("Hard disks");
-    chip->sensorId = "Hard disks";
+    chip->description = g_strdup(_("S.M.A.R.T. harddisk temperatures"));
+    chip->name = g_strdup(_("Hard disks"));
+    chip->sensorId = g_strdup("Hard disks");
     chip->type = HDD;
 
     p_uname = (struct utsname *) malloc (sizeof(struct utsname));

Modified: xfce4-sensors-plugin/trunk/panel-plugin/lmsensors.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/lmsensors.c	2008-09-29 21:37:42 UTC (rev 5493)
+++ xfce4-sensors-plugin/trunk/panel-plugin/lmsensors.c	2008-09-30 22:10:55 UTC (rev 5494)
@@ -74,7 +74,7 @@
     #endif
 
     chip->num_features=0;
-    chip->name = _("LM Sensors");
+    chip->name = g_strdup(_("LM Sensors"));
     chip->chip_features = g_ptr_array_new();
 
     #if SENSORS_API_VERSION < 0x400 /* libsensors3 */
@@ -172,6 +172,7 @@
 void setup_chipfeature_common (t_chipfeature *chipfeature, int number,
                                double sensorFeature)
 {
+    g_free (chipfeature->color);
     chipfeature->color = g_strdup("#00B000");
     chipfeature->valid = TRUE;
 

Modified: xfce4-sensors-plugin/trunk/panel-plugin/sensors.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/sensors.c	2008-09-29 21:37:42 UTC (rev 5493)
+++ xfce4-sensors-plugin/trunk/panel-plugin/sensors.c	2008-09-30 22:10:55 UTC (rev 5494)
@@ -930,8 +930,9 @@
         chipfeature->address = 0;
         chip->sensorId = g_strdup(_("No sensors found!"));
         chip->num_features = 1;
-        chipfeature->color = "#000000";
-        chipfeature->name = "No sensor";
+        chipfeature->color = g_strdup("#000000");
+        g_free (chipfeature->name);
+        chipfeature->name = g_strdup("No sensor");
         chipfeature->valid = TRUE;
         g_free (chipfeature->formatted_value);
         chipfeature->formatted_value = g_strdup("0.0");
@@ -1443,8 +1444,8 @@
         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));
-        chipfeature->color =
-            g_strdup(new_color);
+        g_free (chipfeature->color);
+        chipfeature->color = g_strdup(new_color);
 
         /* clean up */
         gtk_tree_path_free (path);
@@ -2205,8 +2206,23 @@
         sensors_write_config (sd->sensors->plugin, sd->sensors);
     }
     gtk_widget_destroy (sd->dialog);
+
     xfce_panel_plugin_unblock_menu (sd->sensors->plugin);
 
+    /* g_free(sd->coloredBars_Box);
+    g_free(sd->font_Box);
+    g_free(sd->labels_Box);
+    g_free(sd->myComboBox);
+    g_free(sd->myCommandName_Entry);
+    g_free(sd->myExecCommand_CheckBox);
+    g_free(sd->mySensorLabel);
+    g_free(sd->smallspacing_checkbox);
+    g_free(sd->suppressmessage_checkbox);
+    g_free(sd->temperature_radio_group);
+    g_free(sd->unit_checkbox); */
+
+    g_free(sd);
+
     TRACE ("leaves on_optionsDialog_response");
 }
 




More information about the Goodies-commits mailing list