[Gnucash-changes] Clean up xml data structures when the dialog is
destroyed.
David Hampton
hampton at cvs.gnucash.org
Tue Aug 2 22:15:29 EDT 2005
Log Message:
-----------
Clean up xml data structures when the dialog is destroyed. Connect
signals in all add-in preference pages. Don't show the dialog until
completely built and moved to the remembered position.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash/src/gnome-utils:
dialog-preferences.c
preferences.glade
Revision Data
-------------
Index: dialog-preferences.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/dialog-preferences.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -Lsrc/gnome-utils/dialog-preferences.c -Lsrc/gnome-utils/dialog-preferences.c -u -r1.1.2.3 -r1.1.2.4
--- src/gnome-utils/dialog-preferences.c
+++ src/gnome-utils/dialog-preferences.c
@@ -61,11 +61,13 @@
#include "dialog-utils.h"
#include "gnc-gconf-utils.h"
+#include "gnc-gobject-utils.h"
#include "gnc-trace.h"
#include "gnc-ui.h"
#include "gnc-component-manager.h"
#include "dialog-preferences.h"
+#define GLADE_FILENAME "preferences.glade"
#define DIALOG_PREFERENCES_CM_CLASS "dialog-newpreferences"
#define GCONF_SECTION "dialogs/preferences"
#define PREFIX_LEN sizeof("gconf/") - 1
@@ -413,6 +415,18 @@
/* Add to the list of interesting widgets */
gnc_prefs_build_widget_table(xml, dialog);
+ /* Clean up the xml data structure when the dialog is destroyed */
+ g_object_set_data_full(G_OBJECT(dialog), add_in->filename,
+ xml, g_object_unref);
+
+ /* Connect the signals in this glade file. The dialog is passed in
+ * so the the callback can find "interesting" widgets from other
+ * glade files if necessary (via the WIDGET_HASH hash
+ * table). Widgets from the same glade file can be found with the
+ * usual gnc_glade_lookup_widget() function. */
+ glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
+ dialog);
+
/* Prepare for recursion */
notebook = g_object_get_data(G_OBJECT(dialog), NOTEBOOK);
location.notebook = notebook;
@@ -898,11 +912,15 @@
ENTER("");
DEBUG("Opening preferences.glade:");
- xml = gnc_glade_xml_new("preferences.glade", "New Gnucash Preferences");
+ xml = gnc_glade_xml_new(GLADE_FILENAME, "New Gnucash Preferences");
dialog = glade_xml_get_widget(xml, "New Gnucash Preferences");
DEBUG("autoconnect");
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
dialog);
+
+ /* Clean up the xml data structure when the dialog is destroyed */
+ g_object_set_data_full(G_OBJECT(dialog), GLADE_FILENAME,
+ xml, g_object_unref);
DEBUG("done");
notebook = glade_xml_get_widget(xml, "notebook1");
@@ -1121,6 +1139,7 @@
dialog = gnc_preferences_dialog_create();
gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(dialog));
+ gtk_widget_show(dialog);
gnc_gconf_add_notification(G_OBJECT(dialog), NULL,
gnc_preferences_gconf_changed);
Index: preferences.glade
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/preferences.glade,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -Lsrc/gnome-utils/preferences.glade -Lsrc/gnome-utils/preferences.glade -u -r1.1.2.5 -r1.1.2.6
--- src/gnome-utils/preferences.glade
+++ src/gnome-utils/preferences.glade
@@ -138,7 +138,7 @@
</widget>
<widget class="GtkDialog" id="New Gnucash Preferences">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="title" translatable="yes">New Gnucash Preferences</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
More information about the gnucash-changes
mailing list