r20669 - gnucash/trunk/src - Convert "Renumber Subaccounts" dialog to gtkbuilder format

Geert Janssens gjanssens at code.gnucash.org
Sat May 21 15:37:10 EDT 2011


Author: gjanssens
Date: 2011-05-21 15:37:10 -0400 (Sat, 21 May 2011)
New Revision: 20669
Trac: http://svn.gnucash.org/trac/changeset/20669

Removed:
   gnucash/trunk/src/gnome/glade/account.glade
Modified:
   gnucash/trunk/src/gnome-utils/dialog-account.c
   gnucash/trunk/src/gnome/gtkbuilder/account.glade
Log:
Convert "Renumber Subaccounts" dialog to gtkbuilder format

Deleted: gnucash/trunk/src/gnome/glade/account.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/account.glade	2011-05-21 19:37:00 UTC (rev 20668)
+++ gnucash/trunk/src/gnome/glade/account.glade	2011-05-21 19:37:10 UTC (rev 20669)
@@ -1,222 +0,0 @@
-<?xml version="1.0"?>
-<glade-interface>
-  <!-- interface-requires gtk+ 2.10 -->
-  <!-- interface-naming-policy toplevel-contextual -->
-  <widget class="GtkDialog" id="Renumber Accounts">
-    <property name="visible">True</property>
-    <property name="border_width">6</property>
-    <property name="title" translatable="yes">Renumber sub-accounts</property>
-    <property name="modal">True</property>
-    <property name="type_hint">dialog</property>
-    <signal name="response" handler="gnc_account_renumber_response_cb"/>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox14">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child>
-          <widget class="GtkTable" id="table12">
-            <property name="visible">True</property>
-            <property name="n_rows">5</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <widget class="GtkLabel" id="label8477435">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Prefix:</property>
-              </widget>
-              <packing>
-                <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="header_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label">Renumber the immediate sub-accounts of xxx.</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="GtkEntry" id="prefix_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <signal name="changed" handler="gnc_account_renumber_prefix_changed_cb"/>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label8477436">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Examples:</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="GtkLabel" id="example1_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</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="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label8477438">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Interval:</property>
-              </widget>
-              <packing>
-                <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="GtkSpinButton" id="interval_spin">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="adjustment">10 1 10000 5 100 0</property>
-                <property name="climb_rate">1</property>
-                <signal name="value_changed" handler="gnc_account_renumber_interval_changed_cb"/>
-              </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"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="example2_label">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">4</property>
-                <property name="bottom_attach">5</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-          </widget>
-          <packing>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area14">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <widget class="GtkButton" id="cancelbutton2">
-                <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="okbutton2">
-                <property name="response_id">-5</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment19">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <widget class="GtkHBox" id="hbox1">
-                        <property name="visible">True</property>
-                        <property name="spacing">2</property>
-                        <child>
-                          <widget class="GtkImage" id="image1">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-execute</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label8477439">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_Renumber</property>
-                            <property name="use_underline">True</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </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="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
-</glade-interface>

Modified: gnucash/trunk/src/gnome/gtkbuilder/account.glade
===================================================================
--- gnucash/trunk/src/gnome/gtkbuilder/account.glade	2011-05-21 19:37:00 UTC (rev 20668)
+++ gnucash/trunk/src/gnome/gtkbuilder/account.glade	2011-05-21 19:37:10 UTC (rev 20669)
@@ -1598,7 +1598,7 @@
               <object class="GtkSpinButton" id="interval_spin">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="adjustment">adjustment1</property>
+                <property name="adjustment">interval_adjustment</property>
                 <property name="climb_rate">1</property>
                 <signal name="value_changed" handler="gnc_account_renumber_interval_changed_cb"/>
               </object>
@@ -2084,7 +2084,7 @@
       </packing>
     </child>
   </object>
-  <object class="GtkAdjustment" id="adjustment1">
+  <object class="GtkAdjustment" id="interval_adjustment">
     <property name="value">10</property>
     <property name="lower">1</property>
     <property name="upper">10000</property>

Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c	2011-05-21 19:37:00 UTC (rev 20668)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c	2011-05-21 19:37:10 UTC (rev 20669)
@@ -1971,7 +1971,7 @@
 gnc_account_renumber_create_dialog (GtkWidget *window, Account *account)
 {
     RenumberDialog *data;
-    GladeXML *xml;
+    GtkBuilder *builder;
     GtkWidget *widget;
     gchar *string;
 
@@ -1979,12 +1979,14 @@
     data->parent = account;
     data->num_children = gnc_account_n_children(account);
 
-    xml = gnc_glade_xml_new ("account.glade", "Renumber Accounts");
-    data->dialog = glade_xml_get_widget (xml, "Renumber Accounts");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "account.glade", "interval_adjustment");
+    gnc_builder_add_from_file (builder, "account.glade", "Renumber Accounts");
+    data->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Renumber Accounts"));
     gtk_window_set_transient_for(GTK_WINDOW(data->dialog), GTK_WINDOW(window));
-    g_object_set_data_full(G_OBJECT(data->dialog), "xml", xml, g_object_unref);
+    g_object_set_data_full(G_OBJECT(data->dialog), "builder", builder, g_object_unref);
 
-    widget = glade_xml_get_widget (xml, "header_label");
+    widget = GTK_WIDGET(gtk_builder_get_object (builder, "header_label"));
     string = g_strdup_printf(_( "Renumber the immediate sub-accounts of %s?  "
                                 "This will replace the account code field of "
                                 "each child account with a newly generated code."),
@@ -1992,16 +1994,15 @@
     gtk_label_set_text(GTK_LABEL(widget), string);
     g_free(string);
 
-    data->prefix = glade_xml_get_widget (xml, "prefix_entry");
-    data->interval = glade_xml_get_widget (xml, "interval_spin");
-    data->example1 = glade_xml_get_widget (xml, "example1_label");
-    data->example2 = glade_xml_get_widget (xml, "example2_label");
+    data->prefix = GTK_WIDGET(gtk_builder_get_object (builder, "prefix_entry"));
+    data->interval = GTK_WIDGET(gtk_builder_get_object (builder, "interval_spin"));
+    data->example1 = GTK_WIDGET(gtk_builder_get_object (builder, "example1_label"));
+    data->example2 = GTK_WIDGET(gtk_builder_get_object (builder, "example2_label"));
 
     gtk_entry_set_text(GTK_ENTRY(data->prefix), xaccAccountGetCode(account));
     gnc_account_renumber_update_examples(data);
 
-    glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
-                                      data);
+    gtk_builder_connect_signals(builder, data);
 
     gtk_widget_show_all(data->dialog);
 }



More information about the gnucash-changes mailing list