[anjuta] Migrate gtkmm plugin wizard from libglade to GtkBuilder (GnomeBug:530740)



commit 0bf4c9b82de3114096507dabd9cf744ceb215e9e
Author: Javier Jardón <javierjc1982 gmail com>
Date:   Sun Jul 12 20:00:14 2009 +0200

    Migrate gtkmm plugin wizard from libglade to GtkBuilder (GnomeBug:530740)

 plugins/project-wizard/templates/gtkmm.wiz         |    7 ++---
 .../project-wizard/templates/gtkmm/src/Makefile.am |    2 +-
 .../templates/gtkmm/src/Makefile.am.tpl            |   10 +++---
 plugins/project-wizard/templates/gtkmm/src/main.cc |   17 ++++++------
 .../templates/gtkmm/src/project.glade              |   27 --------------------
 .../templates/gtkmm/src/project.gladep             |    8 ------
 .../project-wizard/templates/gtkmm/src/project.ui  |   14 ++++++++++
 7 files changed, 31 insertions(+), 54 deletions(-)
---
diff --git a/plugins/project-wizard/templates/gtkmm.wiz b/plugins/project-wizard/templates/gtkmm.wiz
index 089118d..611ea4b 100644
--- a/plugins/project-wizard/templates/gtkmm.wiz
+++ b/plugins/project-wizard/templates/gtkmm.wiz
@@ -6,8 +6,7 @@
 	<required-program>automake</required-program>
 	<required-program>autoconf</required-program>
 	<required-program>make</required-program>
-	<required-package>gtkmm-2.4 >= 2.8</required-package>
-	<required-package>libglademm-2.4 >= 2.6</required-package>
+	<required-package>gtkmm-2.4 >= 2.12</required-package>
 </project-wizard>
 
 <page name="basic" _label="Basic information" _description="General Project Information">
@@ -31,7 +30,7 @@
 	<property type="hidden" name="NameCLower" default="[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]"/>
 	<property type="hidden" name="NameHLower" default="[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]"/>
 	<property type="hidden" name="HavePackage" default="1"/>
-	<property type="hidden" name="PackageModule1" default="gtkmm-2.4 >= 2.8 libglademm-2.4 >= 2.6"/>
+	<property type="hidden" name="PackageModule1" default="gtkmm-2.4 >= 2.12"/>
 	<property type="boolean" name="HaveI18n" _label="Add internationalization:" _description="Adds support for internationalization so that your project can have translations in different languages" default="1"/>
 	<property type="boolean" name="HaveSharedlib" _label="Add shared library support:" _description="Adds support for building shared libraries in your project" default="1"/>
 	<property type="boolean" name="HaveGtkDoc" _label="Add gtk-doc system:" _description="gtk-doc is used to compile API documentations for GObject based classes" default="0"/>
@@ -75,7 +74,7 @@
 	<directory source="gtkmm" destination="[+Destination+]">
 		<directory source="src">
 			<file source="main.cc"/>
-			<file source="project.glade" destination="[+NameHLower+].glade"/>
+			<file source="project.ui" destination="[+NameHLower+].ui"/>
 			<file source="Makefile.am.tpl" destination="Makefile.am"/>
 		</directory>
 	</directory>
diff --git a/plugins/project-wizard/templates/gtkmm/src/Makefile.am b/plugins/project-wizard/templates/gtkmm/src/Makefile.am
index 5ddd8dd..e30e5f0 100644
--- a/plugins/project-wizard/templates/gtkmm/src/Makefile.am
+++ b/plugins/project-wizard/templates/gtkmm/src/Makefile.am
@@ -1,5 +1,5 @@
 wizard_filesdir = $(anjuta_data_dir)/project/gtkmm/src
-wizard_files_DATA = main.cc Makefile.am.tpl project.glade
+wizard_files_DATA = main.cc Makefile.am.tpl project.ui
 EXTRA_DIST = $(wizard_files_DATA)
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl b/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
index ef0e12f..b0f2448 100644
--- a/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtkmm/src/Makefile.am.tpl
@@ -3,8 +3,8 @@
 
 ## Created by Anjuta
 
-gladedir = $(datadir)/[+NameHLower+]/glade
-glade_DATA = [+NameHLower+].glade
+uidir = $(datadir)/[+NameHLower+]/ui
+ui_DATA = [+NameHLower+].ui
 
 AM_CPPFLAGS = \
 	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@@ -25,9 +25,9 @@ bin_PROGRAMS = [+NameHLower+]
 
 [+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
 
-EXTRA_DIST = $(glade_DATA)
+EXTRA_DIST = $(ui_DATA)
 
-# Remove glade directory on uninstall
+# Remove ui directory on uninstall
 uninstall-local:
-	-rm -r $(gladedir)
+	-rm -r $(uidir)
 	-rm -r $(datadir)/[+NameHLower+]
diff --git a/plugins/project-wizard/templates/gtkmm/src/main.cc b/plugins/project-wizard/templates/gtkmm/src/main.cc
index be65f58..0b23cb3 100644
--- a/plugins/project-wizard/templates/gtkmm/src/main.cc
+++ b/plugins/project-wizard/templates/gtkmm/src/main.cc
@@ -10,7 +10,6 @@
 [+ == "GPL"  +][+(gpl  (get "Name")                " * ")+]
 [+ESAC+] */
 
-#include <libglademm/xml.h>
 #include <gtkmm.h>
 #include <iostream>
 
@@ -20,9 +19,9 @@
 #endif
 [+ENDIF+]
 
-/* For testing propose use the local (not installed) glade file */
-/* #define GLADE_FILE PACKAGE_DATA_DIR"/[+NameHLower+]/glade/[+NameHLower+].glade" */
-#define GLADE_FILE "src/[+NameHLower+].glade"
+/* For testing propose use the local (not installed) ui file */
+/* #define UI_FILE PACKAGE_DATA_DIR"/[+NameHLower+]/ui/[+NameHLower+].ui" */
+#define UI_FILE "src/[+NameHLower+].ui"
    
 int
 main (int argc, char *argv[])
@@ -30,18 +29,18 @@ main (int argc, char *argv[])
 	Gtk::Main kit(argc, argv);
 	
 	//Load the Glade file and instiate its widgets:
-	Glib::RefPtr<Gnome::Glade::Xml> refXml;
+	Glib::RefPtr<Gtk::Builder> builder;
 	try
 	{
-		refXml = Gnome::Glade::Xml::create(GLADE_FILE);
+		builder = Gtk::Builder::create_from_file(UI_FILE);
 	}
-	catch(const Gnome::Glade::XmlError& ex)
-    {
+	catch (const Glib::FileError & ex)
+	{
 		std::cerr << ex.what() << std::endl;
 		return 1;
 	}
 	Gtk::Window* main_win = 0;
-	refXml->get_widget("main_window", main_win);
+	builder->get_widget("main_window", main_win);
 	if (main_win)
 	{
 		kit.run(*main_win);
diff --git a/plugins/project-wizard/templates/gtkmm/src/project.ui b/plugins/project-wizard/templates/gtkmm/src/project.ui
new file mode 100644
index 0000000..8713d19
--- /dev/null
+++ b/plugins/project-wizard/templates/gtkmm/src/project.ui
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.12 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="main_window">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Hello World!</property>
+    <property name="default_width">500</property>
+    <property name="default_height">400</property>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
+</interface>



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