[anjuta] project-wizard: Add an option to not use Gtk.Builder to vala wizard
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: Add an option to not use Gtk.Builder to vala wizard
- Date: Sat, 19 Mar 2011 02:31:24 +0000 (UTC)
commit 3ca3c8f096b4b15a6a4d76b1621c38d7db10e4d3
Author: Johannes Schmid <jhs gnome org>
Date: Fri Mar 18 22:27:53 2011 -0400
project-wizard: Add an option to not use Gtk.Builder to vala wizard
plugins/project-wizard/templates/js.wiz.in | 3 -
.../templates/js_minimal/configure.ac.tpl | 43 --
.../templates/js_minimal/src/Makefile.am | 2 +-
.../templates/js_minimal/src/Makefile.am.tpl | 24 +-
.../templates/js_minimal/src/debug.c | 523 --------------------
.../templates/js_minimal/src/debug.h | 22 -
.../project-wizard/templates/js_minimal/src/main.c | 46 --
.../templates/js_minimal/src/main.js | 7 +-
plugins/project-wizard/templates/vala-gtk.wiz.in | 3 +
.../templates/vala-gtk/src/Makefile.am.tpl | 4 +
.../templates/vala-gtk/src/main.vala | 12 +-
11 files changed, 22 insertions(+), 667 deletions(-)
---
diff --git a/plugins/project-wizard/templates/js.wiz.in b/plugins/project-wizard/templates/js.wiz.in
index 3d225a5..1340e91 100644
--- a/plugins/project-wizard/templates/js.wiz.in
+++ b/plugins/project-wizard/templates/js.wiz.in
@@ -40,9 +40,6 @@
</directory>
<directory source="js_minimal" destination="[+Destination+]">
<directory source="src" destination="src">
- <file source="main.c"/>
- <file source="debug.h"/>
- <file source="debug.c"/>
<file source="main.js"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
diff --git a/plugins/project-wizard/templates/js_minimal/configure.ac.tpl b/plugins/project-wizard/templates/js_minimal/configure.ac.tpl
index 3ec1ea7..1d10788 100644
--- a/plugins/project-wizard/templates/js_minimal/configure.ac.tpl
+++ b/plugins/project-wizard/templates/js_minimal/configure.ac.tpl
@@ -9,49 +9,6 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
-AC_PROG_CC
-
-PKG_CHECK_EXISTS([mozilla-js], [JS_PACKAGE=mozilla-js],
- [PKG_CHECK_EXISTS([xulrunner-js], [JS_PACKAGE=xulrunner-js], [JS_PACKAGE=firefox-js])])
-PKG_CHECK_MODULES(GJS,gtk+-2.0 gjs-gi-1.0 >= 0.6 $JS_PACKAGE)
-
-## some flavors of Firefox .pc only set sdkdir, not libdir
-FIREFOX_JS_SDKDIR=`$PKG_CONFIG --variable=sdkdir $JS_PACKAGE`
-FIREFOX_JS_LIBDIR=`$PKG_CONFIG --variable=libdir $JS_PACKAGE`
-
-## Ubuntu does not set libdir in mozilla-js.pc
-if test x"$FIREFOX_JS_LIBDIR" = x ; then
- ## Ubuntu returns xulrunner-devel as the sdkdir, but for the
- ## libdir we want the runtime location on the target system,
- ## so can't use -devel.
- ## The library is in the non-devel directory also.
- ## Don't ask me why it's in two places.
- FIREFOX_JS_LIBDIR=`echo "$FIREFOX_JS_SDKDIR" | sed -e 's/-devel//g'`
-
- if ! test -d "$FIREFOX_JS_LIBDIR" ; then
- FIREFOX_JS_LIBDIR=
- fi
-fi
-
-
-GJS_JS_DIR=`$PKG_CONFIG --variable=jsdir gjs-1.0`
-GJS_JS_NATIVE_DIR=`$PKG_CONFIG --variable=jsnativedir gjs-1.0`
-AC_SUBST(GJS_JS_DIR)
-AC_SUBST(FIREFOX_JS_LIBDIR)
-AC_SUBST(GJS_JS_NATIVE_DIR)
-
-AM_PATH_GLIB_2_0()
-G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-AC_SUBST(G_IR_SCANNER)
-G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-AC_SUBST(G_IR_COMPILER)
-G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
-AC_SUBST(G_IR_GENERATE)
-GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
-AC_SUBST(GIRDIR)
-TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
-AC_SUBST(TYPELIBDIR)
-
AM_PROG_LIBTOOL
AC_OUTPUT([
diff --git a/plugins/project-wizard/templates/js_minimal/src/Makefile.am b/plugins/project-wizard/templates/js_minimal/src/Makefile.am
index 3fba174..f7139e4 100644
--- a/plugins/project-wizard/templates/js_minimal/src/Makefile.am
+++ b/plugins/project-wizard/templates/js_minimal/src/Makefile.am
@@ -1,3 +1,3 @@
wizard_filesdir = $(anjuta_data_dir)/project/js_minimal/src
-wizard_files_DATA = main.c main.js Makefile.am.tpl debug.c debug.h
+wizard_files_DATA = main.js Makefile.am.tpl
EXTRA_DIST = $(wizard_files_DATA)
diff --git a/plugins/project-wizard/templates/js_minimal/src/Makefile.am.tpl b/plugins/project-wizard/templates/js_minimal/src/Makefile.am.tpl
index 89b942b..48d3864 100644
--- a/plugins/project-wizard/templates/js_minimal/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/js_minimal/src/Makefile.am.tpl
@@ -7,29 +7,7 @@ jsdir = $(pkgdatadir)
js_DATA = \
main.js
-AM_CPPFLAGS = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- -DTYPELIBDIR=\"$(TYPELIBDIR)\"
-
-AM_CFLAGS =\
- -Wall\
- -g \
- $(GJS_CFLAGS)\
- -DPKGLIBDIR=\"$(pkglibdir)\" \
- -DJSDIR=\"$(pkgdatadir)\"
-
-bin_PROGRAMS = [+NameHLower+]
-
-[+NameCLower+]_SOURCES = \
- main.c \
- debug.c debug.h
-
-[+NameCLower+]_LDFLAGS = \
- $(GJS_LIBS) \
- -R $(FIREFOX_JS_LIBDIR) -rdynamic
-
-[+NameCLower+]_LDADD = \
- $(GJS_LIBS)
+bin_SCRIPTs = main.js
EXTRA_DIST = $(js_DATA)
diff --git a/plugins/project-wizard/templates/js_minimal/src/main.js b/plugins/project-wizard/templates/js_minimal/src/main.js
old mode 100644
new mode 100755
index e255841..8fe9a72
--- a/plugins/project-wizard/templates/js_minimal/src/main.js
+++ b/plugins/project-wizard/templates/js_minimal/src/main.js
@@ -1,6 +1,5 @@
-const GLib = imports.gi.GLib;
+#!/usr/bin/gjs
-function start() {
- print("Hello World!");
-}
+const GLib = imports.gi.GLib;
+print("Hello World!");
diff --git a/plugins/project-wizard/templates/vala-gtk.wiz.in b/plugins/project-wizard/templates/vala-gtk.wiz.in
index 372dd04..049cd41 100644
--- a/plugins/project-wizard/templates/vala-gtk.wiz.in
+++ b/plugins/project-wizard/templates/vala-gtk.wiz.in
@@ -35,6 +35,7 @@
<property type="hidden" name="PackageModule1" default="gtk+-2.0 >= 2.16"/>
<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="HavePackageExtra" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
+ <property type="boolean" name="HaveBuilderUI" _label="Use GtkBuilder for user interface:" _description="Use GtkBuilder to create the user-interface in a graphical way and load it from xml files at runtime" default="1"/>
</page>
[+IF (=(get "HavePackageExtra") "1")+]
@@ -57,7 +58,9 @@
<file source="configure.ac.tpl" destination="configure.ac"/>
<directory source="src">
<file source="main.vala" destination="[+NameHLower+].vala"/>
+[+IF (=(get "HaveBuilderUI") "1")+]
<file source="project.ui" destination="[+NameHLower+].ui"/>
+[+ENDIF+]
<file source="config.vapi" destination="config.vapi"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
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 6122ac7..1ede88a 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/vala-gtk/src/Makefile.am.tpl
@@ -3,8 +3,10 @@
## Created by Anjuta
+[+IF (=(get "HaveBuilderUI") "1")+]
uidir = $(datadir)/[+NameHLower+]/ui
ui_DATA = [+NameHLower+].ui
+[+ENDIF+]
AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@@ -29,9 +31,11 @@ bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_LDADD = $([+NameCUpper+]_LIBS)
+[+IF (=(get "HaveBuilderUI") "1")+]
EXTRA_DIST = $(ui_DATA)
# Remove ui directory on uninstall
uninstall-local:
-rm -r $(uidir)
-rm -r $(datadir)/[+NameHLower+]
+[+ENDIF+]
\ No newline at end of file
diff --git a/plugins/project-wizard/templates/vala-gtk/src/main.vala b/plugins/project-wizard/templates/vala-gtk/src/main.vala
index 72fd87d..a82c454 100644
--- a/plugins/project-wizard/templates/vala-gtk/src/main.vala
+++ b/plugins/project-wizard/templates/vala-gtk/src/main.vala
@@ -15,16 +15,18 @@ using Gtk;
public class Main : Object
{
+[+IF (=(get "HaveBuilderUI") "1")+]
/*
* 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";
+[+ENDIF+]
-
public Main ()
{
+[+IF (=(get "HaveBuilderUI") "1")+]
try
{
var builder = new Builder ();
@@ -37,10 +39,16 @@ public class Main : Object
catch (Error e) {
stderr.printf ("Could not load UI: %s\n", e.message);
}
+[+ELSE+]
+ Window window = new Window();
+ window.set_title ("Hello World");
+ window.show_all();
+ window.destroy.connect(on_destroy);
+[+ENDIF+]
}
[CCode (instance_pos = -1)]
- public void on_destroy (Window window)
+ public void on_destroy (Widget window)
{
Gtk.main_quit();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]