[anjuta] Migrate anjuta vala plugin wizard from libglade to GtkBuilder (GnomeBug:530740)
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjuta] Migrate anjuta vala plugin wizard from libglade to GtkBuilder (GnomeBug:530740)
- Date: Sun, 12 Jul 2009 18:53:37 +0000 (UTC)
commit 342c56b9c0e05649d7fac13507dc28f00f2eac97
Author: Javier Jardón <javierjc1982 gmail com>
Date: Sun Jul 12 20:52:45 2009 +0200
Migrate anjuta vala plugin wizard from libglade to GtkBuilder (GnomeBug:530740)
.../templates/anjuta-plugin-vala.wiz | 6 ++--
.../anjuta-plugin-vala/src/Makefile.am.tpl | 12 ++++----
.../templates/anjuta-plugin-vala/src/plugin.vala | 27 +++++++++++++------
.../templates/translatable-strings.h | 3 +-
4 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/plugins/project-wizard/templates/anjuta-plugin-vala.wiz b/plugins/project-wizard/templates/anjuta-plugin-vala.wiz
index 4a3a47a..d80a440 100644
--- a/plugins/project-wizard/templates/anjuta-plugin-vala.wiz
+++ b/plugins/project-wizard/templates/anjuta-plugin-vala.wiz
@@ -34,7 +34,7 @@
<property type="string" name="PluginClass" _label="Plugin Class Name:" _description="Plugin class name" default="AnjutaFoobarPlugin" summary="yes" mandatory="yes"/>
<property type="string" name="PluginDependencies" _label="Plugin Dependencies:" _description="Comma separated, other plugins that this plugin depends on. It could be either primary interface name or plugin location (library:class)" default="" summary="yes"/>
<property type="icon" name="Icon" _label="Icon File:" _description="Icon file for the plugin" summary="yes" mandatory="yes"/>
- <property type="boolean" name="HasGladeFile" _label="Create glade interface file" _description="Create a template glade interface file" default="1"/>
+ <property type="boolean" name="HasGladeFile" _label="Create Gtk Builder interface file" _description="Create a template gtk builder interface file" default="1"/>
<property type="boolean" name="HasUI" _label="Plugin has menus or/and toolbars" _description="Whether the plugin has menus or toolbars" default="1"/>
<property type="hidden" name="HaveI18n" default="1"/>
<property type="hidden" name="HaveSharedlib" default="1"/>
@@ -89,10 +89,10 @@
<file source="[+Icon+]" destination="[+NameHLower+].png"/>
<file source="plugin.plugin.in" destination="[+NameHLower+].plugin.in"/>
[+IF (=(get "HasUI") "1")+]
- <file source="plugin.ui" destination="[+NameHLower+].ui"/>
+ <file source="plugin.xml" destination="[+NameHLower+].xml"/>
[+ENDIF+]
[+IF (=(get "HasGladeFile") "1")+]
- <file source="plugin.glade" destination="[+NameHLower+].glade"/>
+ <file source="plugin.ui" destination="[+NameHLower+].ui"/>
[+ENDIF+]
</directory>
</directory>
diff --git a/plugins/project-wizard/templates/anjuta-plugin-vala/src/Makefile.am.tpl b/plugins/project-wizard/templates/anjuta-plugin-vala/src/Makefile.am.tpl
index 3c3ca71..dacb3ef 100644
--- a/plugins/project-wizard/templates/anjuta-plugin-vala/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/anjuta-plugin-vala/src/Makefile.am.tpl
@@ -2,13 +2,13 @@
# Sample Makefile for a anjuta plugin.
[+IF (=(get "HasUI") "1")+]
# Plugin UI file
-[+NameCLower+]_uidir = $(anjuta_ui_dir)
-[+NameCLower+]_ui_DATA = [+NameHLower+].ui
+[+NameCLower+]_xmldir = $(anjuta_ui_dir)
+[+NameCLower+]_xml_DATA = [+NameHLower+].xml
[+ENDIF+]
[+IF (=(get "HasGladeFile") "1")+]
# Plugin Glade file
-[+NameCLower+]_gladedir = $(anjuta_glade_dir)
-[+NameCLower+]_glade_DATA = [+NameHLower+].glade
+[+NameCLower+]_uidir = $(anjuta_glade_dir)
+[+NameCLower+]_ui_DATA = [+NameHLower+].ui
[+ENDIF+]
# Plugin Icon file
[+NameCLower+]_pixmapsdir = $(anjuta_image_dir)
@@ -69,6 +69,6 @@ lib[+NameCLower+]_la_LIBADD = \
EXTRA_DIST = \
$(plugin_in_files) \
$([+NameCLower+]_plugin_DATA) \
- [+IF (=(get "HasUI") "1")+]$([+NameCLower+]_ui_DATA)[+ENDIF+] \
- [+IF (=(get "HasGladeFile") "1")+]$([+NameCLower+]_glade_DATA)[+ENDIF+] \
+ [+IF (=(get "HasUI") "1")+]$([+NameCLower+]_xml_DATA)[+ENDIF+] \
+ [+IF (=(get "HasGladeFile") "1")+]$([+NameCLower+]_ui_DATA)[+ENDIF+] \
$([+NameCLower+]_pixmaps_DATA)
diff --git a/plugins/project-wizard/templates/anjuta-plugin-vala/src/plugin.vala b/plugins/project-wizard/templates/anjuta-plugin-vala/src/plugin.vala
index d63e532..5f6d736 100644
--- a/plugins/project-wizard/templates/anjuta-plugin-vala/src/plugin.vala
+++ b/plugins/project-wizard/templates/anjuta-plugin-vala/src/plugin.vala
@@ -2,7 +2,7 @@
/*
* plugin.vala
* Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
- *
+ *
[+CASE (get "License") +]
[+ == "BSD" +][+(bsd (get "Name") (get "Author") " * ")+]
[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
@@ -14,14 +14,14 @@ using Anjuta;
public class [+PluginClass+] : Plugin {
[+IF (=(get "HasUI") "1") +]
- static string UI_FILE;
+ static string XML_FILE;
[+ENDIF+][+IF (=(get "HasGladeFile") "1") +]
- static string GLADE_FILE;
+ static string UI_FILE;
[+ENDIF+][+IF (or (=(get "HasUI") "1") (=(get "HasGladeFile") "1") ) +]
static construct {
// workaround for bug 538166, should be const
-[+IF (=(get "HasUI") "1") +] UI_FILE = Config.ANJUTA_DATA_DIR + "/ui/[+NameHLower+].ui";
-[+ ENDIF +][+IF (=(get "HasGladeFile") "1") +] GLADE_FILE = Config.ANJUTA_DATA_DIR + "/glade/[+NameHLower+].glade";
+[+IF (=(get "HasUI") "1") +] XML_FILE = Config.ANJUTA_DATA_DIR + "/ui/[+NameHLower+].xml";
+[+ ENDIF +][+IF (=(get "HasGladeFile") "1") +] UI_FILE = Config.ANJUTA_DATA_DIR + "/glade/[+NameHLower+].ui";
[+ ENDIF +]
}
[+ ENDIF +]
@@ -64,14 +64,23 @@ public class [+PluginClass+] : Plugin {
actions_file,
Config.GETTEXT_PACKAGE, true,
this);
- uiid = ui.merge (UI_FILE);
+ uiid = ui.merge (XML_FILE);
[+ENDIF+][+IF (=(get "HasGladeFile") "1") +]
/* Add plugin widgets to Shell */
- var gxml = new Glade.XML (GLADE_FILE, "top_widget", null);
- widget = gxml.get_widget ("top_widget");
- shell.add_widget (widget, "[+PluginClass+]Widget",
+ try {
+ var builder = new Builder ();
+ builder.add_from_file (UI_FILE);
+
+ widget = builder.get_object ("top_widget") as widget;
+
+ shell.add_widget (widget, "[+PluginClass+]Widget",
_("[+PluginClass+] widget"), null,
ShellPlacement.BOTTOM);
+ } catch (Error e) {
+ stderr.printf ("Could not load UI: %s\n", e.message);
+ return false;
+ }
+
[+ENDIF+]
return true;
}
diff --git a/plugins/project-wizard/templates/translatable-strings.h b/plugins/project-wizard/templates/translatable-strings.h
index d5f8d17..587c595 100644
--- a/plugins/project-wizard/templates/translatable-strings.h
+++ b/plugins/project-wizard/templates/translatable-strings.h
@@ -29,8 +29,7 @@ char *s = N_("Configure external packages");
char *s = N_("Configure external packages:");
char *s = N_("Create Gtk Builder interface file");
char *s = N_("Create a template Gtk Builder interface file");
-char *s = N_("Create a template glade interface file");
-char *s = N_("Create glade interface file");
+char *s = N_("Create a template gtk builder interface file");
char *s = N_("Description:");
char *s = N_("Destination:");
char *s = N_("Display description of the applet");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]