[anjuta] Migrate gtk wizard from libglade to GtkBuilder (GnomeBug:530740)
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] Migrate gtk wizard from libglade to GtkBuilder (GnomeBug:530740)
- Date: Sun, 12 Jul 2009 17:27:02 +0000 (UTC)
commit 2b67887363a6108d2f8d117b21ab0b7b2457a4a7
Author: Javier Jardón <javierjc1982 gmail com>
Date: Sun Jul 12 19:17:20 2009 +0200
Migrate gtk wizard from libglade to GtkBuilder (GnomeBug:530740)
plugins/project-wizard/templates/gtk.wiz | 5 +--
.../project-wizard/templates/gtk/src/Makefile.am | 2 +-
.../templates/gtk/src/Makefile.am.tpl | 10 +++---
plugins/project-wizard/templates/gtk/src/main.c | 27 ++++++++++++-------
.../project-wizard/templates/gtk/src/project.glade | 28 --------------------
.../project-wizard/templates/gtk/src/project.ui | 15 ++++++++++
6 files changed, 40 insertions(+), 47 deletions(-)
---
diff --git a/plugins/project-wizard/templates/gtk.wiz b/plugins/project-wizard/templates/gtk.wiz
index 73b957b..6605046 100644
--- a/plugins/project-wizard/templates/gtk.wiz
+++ b/plugins/project-wizard/templates/gtk.wiz
@@ -7,7 +7,6 @@
<required-program>autoconf</required-program>
<required-program>make</required-program>
<required-package>gtk+-2.0 >= 2.8</required-package>
- <required-package>libglade-2.0 >= 2.6.0</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="gtk+-2.0 >= 2.8 libglade-2.0 >= 2.6.0"/>
+ <property type="hidden" name="PackageModule1" default="gtk+-2.0 >= 2.12"/>
<property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++ support to the project so that C++ source files can be built" default="0"/>
<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"/>
@@ -76,7 +75,7 @@
<file source="main.c"/>
<file source="callbacks.c"/>
<file source="callbacks.h"/>
- <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/gtk/src/Makefile.am b/plugins/project-wizard/templates/gtk/src/Makefile.am
index 8d345bd..3af99b4 100644
--- a/plugins/project-wizard/templates/gtk/src/Makefile.am
+++ b/plugins/project-wizard/templates/gtk/src/Makefile.am
@@ -1,5 +1,5 @@
wizard_filesdir = $(anjuta_data_dir)/project/gtk/src
-wizard_files_DATA = main.c callbacks.c callbacks.h Makefile.am.tpl project.glade
+wizard_files_DATA = main.c callbacks.c callbacks.h Makefile.am.tpl project.ui
EXTRA_DIST = $(wizard_files_DATA)
-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl b/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
index 0207c04..3b65299 100644
--- a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtk/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"\" \
@@ -28,9 +28,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/gtk/src/main.c b/plugins/project-wizard/templates/gtk/src/main.c
index 229e355..8dddca4 100644
--- a/plugins/project-wizard/templates/gtk/src/main.c
+++ b/plugins/project-wizard/templates/gtk/src/main.c
@@ -19,7 +19,6 @@
#include <config.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
[+IF (=(get "HaveI18n") "1")+]
@@ -49,21 +48,29 @@
#include "callbacks.h"
-/* 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"
GtkWidget*
create_window (void)
{
GtkWidget *window;
- GladeXML *gxml;
-
- gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
-
+ GtkBuilder *builder;
+ GError* error = NULL;
+
+ builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
+ {
+ g_warning ("Couldn't load builder file: %s", error->message);
+ g_error_free (error);
+ }
+
/* This is important */
- glade_xml_signal_autoconnect (gxml);
- window = glade_xml_get_widget (gxml, "window");
+ gtk_builder_connect_signals (builder, NULL);
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+
+ g_object_unref (builder);
return window;
}
diff --git a/plugins/project-wizard/templates/gtk/src/project.ui b/plugins/project-wizard/templates/gtk/src/project.ui
new file mode 100644
index 0000000..9f2fb2d
--- /dev/null
+++ b/plugins/project-wizard/templates/gtk/src/project.ui
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.14"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window</property>
+ <property name="default_width">500</property>
+ <property name="default_height">400</property>
+ <signal name="destroy" handler="destroy" object="NULL"/>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]