def get_window(key):
if key in _windows:
- return _windows[key]
+ return _windows[key]["winwrap"]
else:
return None
if key in _windows:
return False
- winwrap.window.connect("destroy", on_window_destroy, key)
- _windows[key] = winwrap
+ handler_id = winwrap.window.connect("destroy", on_window_destroy, key)
+ _windows[key] = {"winwrap": winwrap, "handler_id": handler_id}
print "regist to _windows", key
return True
if key not in _windows:
return
+ do_on_window_destroy(key, get_window(key))
+
del _windows[key]
print "unregist from _windows", key
on_all_window_destroy()
def on_all_window_destroy():
- gtk.main_quit()
+ main_quit()
def thread_idx_updated(thread_uri, idx_dic):
if not thread_uri or not idx_dic:
if winwrap:
winwrap.on_thread_idx_updated(thread_uri, idx_dic)
+def do_on_window_destroy(uri, winwrap):
+ print "window destroyed:", uri
+
def main_quit():
print "session main quit"
- tmp_win_dict = dict(_windows)
uris = _windows.keys()
- if uris:
+ try:
gconf_client = gconf.client_get_default()
- try:
+ if uris:
gconf_client.set_list(
_gconf_key_windows, gconf.VALUE_STRING, uris)
print "save windows", uris
- except:
- pass
+ else:
+ gconf_client.unset(_gconf_key_windows)
+ print "save no window"
+ except:
+ pass
- for uri, winwrap in tmp_win_dict.iteritems():
- winwrap.window.destroy()
+ for uri, value in _windows.iteritems():
+ value["winwrap"].window.disconnect(value["handler_id"])
+ value["winwrap"].window.destroy()
+ do_on_window_destroy(uri, value["winwrap"])
- # do not reach here
gtk.main_quit()
def restore():