Fix #549 make sidebar width persistent
This commit is contained in:
parent
219be3f440
commit
7caf26779f
|
@ -128,7 +128,6 @@ class FilterTreeView(component.Component):
|
|||
self.create_model_filter()
|
||||
|
||||
#init.....
|
||||
self.hpaned.set_position(170)
|
||||
self.label_view.connect("button-press-event", self.on_button_press_event)
|
||||
|
||||
#colors using current theme.
|
||||
|
|
|
@ -113,8 +113,9 @@ DEFAULT_PREFS = {
|
|||
"show_sidebar": True,
|
||||
"show_toolbar": True,
|
||||
"show_statusbar": True,
|
||||
"sidebar_show_zero":False,
|
||||
"sidebar_show_trackers":False
|
||||
"sidebar_show_zero": False,
|
||||
"sidebar_show_trackers": False,
|
||||
"sidebar_position": 170
|
||||
}
|
||||
|
||||
class GtkUI:
|
||||
|
@ -247,6 +248,8 @@ class GtkUI:
|
|||
client.shutdown()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.config.save()
|
||||
try:
|
||||
gtk.main_quit()
|
||||
except RuntimeError:
|
||||
|
|
|
@ -51,9 +51,8 @@ class SideBar(component.Component):
|
|||
glade = self.window.main_glade
|
||||
self.notebook = glade.get_widget("sidebar_notebook")
|
||||
self.hpaned = glade.get_widget("hpaned")
|
||||
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
|
||||
self.tabs = {}
|
||||
|
@ -61,18 +60,21 @@ class SideBar(component.Component):
|
|||
# Hide if necessary
|
||||
self.visible(self.config["show_sidebar"])
|
||||
|
||||
def shutdown(self):
|
||||
log.debug("hpaned.position: %s", self.hpaned.get_position())
|
||||
self.config["sidebar_position"] = self.hpaned.get_position()
|
||||
|
||||
def visible(self, visible):
|
||||
if visible:
|
||||
if self.hpaned_position:
|
||||
self.hpaned.set_position(self.hpaned_position)
|
||||
if self.config["sidebar_position"]:
|
||||
self.hpaned.set_position(self.config["sidebar_position"])
|
||||
self.notebook.show()
|
||||
else:
|
||||
self.notebook.hide()
|
||||
# Store the position for restoring upon show()
|
||||
self.hpaned_position = self.hpaned.get_position()
|
||||
self.config["sidebar_position"] = self.hpaned.get_position()
|
||||
self.hpaned.set_position(-1)
|
||||
|
||||
self.is_visible = visible
|
||||
self.config["show_sidebar"] = visible
|
||||
|
||||
def add_tab(self, widget, tab_name, label):
|
||||
|
|
Loading…
Reference in New Issue