[gucharmap] charmap: Port main to vala
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gucharmap] charmap: Port main to vala
- Date: Sat, 12 May 2012 15:03:28 +0000 (UTC)
commit eb3505fb3672493e753f848c471ddfce8043eac1
Author: Christian Persch <chpe gnome org>
Date: Sun Apr 29 23:11:18 2012 +0200
charmap: Port main to vala
gucharmap/Makefile.am | 22 +++++++++++++++++++++-
gucharmap/config.vapi | 7 +++++++
gucharmap/gucharmap-internal.h | 27 +++++++++++++++++++++++++++
gucharmap/gucharmap-window.c | 8 +++++---
gucharmap/gucharmap-window.h | 6 +++---
5 files changed, 63 insertions(+), 7 deletions(-)
---
diff --git a/gucharmap/Makefile.am b/gucharmap/Makefile.am
index 4b5b117..79ae331 100644
--- a/gucharmap/Makefile.am
+++ b/gucharmap/Makefile.am
@@ -111,6 +111,7 @@ nodist_libgucharmapinclude_HEADERS = \
noinst_LTLIBRARIES = libgucharmapprivate.la
libgucharmapprivate_la_SOURCES = \
+ gucharmap-internal.h \
gucharmap-mini-fontsel.c \
gucharmap-mini-fontsel.h \
gucharmap-print-operation.c \
@@ -150,12 +151,21 @@ else
noinst_PROGRAMS = gucharmap
endif
+gucharmap_DEPENDENCIES = \
+ libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la \
+ libgucharmapprivate.la
+ Gucharmap-$(GUCHARMAP_VAPI_VERSION).vapi \
+ Gucharmap-Private.vapi \
+ $(NULL)
+
gucharmap_SOURCES = \
- main.c \
+ config.vapi \
+ charmap.vala \
$(NULL)
gucharmap_CPPFLAGS = \
-I$(top_srcdir) \
+ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
$(AM_CPPFLAGS)
@@ -166,6 +176,12 @@ gucharmap_CFLAGS = \
gucharmap_LDFLAGS = \
$(AM_LDFLAGS)
+gucharmap_VALAFLAGS = \
+ --pkg glib-2.0 \
+ --pkg gtk+-3.0 \
+ --vapidir . --pkg Gucharmap-$(GUCHARMAP_VAPI_VERSION) --pkg Gucharmap-Private \
+ $(AM_VALAFLAGS)
+
gucharmap_LDADD = \
libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la \
libgucharmapprivate.la \
@@ -240,6 +256,8 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
INTROSPECTION_GIRS = Gucharmap-$(GUCHARMAP_GIR_VERSION).gir Gucharmap-Private.gir
Gucharmap- GUCHARMAP_GIR_VERSION@.gir: libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la
+Gucharmap_ GUCHARMAP_GIR_VERSION_U@_gir_EXPORT_PACKAGES = gucharmap-$(GUCHARMAP_API_PC_VERSION)
+Gucharmap_ GUCHARMAP_GIR_VERSION_U@_gir_SCANNERFLAGS = --c-include "gucharmap/gucharmap.h"
Gucharmap_ GUCHARMAP_GIR_VERSION_U@_gir_INCLUDES = Pango-1.0 Gdk-$(GTK_API_VERSION) Gtk-$(GTK_API_VERSION)
Gucharmap_ GUCHARMAP_GIR_VERSION_U@_gir_CFLAGS = $(GTK_CFLAGS) -DGUCHARMAP_COMPILATION -I$(top_srcdir) -I$(top_builddir)
Gucharmap_ GUCHARMAP_GIR_VERSION_U@_gir_LIBS = libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la
@@ -251,7 +269,9 @@ Gucharmap_Private_gir_CFLAGS = $(GTK_CFLAGS) -DGUCHARMAP_COMPILATION -I$(top_src
Gucharmap_Private_gir_LIBS = libgucharmapprivate.la
Gucharmap_Private_gir_NAMESPACE = GucharmapPrivate
Gucharmap_Private_gir_VERSION = $(GUCHARMAP_GIR_VERSION)
+Gucharmap_Private_gir_EXPORT_PACKAGES =
Gucharmap_Private_gir_SCANNERFLAGS = \
+ --c-include "gucharmap-internal.h" \
--identifier-prefix=Gucharmap \
--symbol-prefix=gucharmap \
--include-uninstalled ./Gucharmap-$(GUCHARMAP_GIR_VERSION).gir \
diff --git a/gucharmap/config.vapi b/gucharmap/config.vapi
new file mode 100644
index 0000000..9b20284
--- /dev/null
+++ b/gucharmap/config.vapi
@@ -0,0 +1,7 @@
+[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
+namespace Config
+{
+ public const string GETTEXT_PACKAGE;
+ public const string LOCALEDIR;
+ public const string VERSION;
+}
diff --git a/gucharmap/gucharmap-internal.h b/gucharmap/gucharmap-internal.h
new file mode 100644
index 0000000..1cdc864
--- /dev/null
+++ b/gucharmap/gucharmap-internal.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright  2012 Christian Persch
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GUCHARMAP_INTERNAL_H__
+#define __GUCHARMAP_INTERNAL_H__
+
+#include "gucharmap-mini-fontsel.h"
+#include "gucharmap-print-operation.h"
+#include "gucharmap-search-dialog.h"
+#include "gucharmap-settings.h"
+#include "gucharmap-window.h"
+
+#endif /* __GUCHARMAP_INTERNAL_H__ */
diff --git a/gucharmap/gucharmap-window.c b/gucharmap/gucharmap-window.c
index 88cf729..900900c 100644
--- a/gucharmap/gucharmap-window.c
+++ b/gucharmap/gucharmap-window.c
@@ -37,7 +37,7 @@
static void gucharmap_window_class_init (GucharmapWindowClass *klass);
static void gucharmap_window_init (GucharmapWindow *window);
-G_DEFINE_TYPE (GucharmapWindow, gucharmap_window, GTK_TYPE_WINDOW)
+G_DEFINE_TYPE (GucharmapWindow, gucharmap_window, GTK_TYPE_APPLICATION_WINDOW)
static void
show_error_dialog (GtkWindow *parent,
@@ -994,9 +994,11 @@ gucharmap_window_class_init (GucharmapWindowClass *klass)
/* Public API */
GtkWidget *
-gucharmap_window_new (void)
+gucharmap_window_new (GApplication *application)
{
- return GTK_WIDGET (g_object_new (gucharmap_window_get_type (), NULL));
+ return g_object_new (GUCHARMAP_TYPE_WINDOW,
+ "application", application,
+ NULL);
}
void
diff --git a/gucharmap/gucharmap-window.h b/gucharmap/gucharmap-window.h
index e75f2eb..fe1bd4e 100644
--- a/gucharmap/gucharmap-window.h
+++ b/gucharmap/gucharmap-window.h
@@ -38,7 +38,7 @@ typedef struct _GucharmapWindowClass GucharmapWindowClass;
struct _GucharmapWindow
{
- GtkWindow parent;
+ GtkApplicationWindow parent;
GSettings *settings;
GucharmapCharmap *charmap;
@@ -63,14 +63,14 @@ struct _GucharmapWindow
struct _GucharmapWindowClass
{
- GtkWindowClass parent_class;
+ GtkApplicationWindowClass parent_class;
};
#define GUCHARMAP_ICON_NAME "accessories-character-map"
GType gucharmap_window_get_type (void);
-GtkWidget * gucharmap_window_new (void);
+GtkWidget * gucharmap_window_new (GApplication *application);
void gucharmap_window_set_font (GucharmapWindow *guw,
const char *font);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]