r20661 - gnucash/trunk/src/gnome - Convert "Delete Account" dialog to gtkbuilder.

Geert Janssens gjanssens at code.gnucash.org
Thu May 19 13:22:49 EDT 2011


Author: gjanssens
Date: 2011-05-19 13:22:49 -0400 (Thu, 19 May 2011)
New Revision: 20661
Trac: http://svn.gnucash.org/trac/changeset/20661

Modified:
   gnucash/trunk/src/gnome/glade/account.glade
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
   gnucash/trunk/src/gnome/gtkbuilder/account.glade
Log:
Convert "Delete Account" dialog to gtkbuilder.

Modified: gnucash/trunk/src/gnome/glade/account.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/account.glade	2011-05-19 17:22:39 UTC (rev 20660)
+++ gnucash/trunk/src/gnome/glade/account.glade	2011-05-19 17:22:49 UTC (rev 20661)
@@ -2,431 +2,6 @@
 <glade-interface>
   <!-- interface-requires gtk+ 2.10 -->
   <!-- interface-naming-policy toplevel-contextual -->
-  <widget class="GtkDialog" id="Delete Account">
-    <property name="border_width">6</property>
-    <property name="title" translatable="yes">Delete Account</property>
-    <property name="modal">True</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="vbox126">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child>
-          <widget class="GtkVBox" id="vbox127">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">12</property>
-            <child>
-              <widget class="GtkLabel" id="header">
-                <property name="visible">True</property>
-                <property name="label">Deleting account xxx</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkVBox" id="transactions">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <widget class="GtkLabel" id="label8477423">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Transactions&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkAlignment" id="alignment8">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkTable" id="table8">
-                        <property name="visible">True</property>
-                        <property name="n_rows">4</property>
-                        <property name="n_columns">2</property>
-                        <property name="column_spacing">12</property>
-                        <child>
-                          <widget class="Custom" id="tmas">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="creation_function">gnc_account_sel_new</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="tmrb">
-                            <property name="label" translatable="yes">M_ove to:</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="tdrb">
-                            <property name="label" translatable="yes">Delete all _transactions</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">tmrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="tmas"/>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="trans_rw">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">This account contains transactions. What would you like to do with these transactions?</property>
-                            <property name="wrap">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="trans_ro">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">This account contains read-only transactions which may not be deleted.</property>
-                            <property name="wrap">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkVBox" id="subaccounts">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <widget class="GtkLabel" id="label8477419">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Sub-accounts&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkAlignment" id="alignment7">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkTable" id="table7">
-                        <property name="visible">True</property>
-                        <property name="n_rows">3</property>
-                        <property name="n_columns">2</property>
-                        <property name="column_spacing">12</property>
-                        <child>
-                          <widget class="GtkLabel" id="label8477420">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">This account contains sub-accounts.  What would you like to do with these sub-accounts?</property>
-                            <property name="wrap">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="damrb">
-                            <property name="label" translatable="yes">_Move to:</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="subaccount_trans"/>
-                            <signal name="toggled" handler="gppat_populate_tmas_list" object="tmas"/>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="dadrb">
-                            <property name="label" translatable="yes">Delete all _subaccounts</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">damrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="damas"/>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="Custom" id="damas">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="creation_function">gnc_account_sel_new</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkVBox" id="subaccount_trans">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <widget class="GtkLabel" id="label8477429">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Sub-account Transactions&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkAlignment" id="alignment9">
-                    <property name="visible">True</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkTable" id="table9">
-                        <property name="visible">True</property>
-                        <property name="n_rows">4</property>
-                        <property name="n_columns">2</property>
-                        <property name="column_spacing">12</property>
-                        <child>
-                          <widget class="Custom" id="dtmas">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="creation_function">gnc_account_sel_new</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="dtmrb">
-                            <property name="label" translatable="yes">M_ove to:</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="dtdrb">
-                            <property name="label" translatable="yes">Delete all _transactions</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">dtmrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="dtmas"/>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="sa_trans_rw">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">One or more sub-accounts contain transactions. What would you like to do with these transactions?</property>
-                            <property name="wrap">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="sa_trans_ro">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">One or more sub-accounts contain read-only transactions which may not be deleted.</property>
-                            <property name="wrap">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="hbuttonbox2">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <widget class="GtkButton" id="cancelbutton">
-                <property name="label">gtk-cancel</property>
-                <property name="response_id">-6</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="deletebutton">
-                <property name="label">gtk-delete</property>
-                <property name="response_id">-3</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
   <widget class="GtkDialog" id="Filter By">
     <property name="visible">True</property>
     <property name="border_width">6</property>

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2011-05-19 17:22:39 UTC (rev 20660)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2011-05-19 17:22:49 UTC (rev 20661)
@@ -72,8 +72,12 @@
 #define PLUGIN_PAGE_ACCT_TREE_CM_CLASS "plugin-page-acct-tree"
 #define GCONF_SECTION "window/pages/account_tree"
 
