Commit 8fdd12ca authored by Lucas Beeler's avatar Lucas Beeler

Fixes string bugs #2909 and #2912.

parent f724371e
...@@ -256,33 +256,15 @@ public abstract class CollectionPage : MediaPage { ...@@ -256,33 +256,15 @@ public abstract class CollectionPage : MediaPage {
} }
private bool selection_has_video() { private bool selection_has_video() {
foreach (DataSource source in get_view().get_selected_sources()) { return MediaSourceCollection.has_video((Gee.Collection<MediaSource>) get_view().get_selected_sources());
if (source is Video) {
return true;
}
}
return false;
} }
private bool page_has_photo() { private bool page_has_photo() {
foreach (DataSource source in get_view().get_sources()) { return MediaSourceCollection.has_photo((Gee.Collection<MediaSource>) get_view().get_sources());
if (source is Photo) {
return true;
}
}
return false;
} }
private bool selection_has_photo() { private bool selection_has_photo() {
foreach (DataSource source in get_view().get_selected_sources()) { return MediaSourceCollection.has_photo((Gee.Collection<MediaSource>) get_view().get_selected_sources());
if (source is Photo) {
return true;
}
}
return false;
} }
protected override void update_actions(int selected_count, int count) { protected override void update_actions(int selected_count, int count) {
......
...@@ -60,8 +60,17 @@ class EventDirectoryItem : CheckerboardItem { ...@@ -60,8 +60,17 @@ class EventDirectoryItem : CheckerboardItem {
} }
private static string get_formatted_title(Event event) { private static string get_formatted_title(Event event) {
bool has_photos = MediaSourceCollection.has_photo(event.get_media());
bool has_videos = MediaSourceCollection.has_video(event.get_media());
int count = event.get_media_count(); int count = event.get_media_count();
string count_text = ngettext("%d Photo", "%d Photos", count).printf(count); string count_text = "";
if (has_photos && has_videos)
count_text = ngettext("%d Photo/Video", "%d Photos/Videos", count).printf(count);
else if (has_videos)
count_text = ngettext("%d Video", "%d Videos", count).printf(count);
else
count_text = ngettext("%d Photo", "%d Photos", count).printf(count);
return "<b>%s</b>\n%s".printf(guarded_markup_escape_text(event.get_name()), return "<b>%s</b>\n%s".printf(guarded_markup_escape_text(event.get_name()),
guarded_markup_escape_text(count_text)); guarded_markup_escape_text(count_text));
......
...@@ -242,6 +242,26 @@ public abstract class MediaSourceCollection : DatabaseSourceCollection { ...@@ -242,6 +242,26 @@ public abstract class MediaSourceCollection : DatabaseSourceCollection {
} }
} }
public static bool has_photo(Gee.Collection<MediaSource> media) {
foreach (MediaSource current_media in media) {
if (current_media is Photo) {
return true;
}
}
return false;
}
public static bool has_video(Gee.Collection<MediaSource> media) {
foreach (MediaSource current_media in media) {
if (current_media is Video) {
return true;
}
}
return false;
}
protected abstract MediaSourceHoldingTank create_trashcan(); protected abstract MediaSourceHoldingTank create_trashcan();
protected abstract MediaSourceHoldingTank create_offline_bin(); protected abstract MediaSourceHoldingTank create_offline_bin();
......
...@@ -400,6 +400,12 @@ public abstract class Page : Gtk.ScrolledWindow, SidebarPage { ...@@ -400,6 +400,12 @@ public abstract class Page : Gtk.ScrolledWindow, SidebarPage {
action.sensitive = sensitive; action.sensitive = sensitive;
} }
public void set_common_action_label(string name, string label) {
Gtk.Action? action = get_common_action(name);
if (action != null)
action.set_label(label);
}
public void set_common_action_important(string name, bool important) { public void set_common_action_important(string name, bool important) {
Gtk.Action? action = get_common_action(name); Gtk.Action? action = get_common_action(name);
if (action != null) if (action != null)
......
...@@ -40,6 +40,7 @@ public class VideosPage : MediaPage { ...@@ -40,6 +40,7 @@ public class VideosPage : MediaPage {
action_group.get_action("FilterPhotos").set_label(_("_Filter Videos")); action_group.get_action("FilterPhotos").set_label(_("_Filter Videos"));
action_group.get_action("SortPhotos").set_label(_("Sort _Videos")); action_group.get_action("SortPhotos").set_label(_("Sort _Videos"));
action_group.get_action("DisplayUnratedOrHigher").set_label(_("_All Videos")); action_group.get_action("DisplayUnratedOrHigher").set_label(_("_All Videos"));
set_common_action_label("CommonJumpToEvent", _("View Eve_nt for Video"));
Gtk.Toolbar toolbar = get_toolbar(); Gtk.Toolbar toolbar = get_toolbar();
......
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