[gtk+/parasite2] parasite: Don't open a window upon load



commit 745cf645b099a425709dbe745cbd1663afd50bd0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 6 22:02:08 2014 -0400

    parasite: Don't open a window upon load
    
    Instead, we want to let GTK+ open a window whose life-cycle
    it can control. We just ensure that all our types are registered
    when the module is loaded, so GTK+ can find them.

 modules/other/parasite/module.c  |   24 +++++++++++++++++++++---
 modules/other/parasite/window.c  |   24 ------------------------
 modules/other/parasite/window.ui |    1 -
 3 files changed, 21 insertions(+), 28 deletions(-)
---
diff --git a/modules/other/parasite/module.c b/modules/other/parasite/module.c
index f54eada..2b2db7a 100644
--- a/modules/other/parasite/module.c
+++ b/modules/other/parasite/module.c
@@ -22,10 +22,18 @@
  */
 #include <glib.h>
 
-#include "window.h"
+#include "button-path.h"
+#include "classes-list.h"
+#include "css-editor.h"
+#include "object-hierarchy.h"
+#include "property-cell-renderer.h"
+#include "prop-list.h"
 #include "python-hooks.h"
+#include "python-shell.h"
 #include "resources.h"
-
+#include "themes.h"
+#include "widget-tree.h"
+#include "window.h"
 
 void
 gtk_module_init (gint *argc, gchar ***argv)
@@ -36,7 +44,17 @@ gtk_module_init (gint *argc, gchar ***argv)
 
   parasite_register_resource ();
 
-  gtk_window_present (GTK_WINDOW (parasite_window_new ()));
+  g_type_ensure (PARASITE_TYPE_THEMES);
+  g_type_ensure (PARASITE_TYPE_CSS_EDITOR);
+  g_type_ensure (PARASITE_TYPE_BUTTON_PATH);
+  g_type_ensure (PARASITE_TYPE_WIDGET_TREE);
+  g_type_ensure (PARASITE_TYPE_PROP_LIST);
+  g_type_ensure (PARASITE_TYPE_OBJECT_HIERARCHY);
+  g_type_ensure (PARASITE_TYPE_CLASSES_LIST);
+  g_type_ensure (PARASITE_TYPE_PYTHON_SHELL);
+  g_type_ensure (PARASITE_TYPE_PROPERTY_CELL_RENDERER);
+  g_type_ensure (PARASITE_TYPE_WINDOW);
 }
 
+
 // vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/window.c b/modules/other/parasite/window.c
index 9fc8646..31242a6 100644
--- a/modules/other/parasite/window.c
+++ b/modules/other/parasite/window.c
@@ -37,19 +37,6 @@
 
 G_DEFINE_TYPE (ParasiteWindow, parasite_window, GTK_TYPE_WINDOW)
 
-static void
-delete_window (GtkWidget *widget)
-{
-  GApplication *app = g_application_get_default ();
-
-  gtk_widget_hide (widget);
-
-  if (app)
-    g_application_quit (app);
-  else
-    exit (0);
-}
-
 extern void on_inspect (GtkWidget *button, ParasiteWindow *pw);
 
 static void
@@ -161,7 +148,6 @@ parasite_window_class_init (ParasiteWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, python_shell);
   gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, widget_popup);
 
-  gtk_widget_class_bind_template_callback (widget_class, delete_window);
   gtk_widget_class_bind_template_callback (widget_class, on_inspect);
   gtk_widget_class_bind_template_callback (widget_class, on_graphic_updates_toggled);
   gtk_widget_class_bind_template_callback (widget_class, on_widget_tree_selection_changed);
@@ -171,16 +157,6 @@ parasite_window_class_init (ParasiteWindowClass *klass)
 GtkWidget *
 parasite_window_new (void)
 {
-  g_type_ensure (PARASITE_TYPE_THEMES);
-  g_type_ensure (PARASITE_TYPE_CSS_EDITOR);
-  g_type_ensure (PARASITE_TYPE_BUTTON_PATH);
-  g_type_ensure (PARASITE_TYPE_WIDGET_TREE);
-  g_type_ensure (PARASITE_TYPE_PROP_LIST);
-  g_type_ensure (PARASITE_TYPE_OBJECT_HIERARCHY);
-  g_type_ensure (PARASITE_TYPE_CLASSES_LIST);
-  g_type_ensure (PARASITE_TYPE_PYTHON_SHELL);
-  g_type_ensure (PARASITE_TYPE_PROPERTY_CELL_RENDERER);
-
   return GTK_WIDGET (g_object_new (PARASITE_TYPE_WINDOW, NULL));
 }
 
diff --git a/modules/other/parasite/window.ui b/modules/other/parasite/window.ui
index 5de9238..5f71470 100644
--- a/modules/other/parasite/window.ui
+++ b/modules/other/parasite/window.ui
@@ -23,7 +23,6 @@
   <template class="ParasiteWindow" parent="GtkWindow">
     <property name="default-height">500</property>
     <property name="default-width">1000</property>
-    <signal name="delete-event" handler="delete_window"/>
     <child type="titlebar">
       <object class="GtkHeaderBar">
         <property name="visible">True</property>


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