[anjuta] project-wizard: Fix up vala-gtk template
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: Fix up vala-gtk template
- Date: Fri, 18 Mar 2011 22:34:51 +0000 (UTC)
commit dfd8a02d6cdcb0f9b47fe6fcd9a017bebb69d9ec
Author: Johannes Schmid <jhs gnome org>
Date: Fri Mar 18 18:02:42 2011 -0400
project-wizard: Fix up vala-gtk template
plugins/project-wizard/templates/vala-gtk.wiz.in | 1 +
.../templates/vala-gtk/src/Makefile.am | 2 +-
.../templates/vala-gtk/src/Makefile.am.tpl | 2 +-
.../templates/vala-gtk/src/config.vapi | 11 ++++
.../templates/vala-gtk/src/main.vala | 53 +++++++++++++-------
.../templates/vala-gtk/src/project.ui | 7 ++-
6 files changed, 53 insertions(+), 23 deletions(-)
---
diff --git a/plugins/project-wizard/templates/vala-gtk.wiz.in b/plugins/project-wizard/templates/vala-gtk.wiz.in
index f0ba1a8..372dd04 100644
--- a/plugins/project-wizard/templates/vala-gtk.wiz.in
+++ b/plugins/project-wizard/templates/vala-gtk.wiz.in
@@ -58,6 +58,7 @@
<directory source="src">
<file source="main.vala" destination="[+NameHLower+].vala"/>
<file source="project.ui" destination="[+NameHLower+].ui"/>
+ <file source="config.vapi" destination="config.vapi"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
</directory>
diff --git a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am
index 8c5ca9c..a6ddf8b 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am
+++ b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am
@@ -1,5 +1,5 @@
wizard_filesdir = $(anjuta_data_dir)/project/vala-gtk/src
-wizard_files_DATA = main.vala Makefile.am.tpl project.ui
+wizard_files_DATA = main.vala Makefile.am.tpl project.ui config.vapi
EXTRA_DIST = $(wizard_files_DATA)
-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
index f3b5601..6122ac7 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
@@ -17,7 +17,7 @@ AM_CFLAGS =\
-g
VALAFLAGS = [+IF (not (= (get "PackageModule2") ""))+] --pkg [+(string-substitute (get "PackageModule2") " " " --pkg ")+] [+ENDIF+] \
- --pkg gtk+-3.0
+ --pkg gtk+-3.0 --vapidir . --pkg config
bin_PROGRAMS = [+NameHLower+]
diff --git a/plugins/project-wizard/templates/vala-gtk/src/config.vapi b/plugins/project-wizard/templates/vala-gtk/src/config.vapi
new file mode 100644
index 0000000..ee98230
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-gtk/src/config.vapi
@@ -0,0 +1,11 @@
+[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
+namespace Config {
+ public const string GETTEXT_PACKAGE;
+ public const string SPRITE_DIR;
+ public const string BACKGROUND_DIR;
+ public const string PACKAGE_DATA_DIR;
+ public const string PACKAGE_LOCALE_DIR;
+ public const string PACKAGE_NAME;
+ public const string PACKAGE_VERSION;
+ public const string VERSION;
+}
diff --git a/plugins/project-wizard/templates/vala-gtk/src/main.vala b/plugins/project-wizard/templates/vala-gtk/src/main.vala
index 9b2902d..72fd87d 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/main.vala
+++ b/plugins/project-wizard/templates/vala-gtk/src/main.vala
@@ -13,28 +13,45 @@
using GLib;
using Gtk;
-public void on_destroy (Window window)
+public class Main : Object
{
- Gtk.main_quit();
-}
+ /*
+ * Uncomment this line when you are done testing and building a tarball
+ * or installing
+ */
+ //const string UI_FILE = Config.PACKAGE_DATA_DIR + "/" + "[+NameHLower+].ui";
+ const string UI_FILE = "src/[+NameHLower+].ui";
+
+ public Main ()
+ {
+ try
+ {
+ var builder = new Builder ();
+ builder.add_from_file (UI_FILE);
+ builder.connect_signals (this);
-int main (string[] args)
-{
- Gtk.init (ref args);
+ var window = builder.get_object ("window") as Window;
+ window.show_all ();
+ }
+ catch (Error e) {
+ stderr.printf ("Could not load UI: %s\n", e.message);
+ }
+ }
- try {
- var builder = new Builder ();
- builder.add_from_file ("[+NameHLower+].ui");
- builder.connect_signals (null);
+ [CCode (instance_pos = -1)]
+ public void on_destroy (Window window)
+ {
+ Gtk.main_quit();
+ }
- var window = builder.get_object ("window") as Window;
- window.show_all ();
- Gtk.main ();
- } catch (Error e) {
- stderr.printf ("Could not load UI: %s\n", e.message);
- return 1;
- }
+ static int main (string[] args)
+ {
+ Gtk.init (ref args);
+ var app = new Main ();
- return 0;
+ Gtk.main ();
+
+ return 0;
+ }
}
diff --git a/plugins/project-wizard/templates/vala-gtk/src/project.ui b/plugins/project-wizard/templates/vala-gtk/src/project.ui
index 1a54059..e04d298 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/project.ui
+++ b/plugins/project-wizard/templates/vala-gtk/src/project.ui
@@ -1,12 +1,13 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-naming-policy project-wide -->
+ <!-- interface-requires gtk+ 2.12 -->
<object class="GtkWindow" id="window">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">window</property>
<property name="default_width">500</property>
<property name="default_height">400</property>
- <signal name="destroy" handler="on_destroy"/>
+ <signal name="destroy" handler="main_on_destroy" swapped="no"/>
<child>
<placeholder/>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]