Here is a quick patch to get the Gnome version of gnucash to handle
delete events on the main window correctly.

Cheers,
G.
--- window-main.c.orig  Sat Oct  2 09:10:17 1999
+++ window-main.c       Sat Oct  2 09:28:22 1999
@@ -70,6 +70,10 @@
 static void gnc_ui_reports_cb( GtkWidget *, gchar * );
 static void gnc_ui_view_cb( GtkWidget *, gint );
 static void gnc_ui_filemenu_cb( GtkWidget *, gint *);
+static gboolean gnc_ui_mainWindow_delete_cb( GtkWidget *, GdkEvent *,
+                                             gpointer );
+static gboolean gnc_ui_mainWindow_destroy_cb( GtkWidget *, GdkEvent *,
+                                              gpointer );
 static void gnc_ui_mainWindow_toolbar_open( GtkWidget *, gpointer );
 static void gnc_ui_mainWindow_toolbar_edit( GtkWidget *, gpointer );
 static void gnc_ui_refresh_statusbar();
@@ -748,6 +752,27 @@
   }  
 }
 
+static gboolean
+gnc_ui_mainWindow_delete_cb            (GtkWidget       *widget,
+                                        GdkEvent        *event,
+                                        gpointer         user_data)
+{
+  gnc_shutdown(0);
+
+  /* Return TRUE because we DON'T want to exit if
+   * gnc_shutdown(0) actually returns */
+  return TRUE;
+}
+
+
+static gboolean
+gnc_ui_mainWindow_destroy_cb           (GtkWidget       *widget,
+                                        GdkEvent        *event,
+                                        gpointer         user_data)
+{
+  return FALSE;
+}
+
 void
 mainWindow() {
   GtkWidget    *scrolled_win;
@@ -819,7 +844,15 @@
     SCM window = POINTER_TOKEN_to_SCM(make_POINTER_TOKEN("gncUIWidget", app));
     gh_call2(run_danglers, hook, window); 
   }
-  
+
+  /* Attach delete and destroy signals to the main window */  
+  gtk_signal_connect (GTK_OBJECT (app), "delete_event",
+                      GTK_SIGNAL_FUNC (gnc_ui_mainWindow_delete_cb),
+                      NULL);
+  gtk_signal_connect (GTK_OBJECT (app), "destroy_event",
+                      GTK_SIGNAL_FUNC (gnc_ui_mainWindow_destroy_cb),
+                      NULL);
+
   /* Show everything now that it is created */
 
   gtk_widget_show(main_vbox);

--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]

Reply via email to