From 4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 09:06:59 +0200 Subject: Imported Upstream version 0.18.1 --- src/library/LastImportBranch.vala | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/library/LastImportBranch.vala (limited to 'src/library/LastImportBranch.vala') diff --git a/src/library/LastImportBranch.vala b/src/library/LastImportBranch.vala new file mode 100644 index 0000000..bc03ee5 --- /dev/null +++ b/src/library/LastImportBranch.vala @@ -0,0 +1,47 @@ +/* Copyright 2011-2014 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.LastImportBranch : Sidebar.RootOnlyBranch { + public LastImportBranch() { + base (new Library.LastImportSidebarEntry()); + + foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all()) + media_sources.import_roll_altered.connect(on_import_rolls_altered); + + set_show_branch(MediaCollectionRegistry.get_instance().get_last_import_id() != null); + } + + ~LastImportBranch() { + foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all()) + media_sources.import_roll_altered.disconnect(on_import_rolls_altered); + } + + public Library.LastImportSidebarEntry get_main_entry() { + return (Library.LastImportSidebarEntry) get_root(); + } + + private void on_import_rolls_altered() { + set_show_branch(MediaCollectionRegistry.get_instance().get_last_import_id() != null); + } +} + +public class Library.LastImportSidebarEntry : Sidebar.SimplePageEntry { + public LastImportSidebarEntry() { + } + + public override string get_sidebar_name() { + return LastImportPage.NAME; + } + + public override Icon? get_sidebar_icon() { + return new ThemedIcon(Resources.ICON_LAST_IMPORT); + } + + protected override Page create_page() { + return new LastImportPage(); + } +} + -- cgit v1.2.3