Fix sidebar view option to be persistent between sessions

This commit is contained in:
Andrew Resch 2008-08-25 08:23:31 +00:00
parent aceab3cd11
commit 2b8e235e8a
2 changed files with 6 additions and 5 deletions

View File

@ -93,7 +93,6 @@ class FilterTreeView(component.Component):
self.create_model_filter() self.create_model_filter()
#init..... #init.....
self._start()
self.hpaned.set_position(170) self.hpaned.set_position(170)
self.label_view.connect("button-press-event", self.on_button_press_event) self.label_view.connect("button-press-event", self.on_button_press_event)

View File

@ -37,6 +37,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):
@ -51,17 +52,20 @@ class SideBar(component.Component):
self.notebook = glade.get_widget("sidebar_notebook") self.notebook = glade.get_widget("sidebar_notebook")
self.hpaned = glade.get_widget("hpaned") self.hpaned = glade.get_widget("hpaned")
self.is_visible = True self.is_visible = True
self.config = ConfigManager("gtkui.conf")
self.hpaned_position = self.hpaned.get_position() self.hpaned_position = self.hpaned.get_position()
# Tabs holds references to the Tab widgets by their name # Tabs holds references to the Tab widgets by their name
self.tabs = {} self.tabs = {}
# Hide if necessary
self.visible(self.config["show_sidebar"])
def visible(self, visible): def visible(self, visible):
if visible: if visible:
if self.hpaned_position: if self.hpaned_position:
self.hpaned.set_position(self.hpaned_position) self.hpaned.set_position(self.hpaned_position)
self.notebook.show() self.notebook.show()
else: else:
self.notebook.hide() self.notebook.hide()
# Store the position for restoring upon show() # Store the position for restoring upon show()
@ -69,6 +73,7 @@ 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 add_tab(self, widget, tab_name, label): def add_tab(self, widget, tab_name, label):
"""Adds a tab object to the notebook.""" """Adds a tab object to the notebook."""
@ -76,9 +81,6 @@ class SideBar(component.Component):
self.tabs[tab_name] = widget self.tabs[tab_name] = widget
pos = self.notebook.insert_page(widget, gtk.Label(label), -1) pos = self.notebook.insert_page(widget, gtk.Label(label), -1)
widget.show_all() widget.show_all()
if not self.notebook.get_property("visible"):
# If the notebook isn't visible, show it
self.visible(True) #Shure?
self.after_update() self.after_update()