Fix view options to be persistent between sessions

This commit is contained in:
Andrew Resch 2008-07-26 08:12:34 +00:00
commit feb54cd785
6 changed files with 31 additions and 4 deletions

View file

@ -9,6 +9,7 @@ Deluge 0.9.04 - "1.0.0_RC4" (In Development)
* Fix new release check * Fix new release check
* Display 'total_wanted' instead of 'total_size' in Size column * Display 'total_wanted' instead of 'total_size' in Size column
* Fix displaying of torrents when language is not English * Fix displaying of torrents when language is not English
* Fix the view options to be persistent between sessions
Deluge 0.9.03 - "1.0.0_RC3" (21 July 2008) Deluge 0.9.03 - "1.0.0_RC3" (21 July 2008)
Core: Core:

View file

@ -97,7 +97,10 @@ DEFAULT_PREFS = {
"autoadd_location": "", "autoadd_location": "",
"choose_directory_dialog_path": deluge.common.get_default_download_dir(), "choose_directory_dialog_path": deluge.common.get_default_download_dir(),
"show_new_releases": True, "show_new_releases": True,
"signal_port": 40000 "signal_port": 40000,
"show_sidebar": True,
"show_toolbar": True,
"show_statusbar": True
} }
class GtkUI: class GtkUI:

View file

@ -101,6 +101,13 @@ class MenuBar(component.Component):
# Attach the torrent_menu to the Torrent file menu # Attach the torrent_menu to the Torrent file menu
self.menu_torrent.set_submenu(self.torrentmenu) self.menu_torrent.set_submenu(self.torrentmenu)
self.window.main_glade.get_widget("menuitem_toolbar").set_active(
self.config["show_toolbar"])
self.window.main_glade.get_widget("menuitem_labels").set_active(
self.config["show_sidebar"])
self.window.main_glade.get_widget("menuitem_statusbar").set_active(
self.config["show_statusbar"])
### Connect Signals ### ### Connect Signals ###
self.window.main_glade.signal_autoconnect({ self.window.main_glade.signal_autoconnect({
## File Menu ## File Menu

View file

@ -36,6 +36,7 @@ import gtk.glade
import deluge.component as component import deluge.component as component
import deluge.common import deluge.common
from deluge.configmanager import ConfigManager
from deluge.log import LOG as log from deluge.log import LOG as log
class SideBar(component.Component): class SideBar(component.Component):
@ -47,7 +48,8 @@ class SideBar(component.Component):
self.hpaned = glade.get_widget("hpaned") self.hpaned = glade.get_widget("hpaned")
self.scrolled = glade.get_widget("scrolledwindow_sidebar") self.scrolled = glade.get_widget("scrolledwindow_sidebar")
self.is_visible = True self.is_visible = True
self.config = ConfigManager("gtkui.conf")
# Create the liststore # Create the liststore
# state str, str that's visible, icon # state str, str that's visible, icon
self.liststore = gtk.ListStore(str, str, gtk.gdk.Pixbuf) self.liststore = gtk.ListStore(str, str, gtk.gdk.Pixbuf)
@ -89,6 +91,9 @@ class SideBar(component.Component):
# Select the 'All' label on init # Select the 'All' label on init
self.label_view.get_selection().select_iter( self.label_view.get_selection().select_iter(
self.liststore.get_iter_first()) self.liststore.get_iter_first())
# Hide if necessary
self.visible(self.config["show_sidebar"])
def visible(self, visible): def visible(self, visible):
if visible: if visible:
@ -98,7 +103,8 @@ class SideBar(component.Component):
self.hpaned.set_position(-1) self.hpaned.set_position(-1)
self.is_visible = visible self.is_visible = visible
self.config["show_sidebar"] = visible
def on_selection_changed(self, selection): def on_selection_changed(self, selection):
try: try:
(model, row) = self.label_view.get_selection().get_selected() (model, row) = self.label_view.get_selection().get_selected()

View file

@ -135,6 +135,9 @@ class StatusBar(component.Component):
callback=self._on_notconnected_item_clicked) callback=self._on_notconnected_item_clicked)
# Show the not connected status bar # Show the not connected status bar
self.show_not_connected() self.show_not_connected()
# Hide if necessary
self.visible(self.config["show_statusbar"])
def start(self): def start(self):
# Add in images and labels # Add in images and labels
@ -197,7 +200,9 @@ class StatusBar(component.Component):
self.statusbar.show() self.statusbar.show()
else: else:
self.statusbar.hide() self.statusbar.hide()
self.config["show_statusbar"] = visible
def show_not_connected(self): def show_not_connected(self):
self.hbox.pack_start( self.hbox.pack_start(
self.not_connected_item.get_eventbox(), expand=False, fill=False) self.not_connected_item.get_eventbox(), expand=False, fill=False)

View file

@ -78,6 +78,9 @@ class ToolBar(component.Component):
if self.config["classic_mode"]: if self.config["classic_mode"]:
self.window.main_glade.get_widget("toolbutton_connectionmanager").hide() self.window.main_glade.get_widget("toolbutton_connectionmanager").hide()
# Hide if necessary
self.visible(self.config["show_toolbar"])
def start(self): def start(self):
for widget in self.change_sensitivity: for widget in self.change_sensitivity:
@ -94,6 +97,8 @@ class ToolBar(component.Component):
else: else:
self.toolbar.hide() self.toolbar.hide()
self.config["show_toolbar"] = visible
def add_toolbutton(self, callback, label=None, image=None, stock=None, def add_toolbutton(self, callback, label=None, image=None, stock=None,
tooltip=None): tooltip=None):
"""Adds a toolbutton to the toolbar""" """Adds a toolbutton to the toolbar"""