[shotwell] Move icons into resource file
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Move icons into resource file
- Date: Mon, 6 Mar 2017 21:58:34 +0000 (UTC)
commit 056b465182a2cc4310dc999bd9f30a791a66e224
Author: Jens Georg <mail jensge org>
Date: Mon Mar 6 21:53:56 2017 +0100
Move icons into resource file
Signed-off-by: Jens Georg <mail jensge org>
icons/Makefile.am | 4 +--
org.gnome.Shotwell.gresource.xml | 54 ++++++++++++++++++++++++++++++++++-
src/AppDirs.vala | 7 ----
src/Resources.vala | 18 +++++------
src/editing_tools/EditingTools.vala | 2 +-
src/main.vala | 3 +-
6 files changed, 64 insertions(+), 24 deletions(-)
---
diff --git a/icons/Makefile.am b/icons/Makefile.am
index 79724ee..ecef591 100644
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -1,6 +1,4 @@
-imagesdir = $(datadir)/shotwell/icons
-
-dist_images_DATA = \
+dist_noinst_DATA = \
all-rejected.png \
crop-pivot-reticle.png \
crop.svg \
diff --git a/org.gnome.Shotwell.gresource.xml b/org.gnome.Shotwell.gresource.xml
index 3716038..68ada98 100644
--- a/org.gnome.Shotwell.gresource.xml
+++ b/org.gnome.Shotwell.gresource.xml
@@ -1,12 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Shotwell">
- <file alias="crop-pivot-reticle.png">icons/crop-pivot-reticle.png</file>
<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>
+ <file>icons/all-rejected.png</file>
+ <file>icons/crop-pivot-reticle.png</file>
+ <file>icons/crop.svg</file>
+ <file>icons/drag_nub.png</file>
+ <file>icons/faces-tool.png</file>
+ <file>icons/filter-flagged-disabled.png</file>
+ <file>icons/filter-flagged.png</file>
+ <file>icons/filter-photos-disabled.png</file>
+ <file>icons/filter-photos.png</file>
+ <file>icons/filter-raw-disabled.png</file>
+ <file>icons/filter-raw.png</file>
+ <file>icons/filter-videos-disabled.png</file>
+ <file>icons/filter-videos.png</file>
+ <file>icons/five-star-filter.svg</file>
+ <file>icons/five-stars.svg</file>
+ <file>icons/flag-page.png</file>
+ <file>icons/flag-trinket.png</file>
+ <file>icons/four-star-filter-plus.svg</file>
+ <file>icons/four-stars.svg</file>
+ <file>icons/generic-plugin.png</file>
+ <file>icons/image-adjust.svg</file>
+ <file>icons/import-all.png</file>
+ <file>icons/import.svg</file>
+ <file>icons/make-primary.svg</file>
+ <file>icons/many-faces.png</file>
+ <file>icons/merge.svg</file>
+ <file>icons/multiple-events.png</file>
+ <file>icons/multiple-tags.png</file>
+ <file>icons/no-event.png</file>
+ <file>icons/noninterpretable-video.png</file>
+ <file>icons/one-event.png</file>
+ <file>icons/one-face.png</file>
+ <file>icons/one-star-filter-plus.svg</file>
+ <file>icons/one-star.svg</file>
+ <file>icons/one-tag.png</file>
+ <file>icons/pin-toolbar.svg</file>
+ <file>icons/publish.png</file>
+ <file>icons/redeye.png</file>
+ <file>icons/rejected.svg</file>
+ <file>icons/shotwell-16.png</file>
+ <file>icons/shotwell-auto-enhance.png</file>
+ <file>icons/shotwell.png</file>
+ <file>icons/shotwell-street.jpg</file>
+ <file>icons/slideshow-extension-point.png</file>
+ <file>icons/sprocket.png</file>
+ <file>icons/straighten.svg</file>
+ <file>icons/three-star-filter-plus.svg</file>
+ <file>icons/three-stars.svg</file>
+ <file>icons/two-star-filter-plus.svg</file>
+ <file>icons/two-stars.svg</file>
+ <file>icons/videos-page.png</file>
+ <file>icons/zoom-in.png</file>
+ <file>icons/zoom-out.png</file>
</gresource>
</gresources>
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 94be26b..0c69270 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -258,13 +258,6 @@ class AppDirs {
return subdir;
}
- public static File get_resources_dir() {
- File? install_dir = get_install_dir();
-
- return (install_dir != null) ? install_dir.get_child("share").get_child("shotwell")
- : get_exec_dir();
- }
-
public static File get_lib_dir() {
File? install_dir = get_install_dir();
diff --git a/src/Resources.vala b/src/Resources.vala
index feb568b..ae6e4f9 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -686,11 +686,10 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
private string END_MULTIDAY_DATE_FORMAT_STRING = null;
private string START_MULTIMONTH_DATE_FORMAT_STRING = null;
private string END_MULTIMONTH_DATE_FORMAT_STRING = null;
-
+
public void init () {
- var icon_theme = Gtk.IconTheme.get_default();
+ get_icon_theme_engine();
// load application-wide stock icons as IconSets
- icon_theme.append_search_path(AppDirs.get_resources_dir().get_child("icons").get_path());
generate_rating_strings();
}
@@ -838,8 +837,8 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
public Gdk.Pixbuf? get_noninterpretable_badge_pixbuf() {
if (noninterpretable_badge_pixbuf == null) {
try {
- noninterpretable_badge_pixbuf = new
Gdk.Pixbuf.from_file(AppDirs.get_resources_dir().get_child(
- "icons").get_child(NONINTERPRETABLE_BADGE_FILE).get_path());
+ var path = "/org/gnome/Shotwell/icons/" + NONINTERPRETABLE_BADGE_FILE;
+ noninterpretable_badge_pixbuf = new Gdk.Pixbuf.from_resource(path);
} catch (Error err) {
error("VideoReader can't load noninterpretable badge image: %s", err.message);
}
@@ -850,7 +849,7 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
public Gtk.IconTheme get_icon_theme_engine() {
Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default();
- icon_theme.append_search_path(AppDirs.get_resources_dir().get_child("icons").get_path());
+ icon_theme.add_resource_path("/org/gnome/Shotwell/icons");
return icon_theme;
}
@@ -893,18 +892,17 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
}
public Gdk.Pixbuf? load_icon(string name, int scale = DEFAULT_ICON_SCALE) {
- File icons_dir = AppDirs.get_resources_dir().get_child("icons");
-
Gdk.Pixbuf pixbuf = null;
try {
- pixbuf = new Gdk.Pixbuf.from_file(icons_dir.get_child(name).get_path());
+ var path = "/org/gnome/Shotwell/icons/%s".printf(name);
+ pixbuf = new Gdk.Pixbuf.from_resource(path);
} catch (Error err) {
critical("Unable to load icon %s: %s", name, err.message);
}
if (pixbuf == null)
return null;
-
+
return (scale > 0) ? scale_pixbuf(pixbuf, scale, Gdk.InterpType.BILINEAR, false) : pixbuf;
}
diff --git a/src/editing_tools/EditingTools.vala b/src/editing_tools/EditingTools.vala
index c3c79f6..d160f23 100644
--- a/src/editing_tools/EditingTools.vala
+++ b/src/editing_tools/EditingTools.vala
@@ -676,7 +676,7 @@ public class CropTool : EditingTool {
constraint_combo.set_row_separator_func(constraint_combo_separator_func);
constraint_combo.set_active(0);
- var image = new Gtk.Image.from_resource ("/org/gnome/Shotwell/crop-pivot-reticle.png");
+ var image = new Gtk.Image.from_icon_name("crop-pivot-reticle", Gtk.IconSize.LARGE_TOOLBAR);
pivot_reticle_button.set_image (image);
pivot_reticle_button.set_tooltip_text(_("Pivot the crop rectangle between portrait and landscape
orientations"));
diff --git a/src/main.vala b/src/main.vala
index 6941734..d65421b 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -105,8 +105,7 @@ void library_exec(string[] mounts) {
progress_dialog.update_display_every(100);
progress_dialog.set_minimum_on_screen_time_msec(250);
try {
- string icon_path =
AppDirs.get_resources_dir().get_child("icons").get_child("shotwell.svg").get_path();
- progress_dialog.icon = new Gdk.Pixbuf.from_file(icon_path);
+ progress_dialog.icon = new
Gdk.Pixbuf.from_resource("/org/gnome/Shotwell/icons/shotwell.svg");
} catch (Error err) {
debug("Warning - could not load application icon for loading window: %s", err.message);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]