Fix view options to be persistent between sessions
This commit is contained in:
parent
cac6b42449
commit
327de6f5cd
|
@ -97,7 +97,10 @@ DEFAULT_PREFS = {
|
|||
"autoadd_location": "",
|
||||
"choose_directory_dialog_path": deluge.common.get_default_download_dir(),
|
||||
"show_new_releases": True,
|
||||
"signal_port": 40000
|
||||
"signal_port": 40000,
|
||||
"show_sidebar": True,
|
||||
"show_toolbar": True,
|
||||
"show_statusbar": True
|
||||
}
|
||||
|
||||
class GtkUI:
|
||||
|
|
|
@ -101,6 +101,14 @@ class MenuBar(component.Component):
|
|||
# Attach the torrent_menu to the Torrent file menu
|
||||
self.menu_torrent.set_submenu(self.torrentmenu)
|
||||
|
||||
# Make sure the view menuitems are showing the correct active state
|
||||
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 ###
|
||||
self.window.main_glade.signal_autoconnect({
|
||||
## File Menu
|
||||
|
@ -167,7 +175,7 @@ class MenuBar(component.Component):
|
|||
self.window.main_glade.get_widget("menuitem_quitdaemon").hide()
|
||||
self.window.main_glade.get_widget("separatormenuitem").hide()
|
||||
self.window.main_glade.get_widget("menuitem_connectionmanager").hide()
|
||||
|
||||
|
||||
def start(self):
|
||||
for widget in self.change_sensitivity:
|
||||
self.window.main_glade.get_widget(widget).set_sensitive(True)
|
||||
|
|
|
@ -36,6 +36,7 @@ import gtk.glade
|
|||
|
||||
import deluge.component as component
|
||||
import deluge.common
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.log import LOG as log
|
||||
|
||||
class SideBar(component.Component):
|
||||
|
@ -47,6 +48,7 @@ class SideBar(component.Component):
|
|||
self.hpaned = glade.get_widget("hpaned")
|
||||
self.scrolled = glade.get_widget("scrolledwindow_sidebar")
|
||||
self.is_visible = True
|
||||
self.config = ConfigManager("gtkui.conf")
|
||||
|
||||
# Create the liststore
|
||||
# state str, str that's visible, icon
|
||||
|
@ -90,6 +92,9 @@ class SideBar(component.Component):
|
|||
self.label_view.get_selection().select_iter(
|
||||
self.liststore.get_iter_first())
|
||||
|
||||
# Hide if necessary
|
||||
self.visible(self.config["show_sidebar"])
|
||||
|
||||
def visible(self, visible):
|
||||
if visible:
|
||||
self.scrolled.show()
|
||||
|
@ -98,6 +103,7 @@ class SideBar(component.Component):
|
|||
self.hpaned.set_position(-1)
|
||||
|
||||
self.is_visible = visible
|
||||
self.config["show_sidebar"] = visible
|
||||
|
||||
def on_selection_changed(self, selection):
|
||||
try:
|
||||
|
|
|
@ -135,6 +135,9 @@ class StatusBar(component.Component):
|
|||
callback=self._on_notconnected_item_clicked)
|
||||
# Show the not connected status bar
|
||||
self.show_not_connected()
|
||||
|
||||
# Hide if necessary
|
||||
self.visible(self.config["show_statusbar"])
|
||||
|
||||
def start(self):
|
||||
# Add in images and labels
|
||||
|
@ -197,6 +200,8 @@ class StatusBar(component.Component):
|
|||
self.statusbar.show()
|
||||
else:
|
||||
self.statusbar.hide()
|
||||
|
||||
self.config["show_statusbar"] = visible
|
||||
|
||||
def show_not_connected(self):
|
||||
self.hbox.pack_start(
|
||||
|
|
|
@ -78,6 +78,9 @@ class ToolBar(component.Component):
|
|||
|
||||
if self.config["classic_mode"]:
|
||||
self.window.main_glade.get_widget("toolbutton_connectionmanager").hide()
|
||||
|
||||
# Hide if necessary
|
||||
self.visible(self.config["show_toolbar"])
|
||||
|
||||
def start(self):
|
||||
for widget in self.change_sensitivity:
|
||||
|
@ -94,6 +97,8 @@ class ToolBar(component.Component):
|
|||
else:
|
||||
self.toolbar.hide()
|
||||
|
||||
self.config["show_toolbar"] = visible
|
||||
|
||||
def add_toolbutton(self, callback, label=None, image=None, stock=None,
|
||||
tooltip=None):
|
||||
"""Adds a toolbutton to the toolbar"""
|
||||
|
|
Loading…
Reference in New Issue