gnome-keyring [PATCH 1/9] ui: use glib resources
- From: Lubomir Rintel <lkundrak v3 sk>
- To: gnome-keyring-list gnome org
- Cc: David Woodhouse <dwmw2 infradead org>, Prashant Tyagi <prashanttyagi221295 gmail com>, Lubomir Rintel <lkundrak v3 sk>
- Subject: gnome-keyring [PATCH 1/9] ui: use glib resources
- Date: Tue, 13 Dec 2016 19:20:02 +0100
It has some rather minor overhead advantages, but more importantly the
widget templates I'd like to use are not able to load .ui files from
files.
---
.gitignore | 2 ++
configure.ac | 1 +
ui/Makefile.am | 17 ++++++++---------
ui/gcr-pkcs11-import-dialog.c | 2 +-
ui/gcr-unlock-options-widget.c | 2 +-
ui/gcr.gresource.xml | 7 +++++++
6 files changed, 20 insertions(+), 11 deletions(-)
create mode 100644 ui/gcr.gresource.xml
diff --git a/.gitignore b/.gitignore
index ce969fc..5f1a46a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,6 +105,8 @@ stamp-*
/ui/gcr-viewer.desktop.in
/ui/gcr-*.deps
/ui/gcr-*.vapi
+/ui/gcr-resources.c
+/ui/gcr-resources.h
/po/Makefile.in.in
/po/*.sed
diff --git a/configure.ac b/configure.ac
index 990b575..4cd50d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,7 @@ AC_SUBST(GLIB_LIBS)
GLIB_GSETTINGS
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
GTK_DOC_CHECK(1.9)
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 6612f0d..c84ef8e 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -6,7 +6,8 @@ check-ui-symbols: gcr-ui-expected.abi gcr-ui-actual.abi
(echo "check-symbols: Symbols have CHANGED. Fix gcr-ui.symbols"; exit 1)
ui_BUILT_SOURCES = \
- ui/gcr-enum-types.c ui/gcr-enum-types.h
+ ui/gcr-enum-types.c ui/gcr-enum-types.h \
+ ui/gcr-resources.c ui/gcr-resources.h
BUILT_SOURCES += \
$(ui_BUILT_SOURCES)
@@ -17,7 +18,6 @@ libgcr_ui_@GCR_MAJOR@_la_CFLAGS = \
-DP11_KIT_API_SUBJECT_TO_CHANGE \
-DG_LOG_DOMAIN=\"Gcr\" \
-DGCR_COMPILATION \
- -DUIDIR=\""$(uidir)"\" \
$(P11_KIT_CFLAGS) \
$(GTK_CFLAGS)
@@ -42,12 +42,6 @@ install-exec-hook:
$(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so`
$(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@
$(LN_S) -f `readlink $(DESTDIR)$(libdir)/libgcr-ui-@GCR_MAJOR@.so`
$(DESTDIR)$(libdir)/libgcr-@GCR_MAJOR@.so.@GCR_CURRENT@.0.0
-uidir = $(datadir)/gcr-@GCR_MAJOR@/ui/
-
-ui_DATA = \
- ui/gcr-pkcs11-import-dialog.ui \
- ui/gcr-unlock-options-widget.ui
-
lib_LTLIBRARIES += \
libgcr-ui-@GCR_MAJOR@.la
@@ -131,6 +125,12 @@ ui/gcr-enum-types.h: $(ENUM_TEMPLATE_H) $(ui_HEADER_FILES)
ui/gcr-enum-types.c: $(ENUM_TEMPLATE_C) $(ui_HEADER_FILES)
$(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@
+ui/gcr-resources.h: ui/gcr.gresource.xml
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/ui --generate-header
--internal
+
+ui/gcr-resources.c: ui/gcr.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/ui
--generate-dependencies $(builddir)/ui/gcr.gresource.xml)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/ui --generate-source
--internal
+
gcr-ui-$(GCR_MAJOR).pc: ui/gcr-ui.pc
$(AM_V_GEN) cp ui/gcr-ui.pc gcr-ui-$(GCR_MAJOR).pc
gcr-$(GCR_MAJOR).pc: ui/gcr.pc
@@ -228,7 +228,6 @@ gcr_prompter_LDADD = \
EXTRA_DIST += \
ui/gcr.pc.in \
ui/gcr-ui.pc.in \
- $(ui_DATA) \
ui/gcr-ui.symbols \
$(desktop_in_in_files) \
$(mime_DATA) \
diff --git a/ui/gcr-pkcs11-import-dialog.c b/ui/gcr-pkcs11-import-dialog.c
index 0157f0a..46781a9 100644
--- a/ui/gcr-pkcs11-import-dialog.c
+++ b/ui/gcr-pkcs11-import-dialog.c
@@ -81,7 +81,7 @@ _gcr_pkcs11_import_dialog_constructed (GObject *obj)
G_OBJECT_CLASS (_gcr_pkcs11_import_dialog_parent_class)->constructed (obj);
- if (!gtk_builder_add_from_file (self->builder, UIDIR "gcr-pkcs11-import-dialog.ui", &error)) {
+ if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/gcr/ui/gcr-pkcs11-import-dialog.ui",
&error)) {
g_warning ("couldn't load ui builder file: %s", error->message);
return;
}
diff --git a/ui/gcr-unlock-options-widget.c b/ui/gcr-unlock-options-widget.c
index 1033fa1..c81862c 100644
--- a/ui/gcr-unlock-options-widget.c
+++ b/ui/gcr-unlock-options-widget.c
@@ -183,7 +183,7 @@ gcr_unlock_options_widget_constructor (GType type, guint n_props, GObjectConstru
if (obj) {
self = GCR_UNLOCK_OPTIONS_WIDGET (obj);
- if (!gtk_builder_add_from_file (self->pv->builder, UIDIR "gcr-unlock-options-widget.ui",
NULL))
+ if (!gtk_builder_add_from_resource (self->pv->builder,
"/org/gnome/gcr/ui/gcr-unlock-options-widget.ui", NULL))
g_return_val_if_reached (obj);
widget = GTK_WIDGET (gtk_builder_get_object (self->pv->builder, "unlock-options-widget"));
diff --git a/ui/gcr.gresource.xml b/ui/gcr.gresource.xml
new file mode 100644
index 0000000..3ab232d
--- /dev/null
+++ b/ui/gcr.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/gcr/ui">
+ <file preprocess="xml-stripblanks">gcr-pkcs11-import-dialog.ui</file>
+ <file preprocess="xml-stripblanks">gcr-unlock-options-widget.ui</file>
+ </gresource>
+</gresources>
--
2.9.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]