Author: dannym
Date: 2007-07-08 13:35:58 +0000 (Sun, 08 Jul 2007)
New Revision: 25901

Modified:
   xfce4-trigger-launcher/trunk/panel-plugin/triggerlauncher.c
   xfce4-trigger-launcher/trunk/panel-plugin/xfce-file-chooser-button.c
   xfce4-trigger-launcher/trunk/panel-plugin/xfce-icon-chooser-button.c
   xfce4-trigger-launcher/trunk/panel-plugin/xfce-launcher-command-entry.c
   xfce4-trigger-launcher/trunk/panel-plugin/xfce-trigger-launcher-options.c
Log:
fix memory management of LauncherCommandEntry, fix a few NULL warnings

Modified: xfce4-trigger-launcher/trunk/panel-plugin/triggerlauncher.c
===================================================================
--- xfce4-trigger-launcher/trunk/panel-plugin/triggerlauncher.c 2007-07-08 
11:36:11 UTC (rev 25900)
+++ xfce4-trigger-launcher/trunk/panel-plugin/triggerlauncher.c 2007-07-08 
13:35:58 UTC (rev 25901)
@@ -124,37 +124,26 @@
     }
 } 
 
+static GdkPixbuf* my_pixbuf_new_from_file_at_size(const char* path, int width, 
int height)
+{
+    GdkPixbuf* result;
+    
+    return (path != NULL) ? gdk_pixbuf_new_from_file_at_size(path, width, 
height, NULL) : NULL;
+    
+}
+
 static void load_pixbufs(TriggerLauncherData* data1)
 {
     free_pixbufs (data1);
     
     
     data1->fallback_pixbuf = xfce_themed_icon_load ("xfce-unknown", 
data1->pixbuf_size);  
-    data1->enabled_pixbuf = gdk_pixbuf_new_from_file_at_size 
(data1->enabled_icon, 
-                                                              
data1->pixbuf_size, 
-                                                              
data1->pixbuf_size,
-                                                              NULL);
-                                                              
-    data1->disabled_pixbuf = gdk_pixbuf_new_from_file_at_size 
(data1->disabled_icon,  
-                                                               
data1->pixbuf_size, 
-                                                               
data1->pixbuf_size, 
-                                                               NULL);
-                                                              
-    data1->undefined_pixbuf = gdk_pixbuf_new_from_file_at_size 
(data1->undefined_icon, 
-                                                                
data1->pixbuf_size, 
-                                                                
data1->pixbuf_size, 
-                                                                NULL);
-                                                                
-    data1->checking_pixbuf = gdk_pixbuf_new_from_file_at_size 
(data1->checking_icon, 
-                                                               
data1->pixbuf_size, 
-                                                               
data1->pixbuf_size, 
-                                                               NULL);
-                                                               
-    data1->overtime_pixbuf = gdk_pixbuf_new_from_file_at_size 
(data1->dodgy_icon, 
-                                                               
data1->pixbuf_size, 
-                                                               
data1->pixbuf_size, 
-                                                               NULL);
-          
+
+    data1->enabled_pixbuf = my_pixbuf_new_from_file_at_size 
(data1->enabled_icon, data1->pixbuf_size, data1->pixbuf_size);
+    data1->disabled_pixbuf = my_pixbuf_new_from_file_at_size 
(data1->disabled_icon, data1->pixbuf_size, data1->pixbuf_size);
+    data1->undefined_pixbuf = my_pixbuf_new_from_file_at_size 
(data1->undefined_icon, data1->pixbuf_size, data1->pixbuf_size);
+    data1->checking_pixbuf = my_pixbuf_new_from_file_at_size 
(data1->checking_icon, data1->pixbuf_size, data1->pixbuf_size);
+    data1->overtime_pixbuf = my_pixbuf_new_from_file_at_size 
(data1->dodgy_icon, data1->pixbuf_size, data1->pixbuf_size);
 }
 
 static void kill_child(TriggerLauncherData* data1)
