paperbox r158 - in trunk: . src



Author: markoa
Date: Wed Jun  4 21:09:27 2008
New Revision: 158
URL: http://svn.gnome.org/viewvc/paperbox?rev=158&view=rev

Log:
Store main paned position in the settings

Modified:
   trunk/ChangeLog
   trunk/src/config.cc
   trunk/src/config.hh
   trunk/src/main-window.cc
   trunk/src/main-window.hh

Modified: trunk/src/config.cc
==============================================================================
--- trunk/src/config.cc	(original)
+++ trunk/src/config.cc	Wed Jun  4 21:09:27 2008
@@ -40,6 +40,7 @@
         Glib::KeyFile kf;
         kf.set_integer(UI_GROUP, "window_width", DEFAULT_WIDTH);
         kf.set_integer(UI_GROUP, "window_height", DEFAULT_HEIGHT);
+        kf.set_integer(UI_GROUP, "paned_position", 3 * (DEFAULT_WIDTH / 4));
  
         Glib::RefPtr<Gio::File> file =
             Gio::File::create_for_path(KEY_FILE_CONFIG_PATH);
@@ -92,11 +93,22 @@
     }
 
     void
+    KeyFileConfig::get_paned_position(int& pos)
+    {
+        pos = keyfile_.get_integer(UI_GROUP, "paned_position");
+    }
+
+    void
     KeyFileConfig::set_window_size(const int width, const int height)
     {
         keyfile_.set_integer(UI_GROUP, "window_width", width);
         keyfile_.set_integer(UI_GROUP, "window_height", height);
-        save();
+    }
+
+    void
+    KeyFileConfig::set_paned_position(const int pos)
+    {
+        keyfile_.set_integer(UI_GROUP, "paned_position", pos);
     }
 
     void

Modified: trunk/src/config.hh
==============================================================================
--- trunk/src/config.hh	(original)
+++ trunk/src/config.hh	Wed Jun  4 21:09:27 2008
@@ -34,6 +34,9 @@
 
         virtual void get_window_size(int& width, int& height) = 0;
         virtual void set_window_size(const int width, const int height) = 0;
+ 
+        virtual void get_paned_position(int& pos) = 0;
+        virtual void set_paned_position(const int pos) = 0;
 
         virtual void save() = 0;
     };
@@ -53,6 +56,9 @@
         virtual void get_window_size(int& width, int& height);
         virtual void set_window_size(const int width, const int height);
 
+        virtual void get_paned_position(int& pos);
+        virtual void set_paned_position(const int pos);
+
         virtual void save();
 
         std::string get_key_file_path();

Modified: trunk/src/main-window.cc
==============================================================================
--- trunk/src/main-window.cc	(original)
+++ trunk/src/main-window.cc	Wed Jun  4 21:09:27 2008
@@ -123,7 +123,9 @@
         cfg->get_window_size(width, height);
         set_default_size(width, height);
 
-        setup_pane_pos();
+        int pane_pos;
+        cfg->get_paned_position(pane_pos);
+        hpane_->set_position(pane_pos);
 
         browser_ = Browser::instance();
         tiles_.reset(new TileSet());
@@ -136,9 +138,15 @@
     MainWindow::~MainWindow()
     {
         shared_ptr<Config> cfg = get_default_config();
+        
         int width, height;
         get_size(width, height);
         cfg->set_window_size(width, height);
+
+        int pos = hpane_->get_position();
+        cfg->set_paned_position(pos);
+
+        cfg->save();
     }
 
     MainWindow*
@@ -212,14 +220,6 @@
     }
 
     void
-    MainWindow::setup_pane_pos()
-    {
-        int width, height;
-        get_size(width, height);
-        hpane_->set_position(3 * (width / 4));
-    }
-
-    void
     MainWindow::setup_categories()
     {
         category_view_.reset(new CategoryView(category_vbox_));

Modified: trunk/src/main-window.hh
==============================================================================
--- trunk/src/main-window.hh	(original)
+++ trunk/src/main-window.hh	Wed Jun  4 21:09:27 2008
@@ -59,7 +59,6 @@
         void init_gui();
         void get_widgets_from_ui_file();
         void setup_tiles();
-        void setup_pane_pos();
         void setup_categories();
         void reload_category_view();
         void connect_signals();



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