-#define DELETE_DIALOG_FILTER  "filter"
-#define DELETE_DIALOG_ACCOUNT "account"
+#define DELETE_DIALOG_FILTER       "filter"
+#define DELETE_DIALOG_ACCOUNT      "account"
+#define DELETE_DIALOG_TRANS_MAS    "trans_mas"
+#define DELETE_DIALOG_SA_MAS       "sa_mas"
+#define DELETE_DIALOG_SA_TRANS_MAS "sa_trans_mas"
+#define DELETE_DIALOG_OK_BUTTON    "deletebutton"
 
 enum
 {
@@ -120,8 +124,8 @@
 
 static void gnc_plugin_page_account_tree_selection_changed_cb (GtkTreeSelection *selection,
         GncPluginPageAccountTree *page);
-void gppat_populate_tmas_list(GtkToggleButton *dmrb, gpointer tmas);
-void gppat_set_insensitive_iff_rb_active(GtkToggleButton *b, GtkWidget *widget);
+void gppat_populate_trans_mas_list(GtkToggleButton *sa_mrb, GtkWidget *dialog);
+void gppat_set_insensitive_iff_rb_active(GtkWidget *widget, GtkToggleButton *b);
 
 /* Command callbacks */
 static void gnc_plugin_page_account_tree_cmd_new_account (GtkAction *action, GncPluginPageAccountTree *plugin_page);
@@ -875,21 +879,21 @@
 set_ok_sensitivity(GtkWidget *dialog)
 {
     GtkWidget *button;
-    gpointer dmas, tmas;
-    gint dmas_cnt, tmas_cnt;
+    GtkWidget *sa_mas, *trans_mas;
+    gint sa_mas_cnt, trans_mas_cnt;
     gboolean sensitive;
 
-    dmas = g_object_get_data(G_OBJECT(dialog), "dmas");
-    tmas = g_object_get_data(G_OBJECT(dialog), "tmas");
-    dmas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(dmas));
-    tmas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(tmas));
+    sa_mas = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_SA_MAS);
+    trans_mas = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_TRANS_MAS);
+    sa_mas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(sa_mas));
+    trans_mas_cnt = gnc_account_sel_get_num_account(GNC_ACCOUNT_SEL(trans_mas));
 
-    sensitive = (((NULL == dmas) ||
-                  (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(dmas)) || dmas_cnt)) &&
-                 ((NULL == tmas) ||
-                  (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(tmas)) || tmas_cnt)));
+    sensitive = (((NULL == sa_mas) ||
+                  (!GTK_WIDGET_IS_SENSITIVE(sa_mas) || sa_mas_cnt)) &&
+                 ((NULL == trans_mas) ||
+                  (!GTK_WIDGET_IS_SENSITIVE(trans_mas) || trans_mas_cnt)));
 
