r21267 - gnucash/trunk/src/gnome-utils - Bug #657596 - Migrate Scheduled Transactions from GladeXML to Builder

Geert Janssens gjanssens at code.gnucash.org
Sat Sep 17 13:40:53 EDT 2011


Author: gjanssens
Date: 2011-09-17 13:40:53 -0400 (Sat, 17 Sep 2011)
New Revision: 21267
Trac: http://svn.gnucash.org/trac/changeset/21267

Modified:
   gnucash/trunk/src/gnome-utils/gnc-frequency.c
Log:
Bug #657596 - Migrate Scheduled Transactions from GladeXML to Builder
Add destroy object for GncFrequency
Patch by Robert Fewell

Modified: gnucash/trunk/src/gnome-utils/gnc-frequency.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-frequency.c	2011-09-17 17:20:01 UTC (rev 21266)
+++ gnucash/trunk/src/gnome-utils/gnc-frequency.c	2011-09-17 17:40:53 UTC (rev 21267)
@@ -58,6 +58,7 @@
 /** Private Prototypes ********************/
 
 static void gnc_frequency_class_init( GncFrequencyClass *klass );
+static void gnc_frequency_class_destroy( GtkObject *object );
 
 static void freq_combo_changed( GtkComboBox *b, gpointer d );
 static void start_date_changed( GNCDateEdit *gde, gpointer d );
@@ -70,6 +71,8 @@
 
 /** Static Inits ********************/
 
+static GObjectClass *parent_class = NULL;
+
 enum
 {
     PAGE_NONE = 0,
@@ -137,8 +140,12 @@
 gnc_frequency_class_init( GncFrequencyClass *klass )
 {
     GObjectClass *object_class;
+    GtkObjectClass *gtkobject_class;
 
+    parent_class = g_type_class_peek_parent (klass);
+
     object_class = G_OBJECT_CLASS (klass);
+    gtkobject_class = GTK_OBJECT_CLASS (klass);
 
     gnc_frequency_signals[GNCFREQ_CHANGED] =
         g_signal_new ("changed",
@@ -150,6 +157,9 @@
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE,
                       0);
+
+    /* GtkObject signals */
+    gtkobject_class->destroy = gnc_frequency_class_destroy;
 }
 
 
@@ -260,12 +270,41 @@
 
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, gf);
 
-    /* We can not use this as builder file is accessed when widgets change */
-    /* g_object_unref(G_OBJECT(builder)); */
 }
 
 
+/** Destroy the GncFrequency object.  This function is called (possibly
+ *  multiple times) from the Gtk_Object level to destroy the object.
+ *
+ *  @param object The object being destroyed.
+ *
+ *  @internal
+ */
 static void
+gnc_frequency_class_destroy (GtkObject *object)
+{
+    GncFrequency *gf;
+
+    ENTER("frequency %p", object);
+    g_return_if_fail (object != NULL);
+    g_return_if_fail (GNC_IS_FREQUENCY (object));
+
+    gf = GNC_FREQUENCY (object);
+
+    if (gf->builder)
+    {
+        DEBUG("removing builder");
+        g_object_unref(G_OBJECT(gf->builder));
+        gf->builder = NULL;
+    }
+
+    if (GTK_OBJECT_CLASS (parent_class)->destroy)
+        GTK_OBJECT_CLASS (parent_class)->destroy (object);
+    LEAVE(" ");
+}
+
+
+static void
 spin_changed_helper( GtkAdjustment *adj, gpointer d )
 {
     g_signal_emit_by_name(GNC_FREQUENCY(d), "changed");



More information about the gnucash-changes mailing list