[shotwell] Move ui files into resources
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Move ui files into resources
- Date: Mon, 6 Mar 2017 21:58:39 +0000 (UTC)
commit 93ee36a52afe4a07b73ce499854aa3e8c10154d9
Author: Jens Georg <mail jensge org>
Date: Mon Mar 6 22:15:54 2017 +0100
Move ui files into resources
Signed-off-by: Jens Georg <mail jensge org>
org.gnome.Shotwell.gresource.xml | 30 ++++++++++++++++++++++++------
src/AppWindow.vala | 3 +--
src/Page.vala | 9 ++++-----
src/Resources.vala | 4 ++--
src/SearchFilter.vala | 2 +-
src/searches/Branch.vala | 3 +--
src/sidebar/Tree.vala | 3 +--
src/tags/Branch.vala | 3 +--
ui/Makefile.am | 10 +++-------
9 files changed, 38 insertions(+), 29 deletions(-)
---
diff --git a/org.gnome.Shotwell.gresource.xml b/org.gnome.Shotwell.gresource.xml
index 68ada98..e7dfd17 100644
--- a/org.gnome.Shotwell.gresource.xml
+++ b/org.gnome.Shotwell.gresource.xml
@@ -1,12 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Shotwell">
- <file alias="search_sidebar_context.ui">ui/search_sidebar_context.ui</file>
- <file alias="tag_sidebar_context.ui">ui/tag_sidebar_context.ui</file>
- <file alias="sidebar_default_context.ui">ui/sidebar_default_context.ui</file>
- <file alias="search_bar.ui">ui/search_bar.ui</file>
- <file>ui/set_background_dialog.ui</file>
- <file>ui/set_background_slideshow_dialog.ui</file>
+ <!-- UI files -->
+ <file preprocess="xml-stripblanks">ui/collection.ui</file>
+ <file preprocess="xml-stripblanks">ui/direct_context.ui</file>
+ <file preprocess="xml-stripblanks">ui/direct.ui</file>
+ <file preprocess="xml-stripblanks">ui/events_directory.ui</file>
+ <file preprocess="xml-stripblanks">ui/event.ui</file>
+ <file preprocess="xml-stripblanks">ui/fullscreen.ui</file>
+ <file preprocess="xml-stripblanks">ui/import_queue.ui</file>
+ <file preprocess="xml-stripblanks">ui/import.ui</file>
+ <file preprocess="xml-stripblanks">ui/media.ui</file>
+ <file preprocess="xml-stripblanks">ui/offline.ui</file>
+ <file preprocess="xml-stripblanks">ui/photo_context.ui</file>
+ <file preprocess="xml-stripblanks">ui/photo.ui</file>
+ <file preprocess="xml-stripblanks">ui/savedsearch.ui</file>
+ <file preprocess="xml-stripblanks">ui/search_bar.ui</file>
+ <file preprocess="xml-stripblanks">ui/search_sidebar_context.ui</file>
+ <file preprocess="xml-stripblanks">ui/set_background_dialog.ui</file>
+ <file preprocess="xml-stripblanks">ui/set_background_slideshow_dialog.ui</file>
+ <file compressed="true">ui/shotwell.ui</file>
+ <file preprocess="xml-stripblanks">ui/sidebar_default_context.ui</file>
+ <file preprocess="xml-stripblanks">ui/tag_sidebar_context.ui</file>
+ <file preprocess="xml-stripblanks">ui/tags.ui</file>
+ <file preprocess="xml-stripblanks">ui/trash.ui</file>
+ <!-- Icons -->
<file>icons/all-rejected.png</file>
<file>icons/crop-pivot-reticle.png</file>
<file>icons/crop.svg</file>
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 3b69156..8b24baf 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -477,8 +477,7 @@ public abstract class AppWindow : PageWindow {
public static Gtk.Builder create_builder(string glade_filename = "shotwell.ui", void *user = null) {
Gtk.Builder builder = new Gtk.Builder();
try {
- builder.add_from_file(AppDirs.get_resources_dir().get_child("ui").get_child(
- glade_filename).get_path());
+ builder.add_from_resource(Resources.get_ui(glade_filename));
} catch(GLib.Error error) {
warning("Unable to create Gtk.Builder: %s\n", error.message);
}
diff --git a/src/Page.vala b/src/Page.vala
index 2a13221..bdeee6b 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -570,13 +570,12 @@ public abstract class Page : Gtk.ScrolledWindow {
}
private void init_load_ui(string ui_filename) {
- File ui_file = Resources.get_ui(ui_filename);
-
+ var ui_resource = Resources.get_ui(ui_filename);
try {
- builder.add_from_file(ui_file.get_path());
+ builder.add_from_resource(ui_resource);
} catch (Error err) {
- AppWindow.error_message("Error loading UI file %s: %s".printf(
- ui_file.get_path(), err.message));
+ AppWindow.error_message("Error loading UI resource %s: %s".printf(
+ ui_resource, err.message));
Application.get_instance().panic();
}
}
diff --git a/src/Resources.vala b/src/Resources.vala
index ae6e4f9..046f193 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -827,8 +827,8 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
return END_MULTIMONTH_DATE_FORMAT_STRING;
}
- public File get_ui(string filename) {
- return AppDirs.get_resources_dir().get_child("ui").get_child(filename);
+ public string get_ui(string filename) {
+ return "/org/gnome/Shotwell/ui/%s".printf(filename);
}
private const string NONINTERPRETABLE_BADGE_FILE = "noninterpretable-video.png";
diff --git a/src/SearchFilter.vala b/src/SearchFilter.vala
index 137318a..e4c1512 100644
--- a/src/SearchFilter.vala
+++ b/src/SearchFilter.vala
@@ -1059,7 +1059,7 @@ public class SearchFilterToolbar : Gtk.Revealer {
toolbar.set_icon_size(Gtk.IconSize.SMALL_TOOLBAR);
try {
- this.builder.add_from_resource ("/org/gnome/Shotwell/search_bar.ui");
+ this.builder.add_from_resource (Resources.get_ui("search_bar.ui"));
} catch (Error err) {
AppWindow.panic(_("Error loading search bar UI: %s").printf(
err.message));
diff --git a/src/searches/Branch.vala b/src/searches/Branch.vala
index f557baa..1c4ee90 100644
--- a/src/searches/Branch.vala
+++ b/src/searches/Branch.vala
@@ -72,8 +72,7 @@ public class Searches.Header : Sidebar.Header, Sidebar.Contextable {
private void setup_context_menu() {
this.builder = new Gtk.Builder ();
try {
- this.builder.add_from_resource
- ("/org/gnome/Shotwell/search_sidebar_context.ui");
+ this.builder.add_from_resource(Resources.get_ui("search_sidebar_context.ui"));
var model = builder.get_object ("popup-menu") as GLib.MenuModel;
this.context_menu = new Gtk.Menu.from_model (model);
} catch (Error error) {
diff --git a/src/sidebar/Tree.vala b/src/sidebar/Tree.vala
index 9c80f00..a3fc8bf 100644
--- a/src/sidebar/Tree.vala
+++ b/src/sidebar/Tree.vala
@@ -197,8 +197,7 @@ public class Sidebar.Tree : Gtk.TreeView {
private void setup_default_context_menu() {
try {
- this.builder.add_from_resource
- ("/org/gnome/Shotwell/sidebar_default_context.ui");
+ this.builder.add_from_resource(Resources.get_ui("sidebar_default_context.ui"));
var model = builder.get_object ("popup-menu") as GLib.MenuModel;
this.default_context_menu = new Gtk.Menu.from_model (model);
var group = new GLib.SimpleActionGroup ();
diff --git a/src/tags/Branch.vala b/src/tags/Branch.vala
index 41c6feb..52dabdb 100644
--- a/src/tags/Branch.vala
+++ b/src/tags/Branch.vala
@@ -135,8 +135,7 @@ public class Tags.Header : Sidebar.Header, Sidebar.InternalDropTargetEntry,
private void setup_context_menu() {
this.builder = new Gtk.Builder ();
try {
- this.builder.add_from_resource
- ("/org/gnome/Shotwell/tag_sidebar_context.ui");
+ this.builder.add_from_resource(Resources.get_ui("tag_sidebar_context.ui"));
var model = builder.get_object ("popup-menu") as GLib.MenuModel;
this.context_menu = new Gtk.Menu.from_model (model);
} catch (Error error) {
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 21fe589..72d5a40 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -1,5 +1,4 @@
-uidir = $(datadir)/shotwell/ui
-dist_ui_DATA = \
+dist_noinst_DATA = \
collection.ui \
direct_context.ui \
direct.ui \
@@ -15,15 +14,12 @@ dist_ui_DATA = \
savedsearch.ui \
search_bar.ui \
search_sidebar_context.ui \
+ set_background_dialog.ui \
+ set_background_slideshow_dialog.ui
shotwell.ui \
sidebar_default_context.ui \
tag_sidebar_context.ui \
tags.ui \
trash.ui
-dist_noinst_DATA = \
- set_background_dialog.ui \
- set_background_slideshow_dialog.ui
-
-
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]