diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 22:57:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 22:57:41 +0000 |
commit | 4465980abb5516b9cf56682119a441f90bd2e072 (patch) | |
tree | 2dc4afbcf53892011419388c9294da7f13632c67 | |
parent | b232fc0b33f3c21a90918be4b646ccef388c9e63 (diff) | |
download | chromium_src-4465980abb5516b9cf56682119a441f90bd2e072.zip chromium_src-4465980abb5516b9cf56682119a441f90bd2e072.tar.gz chromium_src-4465980abb5516b9cf56682119a441f90bd2e072.tar.bz2 |
Remember/restore the bookmark manager pane position.
BUG=18071
Review URL: http://codereview.chromium.org/160422
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22113 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.cc | 24 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.h | 1 |
2 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc index 06c86c0..132b6f9 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.cc +++ b/chrome/browser/gtk/bookmark_manager_gtk.cc @@ -331,6 +331,9 @@ BookmarkManagerGtk::BookmarkManagerGtk(Profile* profile) } BookmarkManagerGtk::~BookmarkManagerGtk() { + g_browser_process->local_state()->SetInteger( + prefs::kBookmarkManagerSplitLocation, + gtk_paned_get_position(GTK_PANED(paned_))); SaveColumnConfiguration(); model_->RemoveObserver(this); } @@ -403,15 +406,26 @@ void BookmarkManagerGtk::InitWidgets() { GtkWidget* left_pane = MakeLeftPane(); GtkWidget* right_pane = MakeRightPane(); - GtkWidget* paned = gtk_hpaned_new(); + paned_ = gtk_hpaned_new(); + gtk_paned_pack1(GTK_PANED(paned_), left_pane, FALSE, FALSE); + gtk_paned_pack2(GTK_PANED(paned_), right_pane, TRUE, FALSE); + // Set the initial position of the pane divider. - gtk_paned_set_position(GTK_PANED(paned), width / 3); - gtk_paned_pack1(GTK_PANED(paned), left_pane, FALSE, FALSE); - gtk_paned_pack2(GTK_PANED(paned), right_pane, TRUE, FALSE); + int split_x = g_browser_process->local_state()->GetInteger( + prefs::kBookmarkManagerSplitLocation); + if (split_x == -1) { + split_x = width / 3; + } else { + int min_split_size = width / 8; + // Make sure the user can see both the tree/table. + split_x = std::min(width - min_split_size, + std::max(min_split_size, split_x)); + } + gtk_paned_set_position(GTK_PANED(paned_), split_x); GtkWidget* vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), paned, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), paned_, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(window_), vbox); ResetOrganizeMenu(true); diff --git a/chrome/browser/gtk/bookmark_manager_gtk.h b/chrome/browser/gtk/bookmark_manager_gtk.h index e09681a..261a05c 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.h +++ b/chrome/browser/gtk/bookmark_manager_gtk.h @@ -279,6 +279,7 @@ class BookmarkManagerGtk : public BookmarkModelObserver, GtkWidget* search_entry_; Profile* profile_; BookmarkModel* model_; + GtkWidget* paned_; GtkWidget* left_tree_view_; GtkWidget* right_tree_view_; |