Commit e2198219 authored by Jim Nelson's avatar Jim Nelson

Revert "Use Gtk.Stack instead of Gtk.Notebook in LibraryWindow: Bug #744289"

This reverts commit be4dc326.

Problems while editing photos were detected after original commit.
Patch needs more work before accepting.
parent eedaf5b3
......@@ -147,7 +147,7 @@ public class LibraryWindow : AppWindow {
private BasicProperties basic_properties = new BasicProperties();
private ExtendedPropertiesWindow extended_properties;
private Gtk.Stack stack = new Gtk.Stack();
private Gtk.Notebook notebook = new Gtk.Notebook();
private Gtk.Box layout = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
private Gtk.Box right_vbox;
......@@ -1054,7 +1054,7 @@ public class LibraryWindow : AppWindow {
assert(controller.get_view().get_view_for_source(current) != null);
if (photo_page == null) {
photo_page = new LibraryPhotoPage();
add_to_stack(photo_page);
add_to_notebook(photo_page);
// need to do this to allow the event loop a chance to map and realize the page
// before switching to it
......@@ -1097,21 +1097,22 @@ public class LibraryWindow : AppWindow {
}
// This should only be called by LibraryWindow and PageStub.
public void add_to_stack(Page page) {
// need to show all before handing over to stack
public void add_to_notebook(Page page) {
// need to show all before handing over to notebook
page.show_all();
stack.add(page);
int pos = notebook.append_page(page, null);
assert(pos >= 0);
// need to show_all() after pages are added and removed
stack.show_all();
notebook.show_all();
}
private void remove_from_stack(Page page) {
stack.remove(page);
private void remove_from_notebook(Page page) {
notebook.remove(page);
// need to show_all() after pages are added and removed
stack.show_all();
notebook.show_all();
}
// check for settings that should persist between instances
......@@ -1276,6 +1277,10 @@ public class LibraryWindow : AppWindow {
}
private void create_layout(Page start_page) {
// use a Notebook to hold all the pages, which are switched when a sidebar child is selected
notebook.set_show_tabs(false);
notebook.set_show_border(false);
// put the sidebar in a scrolling window
Gtk.ScrolledWindow scrolled_sidebar = new Gtk.ScrolledWindow(null, null);
scrolled_sidebar.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
......@@ -1304,7 +1309,7 @@ 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);
right_vbox.pack_start(notebook, true, true, 0);
client_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
client_paned.pack1(sidebar_paned, false, false);
......@@ -1312,7 +1317,7 @@ public class LibraryWindow : AppWindow {
client_paned.pack2(right_vbox, true, false);
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);
notebook.set_size_request(PAGE_MIN_WIDTH, -1);
layout.pack_end(client_paned, true, true, 0);
......@@ -1355,7 +1360,7 @@ public class LibraryWindow : AppWindow {
unsubscribe_from_basic_information(current_page);
}
stack.set_visible_child(page);
notebook.set_current_page(notebook.page_num(page));
// do this prior to changing selection, as the change will fire a cursor-changed event,
// which will then call this function again
......@@ -1430,7 +1435,7 @@ public class LibraryWindow : AppWindow {
assert(!page_map.has_key(page));
page_map.set(page, entry);
add_to_stack(page);
add_to_notebook(page);
}
private void on_destroying_page(Sidebar.PageRepresentative entry, Page page) {
......@@ -1438,7 +1443,7 @@ public class LibraryWindow : AppWindow {
if (page == get_current_page())
switch_to_page(library_branch.get_main_page());
remove_from_stack(page);
remove_from_notebook(page);
bool removed = page_map.unset(page);
assert(removed);
......
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