1 # Copyright (C) 2006 by Aiwota Programmer
2 # aiwotaprog@tetteke.tk
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 from BbsType import bbs_type_judge_uri
27 from BbsType import bbs_type_exception
30 # key: /bbs/board/thread value: toplevel window widget
41 raise ValueError, "parameter must not be empty"
43 key = winwrap.get_uri()
45 raise ValueError, "uri must not be empty"
50 _windows[key] = winwrap
51 print "regist to _windows", key
54 def unregist(winwrap):
55 key = winwrap.get_uri()
56 if key not in _windows:
57 print key, "is not found in _windows"
61 print "unregist from _windows", key
64 print "all window unregist"
65 on_all_window_destroy()
67 def on_all_window_destroy():
70 def thread_idx_updated(thread_uri, idx_dic):
71 if not thread_uri or not idx_dic:
72 raise ValueError, "parameter must not be empty"
74 gobject.idle_add(on_thread_idx_updated, thread_uri, idx_dic)
76 def on_thread_idx_updated(thread_uri, idx_dic):
77 bbs_type = bbs_type_judge_uri.get_type(thread_uri)
78 winwrap = get_window(bbs_type.get_uri_base())
80 winwrap.on_thread_idx_updated(thread_uri, idx_dic)
83 print "session main quit"
85 uris = _windows.keys()
87 gconf_client = gconf.client_get_default()
88 gconf_key_windows = config.gconf_app_key_base() + "/windows"
90 gconf_client.set_list(
91 gconf_key_windows, gconf.VALUE_STRING, uris)
92 print "save windows", uris
94 gconf_client.unset(gconf_key_windows)
95 print "save no window"
100 for uri, winwrap in temp.iteritems():
104 traceback.print_exc()
110 gconf_client = gconf.client_get_default()
112 gconf_key_windows = config.gconf_app_key_base() + "/windows"
113 uris = gconf_client.get_list(gconf_key_windows, gconf.VALUE_STRING)
116 uri_opener.open_uri(uri)
117 except bbs_type_exception.BbsTypeError, msg:
123 uri_opener.open_uri("http://ex11.2ch.net/morningcoffee/")