@@ -513,11 +502,11 @@
     xfce_rc_write_entry (rc, "disable_command", data1->disable_command);
     xfce_rc_write_entry (rc, "poke_command", data1->poke_command);
     xfce_rc_write_entry (rc, "check_status_command", 
data1->check_status_command);
-    xfce_rc_write_entry (rc, "enabled_icon", data1->enabled_icon);
-    xfce_rc_write_entry (rc, "disabled_icon", data1->disabled_icon);
-    xfce_rc_write_entry (rc, "undefined_icon", data1->undefined_icon);
-    xfce_rc_write_entry (rc, "checking_icon", data1->checking_icon);
-    xfce_rc_write_entry (rc, "dodgy_icon", data1->dodgy_icon);
+    xfce_rc_write_entry (rc, "enabled_icon", data1->enabled_icon ? 
data1->enabled_icon : "");
+    xfce_rc_write_entry (rc, "disabled_icon", data1->disabled_icon ? 
data1->disabled_icon : "");
+    xfce_rc_write_entry (rc, "undefined_icon", data1->undefined_icon ? 
data1->undefined_icon : "");
+    xfce_rc_write_entry (rc, "checking_icon", data1->checking_icon ? 
data1->checking_icon : "");
+    xfce_rc_write_entry (rc, "dodgy_icon", data1->dodgy_icon ? 
data1->dodgy_icon : "");
     xfce_rc_write_int_entry (rc, "check_interval", data1->check_interval);
         
     /*
@@ -734,6 +723,9 @@
       GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
       NULL));
       
+    g_object_ref(G_OBJECT(data1->dialog_1));
+    gtk_object_sink(GTK_OBJECT(data1->dialog_1));
+      
     g_signal_connect (G_OBJECT(data1->dialog_1), 
       "delete-event", G_CALLBACK(trigger_launcher_configure_delete_event_cb), 
data1);
     

Modified: xfce4-trigger-launcher/trunk/panel-plugin/xfce-file-chooser-button.c
===================================================================
--- xfce4-trigger-launcher/trunk/panel-plugin/xfce-file-chooser-button.c        
2007-07-08 11:36:11 UTC (rev 25900)
+++ xfce4-trigger-launcher/trunk/panel-plugin/xfce-file-chooser-button.c        
2007-07-08 13:35:58 UTC (rev 25901)
@@ -210,11 +210,13 @@
   g_free (button1->file_path);
   button1->file_path = NULL;
   
-  if (value != NULL) {
+  if (value != NULL && value[0] != 0) {
     button1->file_path = g_strdup (value);
+    gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(button1->file_chooser), 
value);
+  } else {
+    gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER(button1->file_chooser));
   }
   
-  gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(button1->file_chooser), 
value);
   
   if (value != NULL) {
     if (value[0] != 0) {

Modified: xfce4-trigger-launcher/trunk/panel-plugin/xfce-icon-chooser-button.c
===================================================================
--- xfce4-trigger-launcher/trunk/panel-plugin/xfce-icon-chooser-button.c        
2007-07-08 11:36:11 UTC (rev 25900)
+++ xfce4-trigger-launcher/trunk/panel-plugin/xfce-icon-chooser-button.c        
2007-07-08 13:35:58 UTC (rev 25901)
@@ -29,11 +29,10 @@
     g_object_unref (G_OBJECT(button->preview));
     button->preview = NULL;
   }
-  
-  button->preview = gdk_pixbuf_new_from_file_at_scale (file_path,
-                                                       24, 24,
-                                                       TRUE,
-                                                       NULL);
+
+  if (file_path != NULL) {
+    button->preview = gdk_pixbuf_new_from_file_at_scale (file_path, 24, 24, 
TRUE, NULL);
+  }
                                              
   gtk_image_set_from_pixbuf (button->image, button->preview);
 }

Modified: 
xfce4-trigger-launcher/trunk/panel-plugin/xfce-launcher-command-entry.c
===================================================================
--- xfce4-trigger-launcher/trunk/panel-plugin/xfce-launcher-command-entry.c     
2007-07-08 11:36:11 UTC (rev 25900)
+++ xfce4-trigger-launcher/trunk/panel-plugin/xfce-launcher-command-entry.c     
2007-07-08 13:35:58 UTC (rev 25901)
@@ -90,7 +90,9 @@
 */
     g_free (e->exec);
 
-    g_free (e);
+    if (G_OBJECT_CLASS(parent_class)->finalize != NULL) {
+        (* G_OBJECT_CLASS(parent_class)->finalize)(G_OBJECT(e));
+    }
 }
 
 static void
@@ -241,7 +243,8 @@
     }*/
 }
 
