[anjuta] project-wizard: gtk & gtkapplication - add switch to create project without GtkBuilder
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: gtk & gtkapplication - add switch to create project without GtkBuilder
- Date: Thu, 9 Dec 2010 22:41:05 +0000 (UTC)
commit 0eb805e9280af060c6b2b46de0e01cb5477f7502
Author: Johannes Schmid <jhs gnome org>
Date: Thu Dec 9 23:12:35 2010 +0100
project-wizard: gtk & gtkapplication - add switch to create project without GtkBuilder
plugins/project-wizard/templates/gtk.wiz.in | 7 +++++--
.../project-wizard/templates/gtk/po/POTFILES.in | 4 +---
.../templates/gtk/src/Makefile.am.tpl | 4 ++++
plugins/project-wizard/templates/gtk/src/main.c | 16 ++++++++++++++++
.../project-wizard/templates/gtkapplication.wiz.in | 3 +++
.../templates/gtkapplication/po/POTFILES.in | 6 +++---
.../templates/gtkapplication/src/Makefile.am.tpl | 4 ++++
.../templates/gtkapplication/src/application.c | 10 ++++++++--
8 files changed, 44 insertions(+), 10 deletions(-)
---
diff --git a/plugins/project-wizard/templates/gtk.wiz.in b/plugins/project-wizard/templates/gtk.wiz.in
index efb1c29..132c065 100644
--- a/plugins/project-wizard/templates/gtk.wiz.in
+++ b/plugins/project-wizard/templates/gtk.wiz.in
@@ -7,7 +7,7 @@
<required-program>automake</required-program>
<required-program>autoconf</required-program>
<required-program>make</required-program>
- <required-package>gtk+-3.0 >= 2.90.3</required-package>
+ <required-package>gtk+-3.0</required-package>
</project-wizard>
<page name="basic" _label="Basic information" _description="General Project Information">
@@ -31,12 +31,13 @@
<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+-3.0 >= 2.90.3"/>
+ <property type="hidden" name="PackageModule1" default="gtk+-3.0"/>
<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"/>
<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"/>
<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")+]
@@ -66,7 +67,9 @@
<directory source="gtk" destination="[+Destination+]">
<directory source="src">
<file source="main.c"/>
+[+IF (=(get "HaveBuilderUI") "1")+]
<file source="project.ui" destination="[+NameHLower+].ui"/>
+[+ENDIF+]
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
</directory>
diff --git a/plugins/project-wizard/templates/gtk/po/POTFILES.in b/plugins/project-wizard/templates/gtk/po/POTFILES.in
index 41ad205..ddb7fc3 100644
--- a/plugins/project-wizard/templates/gtk/po/POTFILES.in
+++ b/plugins/project-wizard/templates/gtk/po/POTFILES.in
@@ -1,6 +1,4 @@
[+ autogen5 template +]
# List of source files containing translatable strings.
-
src/main.c
-src/callbacks.c
-src/callbacks.h
+[type: gettext/glade]src/[+NameHLower+].ui
diff --git a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl b/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
index 56a2ad6..5e1db2e 100644
--- a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/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"\" \
@@ -26,9 +28,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/gtk/src/main.c b/plugins/project-wizard/templates/gtk/src/main.c
index 4be82fc..5b92bbb 100644
--- a/plugins/project-wizard/templates/gtk/src/main.c
+++ b/plugins/project-wizard/templates/gtk/src/main.c
@@ -17,6 +17,7 @@
#include <glib/gi18n.h>
[+ENDIF+]
+[+IF (=(get "HaveBuilderUI") "1")+]
/* 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"
@@ -57,6 +58,21 @@ create_window (void)
return window;
}
+[+ELSE+]
+static GtkWidget*
+create_window (void)
+{
+ GtkWidget *window;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "[+Name+]");
+
+ /* Exit when the window is closed */
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+
+ return window;
+}
+[+ENDIF+]
int
main (int argc, char *argv[])
diff --git a/plugins/project-wizard/templates/gtkapplication.wiz.in b/plugins/project-wizard/templates/gtkapplication.wiz.in
index d647643..b92de0d 100644
--- a/plugins/project-wizard/templates/gtkapplication.wiz.in
+++ b/plugins/project-wizard/templates/gtkapplication.wiz.in
@@ -38,6 +38,7 @@
<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"/>
<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")+]
@@ -69,7 +70,9 @@
<file source="main.c"/>
<file source="application.h" destination="[+NameLower+].h"/>
<file source="application.c" destination="[+NameLower+].c"/>
+ [+IF (=(get "HaveBuilderUI") "1")+]
<file source="project.ui" destination="[+NameHLower+].ui"/>
+ [+ENDIF+]
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
</directory>
diff --git a/plugins/project-wizard/templates/gtkapplication/po/POTFILES.in b/plugins/project-wizard/templates/gtkapplication/po/POTFILES.in
index 41ad205..a9ae4c7 100644
--- a/plugins/project-wizard/templates/gtkapplication/po/POTFILES.in
+++ b/plugins/project-wizard/templates/gtkapplication/po/POTFILES.in
@@ -1,6 +1,6 @@
[+ autogen5 template +]
# List of source files containing translatable strings.
-
src/main.c
-src/callbacks.c
-src/callbacks.h
+src/application.c
+src/application.h
+[type: gettext/glade]src/[+NameHLower+].ui
diff --git a/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl b/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
index 8aa9d8b..a286752 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtkapplication/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"\" \
@@ -28,9 +30,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+]
diff --git a/plugins/project-wizard/templates/gtkapplication/src/application.c b/plugins/project-wizard/templates/gtkapplication/src/application.c
index 720ad32..59935c4 100644
--- a/plugins/project-wizard/templates/gtkapplication/src/application.c
+++ b/plugins/project-wizard/templates/gtkapplication/src/application.c
@@ -14,9 +14,11 @@
#include <glib/gi18n.h>
[+ENDIF+]
+[+IF (=(get "HaveBuilderUI") "1")+]
/* 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"
+[+ENDIF+]
G_DEFINE_TYPE ([+NameCClass+], [+NameCLower+], GTK_TYPE_APPLICATION);
@@ -26,6 +28,7 @@ static void
GFile *file)
{
GtkWidget *window;
+[+IF (=(get "HaveBuilderUI") "1")+]
GtkBuilder *builder;
GError* error = NULL;
@@ -43,8 +46,11 @@ static void
/* Get the window object from the ui file */
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_unref (builder);
-
-
+[+ELSE+]
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "[+Name+]");
+[+ENDIF+]
+
gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));
if (file != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]