[gnac/devel] Code cleanup to prevent warnings when destroying windows.



commit 9ff9820a12c766fee678814bd3f358c5fdbb7a0e
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Thu Apr 22 16:46:41 2010 +0100

    Code cleanup to prevent warnings when destroying windows.

 src/gnac-prefs.c      |    4 +---
 src/gnac-properties.c |    4 +---
 src/gnac-ui.c         |   12 ++++--------
 3 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/src/gnac-prefs.c b/src/gnac-prefs.c
index 8e1f0dd..d2875c0 100644
--- a/src/gnac-prefs.c
+++ b/src/gnac-prefs.c
@@ -653,12 +653,10 @@ gnac_prefs_destroy(void)
   if (gnac_prefs_builder) {
     window = GTK_WIDGET(gtk_builder_get_object(gnac_prefs_builder, 
                                        "gnac_preference_window"));
+    if (window) gtk_widget_destroy(window);
     g_object_unref(gnac_prefs_builder);
     gnac_prefs_builder = NULL;
   }
 
   gnac_prefs_free_tooltip_patterns();
-
-  if (window)
-    gtk_widget_destroy(window);
 }
diff --git a/src/gnac-properties.c b/src/gnac-properties.c
index 35d4b4d..562a576 100644
--- a/src/gnac-properties.c
+++ b/src/gnac-properties.c
@@ -644,10 +644,8 @@ gnac_properties_destroy(void)
   if (gnac_properties_builder) {
     window = GTK_WIDGET(gtk_builder_get_object(gnac_properties_builder, 
                                             "properties_window"));
+    if (window) gtk_widget_destroy(window);
     g_object_unref(gnac_properties_builder);
     gnac_properties_builder = NULL;
   }
-
-  if (window) 
-    gtk_widget_destroy(window);
 }
diff --git a/src/gnac-ui.c b/src/gnac-ui.c
index ffd5144..2532227 100644
--- a/src/gnac-ui.c
+++ b/src/gnac-ui.c
@@ -324,16 +324,12 @@ gnac_ui_destroy(void)
   
   if (gnac_main_builder) {
     main_window = gnac_ui_get_widget("main_window");
+    if (main_window) gtk_widget_destroy(main_window);
     about_dialog = gnac_ui_get_widget("aboutdialog");
+    if (about_dialog) gtk_widget_destroy(about_dialog);
     g_object_unref(gnac_main_builder); 
     gnac_main_builder = NULL;
   }
-
-  if (main_window) 
-    gtk_widget_destroy(main_window);
-
-  if (about_dialog)
-    gtk_widget_destroy(about_dialog);
 }
 
 
@@ -564,8 +560,8 @@ gnac_ui_show_error_trash(const gchar *filename)
 
   gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
    _("Cannot trash file %s"), filename);
-  response = gtk_dialog_run(GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
+  response = gtk_dialog_run(GTK_DIALOG(dialog));
+  gtk_widget_destroy(dialog);
 
   return response;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]