diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:20 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-09-30 14:09:20 +0200 |
commit | 5e9f4eea451a77ba3b93db3747841ed2bd969e9f (patch) | |
tree | 75046a38ca68975261d853a2e56ff7bf6b3e1daa /src/library/LibraryWindow.vala | |
parent | 18b52c2983a1b3409011f72d27f15de576c5eb1c (diff) |
New upstream version 0.30.1upstream/0.30.1
Diffstat (limited to 'src/library/LibraryWindow.vala')
-rw-r--r-- | src/library/LibraryWindow.vala | 91 |
1 files changed, 58 insertions, 33 deletions
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala index 7f5100a..b9acb22 100644 --- a/src/library/LibraryWindow.vala +++ b/src/library/LibraryWindow.vala @@ -6,6 +6,7 @@ public class LibraryWindow : AppWindow { public const int SIDEBAR_MIN_WIDTH = 120; + public const int EXTENDED_INFO_MIN_WIDTH = 360; public static int PAGE_MIN_WIDTH { get { @@ -45,7 +46,11 @@ public class LibraryWindow : AppWindow { CAMERAS, SAVED_SEARCH, EVENTS, + IMPORT_ROLL, FOLDERS, +#if ENABLE_FACES + FACES, +#endif TAGS } @@ -110,9 +115,13 @@ public class LibraryWindow : AppWindow { private Library.Branch library_branch = new Library.Branch(); private Tags.Branch tags_branch = new Tags.Branch(); private Folders.Branch folders_branch = new Folders.Branch(); +#if ENABLE_FACES + private Faces.Branch faces_branch = new Faces.Branch(); +#endif private Events.Branch events_branch = new Events.Branch(); private Camera.Branch camera_branch = new Camera.Branch(); private Searches.Branch saved_search_branch = new Searches.Branch(); + private ImportRoll.Branch import_roll_branch = new ImportRoll.Branch(); private bool page_switching_enabled = true; private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry>(); @@ -136,7 +145,8 @@ public class LibraryWindow : AppWindow { private bool background_progress_displayed = false; private BasicProperties basic_properties = new BasicProperties(); - private ExtendedPropertiesWindow extended_properties; + private ExtendedProperties extended_properties = new ExtendedProperties(); + private Gtk.Revealer extended_properties_revealer = new Gtk.Revealer(); private Gtk.Stack stack = new Gtk.Stack(); private Gtk.Box layout = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); @@ -164,14 +174,14 @@ public class LibraryWindow : AppWindow { sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY); sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS); sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS); +#if ENABLE_FACES + sidebar_tree.graft(faces_branch, SidebarRootPosition.FACES); +#endif + sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS); sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS); sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH); - - // create and connect extended properties window - extended_properties = new ExtendedPropertiesWindow(this); - extended_properties.hide.connect(hide_extended_properties); - extended_properties.show.connect(show_extended_properties); + sidebar_tree.graft(import_roll_branch, SidebarRootPosition.IMPORT_ROLL); properties_scheduler = new OneShotScheduler("LibraryWindow properties", on_update_properties_now); @@ -228,9 +238,6 @@ public class LibraryWindow : AppWindow { unsubscribe_from_basic_information(get_current_page()); - extended_properties.hide.disconnect(hide_extended_properties); - extended_properties.show.disconnect(show_extended_properties); - foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all()) { media_sources.trashcan_contents_altered.disconnect(on_trashcan_contents_altered); media_sources.items_altered.disconnect(on_media_altered); @@ -404,7 +411,17 @@ public class LibraryWindow : AppWindow { else debug("No search entry found for rename"); } - + +#if ENABLE_FACES + public void rename_face_in_sidebar(Face face) { + Faces.SidebarEntry? entry = faces_branch.get_entry_for_face(face); + if (entry != null) + sidebar_tree.rename_entry_in_place(entry); + else + assert_not_reached(); + } +#endif + protected override void on_quit() { Config.Facade.get_instance().set_library_window_state(maximized, dimensions); @@ -687,12 +704,11 @@ public class LibraryWindow : AppWindow { if (display) { extended_properties.update_properties(get_current_page()); - extended_properties.show_all(); - } else { - extended_properties.hide(); } + extended_properties_revealer.set_reveal_child(display); action.set_state (value); + Config.Facade.get_instance().set_display_extended_properties(display); } private void on_display_searchbar(GLib.SimpleAction action, Variant? value) { @@ -750,22 +766,6 @@ public class LibraryWindow : AppWindow { return Config.Facade.get_instance ().get_display_toolbar (); } - private void show_extended_properties() { - sync_extended_properties(true); - } - - private void hide_extended_properties() { - sync_extended_properties(false); - } - - private void sync_extended_properties(bool show) { - var action = this.lookup_action ("CommonDisplayExtendedProperties"); - action.change_state (show); - - // sync the setting so it will persist - Config.Facade.get_instance().set_display_extended_properties(show); - } - public void enqueue_batch_import(BatchImport batch_import, bool allow_user_cancel) { library_branch.import_queue_entry.enqueue_and_schedule(batch_import, allow_user_cancel); } @@ -810,9 +810,9 @@ public class LibraryWindow : AppWindow { private Gdk.DragAction get_drag_action() { Gdk.ModifierType mask; - - get_window().get_device_position(Gdk.Display.get_default().get_device_manager() - .get_client_pointer(), null, null, out mask); + + var seat = Gdk.Display.get_default().get_default_seat(); + get_window().get_device_position(seat.get_pointer(), null, null, out mask); bool ctrl = (mask & Gdk.ModifierType.CONTROL_MASK) != 0; bool alt = (mask & Gdk.ModifierType.MOD1_MASK) != 0; @@ -1186,7 +1186,9 @@ public class LibraryWindow : AppWindow { right_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); right_vbox.pack_start(search_toolbar, false, false, 0); - right_vbox.pack_start(stack, true, true, 0); + var stack_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0); + stack_box.pack_start(stack, true, true, 0); + right_vbox.pack_start(stack_box, true, true, 0); right_vbox.add (toolbar_revealer); client_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL); @@ -1196,6 +1198,29 @@ public class LibraryWindow : AppWindow { client_paned.set_position(Config.Facade.get_instance().get_sidebar_position()); // TODO: Calc according to layout's size, to give sidebar a maximum width stack.set_size_request(PAGE_MIN_WIDTH, -1); + var scrolled = new Gtk.ScrolledWindow(null, null); + scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); + scrolled.add(extended_properties); + extended_properties_revealer.add(scrolled); + extended_properties_revealer.set_transition_type(Gtk.RevealerTransitionType.SLIDE_LEFT); + extended_properties_revealer.halign = Gtk.Align.END; + extended_properties_revealer.valign = Gtk.Align.FILL; + + extended_properties.vexpand = true; + extended_properties.set_margin_top (9); + extended_properties.set_margin_bottom (9); + extended_properties.set_margin_start (9); + extended_properties.set_margin_end (9); + scrolled.set_size_request(EXTENDED_INFO_MIN_WIDTH, -1); + + stack_box.pack_end(extended_properties_revealer, false, false, 0); + extended_properties_revealer.halign = Gtk.Align.END; + extended_properties_revealer.hexpand = false; + if (Config.Facade.get_instance().get_display_extended_properties()) { + extended_properties_revealer.set_reveal_child(true); + } else { + extended_properties_revealer.set_reveal_child(false); + } layout.pack_end(client_paned, true, true, 0); |