AUDIT: r15976 - gnucash/trunk/src/gnome-utils - Remember the current session when an option dialog boxes is opened,

David Hampton hampton at cvs.gnucash.org
Sun Apr 22 01:59:52 EDT 2007


Author: hampton
Date: 2007-04-22 01:59:51 -0400 (Sun, 22 Apr 2007)
New Revision: 15976
Trac: http://svn.gnucash.org/trac/changeset/15976

Modified:
   gnucash/trunk/src/gnome-utils/dialog-options.c
Log:
Remember the current session when an option dialog boxes is opened,
and close it when the session is closed.  Fixes #394074.
BP


Modified: gnucash/trunk/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-options.c	2007-04-22 05:22:51 UTC (rev 15975)
+++ gnucash/trunk/src/gnome-utils/dialog-options.c	2007-04-22 05:59:51 UTC (rev 15976)
@@ -38,12 +38,14 @@
 #include "gnc-account-sel.h"
 #include "gnc-tree-view-account.h"
 #include "gnc-commodity-edit.h"
+#include "gnc-component-manager.h"
 #include "gnc-general-select.h"
 #include "gnc-currency-edit.h"
 #include "gnc-date-edit.h"
 #include "gnc-engine.h"
 #include "gnc-gconf-utils.h"
 #include "gnc-gui-query.h"
+#include "gnc-session.h"
 #include "gnc-ui.h"
 #include "guile-util.h"
 #include "option-util.h"
@@ -59,6 +61,8 @@
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_GUI;
 
+#define DIALOG_OPTIONS_CM_CLASS "dialog-options"
+
 /*
  * Point where preferences switch control method from a set of
  * notebook tabs to a list.
@@ -1382,6 +1386,13 @@
 #endif
 }
 
+static void
+component_close_handler (gpointer data)
+{
+  GNCOptionWin *window = data;
+  gtk_dialog_response(GTK_DIALOG(window->dialog), GTK_RESPONSE_CANCEL);
+}
+
 /* gnc_options_dialog_new:
  *
  *   - Opens the preferences glade file
@@ -1396,6 +1407,7 @@
   GNCOptionWin * retval;
   GladeXML *xml;
   GtkWidget * hbox;
+  gint component_id;
 
   retval = g_new0(GNCOptionWin, 1);
   xml = gnc_glade_xml_new ("preferences.glade", "GnuCash Options");
@@ -1415,6 +1427,11 @@
   gtk_widget_show(retval->notebook);
   gtk_box_pack_start(GTK_BOX(hbox), retval->notebook, TRUE, TRUE, 5);
 
+  component_id = gnc_register_gui_component (DIALOG_OPTIONS_CM_CLASS,
+                                             NULL, component_close_handler,
+                                             retval);
+  gnc_gui_component_set_session (component_id, gnc_get_current_session());
+
   return retval;
 }
 



More information about the gnucash-changes mailing list