r21147 - gnucash/trunk - Convert lot viewer GUI to gtkbuilder format

Geert Janssens gjanssens at code.gnucash.org
Wed Aug 10 17:10:30 EDT 2011


Author: gjanssens
Date: 2011-08-10 17:10:29 -0400 (Wed, 10 Aug 2011)
New Revision: 21147
Trac: http://svn.gnucash.org/trac/changeset/21147

Removed:
   gnucash/trunk/src/gnome/glade/lots.glade
Modified:
   gnucash/trunk/po/POTFILES.in
   gnucash/trunk/src/gnome/glade/Makefile.am
   gnucash/trunk/src/gnome/gtkbuilder/lots.glade
   gnucash/trunk/src/gnome/lot-viewer.c
Log:
Convert lot viewer GUI to gtkbuilder format

Modified: gnucash/trunk/po/POTFILES.in
===================================================================
--- gnucash/trunk/po/POTFILES.in	2011-08-10 21:10:03 UTC (rev 21146)
+++ gnucash/trunk/po/POTFILES.in	2011-08-10 21:10:29 UTC (rev 21147)
@@ -208,7 +208,6 @@
 src/gnome/dialog-sx-since-last-run.c
 src/gnome/dialog-tax-info.c
 src/gnome/glade/budget.glade
-src/gnome/glade/lots.glade
 src/gnome/glade/newuser.glade
 src/gnome/glade/print.glade
 src/gnome/glade/progress.glade

Modified: gnucash/trunk/src/gnome/glade/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome/glade/Makefile.am	2011-08-10 21:10:03 UTC (rev 21146)
+++ gnucash/trunk/src/gnome/glade/Makefile.am	2011-08-10 21:10:29 UTC (rev 21147)
@@ -1,7 +1,6 @@
 gladedir = $(GNC_GLADE_DIR)
 glade_DATA = \
 	budget.glade \
-	lots.glade \
 	newuser.glade \
 	print.glade \
 	progress.glade \