-gchar const* xfce_launcher_command_entry_get_command 
(XfceLauncherCommandEntry* e)
+gchar const*
+xfce_launcher_command_entry_get_command (XfceLauncherCommandEntry* e)
 {
   xfce_launcher_command_entry_update_data_from_gui(e);
 
@@ -252,7 +255,8 @@
   }
 }
 
-static void 
xfce_launcher_command_entry_class_init(XfceLauncherCommandEntryClass* klass)
+static void
+xfce_launcher_command_entry_class_init(XfceLauncherCommandEntryClass* klass)
 {
   parent_class = g_type_class_ref (GTK_TYPE_VBOX);
   
@@ -260,7 +264,8 @@
   
 }
 
-GType xfce_launcher_command_entry_get_type(void)
+GType
+xfce_launcher_command_entry_get_type(void)
 {
   static GType atype = 0;
   
@@ -275,17 +280,19 @@
       sizeof(XfceLauncherCommandEntry),
       0, /* n_preallocs */
       (GInstanceInitFunc) xfce_launcher_command_entry_init,
+      NULL
     };
     
     atype = g_type_register_static(GTK_TYPE_VBOX,
-      "XfceXfceLauncherCommandEntry", 
+      "XfceLauncherCommandEntry", 
       &typeinfo, 
       0);
   }
   return atype;
 }
 
-XfceLauncherCommandEntry* xfce_launcher_command_entry_new(void)
+XfceLauncherCommandEntry*
+xfce_launcher_command_entry_new(void)
 {
   return g_object_new (xfce_launcher_command_entry_get_type (), NULL);
 }

Modified: 
xfce4-trigger-launcher/trunk/panel-plugin/xfce-trigger-launcher-options.c
===================================================================
--- xfce4-trigger-launcher/trunk/panel-plugin/xfce-trigger-launcher-options.c   
2007-07-08 11:36:11 UTC (rev 25900)
+++ xfce4-trigger-launcher/trunk/panel-plugin/xfce-trigger-launcher-options.c   
2007-07-08 13:35:58 UTC (rev 25901)
@@ -97,8 +97,7 @@
   options1->check_interval_entry = 
GTK_SPIN_BUTTON(gtk_spin_button_new_with_range (0.02, 4294961.0, 5.0));
   
   gtk_spin_button_set_digits (options1->check_interval_entry, 2);
-  
-  
+
   gtk_widget_show (GTK_WIDGET(options1->check_status_launcher));
   gtk_widget_show (GTK_WIDGET(options1->enable_launcher));
   gtk_widget_show (GTK_WIDGET(options1->disable_launcher));
@@ -200,9 +199,8 @@
   gtk_box_pack_start (enable_command_box, 
GTK_WIDGET(options1->enable_launcher), TRUE, TRUE, 0);
 
   gtk_box_pack_start (disable_command_box, 
GTK_WIDGET(options1->disable_launcher), TRUE, TRUE, 0);
-
   gtk_box_pack_start (poke_command_box, GTK_WIDGET(options1->poke_launcher), 
TRUE, TRUE, 0);
-  
+
   gtk_box_pack_start (disabled_icon_box, GTK_WIDGET(disabled_icon_label), 
FALSE, FALSE, 0);
   gtk_box_pack_start (enabled_icon_box, GTK_WIDGET(enabled_icon_label), FALSE, 
FALSE, 0);
   gtk_box_pack_start (undefined_icon_box, GTK_WIDGET(undefined_icon_label), 
FALSE, FALSE, 0);
@@ -267,11 +265,7 @@
   gtk_box_pack_start (GTK_BOX(options1), GTK_WIDGET(outer_box), TRUE, TRUE, 7);
 }
 
-static
-xfce_trigger_launcher_options_get_property(GObject* object_1,
-                                           guint property_id,  
-                                           GValue* value,
-                                           GParamSpec* spec_1)
+static void xfce_trigger_launcher_options_get_property(GObject* object_1, 
guint property_id, GValue* value, GParamSpec* spec_1)
 {
   XfceTriggerLauncherOptions* options_1;
 
@@ -339,11 +333,7 @@
   }
 }
 
-static
-xfce_trigger_launcher_options_set_property(GObject* object_1, 
-                                           guint property_id,
-                                           GValue const* value,
-                                           GParamSpec* spec_1)
+static void xfce_trigger_launcher_options_set_property(GObject* object_1, 
guint property_id, GValue const* value, GParamSpec* spec_1)
 {
   XfceTriggerLauncherOptions* options_1;
 

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to