[gtkmm-documentation] Gtk::Builder examples: Update the Glade files.



commit 2466f3312e5066ed26c433f595952eddaf0bcfc5
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue Oct 4 17:07:10 2011 +0200

    Gtk::Builder examples: Update the Glade files.
    
    * examples/book/builder/basic/basic.glade:
    * examples/book/builder/derived/derived.glade: Rename from basic.ui.
    Replace "libglademm" in the label text with "Glade and Gtk::Builder".
    * examples/Makefile.am: Change the file names of the Glade files.
    * examples/book/builder/basic/main.cc:
    * examples/book/builder/derived/main.cc: Change name of loaded Glade file.
    Catch Glib::MarkupError exceptions from Gtk::Builder::add_from_file().
    Bug #658265.

 ChangeLog                                   |   13 +++++
 examples/Makefile.am                        |    4 +-
 examples/book/builder/basic/basic.glade     |   63 +++++++++++++++++++++++
 examples/book/builder/basic/basic.ui        |   72 ---------------------------
 examples/book/builder/basic/main.cc         |    9 +++-
 examples/book/builder/derived/basic.ui      |   72 ---------------------------
 examples/book/builder/derived/derived.glade |   63 +++++++++++++++++++++++
 examples/book/builder/derived/main.cc       |   10 +++-
 8 files changed, 156 insertions(+), 150 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3a5ebef..0d23595 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-10-04  Kjell Ahlstedt <kjell ahlstedt bredband net>
 
+	Gtk::Builder examples: Update the Glade files.
+
+	* examples/book/builder/basic/basic.glade:
+	* examples/book/builder/derived/derived.glade: Rename from basic.ui.
+	Replace "libglademm" in the label text with "Glade and Gtk::Builder".
+	* examples/Makefile.am: Change the file names of the Glade files.
+	* examples/book/builder/basic/main.cc:
+	* examples/book/builder/derived/main.cc: Change name of loaded Glade file.
+	Catch Glib::MarkupError exceptions from Gtk::Builder::add_from_file().
+	Bug #658265.
+
+2011-10-04  Kjell Ahlstedt <kjell ahlstedt bredband net>
+
 	Update the Recently Used Documents chapter to gtkmm3 status.
 
 	* examples/book/recent_files/examplewindow.[h|cc]: Remove obsolete comments.
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 79fe631..11af541 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -114,8 +114,8 @@ check_PROGRAMS =					\
 dist_noinst_DATA =				\
 	README					\
 	book/README				\
-	book/builder/basic/basic.ui		\
-	book/builder/derived/basic.ui		\
+	book/builder/basic/basic.glade		\
+	book/builder/derived/derived.glade	\
 	book/buttons/button/info.xpm		\
 	book/custom/custom_widget/custom_gtk.css	\
 	book/drawingarea/image/fractal_image.png	\
diff --git a/examples/book/builder/basic/basic.glade b/examples/book/builder/basic/basic.glade
new file mode 100644
index 0000000..93d7572
--- /dev/null
+++ b/examples/book/builder/basic/basic.glade
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkDialog" id="DialogBasic">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Basic Builder example</property>
+    <property name="default_width">250</property>
+    <property name="default_height">100</property>
+    <property name="type_hint">normal</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="quit_button">
+                <property name="label">gtk-quit</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_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">This is a basic Glade and Gtk::Builder example</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">quit_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/examples/book/builder/basic/main.cc b/examples/book/builder/basic/main.cc
index b76c749..05346a6 100644
--- a/examples/book/builder/basic/main.cc
+++ b/examples/book/builder/basic/main.cc
@@ -18,13 +18,18 @@ int main (int argc, char **argv)
   Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
   try
   {
-    refBuilder->add_from_file("basic.ui");
+    refBuilder->add_from_file("basic.glade");
   }
   catch(const Glib::FileError& ex)
   {
     std::cerr << "FileError: " << ex.what() << std::endl;
     return 1;
   }
+  catch(const Glib::MarkupError& ex)
+  {
+    std::cerr << "MarkupError: " << ex.what() << std::endl;
+    return 1;
+  }
   catch(const Gtk::BuilderError& ex)
   {
     std::cerr << "BuilderError: " << ex.what() << std::endl;
@@ -46,5 +51,7 @@ int main (int argc, char **argv)
     kit.run(*pDialog);
   }
 
+  delete pDialog;
+
   return 0;
 }
diff --git a/examples/book/builder/derived/derived.glade b/examples/book/builder/derived/derived.glade
new file mode 100644
index 0000000..90c7c5e
--- /dev/null
+++ b/examples/book/builder/derived/derived.glade
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkDialog" id="DialogDerived">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Derived Builder example</property>
+    <property name="default_width">250</property>
+    <property name="default_height">100</property>
+    <property name="type_hint">normal</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="quit_button">
+                <property name="label">gtk-quit</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_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">This is a Glade and Gtk::Builder example with a derived widget</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">quit_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/examples/book/builder/derived/main.cc b/examples/book/builder/derived/main.cc
index dcf876b..112ff81 100644
--- a/examples/book/builder/derived/main.cc
+++ b/examples/book/builder/derived/main.cc
@@ -27,13 +27,18 @@ int main (int argc, char **argv)
   Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
   try
   {
-    refBuilder->add_from_file("basic.ui");
+    refBuilder->add_from_file("derived.glade");
   }
   catch(const Glib::FileError& ex)
   {
     std::cerr << "FileError: " << ex.what() << std::endl;
     return 1;
   }
+  catch(const Glib::MarkupError& ex)
+  {
+    std::cerr << "MarkupError: " << ex.what() << std::endl;
+    return 1;
+  }
   catch(const Gtk::BuilderError& ex)
   {
     std::cerr << "BuilderError: " << ex.what() << std::endl;
@@ -42,7 +47,7 @@ int main (int argc, char **argv)
 
   //Get the GtkBuilder-instantiated dialog::
   DerivedDialog* pDialog = 0;
-  refBuilder->get_widget_derived("DialogBasic", pDialog);
+  refBuilder->get_widget_derived("DialogDerived", pDialog);
   if(pDialog)
   {
     //Start:
@@ -50,7 +55,6 @@ int main (int argc, char **argv)
   }
 
   delete pDialog;
-    
 
   return 0;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]