summaryrefslogtreecommitdiff
path: root/src/CollectionPage.vala
diff options
context:
space:
mode:
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) {