gget r16 - in trunk: data gget
- From: johans svn gnome org
- To: svn-commits-list gnome org
- Subject: gget r16 - in trunk: data gget
- Date: Wed, 25 Jun 2008 14:29:24 +0000 (UTC)
Author: johans
Date: Wed Jun 25 14:29:24 2008
New Revision: 16
URL: http://svn.gnome.org/viewvc/gget?rev=16&view=rev
Log:
Remember geometry and position of the main window.
Modified:
trunk/data/gget.schemas.in
trunk/gget/Configuration.py
trunk/gget/MainWindow.py
Modified: trunk/data/gget.schemas.in
==============================================================================
--- trunk/data/gget.schemas.in (original)
+++ trunk/data/gget.schemas.in Wed Jun 25 14:29:24 2008
@@ -67,6 +67,50 @@
</locale>
</schema>
<schema>
+ <key>/schemas/apps/gget/general/window_width</key>
+ <applyto>/apps/gget/general/window_width</applyto>
+ <owner>gget</owner>
+ <type>int</type>
+ <default>800</default>
+ <locale name="C">
+ <short>Main window width</short>
+ <long>The width of the main window.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gget/general/window_height</key>
+ <applyto>/apps/gget/general/window_height</applyto>
+ <owner>gget</owner>
+ <type>int</type>
+ <default>600</default>
+ <locale name="C">
+ <short>Main window height</short>
+ <long>The height of the main window.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gget/general/window_position_x</key>
+ <applyto>/apps/gget/general/window_position_x</applyto>
+ <owner>gget</owner>
+ <type>int</type>
+ <default>50</default>
+ <locale name="C">
+ <short>Main window x position</short>
+ <long>The x position of the main window.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gget/general/window_position_y</key>
+ <applyto>/apps/gget/general/window_position_y</applyto>
+ <owner>gget</owner>
+ <type>int</type>
+ <default>50</default>
+ <locale name="C">
+ <short>Main window y position</short>
+ <long>The y position of the main window.</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/gget/folders/ask_for_location</key>
<applyto>/apps/gget/folders/ask_for_location</applyto>
<owner>gget</owner>
Modified: trunk/gget/Configuration.py
==============================================================================
--- trunk/gget/Configuration.py (original)
+++ trunk/gget/Configuration.py Wed Jun 25 14:29:24 2008
@@ -29,26 +29,34 @@
DIR_GGET = "/apps/gget"
DIR_GNOME = "/desktop/gnome"
-KEY_SHOW_STATUSBAR = "/general/show_statusbar"
-KEY_SHOW_TOOLBAR = "/general/show_toolbar"
-KEY_SHOW_STATUS_ICON = "/general/show_status_icon"
-KEY_SHOW_MAIN_WINDOW = "/general/show_main_window"
-KEY_AUTOSTART = "/general/autostart"
-KEY_AUTORESUME = "/general/autoresume"
-KEY_ASK_FOR_LOCATION = "/folders/ask_for_location"
-KEY_DEFAULT_FOLDER = "/folders/default_folder"
+KEY_SHOW_STATUSBAR = "/general/show_statusbar"
+KEY_SHOW_TOOLBAR = "/general/show_toolbar"
+KEY_SHOW_STATUS_ICON = "/general/show_status_icon"
+KEY_SHOW_MAIN_WINDOW = "/general/show_main_window"
+KEY_AUTOSTART = "/general/autostart"
+KEY_AUTORESUME = "/general/autoresume"
+KEY_ASK_FOR_LOCATION = "/folders/ask_for_location"
+KEY_DEFAULT_FOLDER = "/folders/default_folder"
+KEY_WINDOW_WIDTH = "/general/window_width"
+KEY_WINDOW_HEIGHT = "/general/window_height"
+KEY_WINDOW_POSITION_X = "/general/window_position_x"
+KEY_WINDOW_POSITION_Y = "/general/window_position_y"
KEY_TOOLBAR_STYLE = "/interface/toolbar_style"
-FUNCTION_SUFFIXES = {KEY_SHOW_TOOLBAR: 'bool',
- KEY_SHOW_STATUSBAR: 'bool',
- KEY_SHOW_STATUS_ICON: 'bool',
- KEY_SHOW_MAIN_WINDOW: 'bool',
- KEY_AUTOSTART: 'bool',
- KEY_AUTORESUME: 'bool',
- KEY_ASK_FOR_LOCATION: 'bool',
- KEY_DEFAULT_FOLDER: 'string',
- KEY_TOOLBAR_STYLE: 'string'
+FUNCTION_SUFFIXES = {KEY_SHOW_TOOLBAR: 'bool',
+ KEY_SHOW_STATUSBAR: 'bool',
+ KEY_SHOW_STATUS_ICON: 'bool',
+ KEY_SHOW_MAIN_WINDOW: 'bool',
+ KEY_AUTOSTART: 'bool',
+ KEY_AUTORESUME: 'bool',
+ KEY_ASK_FOR_LOCATION: 'bool',
+ KEY_DEFAULT_FOLDER: 'string',
+ KEY_WINDOW_WIDTH: 'int',
+ KEY_WINDOW_HEIGHT: 'int',
+ KEY_WINDOW_POSITION_X: 'int',
+ KEY_WINDOW_POSITION_Y: 'int',
+ KEY_TOOLBAR_STYLE: 'string'
}
class Configuration(object):
@@ -204,6 +212,54 @@
default_folder = property(get_default_folder, set_default_folder)
+ # Window width
+ def get_window_width(self, use_cache=True):
+ if use_cache:
+ return self.option_cache[KEY_WINDOW_WIDTH]
+ else:
+ return self.__get_option(KEY_WINDOW_WIDTH)
+
+ def set_window_width(self, window_width):
+ self.__set_option(KEY_WINDOW_WIDTH, window_width)
+
+ window_width = property(get_window_width, set_window_width)
+
+ # Window height
+ def get_window_height(self, use_cache=True):
+ if use_cache:
+ return self.option_cache[KEY_WINDOW_HEIGHT]
+ else:
+ return self.__get_option(KEY_WINDOW_HEIGHT)
+
+ def set_window_height(self, window_height):
+ self.__set_option(KEY_WINDOW_HEIGHT, window_height)
+
+ window_height = property(get_window_height, set_window_height)
+
+ # Window position x
+ def get_window_position_x(self, use_cache=True):
+ if use_cache:
+ return self.option_cache[KEY_WINDOW_POSITION_X]
+ else:
+ return self.__get_option(KEY_WINDOW_POSITION_X)
+
+ def set_window_position_x(self, window_position_x):
+ self.__set_option(KEY_WINDOW_POSITION_X, window_position_x)
+
+ window_position_x = property(get_window_position_x, set_window_position_x)
+
+ # Window position y
+ def get_window_position_y(self, use_cache=True):
+ if use_cache:
+ return self.option_cache[KEY_WINDOW_POSITION_Y]
+ else:
+ return self.__get_option(KEY_WINDOW_POSITION_Y)
+
+ def set_window_position_y(self, window_position_y):
+ self.__set_option(KEY_WINDOW_POSITION_Y, window_position_y)
+
+ window_position_y = property(get_window_position_y, set_window_position_y)
+
# Toolbar style
def get_toolbar_style(self, use_cache=True):
if use_cache:
Modified: trunk/gget/MainWindow.py
==============================================================================
--- trunk/gget/MainWindow.py (original)
+++ trunk/gget/MainWindow.py Wed Jun 25 14:29:24 2008
@@ -49,6 +49,11 @@
self.__add_config_notifications()
# Set widget states from configuration
+ self.window.set_default_size(self.config.window_width,
+ self.config.window_height)
+ self.window.move(self.config.window_position_x,
+ self.config.window_position_y)
+
self.show_toolbar_menu_item.set_active(self.config.show_toolbar)
self.show_statusbar_menu_item.set_active(self.config.show_statusbar)
@@ -202,6 +207,7 @@
def __connect_widgets(self):
"""Connect widgets to various signals."""
self.window.connect("destroy", self.quit)
+ self.window.connect("configure-event", self.__window_configure_event)
# File menu
self.add_menu_item.connect("activate", self.show_add_download_dialog)
@@ -238,6 +244,16 @@
self.resume_imi.connect("activate", self.__resume_imi_activate)
self.cancel_imi.connect("activate", self.__cancel_download)
+ def __window_configure_event(self, widget, event):
+ """Saves the window geometry and position"""
+ (width, height) = widget.get_size()
+ self.config.window_width = width
+ self.config.window_height = height
+ (position_x, position_y) = widget.get_position()
+ self.config.window_position_x = position_x
+ self.config.window_position_y = position_y
+ return False # Propagate signal further
+
def show_add_download_dialog(self, widget):
"""Show the dialog used for adding a new download."""
add = AddDownloadDialog(self.config)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]