From c43dfb815a4951b8248f4f0e98babe4f80204f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 3 Apr 2015 13:14:53 +0200 Subject: Imported Upstream version 0.22.0 --- src/library/LastImportSidebarEntry.vala | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/library/LastImportSidebarEntry.vala (limited to 'src/library/LastImportSidebarEntry.vala') diff --git a/src/library/LastImportSidebarEntry.vala b/src/library/LastImportSidebarEntry.vala new file mode 100644 index 0000000..3414130 --- /dev/null +++ b/src/library/LastImportSidebarEntry.vala @@ -0,0 +1,36 @@ +/* Copyright 2011-2015 Yorba Foundation + * + * This software is licensed under the GNU Lesser General Public License + * (version 2.1 or later). See the COPYING file in this distribution. + */ + +public class Library.LastImportSidebarEntry : Library.HideablePageEntry { + public LastImportSidebarEntry() { + foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all()) + media_sources.import_roll_altered.connect(on_import_rolls_altered); + + visible = (MediaCollectionRegistry.get_instance().get_last_import_id() != null); + } + + ~LastImportSidebarEntry() { + foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all()) + media_sources.import_roll_altered.disconnect(on_import_rolls_altered); + } + + public override string get_sidebar_name() { + return LastImportPage.NAME; + } + + public override string? get_sidebar_icon() { + return Resources.ICON_LAST_IMPORT; + } + + protected override Page create_page() { + return new LastImportPage(); + } + + private void on_import_rolls_altered() { + visible = (MediaCollectionRegistry.get_instance().get_last_import_id() != null); + } +} + -- cgit v1.2.3