[gtranslator] Open-tran plugin using Gresource
- From: Daniel Mustieles GarcÃa <dmustieles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Open-tran plugin using Gresource
- Date: Thu, 12 Apr 2012 14:12:59 +0000 (UTC)
commit e25d6669d43d74747f4aba68564bd46049a0fef4
Author: Daniel Mustieles <daniel mustieles gmail com>
Date: Thu Apr 12 16:12:28 2012 +0200
Open-tran plugin using Gresource
plugins/open-tran/Makefile.am | 18 ++++++++-----
plugins/open-tran/gtr-open-tran-plugin.c | 32 +++++++++---------------
plugins/open-tran/gtr-open-tran.gresource.xml | 6 ++++
3 files changed, 29 insertions(+), 27 deletions(-)
---
diff --git a/plugins/open-tran/Makefile.am b/plugins/open-tran/Makefile.am
index 8c4ab54..bbe1b2c 100644
--- a/plugins/open-tran/Makefile.am
+++ b/plugins/open-tran/Makefile.am
@@ -9,23 +9,26 @@ INCLUDES = \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED)
+BUILT_SOURCES = \
+ gtr-open-tran-resources.c
+
plugin_LTLIBRARIES = libopentran.la
libopentran_la_SOURCES = \
gtr-open-tran-panel.c \
gtr-open-tran-panel.h\
gtr-open-tran-plugin.c \
- gtr-open-tran-plugin.h
+ gtr-open-tran-plugin.h \
+ $(BUILT_SOURCES)
libopentran_la_LDFLAGS = \
$(PLUGIN_LIBTOOL_FLAGS) \
$(GTRANSLATOR_LIBS) \
$(JSON_GLIB_LIBS)
-uidir = $(pkgdatadir)/ui
+gtr-open-tran-resources.c: gtr-open-tran.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies gtr-open-tran.gresource.xml)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source gtr-open-tran.gresource.xml
-ui_DATA = \
- gtr-open-tran-dialog.ui
pixmaps_dir = $(datadir)/pixmaps/gtranslator
pixmaps__DATA = \
@@ -56,13 +59,14 @@ gsettings_SCHEMAS = org.gnome.gtranslator.plugins.open-tran.gschema.xml
@GSETTINGS_RULES@
EXTRA_DIST = \
- $(ui_DATA) \
$(pixmaps__DATA) \
$(plugin_in_files) \
+ gtr-open-tran.gresource.xml \
+ gtr-ope-tran-dialog-ui \
org.gnome.gtranslator.plugins.open-tran.gschema.xml.in.in
-CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
-DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS) $(BUILT_SOURCES)
+DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS) $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
diff --git a/plugins/open-tran/gtr-open-tran-plugin.c b/plugins/open-tran/gtr-open-tran-plugin.c
index f8b5d57..eb32fad 100644
--- a/plugins/open-tran/gtr-open-tran-plugin.c
+++ b/plugins/open-tran/gtr-open-tran-plugin.c
@@ -204,9 +204,7 @@ get_configuration_dialog (GtrOpenTranPlugin * plugin)
{
GtrOpenTranPluginPrivate *priv = plugin->priv;
GtrOpenTranConfigureDialog *dlg;
- gboolean ret;
- GtkWidget *error_widget;
- gchar *path;
+ GtkBuilder *builder;
gchar *root_objects[] = {
"main_box",
NULL
@@ -215,23 +213,17 @@ get_configuration_dialog (GtrOpenTranPlugin * plugin)
dlg = g_slice_new (GtrOpenTranConfigureDialog);
dlg->settings = g_object_ref (priv->settings);
- path = gtr_dirs_get_ui_file ("gtr-open-tran-dialog.ui");
- ret = gtr_utils_get_ui_objects (path,
- root_objects,
- &error_widget,
- "main_box", &dlg->main_box,
- "search_code", &dlg->search_code_entry,
- "own_code", &dlg->own_code_entry,
- "use_mirror_server", &dlg->use_mirror_server_entry,
- "mirror_server_url", &dlg->mirror_server_url_entry,
- "mirror_server_frame", &dlg->mirror_server_frame_entry,
- NULL);
- if (!ret)
- {
- g_error (_("Error from configuration dialog %s"), path);
- }
-
- g_free (path);
+ builder = gtk_builder_new ();
+ gtk_builder_add_objects_from_resource (builder, "/org/gnome/gtranslator/plugins/open-tran/ui/gtr-open-tran-dialog.ui",
+ root_objects, NULL);
+ dlg->main_box = GTK_WIDGET (gtk_builder_get_object (builder, "main_box"));
+ g_object_ref (dlg->main_box);
+ dlg->search_code_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search_code"));
+ dlg->own_code_entry = GTK_WIDGET (gtk_builder_get_object (builder, "own_code"));
+ dlg->use_mirror_server_entry = GTK_WIDGET (gtk_builder_get_object (builder, "use_mirror_server"));
+ dlg->mirror_server_url_entry = GTK_WIDGET (gtk_builder_get_object (builder, "mirror_server_url"));
+ dlg->mirror_server_frame_entry = GTK_WIDGET (gtk_builder_get_object (builder, "mirror_server_frame"));
+ g_object_unref (builder);
g_settings_bind (dlg->settings,
GTR_SETTINGS_OWN_CODE,
diff --git a/plugins/open-tran/gtr-open-tran.gresource.xml b/plugins/open-tran/gtr-open-tran.gresource.xml
new file mode 100644
index 0000000..741185a
--- /dev/null
+++ b/plugins/open-tran/gtr-open-tran.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/gtranslator/plugins/open-tran/ui">
+ <file preprocess="xml-stripblanks">gtr-open-tran-dialog.ui</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]