An experimental fix for bug12048
This commit is contained in:
parent
09709ec0c6
commit
3c1c21163c
@ -134,6 +134,8 @@ class UIManager():
|
|||||||
self.et_xml = ET.fromstring(initial_xml)
|
self.et_xml = ET.fromstring(initial_xml)
|
||||||
self.builder = None
|
self.builder = None
|
||||||
self.toolbar = None
|
self.toolbar = None
|
||||||
|
self.old_toolbar = None # holds previous toolbar until Gtk is idle
|
||||||
|
self.old_toolbar_items = None
|
||||||
self.action_groups = [] # current list of action groups
|
self.action_groups = [] # current list of action groups
|
||||||
self.show_groups = [] # groups to show at the moment
|
self.show_groups = [] # groups to show at the moment
|
||||||
self.accel_dict = {} # used to store accel overrides from file
|
self.accel_dict = {} # used to store accel overrides from file
|
||||||
@ -242,6 +244,11 @@ class UIManager():
|
|||||||
# the following updates the toolbar from the new builder
|
# the following updates the toolbar from the new builder
|
||||||
toolbar_parent = toolbar.get_parent()
|
toolbar_parent = toolbar.get_parent()
|
||||||
tb_show = toolbar.get_visible()
|
tb_show = toolbar.get_visible()
|
||||||
|
if not self.old_toolbar:
|
||||||
|
self.old_toolbar = toolbar
|
||||||
|
self.old_toolbar_items = toolbar.get_children()
|
||||||
|
else:
|
||||||
|
print("Problem: multiple Toolbar updates before idle")
|
||||||
toolbar_parent.remove(toolbar)
|
toolbar_parent.remove(toolbar)
|
||||||
toolbar = self.builder.get_object("ToolBar") # new toolbar
|
toolbar = self.builder.get_object("ToolBar") # new toolbar
|
||||||
if config.get('interface.toolbar-text'):
|
if config.get('interface.toolbar-text'):
|
||||||
@ -251,8 +258,18 @@ class UIManager():
|
|||||||
toolbar.show_all()
|
toolbar.show_all()
|
||||||
else:
|
else:
|
||||||
toolbar.hide()
|
toolbar.hide()
|
||||||
|
GLib.idle_add(self.delete_old_toolbar)
|
||||||
#print('*** Update ui')
|
#print('*** Update ui')
|
||||||
|
|
||||||
|
def delete_old_toolbar(self):
|
||||||
|
""" This is used to finish removal of the old toolbar after Gtk is
|
||||||
|
idle. To avoid an issue with the toolbar being removed before all
|
||||||
|
references were removed.
|
||||||
|
"""
|
||||||
|
self.old_toolbar = None
|
||||||
|
self.old_toolbar_items = None
|
||||||
|
return False
|
||||||
|
|
||||||
def add_ui_from_string(self, changexml):
|
def add_ui_from_string(self, changexml):
|
||||||
""" This performs a merge operation on the xml elements that have
|
""" This performs a merge operation on the xml elements that have
|
||||||
matching 'id's between the current ui xml and change xml strings.
|
matching 'id's between the current ui xml and change xml strings.
|
||||||
|
Loading…
Reference in New Issue
Block a user