-    button = gnc_glade_lookup_widget(dialog, "deletebutton");
+    button = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_OK_BUTTON);
     gtk_widget_set_sensitive(button, sensitive);
 }
 
@@ -914,22 +918,29 @@
     gnc_account_sel_purge_account( gas, account, exclude_subaccounts);
 
     /* The sensitivity of the OK button needs to be reevaluated. */
-    set_ok_sensitivity(GTK_WIDGET(dialog));
+    set_ok_sensitivity(dialog);
 }
 
 void
-gppat_populate_tmas_list(GtkToggleButton *damrb,
-                         gpointer tmas)
+gppat_populate_trans_mas_list(GtkToggleButton *sa_mrb,
+                              GtkWidget *dialog)
 {
-    GtkWidget *dialog;
+    GtkWidget *trans_mas;
 
+    g_return_if_fail(GTK_IS_DIALOG(dialog));
+
     /* Cannot move transactions to subaccounts if they are to be deleted. */
-    dialog = gnc_glade_lookup_widget(GTK_WIDGET(damrb), "Delete Account");
-    gppat_populate_gas_list(dialog, tmas, !gtk_toggle_button_get_active(damrb));
+    trans_mas = g_object_get_data(G_OBJECT(dialog), DELETE_DIALOG_TRANS_MAS);
+    gppat_populate_gas_list(dialog, GNC_ACCOUNT_SEL(trans_mas), !gtk_toggle_button_get_active(sa_mrb));
 }
 
+/* Note that the emitting object (the toggle button) and the signal data
+ * are swapped in below callback function. This is a gtkbuilder feature:
+ * it swaps if you explicitly set an object for a signal handler in the
+ * gtkbuilder xml file.
+ */
 void
