Commit b68704d3 authored by Jim Nelson's avatar Jim Nelson

#2994: Fixed regression with handling fullscreen mode with photos and videos present.

parent e991aee3
......@@ -382,13 +382,25 @@ public abstract class CollectionPage : MediaPage {
}
public override CheckerboardItem? get_fullscreen_photo() {
// use first selected item; if no selection, use first item
if (get_view().get_selected_count() > 0)
return (CheckerboardItem?) get_view().get_selected_at(0);
else if (get_view().get_count() > 0)
return (CheckerboardItem?) get_view().get_at(0);
else
// if a selection, use first selected photo, otherwise, no go
if (get_view().get_selected_count() > 0) {
foreach (DataView view in get_view().get_selected()) {
Thumbnail thumbnail = (Thumbnail) view;
if (thumbnail.get_media_source() is Photo)
return thumbnail;
}
return null;
}
// no selection, so use first photo
foreach (DataObject object in get_view().get_all()) {
Thumbnail thumbnail = (Thumbnail) object;
if (thumbnail.get_media_source() is Photo)
return thumbnail;
}
return null;
}
protected override bool on_app_key_pressed(Gdk.EventKey event) {
......
......@@ -337,6 +337,18 @@ public class Event : EventSource, ContainerSource, Proxyable {
view.remove_marked(view.mark_many(views));
}
// TODO: A preferred way to do this is for ContainerSource to have an abstract interface for
// obtaining the DataCollection in the ContainerSource of all the media objects. Then,
// ContinerSource could offer this helper class.
public bool contains_media_type(string media_type) {
foreach (MediaSource media in get_media()) {
if (media.get_typename() == media_type)
return true;
}
return false;
}
private Gee.ArrayList<MediaSource> views_to_media(Gee.Iterable<DataObject> views) {
Gee.ArrayList<MediaSource> media = new Gee.ArrayList<MediaSource>();
foreach (DataObject object in views)
......
......@@ -266,13 +266,25 @@ public class EventsDirectoryPage : CheckerboardPage {
}
private EventDirectoryItem? get_fullscreen_item() {
// use first selected item, otherwise use first item
if (get_view().get_selected_count() > 0)
return (EventDirectoryItem?) get_view().get_selected_at(0);
else if (get_view().get_count() > 0)
return (EventDirectoryItem?) get_view().get_at(0);
else
// if there's a selection, use first selected event with a photo; otherwise, no go.
if (get_view().get_selected_count() > 0) {
foreach (DataView view in get_view().get_selected()) {
EventDirectoryItem item = (EventDirectoryItem) view;
if (item.event.contains_media_type(Photo.TYPENAME))
return item;
}
return null;
}
// no selection, so use first event with photo
foreach (DataObject object in get_view().get_all()) {
EventDirectoryItem item = (EventDirectoryItem) object;
if (item.event.contains_media_type(Photo.TYPENAME))
return item;
}
return null;
}
public EventPage? get_fullscreen_event() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment