summaryrefslogtreecommitdiff
path: root/src/CollectionPage.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-12-17 19:58:25 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-12-17 19:58:25 +0100
commit4cb46f4de4b881e5b1f65af017dca6f3917e55e5 (patch)
treefb359e210d2d9c30f5ad36a447ea29b62ae9bb56 /src/CollectionPage.vala
parent841f952294b349b2b8e2afb5305ce34a3b59bb4b (diff)
parentf5a0cee8ccecc7b6c6c2d8e9fb6f6eecd53531fe (diff)
Update upstream source from tag 'upstream/0.32.4'
Update to upstream version '0.32.4' with Debian dir 51798a6af1c9b7e48f979c020d72f3c5ddd964a6
Diffstat (limited to 'src/CollectionPage.vala')
-rw-r--r--src/CollectionPage.vala46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/CollectionPage.vala b/src/CollectionPage.vala
index ac05f8b..9a96041 100644
--- a/src/CollectionPage.vala
+++ b/src/CollectionPage.vala
@@ -240,6 +240,7 @@ public abstract class CollectionPage : MediaPage {
primary_is_video = true;
bool selection_has_videos = selection_has_video();
+ bool selection_has_photos = selection_has_photo();
bool page_has_photos = page_has_photo();
// don't allow duplication of the selection if it contains a video -- videos are huge and
@@ -270,11 +271,14 @@ public abstract class CollectionPage : MediaPage {
set_action_sensitive("NewEvent", has_selected);
set_action_sensitive("AddTags", has_selected);
set_action_sensitive("ModifyTags", one_selected);
- set_action_sensitive("Slideshow", page_has_photos && (!primary_is_video));
+
+ // Allow starting slideshow even if first selected item is a video. Otherwise the
+ // behavior is quite confusing, it will start if you do not select anything and just skipt the video
+ set_action_sensitive("Slideshow", (page_has_photos && !has_selected) || selection_has_photos);
set_action_sensitive("Print", (!selection_has_videos) && has_selected);
set_action_sensitive("Publish", has_selected);
- set_action_sensitive("SetBackground", (!selection_has_videos) && has_selected );
+ set_action_sensitive("SetBackground", has_selected && selection_has_photos);
if (has_selected) {
debug ("Setting action label for SetBackground...");
var label = one_selected
@@ -679,23 +683,27 @@ public abstract class CollectionPage : MediaPage {
if (get_view().get_count() == 0)
return;
- // use first selected photo, else use first photo
- Gee.List<DataSource>? sources = (get_view().get_selected_count() > 0)
- ? get_view().get_selected_sources_of_type(typeof(LibraryPhoto))
- : get_view().get_sources_of_type(typeof(LibraryPhoto));
- if (sources == null || sources.size == 0)
- return;
-
- Thumbnail? thumbnail = (Thumbnail?) get_view().get_view_for_source(sources[0]);
- if (thumbnail == null)
- return;
-
- LibraryPhoto? photo = thumbnail.get_media_source() as LibraryPhoto;
- if (photo == null)
- return;
-
- AppWindow.get_instance().go_fullscreen(new SlideshowPage(LibraryPhoto.global, get_view(),
- photo));
+ // check selection for valid starting photo, otherwise start at beginning of collection
+ if (get_view().get_selected_count() > 0) {
+ Gee.List<DataSource>? sources =
+ get_view().get_selected_sources_of_type(typeof(LibraryPhoto));
+ if (sources == null || sources.size == 0)
+ return;
+
+ Thumbnail? thumbnail = (Thumbnail?) get_view().get_view_for_source(sources[0]);
+ if (thumbnail == null)
+ return;
+
+ LibraryPhoto? photo = thumbnail.get_media_source() as LibraryPhoto;
+ if (photo == null)
+ return;
+
+ AppWindow.get_instance().go_fullscreen(new SlideshowPage(LibraryPhoto.global,
+ get_view(), photo));
+ } else {
+ AppWindow.get_instance().go_fullscreen(new SlideshowPage(LibraryPhoto.global,
+ get_view()));
+ }
}
protected override bool on_ctrl_pressed(Gdk.EventKey? event) {