[gnote] Save the splitter position for the search window (Tomboy bug #563744).



commit d1cba305546373175d7637e09a9c4fb398751ce3
Author: Hubert Figuiere <hub figuiere net>
Date:   Fri Jul 17 01:13:26 2009 -0400

    Save the splitter position for the search window (Tomboy bug #563744).
    (tb-backport)

 src/preferences.cpp   |    1 +
 src/preferences.hpp   |    1 +
 src/recentchanges.cpp |   23 +++++++++++++----------
 src/recentchanges.hpp |    2 ++
 4 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/preferences.cpp b/src/preferences.cpp
index e3f6d47..c075b85 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -61,6 +61,7 @@ namespace gnote {
   const char * Preferences::SEARCH_WINDOW_Y_POS = "/apps/gnote/search_window_y_pos";
   const char * Preferences::SEARCH_WINDOW_WIDTH = "/apps/gnote/search_window_width";
   const char * Preferences::SEARCH_WINDOW_HEIGHT = "/apps/gnote/search_window_height";
+  const char * Preferences::SEARCH_WINDOW_SPLITTER_POS = "/apps/gnote/search_window_splitter_pos";
 
 
   Preferences::Preferences()
diff --git a/src/preferences.hpp b/src/preferences.hpp
index 5741b8e..3b9f1fb 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -71,6 +71,7 @@ namespace gnote {
     static const char *SEARCH_WINDOW_Y_POS;
     static const char *SEARCH_WINDOW_WIDTH;
     static const char *SEARCH_WINDOW_HEIGHT;
+    static const char *SEARCH_WINDOW_SPLITTER_POS;
 
     Preferences();
     ~Preferences();
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 95f7a5e..5cefcc5 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -24,7 +24,6 @@
 #include <glibmm/i18n.h>
 #include <gtkmm/image.h>
 #include <gtkmm/main.h>
-#include <gtkmm/paned.h>
 #include <gtkmm/stock.h>
 #include <gtkmm/table.h>
 #include <gtkmm/treestore.h>
@@ -174,23 +173,22 @@ namespace gnote {
     m_tree->get_size_request (h,w);
     m_matches_window.set_size_request(std::min(h, 420), std::min(w, 480));
                         
-    restore_position ();
-
     m_matches_window.property_hscrollbar_policy() = Gtk::POLICY_AUTOMATIC;
     m_matches_window.property_vscrollbar_policy() = Gtk::POLICY_AUTOMATIC;
     m_matches_window.add (*m_tree);
     m_matches_window.show ();
 
-    Gtk::HPaned *hpaned = manage(new Gtk::HPaned ());
-    hpaned->set_position(150);
-    hpaned->add1 (*notebooksPane);
-    hpaned->add2 (m_matches_window);
-    hpaned->show ();
+    m_hpaned.set_position(150);
+    m_hpaned.add1 (*notebooksPane);
+    m_hpaned.add2 (m_matches_window);
+    m_hpaned.show ();
+
+    restore_position ();
 
     Gtk::VBox *vbox = manage(new Gtk::VBox (false, 8));
     vbox->set_border_width(6);
     vbox->pack_start (*hbox, false, false, 0);
-    vbox->pack_start (*hpaned, true, true, 0);
+    vbox->pack_start (m_hpaned, true, true, 0);
     vbox->pack_start (m_status_bar, false, false, 0);
     vbox->show ();
 
@@ -1543,6 +1541,8 @@ namespace gnote {
     prefs.set<int> (Preferences::SEARCH_WINDOW_Y_POS, y);
     prefs.set<int> (Preferences::SEARCH_WINDOW_WIDTH, width);
     prefs.set<int> (Preferences::SEARCH_WINDOW_HEIGHT, height);
+    prefs.set<int> (Preferences::SEARCH_WINDOW_SPLITTER_POS, 
+                    m_hpaned.get_position());
   }
         
    
@@ -1553,7 +1553,7 @@ namespace gnote {
     int y = prefs.get<int> (Preferences::SEARCH_WINDOW_Y_POS);
     int width = prefs.get<int> (Preferences::SEARCH_WINDOW_WIDTH);
     int height = prefs.get<int> (Preferences::SEARCH_WINDOW_HEIGHT);
-          
+    int pos = prefs.get<int> (Preferences::SEARCH_WINDOW_SPLITTER_POS);
 
     if((width == 0) || (height == 0)) {
       return;
@@ -1561,6 +1561,9 @@ namespace gnote {
           
     set_default_size(width, height);
     move (x, y);
+    if(pos) {
+      m_hpaned.set_position(pos);
+    }
   }
 
 
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 320888e..62beb07 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -34,6 +34,7 @@
 #include <gtkmm/comboboxentry.h>
 #include <gtkmm/liststore.h>
 #include <gtkmm/menubar.h>
+#include <gtkmm/paned.h>
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/selectiondata.h>
 #include <gtkmm/statusbar.h>
@@ -167,6 +168,7 @@ private:
   Gtk::CheckButton    m_case_sensitive;
   Gtk::Statusbar      m_status_bar;
   Gtk::ScrolledWindow m_matches_window;
+  Gtk::HPaned         m_hpaned;
   Gtk::VBox           m_content_vbox;
   Gtk::TreeViewColumn *m_matches_column;
         



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]