Deleted: gnucash/trunk/src/gnome/glade/lots.glade
===================================================================
--- gnucash/trunk/src/gnome/glade/lots.glade	2011-08-10 21:10:03 UTC (rev 21146)
+++ gnucash/trunk/src/gnome/glade/lots.glade	2011-08-10 21:10:29 UTC (rev 21147)
@@ -1,418 +0,0 @@
-<?xml version="1.0"?>
-<glade-interface>
-  <!-- interface-requires gtk+ 2.10 -->
-  <!-- interface-naming-policy toplevel-contextual -->
-  <widget class="GtkDialog" id="Lot Viewer Window">
-    <property name="visible">True</property>
-    <property name="title" translatable="yes">Lot Viewer</property>
-    <property name="default_width">600</property>
-    <property name="default_height">400</property>
-    <property name="type_hint">dialog</property>
-    <signal name="destroy" handler="lv_window_destroy_cb"/>
-    <signal name="response" handler="lv_response_cb"/>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox1">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <child>
-          <widget class="GtkVPaned" id="lot vpaned">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="orientation">vertical</property>
-            <property name="position">200</property>
-            <signal name="notify" handler="lv_paned_notify_cb"/>
-            <child>
-              <widget class="GtkHPaned" id="lot hpaned">
-                <property name="width_request">300</property>
-                <property name="height_request">100</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="border_width">3</property>
-                <property name="position">200</property>
-                <signal name="notify" handler="lv_paned_notify_cb"/>
-                <child>
-                  <widget class="GtkTable" id="table1">
-                    <property name="visible">True</property>
-                    <property name="n_rows">5</property>
-                    <child>
-                      <widget class="GtkEntry" id="lot title entry">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip" translatable="yes">Enter a name for the highlighted lot.</property>
-                        <signal name="changed" handler="lv_title_entry_changed_cb"/>
-                      </widget>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="y_options"></property>
-                        <property name="x_padding">12</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label19">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes"><b>_Notes</b></property>
-                        <property name="use_markup">True</property>
-                        <property name="use_underline">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="GtkScrolledWindow" id="scrolledwindow2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="vscrollbar_policy">never</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <widget class="GtkTextView" id="lot notes text">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="tooltip" translatable="yes">Enter any notes you want to make about this lot.</property>
-                            <property name="wrap_mode">word</property>
-                          </widget>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
-                        <property name="x_padding">12</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label20">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</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="GtkLabel" id="label8">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes"><b>_Title</b></property>
-                        <property name="use_markup">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="justify">center</property>
-                      </widget>
-                      <packing>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="resize">False</property>
-                    <property name="shrink">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkTable" id="table2">
-                    <property name="visible">True</property>
-                    <property name="n_rows">2</property>
-                    <child>
-                      <widget class="GtkLabel" id="label9">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes"><b>_Lots in This Account</b></property>
-                        <property name="use_markup">True</property>
-                        <property name="use_underline">True</property>
-                      </widget>
-                      <packing>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <widget class="GtkTreeView" id="lot view">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="rules_hint">True</property>
-                            <property name="enable_search">False</property>
-                          </widget>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_padding">12</property>
-                      </packing>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">True</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkTable" id="table3">
-                <property name="visible">True</property>
-                <property name="n_rows">2</property>
-                <child>
-                  <widget class="GtkLabel" id="label10">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes"><b>_Mini-Viewer</b></property>
-                    <property name="use_markup">True</property>
-                    <property name="use_underline">True</property>
-                  </widget>
-                  <packing>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkScrolledWindow" id="scrolledwindow4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hscrollbar_policy">automatic</property>
-                    <property name="vscrollbar_policy">automatic</property>
-                    <property name="shadow_type">in</property>
-                    <child>
-                      <widget class="GtkTreeView" id="split view">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="rules_hint">True</property>
-                        <property name="enable_search">False</property>
-                      </widget>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_padding">12</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <widget class="GtkButton" id="new lot button">
-                <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="alignment3">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <widget class="GtkHBox" id="hbox4">
-                        <property name="visible">True</property>
-                        <property name="spacing">2</property>
-                        <child>
-                          <widget class="GtkImage" id="image3">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-new</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="label21">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_New Lot</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">0</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="scrub account button">
-                <property name="response_id">4</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="alignment1">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <widget class="GtkHBox" id="hbox2">
-                        <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-clear</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="label16">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">Scrub _Account</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>
-            <child>
-              <widget class="GtkButton" id="scrub lot button">
-                <property name="response_id">3</property>
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Scrub the highlighted lot</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment2">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <widget class="GtkHBox" id="hbox3">
-                        <property name="visible">True</property>
-                        <property name="spacing">2</property>
-                        <child>
-                          <widget class="GtkImage" id="image2">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-clear</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="label17">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_Scrub</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">2</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="delete button">
-                <property name="label">gtk-delete</property>
-                <property name="response_id">2</property>
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip" translatable="yes">Delete the highlighted lot</property>
-                <property name="use_stock">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="button5">
-                <property name="label">gtk-close</property>
-                <property name="response_id">-7</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">4</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/lots.glade
===================================================================
--- gnucash/trunk/src/gnome/gtkbuilder/lots.glade	2011-08-10 21:10:03 UTC (rev 21146)
+++ gnucash/trunk/src/gnome/gtkbuilder/lots.glade	2011-08-10 21:10:29 UTC (rev 21147)
@@ -190,7 +190,12 @@
                     <property name="vscrollbar_policy">automatic</property>
                     <property name="shadow_type">in</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkTreeView" id="split view">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="rules_hint">True</property>
+                        <property name="enable_search">False</property>
+                      </object>
                     </child>
                   </object>
                   <packing>