-gppat_set_insensitive_iff_rb_active(GtkToggleButton *b, GtkWidget *widget)
+gppat_set_insensitive_iff_rb_active(GtkWidget *widget, GtkToggleButton *b)
 {
     gtk_widget_set_sensitive(widget, !gtk_toggle_button_get_active(b));
     set_ok_sensitivity(gtk_widget_get_toplevel(widget));
@@ -940,19 +951,17 @@
 {
     Account *account = gnc_plugin_page_account_tree_get_current_account (page);
     gchar *acct_name;
-    GList *splits;
     delete_helper_t delete_res = { FALSE, FALSE };
-    GtkWidget *widget;
     GtkWidget *window;
-    GtkWidget *dialog = NULL;
-    GNCAccountSel *damas = NULL; /* descendant account move account selector */
-    GNCAccountSel *dtmas = NULL; /* descendant transaction move account selector */
-    GNCAccountSel *tmas = NULL; /* transaction move account selector */
-    gint response;
+    GtkWidget *trans_mas = NULL; /* transaction move to account selector */
+    GtkWidget *sa_mas = NULL;    /* subaccount move to account selector */
+    GtkWidget *sa_trans_mas = NULL; /* subaccount's transaction move to account selector */
     Account *ta = NULL; /* transaction adopter */
-    Account *daa = NULL; /* descendant account adopter */
-    Account *dta = NULL; /* descendant transaction adopter */
+    Account *saa = NULL; /* subaccount adopter */
+    Account *sta = NULL; /* subaccount transaction adopter */
+    GList *splits;
     GList* list;
+    gint response;
 
     if (NULL == account)
         return;
@@ -984,21 +993,27 @@
      */
     if ((NULL != splits) || (gnc_account_n_children(account) > 0))
     {
-        GList *filter;
-        GladeXML *xml;
-        GtkWidget *label;
-        gchar *message;
+        GList *filter = NULL;
+        GtkBuilder *builder = NULL;
+        GtkWidget *dialog = NULL;
+        GtkWidget *box = NULL;
+        GtkWidget *widget = NULL;
+        gchar *title = NULL;
 
-        xml = gnc_glade_xml_new ("account.glade", "Delete Account");
-        dialog = glade_xml_get_widget (xml, "Delete Account");
+        builder = gtk_builder_new();
+        gnc_builder_add_from_file (builder, "account.glade", "Delete Account");
+
+        dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Delete Account"));
         gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(window));
-        glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, dialog);
 
-        label = glade_xml_get_widget (xml, "header");
-        message = g_strdup_printf(_("Deleting account %s"), acct_name);
-        gtk_label_set_text(GTK_LABEL(label), message);
-        g_free(message);
+        widget = GTK_WIDGET(gtk_builder_get_object (builder, "header"));
+        title = g_strdup_printf(_("Deleting account %s"), acct_name);
+        gtk_label_set_text(GTK_LABEL(widget), title);
+        g_free(title);
 
+        widget = GTK_WIDGET(gtk_builder_get_object (builder, DELETE_DIALOG_OK_BUTTON));
+        g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_OK_BUTTON, widget);
+
         /*
          * Reparent only to accounts of the same
          * type as the one being deleted.
@@ -1015,24 +1030,27 @@
         {
             delete_helper_t delete_res2 = { FALSE, FALSE };
 
-            tmas = GNC_ACCOUNT_SEL(glade_xml_get_widget (xml, "tmas"));
-            gppat_populate_gas_list(dialog, tmas, FALSE);
+            trans_mas = gnc_account_sel_new();
+            box = GTK_WIDGET(gtk_builder_get_object (builder, "trans_mas_hbox"));
+            gtk_box_pack_start (GTK_BOX(box), trans_mas, TRUE, TRUE, 0);
+            g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_TRANS_MAS, trans_mas);
+            gppat_populate_gas_list(dialog, GNC_ACCOUNT_SEL(trans_mas), FALSE);
 
             delete_account_helper(account, &delete_res2);
             if (delete_res2.has_ro_splits)
             {
-                gtk_widget_destroy(glade_xml_get_widget (xml, "trans_rw"));
-                widget = glade_xml_get_widget (xml, "tdrb");
+                gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "trans_rw")));
+                widget = GTK_WIDGET(gtk_builder_get_object (builder, "trans_drb"));
                 gtk_widget_set_sensitive(widget, FALSE);
             }
             else
             {
-                gtk_widget_destroy(glade_xml_get_widget (xml, "trans_ro"));
+                gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "trans_ro")));
             }
         }
         else
         {
-            gtk_widget_destroy(glade_xml_get_widget (xml, "transactions"));
+            gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "transactions")));
         }
 
         /*
@@ -1047,32 +1065,43 @@
                                                  &delete_res);
             if (delete_res.has_ro_splits)
             {
-                gtk_widget_destroy(glade_xml_get_widget (xml, "sa_trans_rw"));
-                widget = glade_xml_get_widget (xml, "dtdrb");
+                gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "sa_trans_rw")));
+                widget = GTK_WIDGET(gtk_builder_get_object (builder, "sa_trans_drb"));
                 gtk_widget_set_sensitive(widget, FALSE);
             }
             else if (delete_res.has_splits)
             {
-                gtk_widget_destroy(glade_xml_get_widget (xml, "sa_trans_ro"));
+                gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "sa_trans_ro")));
             }
             else
             {
-                gtk_widget_destroy(glade_xml_get_widget (xml, "subaccount_trans"));
+                gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "subaccount_trans")));
             }
-            damas = GNC_ACCOUNT_SEL(glade_xml_get_widget (xml, "damas"));
-            gppat_populate_gas_list(dialog, damas, TRUE);
-            dtmas = GNC_ACCOUNT_SEL(glade_xml_get_widget (xml, "dtmas"));
-            gppat_populate_gas_list(dialog, dtmas, TRUE);
+
+            sa_mas = gnc_account_sel_new();
+            box = GTK_WIDGET(gtk_builder_get_object (builder, "sa_mas_hbox"));
+            gtk_box_pack_start (GTK_BOX(box), sa_mas, TRUE, TRUE, 0);
+            g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_SA_MAS, sa_mas);
+            gppat_populate_gas_list(dialog, GNC_ACCOUNT_SEL(sa_mas), TRUE);
+
+            sa_trans_mas = gnc_account_sel_new();
+            box = GTK_WIDGET(gtk_builder_get_object (builder, "sa_trans_mas_hbox"));
+            gtk_box_pack_start (GTK_BOX(box), sa_trans_mas, TRUE, TRUE, 0);
+            g_object_set_data(G_OBJECT(dialog), DELETE_DIALOG_SA_TRANS_MAS, sa_trans_mas);
+            gppat_populate_gas_list(dialog, GNC_ACCOUNT_SEL(sa_trans_mas), TRUE);
         }
         else
         {
-            gtk_widget_destroy(glade_xml_get_widget (xml, "subaccounts"));
-            gtk_widget_destroy(glade_xml_get_widget (xml, "subaccount_trans"));
+            gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "subaccounts")));
+            gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "subaccount_trans")));
         }
 
         /* default to cancel */
         gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
 
