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

Fixes string bugs #2909 and #2912.

parent f724371e
......@@ -256,35 +256,17 @@ public abstract class CollectionPage : MediaPage {
}
private bool selection_has_video() {
foreach (DataSource source in get_view().get_selected_sources()) {
if (source is Video) {
return true;
}
}
return false;
return MediaSourceCollection.has_video((Gee.Collection<MediaSource>) get_view().get_selected_sources());
}
private bool page_has_photo() {
foreach (DataSource source in get_view().get_sources()) {
if (source is Photo) {
return true;
}
}
return false;
return MediaSourceCollection.has_photo((Gee.Collection<MediaSource>) get_view().get_sources());
}
private bool selection_has_photo() {
foreach (DataSource source in get_view().get_selected_sources()) {
if (source is Photo) {
return true;
}
}
return false;
return MediaSourceCollection.has_photo((Gee.Collection<MediaSource>) get_view().get_selected_sources());
}
protected override void update_actions(int selected_count, int count) {
base.update_actions(selected_count, count);
......
......@@ -60,8 +60,17 @@ class EventDirectoryItem : CheckerboardItem {
}
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();
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()),
guarded_markup_escape_text(count_text));
......
......@@ -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_offline_bin();
......
......@@ -399,6 +399,12 @@ public abstract class Page : Gtk.ScrolledWindow, SidebarPage {
if (action != null)
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) {
Gtk.Action? action = get_common_action(name);
......
......@@ -40,6 +40,7 @@ public class VideosPage : MediaPage {
action_group.get_action("FilterPhotos").set_label(_("_Filter Videos"));
action_group.get_action("SortPhotos").set_label(_("Sort _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();
......
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