[anjuta] project-wizard: ported gtk wizard to gtk+ 3.0
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] project-wizard: ported gtk wizard to gtk+ 3.0
- Date: Fri, 3 Dec 2010 09:51:35 +0000 (UTC)
commit ca095939cbf83d4c7e15f3ddeb20cfdae0abd0f3
Author: Johannes Schmid <jhs gnome org>
Date: Fri Dec 3 10:32:34 2010 +0100
project-wizard: ported gtk wizard to gtk+ 3.0
plugins/project-wizard/templates/gtk-logo.png | Bin 4293 -> 2169 bytes
plugins/project-wizard/templates/gtk.wiz.in | 8 +--
.../project-wizard/templates/gtk/src/Makefile.am | 2 +-
.../templates/gtk/src/Makefile.am.tpl | 2 -
.../project-wizard/templates/gtk/src/callbacks.c | 24 --------
.../project-wizard/templates/gtk/src/callbacks.h | 15 -----
plugins/project-wizard/templates/gtk/src/main.c | 56 +++++++-------------
7 files changed, 23 insertions(+), 84 deletions(-)
---
diff --git a/plugins/project-wizard/templates/gtk-logo.png b/plugins/project-wizard/templates/gtk-logo.png
index 90491af..9b4cf6c 100644
Binary files a/plugins/project-wizard/templates/gtk-logo.png and b/plugins/project-wizard/templates/gtk-logo.png differ
diff --git a/plugins/project-wizard/templates/gtk.wiz.in b/plugins/project-wizard/templates/gtk.wiz.in
index 4a6503e..2bab502 100644
--- a/plugins/project-wizard/templates/gtk.wiz.in
+++ b/plugins/project-wizard/templates/gtk.wiz.in
@@ -1,13 +1,13 @@
<project-template>
<project-wizard>
- <_name>GTK+</_name>
- <_description>A generic GTK+ project</_description>
+ <_name>GTK+ (simple)</_name>
+ <_description>Simple GTK+ project</_description>
<icon>gtk-logo.png</icon>
<category>C</category>
<required-program>automake</required-program>
<required-program>autoconf</required-program>
<required-program>make</required-program>
- <required-package>gtk+-2.0 >= 2.16</required-package>
+ <required-package>gtk+-3.0 >= 2.90.3</required-package>
</project-wizard>
<page name="basic" _label="Basic information" _description="General Project Information">
@@ -66,8 +66,6 @@
<directory source="gtk" destination="[+Destination+]">
<directory source="src">
<file source="main.c"/>
- <file source="callbacks.c"/>
- <file source="callbacks.h"/>
<file source="project.ui" destination="[+NameHLower+].ui"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
diff --git a/plugins/project-wizard/templates/gtk/src/Makefile.am b/plugins/project-wizard/templates/gtk/src/Makefile.am
index 3af99b4..eaecbba 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.ui
+wizard_files_DATA = main.c 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 3b65299..56a2ad6 100644
--- a/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
+++ b/plugins/project-wizard/templates/gtk/src/Makefile.am.tpl
@@ -19,8 +19,6 @@ AM_CFLAGS =\
bin_PROGRAMS = [+NameHLower+]
[+NameCLower+]_SOURCES = \
- callbacks.c \
- callbacks.h \
main.c
[+NameCLower+]_LDFLAGS = \
diff --git a/plugins/project-wizard/templates/gtk/src/main.c b/plugins/project-wizard/templates/gtk/src/main.c
index 8dddca4..4be82fc 100644
--- a/plugins/project-wizard/templates/gtk/src/main.c
+++ b/plugins/project-wizard/templates/gtk/src/main.c
@@ -10,55 +10,37 @@
[+ == "GPL" +][+(gpl (get "Name") " * ")+]
[+ESAC+] */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
#include <config.h>
-
#include <gtk/gtk.h>
-
[+IF (=(get "HaveI18n") "1")+]
-/*
- * Standard gettext macros.
- */
-#ifdef ENABLE_NLS
-# include <libintl.h>
-# undef _
-# define _(String) dgettext (PACKAGE, String)
-# ifdef gettext_noop
-# define N_(String) gettext_noop (String)
-# else
-# define N_(String) (String)
-# endif
-#else
-# define textdomain(String) (String)
-# define gettext(String) (String)
-# define dgettext(Domain,Message) (Message)
-# define dcgettext(Domain,Message,Type) (Message)
-# define bindtextdomain(Domain,Directory) (Domain)
-# define _(String) (String)
-# define N_(String) (String)
-#endif
+#include <glib/gi18n.h>
[+ENDIF+]
-
-#include "callbacks.h"
-
/* 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*
+
+/* Signal handlers */
+/* Note: These may not be declared static because signal autoconnection
+ * only works with non-static methods
+ */
+
+/* Called when the window is closed */
+void
+destroy (GtkWidget *widget, gpointer data)
+{
+ gtk_main_quit ();
+}
+
+static GtkWidget*
create_window (void)
{
GtkWidget *window;
GtkBuilder *builder;
GError* error = NULL;
+ /* Load UI from file */
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
{
@@ -66,16 +48,16 @@ create_window (void)
g_error_free (error);
}
- /* This is important */
+ /* Auto-connect signal handlers */
gtk_builder_connect_signals (builder, NULL);
- window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+ /* Get the window object from the ui file */
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_unref (builder);
return window;
}
-
int
main (int argc, char *argv[])
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]