[baobab/wip/vala: 43/46] Use GResource
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/wip/vala: 43/46] Use GResource
- Date: Sun, 11 Mar 2012 17:34:16 +0000 (UTC)
commit 968d4e8401eada6bb136c690dd1f294cde029f4b
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Feb 11 09:44:40 2012 +0100
Use GResource
configure.ac | 4 +
data/Makefile.am | 7 --
data/baobab-preferences-dialog.ui | 178 -----------------------------------
src/Makefile.am | 17 +++-
src/baobab-application.vala | 2 +-
{data => src}/baobab-main-window.ui | 12 +-
{data => src}/baobab-menu.ui | 0
src/baobab-window.vala | 2 +-
src/baobab.gresource.xml | 7 ++
9 files changed, 34 insertions(+), 195 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3f66a36..ff7131c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,10 @@ AC_CACHE_SAVE
GLIB_GSETTINGS
+# Resources
+GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
+AC_SUBST(GLIB_COMPILE_RESOURCES)
+
# Mallard help
YELP_HELP_INIT
diff --git a/data/Makefile.am b/data/Makefile.am
index 0e4c1d1..6144343 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,9 +1,3 @@
-uidir = $(datadir)/baobab
-ui_DATA = \
- baobab-main-window.ui \
- baobab-menu.ui \
- baobab-preferences-dialog.ui
-
baobabappdir = $(datadir)/applications
baobabapp_in_files = baobab.desktop.in
baobabapp_DATA = $(baobabapp_in_files:.desktop.in=.desktop)
@@ -24,7 +18,6 @@ gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
man_MANS = baobab.1
EXTRA_DIST = \
- $(ui_DATA) \
baobab.desktop.in.in \
$(gsettingsschema_in_files) \
$(man_MANS)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9daab6a..792df96 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,8 @@ INCLUDES = \
bin_PROGRAMS = baobab
+BUILT_SOURCES = baobab-resources.c
+
baobab_VALAFLAGS = --pkg gtk+-3.0
baobab_SOURCES = \
fixes.vapi \
@@ -28,7 +30,11 @@ baobab_SOURCES = \
baobab-application.vala \
baobab-window.vala \
baobab-connect-server.vala \
- main.vala
+ main.vala \
+ $(BUILT_SOURCES)
+
+baobab-resources.c: baobab.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies baobab.gresource.xml)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source baobab.gresource.xml
AM_CFLAGS = \
$(gtk_CFLAGS) \
@@ -51,6 +57,13 @@ MAINTAINERCLEANFILES = \
baobab-cellrenderers.c \
baobab-window.c \
baobab_vala.stamp \
- main.c
+ main.c \
+ $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ baobab.gresource.xml \
+ baobab-main-window.ui \
+ baobab-preferences-dialog.ui \
+ baobab-menu.ui
-include $(top_srcdir)/git.mk
diff --git a/src/baobab-application.vala b/src/baobab-application.vala
index 81cb47e..3d1451f 100644
--- a/src/baobab-application.vala
+++ b/src/baobab-application.vala
@@ -58,7 +58,7 @@ namespace Baobab {
var gtk_settings = Gtk.Settings.get_default ();
var builder = new Gtk.Builder ();
try {
- builder.add_from_file (Config.PKGDATADIR + "/baobab-menu.ui");
+ builder.add_from_resource ("/org/gnome/baobab/ui/baobab-menu.ui");
} catch (Error e) {
error ("loading menu builder file: %s", e.message);
}
diff --git a/data/baobab-main-window.ui b/src/baobab-main-window.ui
similarity index 98%
rename from data/baobab-main-window.ui
rename to src/baobab-main-window.ui
index 35a4726..fd22fc6 100644
--- a/data/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -18,8 +18,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
- <property name="tooltip_markup" translatable="yes">Scan home folder</property>
- <property name="tooltip_text" translatable="yes">Scan home folder</property>
+ <property name="tooltip_markup" translatable="yes">Scan your home folder</property>
+ <property name="tooltip_text" translatable="yes">Scan your home folder</property>
<property name="use_action_appearance">False</property>
<property name="is_important">True</property>
<property name="action_name">win.scan-home</property>
@@ -28,7 +28,7 @@
<property name="stock_id">gtk-home</property>
<child internal-child="accessible">
<object class="AtkObject" id="scan-home-button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Scan home folder</property>
+ <property name="AtkObject::accessible-name" translatable="yes">Scan your home folder</property>
</object>
</child>
</object>
@@ -43,11 +43,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
- <property name="tooltip_markup" translatable="yes">Scan filesystem</property>
- <property name="tooltip_text" translatable="yes">Scan filesystem</property>
+ <property name="tooltip_markup" translatable="yes">Scan the file system</property>
+ <property name="tooltip_text" translatable="yes">Scan the file system</property>
<property name="use_action_appearance">False</property>
<property name="action_name">win.scan-filesystem</property>
- <property name="label" translatable="yes">Scan Filesystem</property>
+ <property name="label" translatable="yes">Scan File System</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-harddisk</property>
</object>
diff --git a/data/baobab-menu.ui b/src/baobab-menu.ui
similarity index 100%
rename from data/baobab-menu.ui
rename to src/baobab-menu.ui
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 1c66364..844b795 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -74,7 +74,7 @@ namespace Baobab {
// Build ourselves.
var builder = new Gtk.Builder ();
try {
- builder.add_from_file (Config.PKGDATADIR + "/baobab-main-window.ui");
+ builder.add_from_resource ("/org/gnome/baobab/ui/baobab-main-window.ui");
} catch (Error e) {
error ("loading main builder file: %s", e.message);
}
diff --git a/src/baobab.gresource.xml b/src/baobab.gresource.xml
new file mode 100644
index 0000000..d0789b8
--- /dev/null
+++ b/src/baobab.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/baobab/ui">
+ <file preprocess="xml-stripblanks">baobab-main-window.ui</file>
+ <file preprocess="xml-stripblanks">baobab-menu.ui</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]