From 5e9f4eea451a77ba3b93db3747841ed2bd969e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 30 Sep 2018 14:09:20 +0200 Subject: New upstream version 0.30.1 --- src/SearchFilter.vala | 62 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 19 deletions(-) (limited to 'src/SearchFilter.vala') diff --git a/src/SearchFilter.vala b/src/SearchFilter.vala index 8acf035..bad6a73 100644 --- a/src/SearchFilter.vala +++ b/src/SearchFilter.vala @@ -223,6 +223,10 @@ public abstract class DefaultSearchViewFilter : SearchViewFilter { Gee.List? tags = Tag.global.fetch_for_source(source); int tags_size = (tags != null) ? tags.size : 0; +#if ENABLE_FACES + Gee.List? faces = Face.global.fetch_for_source(source); +#endif + foreach (unowned string word in get_search_filter_words()) { if (media_keywords != null && media_keywords.contains(word)) continue; @@ -245,6 +249,22 @@ public abstract class DefaultSearchViewFilter : SearchViewFilter { continue; } +#if ENABLE_FACES + if (faces != null) { + bool found = false; + foreach (Face f in faces) { + unowned string? face_keywords = f.get_indexable_keywords(); + if (face_keywords != null && face_keywords.contains(word)) { + found = true; + + break; + } + } + + if (found) + continue; + } +#endif // failed all tests (this even works if none of the Indexables have strings, // as they fail the implicit AND test) return false; @@ -754,28 +774,32 @@ public class SearchFilterToolbar : Gtk.Revealer { } private Gtk.Widget get_filter_icon(RatingFilter filter) { - string filename = null; + Gtk.Widget? icon = null; switch (filter) { case RatingFilter.REJECTED_OR_HIGHER: - filename = Resources.ICON_FILTER_REJECTED_OR_BETTER; + icon = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0); + var image = new Gtk.Image.from_icon_name ("emblem-photos-symbolic", Gtk.IconSize.SMALL_TOOLBAR); + image.margin_end = 2; + (icon as Gtk.Box).pack_start(image); + image = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.SMALL_TOOLBAR); + (icon as Gtk.Box).pack_start(image); + icon.show_all(); break; case RatingFilter.REJECTED_ONLY: - filename = Resources.ICON_RATING_REJECTED; + icon = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.SMALL_TOOLBAR); break; case RatingFilter.UNRATED_OR_HIGHER: default: - filename = Resources.ICON_FILTER_UNRATED_OR_BETTER; + icon = new Gtk.Image.from_icon_name ("emblem-photos-symbolic", Gtk.IconSize.SMALL_TOOLBAR); break; } - - Gtk.Image image = new Gtk.Image.from_pixbuf(Resources.load_icon(filename, - get_filter_icon_size(filter))); - image.set_margin_end(6); - return image; + icon.margin_end = 6; + + return icon; } private int get_filter_icon_size(RatingFilter filter) { @@ -857,7 +881,7 @@ public class SearchFilterToolbar : Gtk.Revealer { button = new Gtk.ToggleButton(); button.set_always_show_image(true); - Gtk.Image? image = new Gtk.Image.from_icon_name("edit-find", Gtk.IconSize.SMALL_TOOLBAR); + Gtk.Image? image = new Gtk.Image.from_icon_name("edit-find-symbolic", Gtk.IconSize.SMALL_TOOLBAR); image.set_margin_end(6); button.set_image(image); button.set_can_focus(false); @@ -1171,29 +1195,29 @@ public class SearchFilterToolbar : Gtk.Revealer { if (has_photos || has_raw) // As a user, I would expect, that a raw photo is still a photo. // Let's enable the photo button even if there ar only raw photos. - toolbtn_photos.set_icon_name(Resources.ICON_FILTER_PHOTOS); + toolbtn_photos.set_icon_name("filter-photos-symbolic"); else - toolbtn_photos.set_icon_name(Resources.ICON_FILTER_PHOTOS_DISABLED); + toolbtn_photos.set_icon_name("filter-photos-disabled-symbolic"); if (has_videos) - toolbtn_videos.set_icon_name(Resources.ICON_FILTER_VIDEOS); + toolbtn_videos.set_icon_name("filter-videos-symbolic"); else - toolbtn_videos.set_icon_name(Resources.ICON_FILTER_VIDEOS_DISABLED); + toolbtn_videos.set_icon_name("filter-videos-disabled-symbolic"); if (has_raw) - toolbtn_raw.set_icon_name(Resources.ICON_FILTER_RAW); + toolbtn_raw.set_icon_name("filter-raw-symbolic"); else - toolbtn_raw.set_icon_name(Resources.ICON_FILTER_RAW_DISABLED); + toolbtn_raw.set_icon_name("filter-raw-disabled-symbolic"); if (has_flagged) - toolbtn_flag.set_icon_name(Resources.ICON_FILTER_FLAGGED); + toolbtn_flag.set_icon_name("filter-flagged-symbolic"); else - toolbtn_flag.set_icon_name(Resources.ICON_FILTER_FLAGGED_DISABLED); + toolbtn_flag.set_icon_name("filter-flagged-disabled-symbolic"); } // Ticket #3260 part IV - display the context menu on secondary click private bool on_context_menu_requested(int x, int y, int button) { - close_menu.popup(null, null, null, button, Gtk.get_current_event_time()); + close_menu.popup_at_pointer(null); return false; } -- cgit v1.2.3