+        gtk_builder_connect_signals(builder, dialog);
+        g_object_unref(G_OBJECT(builder));
+
         /*
          * Note that one effect of the modal dialog is preventing
          * the account selectors from being repopulated.
@@ -1087,12 +1116,12 @@
             g_free(acct_name);
             return;
         }
-        if (tmas && GTK_WIDGET_IS_SENSITIVE(tmas))
-            ta = gnc_account_sel_get_account(tmas);
-        if (damas && GTK_WIDGET_IS_SENSITIVE(damas))
-            daa = gnc_account_sel_get_account(damas);
-        if (dtmas && GTK_WIDGET_IS_SENSITIVE(dtmas))
-            dta = gnc_account_sel_get_account(dtmas);
+        if (trans_mas && GTK_WIDGET_IS_SENSITIVE(trans_mas))
+            ta = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(trans_mas));
+        if (sa_mas && GTK_WIDGET_IS_SENSITIVE(sa_mas))
+            saa = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(sa_mas));
+        if (sa_trans_mas && GTK_WIDGET_IS_SENSITIVE(sa_trans_mas))
+            sta = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(sa_trans_mas));
         gtk_widget_destroy(dialog);
         g_list_free(filter);
     } /* (NULL != splits) || (NULL != children) */
@@ -1107,6 +1136,7 @@
         char *message;
         char *name;
         int i = 0;
+        GtkWidget *dialog;
 
         lines[0] = g_strdup_printf(format, acct_name);
         if (splits)
