summaryrefslogtreecommitdiff
path: root/src/CollectionPage.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-12-29 18:43:43 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-12-29 18:43:43 +0100
commit14bc7db2e07c5d1ccfb4d723c9dba395e6c93171 (patch)
tree7b00861348dedd18d3651537128bbe783dab364c /src/CollectionPage.vala
parent1bf62485f701b52ae27433e3570ac24cd7da886f (diff)
parent67d142325abb0d9345baef77f00a047a7dc1eca3 (diff)
Merge branch 'release/debian/0.32.4-1'debian/0.32.4-1
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) {