Modified: gnucash/trunk/src/gnome/lot-viewer.c
===================================================================
--- gnucash/trunk/src/gnome/lot-viewer.c	2011-08-10 21:10:03 UTC (rev 21146)
+++ gnucash/trunk/src/gnome/lot-viewer.c	2011-08-10 21:10:29 UTC (rev 21147)
@@ -737,38 +737,42 @@
 static void
 lv_create (GNCLotViewer *lv)
 {
-    GladeXML *xml;
-    char win_title[251];
+    gchar *win_title;
     gint position;
+    GtkBuilder *builder;
 
-    xml = gnc_glade_xml_new ("lots.glade", "Lot Viewer Window");
-    lv->window = glade_xml_get_widget (xml, "Lot Viewer Window");
 
-    snprintf (win_title, 250, _("Lots in Account %s"),
-              xaccAccountGetName(lv->account));
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "lots.glade", "Lot Viewer Window");
+
+    lv->window = GTK_WIDGET(gtk_builder_get_object (builder, "Lot Viewer Window"));
+
+    win_title=g_strdup_printf (_("Lots in Account %s"),
+                               xaccAccountGetName(lv->account));
     gtk_window_set_title (GTK_WINDOW (lv->window), win_title);
+    g_free (win_title);
 
 #ifdef LOTS_READY_FOR_SHOWTIME
-    lv->regview_button = GTK_BUTTON(glade_xml_get_widget (xml, "regview button"));
+    lv->regview_button = GTK_BUTTON(glade_xml_get_widget (builder, "regview button"));
 #endif
-    lv->delete_button = GTK_BUTTON(glade_xml_get_widget (xml, "delete button"));
-    lv->scrub_lot_button = GTK_BUTTON(glade_xml_get_widget (xml, "scrub lot button"));
-    lv->new_lot_button = GTK_BUTTON(glade_xml_get_widget (xml, "new lot button"));
+    lv->delete_button = GTK_BUTTON(gtk_builder_get_object (builder, "delete button"));
+    lv->scrub_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "scrub lot button"));
+    lv->new_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "new lot button"));
 
-    lv->lot_view = GTK_TREE_VIEW(glade_xml_get_widget (xml, "lot view"));
+    lv->lot_view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "lot view"));
     lv_init_lot_view(lv);
-    lv->lot_notes = GTK_TEXT_VIEW(glade_xml_get_widget (xml, "lot notes text"));
-    lv->title_entry = GTK_ENTRY (glade_xml_get_widget (xml, "lot title entry"));
+    lv->lot_notes = GTK_TEXT_VIEW(gtk_builder_get_object (builder, "lot notes text"));
+    lv->title_entry = GTK_ENTRY (gtk_builder_get_object (builder, "lot title entry"));
 
-    lv->split_view = GTK_TREE_VIEW(glade_xml_get_widget (xml, "split view"));
+    lv->split_view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "split view"));
     lv_init_split_view(lv);
 
-    lv->lot_vpaned = GTK_PANED (glade_xml_get_widget (xml, "lot vpaned"));
+    lv->lot_vpaned = GTK_PANED (gtk_builder_get_object (builder, "lot vpaned"));
     position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_VPOSITION, NULL);
     if (position)
         gtk_paned_set_position (lv->lot_vpaned, position);
 
-    lv->lot_hpaned = GTK_PANED (glade_xml_get_widget (xml, "lot hpaned"));
+    lv->lot_hpaned = GTK_PANED (gtk_builder_get_object (builder, "lot hpaned"));
     position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_HPOSITION, NULL);
     if (position)
         gtk_paned_set_position (lv->lot_hpaned, position);
@@ -776,9 +780,8 @@
     lv->selected_lot = NULL;
 
     /* Setup signals */
-    glade_xml_signal_autoconnect_full( xml,
-                                       gnc_glade_autoconnect_full_func,
-                                       lv);
+    gtk_builder_connect_signals(builder, lv);
+    g_object_unref(G_OBJECT(builder));
 
     gnc_restore_window_size(GCONF_SECTION, GTK_WINDOW(lv->window));
 }



More information about the gnucash-changes mailing list