@@ -1126,9 +1156,9 @@
         }
         if (gnc_account_n_children(account) > 0)
         {
-            if (daa)
+            if (saa)
             {
-                name = gnc_account_get_full_name(daa);
+                name = gnc_account_get_full_name(saa);
                 format = _("All of its sub-accounts will be moved to "
                            "the account %s.");
                 lines[++i] = g_strdup_printf(format, name);
@@ -1137,9 +1167,9 @@
             {
                 format = _("All of its subaccounts will be deleted.");
                 lines[++i] = g_strdup_printf("%s", format);
-                if (dta)
+                if (sta)
                 {
-                    name = gnc_account_get_full_name(dta);
+                    name = gnc_account_get_full_name(sta);
                     format = _("All sub-account transactions will be moved to "
                                "the account %s.");
                     lines[++i] = g_strdup_printf(format, name);
@@ -1179,23 +1209,23 @@
             gnc_set_busy_cursor(NULL, TRUE);
             gnc_suspend_gui_refresh ();
             xaccAccountBeginEdit (account);
-            if (NULL != daa)
+            if (NULL != saa)
             {
                 GList *acct_list, *ptr;
 
-                xaccAccountBeginEdit (daa);
+                xaccAccountBeginEdit (saa);
                 acct_list = gnc_account_get_children(account);
                 for (ptr = acct_list; ptr; ptr = g_list_next(ptr))
-                    gnc_account_append_child (daa, ptr->data);
+                    gnc_account_append_child (saa, ptr->data);
                 g_list_free(acct_list);
-                xaccAccountCommitEdit (daa);
+                xaccAccountCommitEdit (saa);
             }
-            else if (NULL != dta)
+            else if (NULL != sta)
             {
                 /* Move the splits of its subaccounts, if any. */
                 gnc_account_foreach_descendant(account,
                                                (AccountCb)xaccAccountMoveAllSplits,
-                                               dta);
+                                               sta);
             }
             if (NULL != ta)
             {

Modified: gnucash/trunk/src/gnome/gtkbuilder/account.glade
===================================================================
--- gnucash/trunk/src/gnome/gtkbuilder/account.glade	2011-05-19 17:22:39 UTC (rev 20660)
+++ gnucash/trunk/src/gnome/gtkbuilder/account.glade	2011-05-19 17:22:49 UTC (rev 20661)
@@ -901,7 +901,7 @@
                         <property name="n_columns">2</property>
                         <property name="column_spacing">12</property>
                         <child>
-                          <object class="GtkRadioButton" id="tmrb">
+                          <object class="GtkRadioButton" id="trans_mrb">
                             <property name="label" translatable="yes">M_ove to:</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -918,15 +918,15 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="tdrb">
+                          <object class="GtkRadioButton" id="trans_drb">
                             <property name="label" translatable="yes">Delete all _transactions</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">tmrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="tmas"/>
+                            <property name="group">trans_mrb</property>
+                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="trans_mas_hbox"/>
                           </object>
                           <packing>
                             <property name="right_attach">2</property>
@@ -965,7 +965,18 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <object class="GtkHBox" id="trans_mas_hbox">
+                            <property name="visible">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
@@ -1022,7 +1033,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="damrb">
+                          <object class="GtkRadioButton" id="sa_mrb">
                             <property name="label" translatable="yes">_Move to:</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -1031,7 +1042,7 @@
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="subaccount_trans"/>
-                            <signal name="toggled" handler="gppat_populate_tmas_list" object="tmas"/>
+                            <signal name="toggled" handler="gppat_populate_trans_mas_list"/>
                           </object>
                           <packing>
                             <property name="top_attach">2</property>
@@ -1041,15 +1052,15 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="dadrb">
+                          <object class="GtkRadioButton" id="sa_drb">
                             <property name="label" translatable="yes">Delete all _subaccounts</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">damrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="damas"/>
+                            <property name="group">sa_mrb</property>
+                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="sa_mas_hbox"/>
                           </object>
                           <packing>
                             <property name="right_attach">2</property>
@@ -1060,7 +1071,18 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <object class="GtkHBox" id="sa_mas_hbox">
+                            <property name="visible">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
@@ -1107,7 +1129,7 @@
                         <property name="n_columns">2</property>
                         <property name="column_spacing">12</property>
                         <child>
-                          <object class="GtkRadioButton" id="dtmrb">
+                          <object class="GtkRadioButton" id="sa_trans_mrb">
                             <property name="label" translatable="yes">M_ove to:</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -1124,15 +1146,15 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="dtdrb">
+                          <object class="GtkRadioButton" id="sa_trans_drb">
                             <property name="label" translatable="yes">Delete all _transactions</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">dtmrb</property>
-                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="dtmas"/>
+                            <property name="group">sa_trans_mrb</property>
+                            <signal name="toggled" handler="gppat_set_insensitive_iff_rb_active" object="sa_trans_mas_hbox"/>
                           </object>
                           <packing>
                             <property name="right_attach">2</property>
@@ -1171,7 +1193,18 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <object class="GtkHBox" id="sa_trans_mas_hbox">
+                            <property name="visible">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                          </packing>
                         </child>
                       </object>
                     </child>



More information about the gnucash-changes mailing list