OSDN Git Service

Change widget name and signal handler name.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 19 Sep 2006 10:01:54 +0000 (19:01 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 19 Sep 2006 10:01:54 +0000 (19:01 +0900)
src/FukuiNoNamari/board_window.py
src/data/board_window.glade

index 16aa9fd..0c29bab 100644 (file)
@@ -67,14 +67,14 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         glade_path = os.path.join(config.glade_dir, GLADE_FILENAME)
         self.widget_tree = gtk.glade.XML(glade_path)
 
-        self.window = self.widget_tree.get_widget("board_window")
+        self.window = self.widget_tree.get_widget("window_board")
 
         self.window.set_title(self.bbs_type.uri)
 
         self.treeview = self.widget_tree.get_widget("treeview")
         self.treeview.set_model(ThreadListModel())
 
-        self.popupmenu = self.widget_tree.get_widget("popup_menu")
+        self.popupmenu = self.widget_tree.get_widget("popup_treeview_menu")
         self.toolbar = self.widget_tree.get_widget("toolbar")
         self.toolbar.unset_style()
         self.statusbar = self.widget_tree.get_widget("appbar")
@@ -88,34 +88,10 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
 
         self.treeview.set_fixed_height_mode(True)
 
-        sigdic = {"on_board_window_destroy": self.on_board_window_destroy,
-                  "on_quit_activate": self.on_quit_activate,
-                  "on_refresh_activate": self.on_refresh_activate,
-                  "on_treeview_row_activated":
-                  lambda w,p,v: self.on_open_thread(w),
-                  "on_treeview_button_press_event":
-                  self.on_treeview_button_press_event,
-                  "on_close_activate":
-                  self.on_close_activate,
-                  "on_toolbar_activate": self.on_toolbar_activate,
-                  "on_statusbar_activate": self.on_statusbar_activate,
-                  "on_board_window_delete_event":
-                  self.on_board_window_delete_event,
-                  "on_entry_filterbar_activate": self.on_entry_filterbar_activate,
-                  "on_filter_activate": self.on_filter_activate,
-                  "on_toolbutton_filterbar_close_clicked":
-                  self.on_toolbutton_filterbar_close_clicked,
-                  "on_button_filterbar_clear_clicked":
-                  self.on_button_filterbar_clear_clicked,
-                  "on_delete_activate": self.on_delete_activate,
-                  "on_manage_bookmarks_activate": \
-                  self.on_manage_bookmarks_activate,
-                  "on_add_bookmark_activate": self.on_add_bookmark_activate,
-                  "on_popup_menu_open_activate": self.on_open_thread}
-        self.widget_tree.signal_autoconnect(sigdic)
+        self.widget_tree.signal_autoconnect(self)
 
         # menu plugins
-        self.edit1 = self.widget_tree.get_widget("edit1").get_submenu()
+        self.edit1 = self.widget_tree.get_widget("menu_edit").get_submenu()
         board_plugins.load(self.treeview, self.edit1)
 
         self.restore()
@@ -133,19 +109,19 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
     def get_uri(self):
         return self.bbs_type.get_uri_base()
 
-    def on_toolbar_activate(self, widget):
+    def on_menu_toolbar_activate(self, widget):
         if self.toolbar.parent.get_property("visible"):
             self.toolbar.parent.hide()
         else:
             self.toolbar.parent.show()
 
-    def on_statusbar_activate(self, widget):
+    def on_menu_statusbar_activate(self, widget):
         if self.statusbar.get_property("visible"):
             self.statusbar.hide()
         else:
             self.statusbar.show()
 
-    def on_filter_activate(self, widget):
+    def on_menu_filter_activate(self, widget):
         self.filterbar.show()
         self.entry_filterbar.grab_focus()
 
@@ -177,23 +153,26 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         if model:
             model.refilter(None)
 
-    def on_board_window_delete_event(self, widget, event):
+    def on_window_board_delete_event(self, widget, event):
         self.save()
         return False
 
-    def on_board_window_destroy(self, widget):
+    def on_window_board_destroy(self, widget):
         self.destroyed()
 
-    def on_quit_activate(self, widget):
+    def on_menu_quit_activate(self, widget):
         session.main_quit()
 
-    def on_close_activate(self, widget):
+    def on_menu_close_activate(self, widget):
         self.destroy()
 
-    def on_refresh_activate(self, widget):
+    def on_menu_refresh_activate(self, widget):
         self.load(True)
 
-    def on_open_thread(self, widget):
+    def on_menu_open_activate(self, widget):
+        self.open_thread()
+
+    def open_thread(self):
         treeselection = self.treeview.get_selection()
         model, iter = treeselection.get_selected()
         if not iter:
@@ -213,14 +192,14 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         bbs_type_for_thread = self.bbs_type.clone_with_thread(thread)
         uri_opener.open_uri(bbs_type_for_thread.get_thread_uri(), update)
 
-    def on_add_bookmark_activate(self, widget):
+    def on_menu_add_bookmark_activate(self, widget):
         bookmark_list.bookmark_list.add_bookmark_with_edit(
             uri=self.bbs_type.uri)
 
-    def on_manage_bookmarks_activate(self, widget):
+    def on_menu_manage_bookmarks_activate(self, widget):
         bookmark_window.open()
 
-    def on_delete_activate(self, widget):
+    def on_menu_delete_activate(self, widget):
         selection = self.treeview.get_selection()
         model, iter = selection.get_selected()
         if not iter:
@@ -246,6 +225,9 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         except OSError:
             traceback.print_exc()
 
+    def on_treeview_row_activated(self, widget, path, view_column):
+        self.open_thread()
+
     def on_treeview_button_press_event(self, widget, event):
         if event.button == 3:
             x = int(event.x)
index 9d9d97c..958c891 100644 (file)
@@ -5,7 +5,7 @@
 <requires lib="gnome"/>
 <requires lib="bonobo"/>
 
-<widget class="GnomeApp" id="board_window">
+<widget class="GnomeApp" id="window_board">
   <property name="title" translatable="yes">board_window</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
@@ -20,8 +20,8 @@
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="enable_layout_config">True</property>
-  <signal name="destroy" handler="on_board_window_destroy" last_modification_time="Wed, 09 Aug 2006 23:41:09 GMT"/>
-  <signal name="delete_event" handler="on_board_window_delete_event" last_modification_time="Thu, 31 Aug 2006 11:00:02 GMT"/>
+  <signal name="destroy" handler="on_window_board_destroy" last_modification_time="Tue, 19 Sep 2006 09:45:26 GMT"/>
+  <signal name="delete_event" handler="on_window_board_delete_event" last_modification_time="Tue, 19 Sep 2006 09:45:38 GMT"/>
 
   <child internal-child="dock">
     <widget class="BonoboDock" id="bonobodock1">
              <property name="visible">True</property>
 
              <child>
-               <widget class="GtkMenuItem" id="file1">
+               <widget class="GtkMenuItem" id="menu_file">
                  <property name="visible">True</property>
                  <property name="stock_item">GNOMEUIINFO_MENU_FILE_TREE</property>
 
                  <child>
-                   <widget class="GtkMenu" id="file1_menu">
+                   <widget class="GtkMenu" id="menu_file_menu">
 
                      <child>
-                       <widget class="GtkImageMenuItem" id="close">
+                       <widget class="GtkImageMenuItem" id="menu_file_close">
                          <property name="visible">True</property>
                          <property name="stock_item">GNOMEUIINFO_MENU_CLOSE_ITEM</property>
-                         <signal name="activate" handler="on_close_activate" last_modification_time="Sun, 20 Aug 2006 13:00:02 GMT"/>
+                         <signal name="activate" handler="on_menu_close_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
 
                      </child>
 
                      <child>
-                       <widget class="GtkImageMenuItem" id="quit">
+                       <widget class="GtkImageMenuItem" id="menu_file_quit">
                          <property name="visible">True</property>
                          <property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property>
-                         <signal name="activate" handler="on_quit_activate" last_modification_time="Wed, 09 Aug 2006 23:42:32 GMT"/>
+                         <signal name="activate" handler="on_menu_quit_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
                    </widget>
              </child>
 
              <child>
-               <widget class="GtkMenuItem" id="edit1">
+               <widget class="GtkMenuItem" id="menu_edit">
                  <property name="visible">True</property>
                  <property name="stock_item">GNOMEUIINFO_MENU_EDIT_TREE</property>
 
                  <child>
-                   <widget class="GtkMenu" id="edit1_menu">
+                   <widget class="GtkMenu" id="menu_edit_menu">
 
                      <child>
-                       <widget class="GtkMenuItem" id="filter">
+                       <widget class="GtkMenuItem" id="menu_edit_filter">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">Filter</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_filter_activate" last_modification_time="Wed, 06 Sep 2006 21:41:17 GMT"/>
+                         <signal name="activate" handler="on_menu_filter_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                          <accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
                        </widget>
                      </child>
                      </child>
 
                      <child>
-                       <widget class="GtkImageMenuItem" id="delete">
+                       <widget class="GtkImageMenuItem" id="menu_edit_delete">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">_Delete Thread Log</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_delete_activate" last_modification_time="Thu, 14 Sep 2006 07:21:17 GMT"/>
+                         <signal name="activate" handler="on_menu_delete_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
 
                          <child internal-child="image">
-                           <widget class="GtkImage" id="image24">
+                           <widget class="GtkImage" id="image28">
                              <property name="visible">True</property>
                              <property name="stock">gtk-delete</property>
                              <property name="icon_size">1</property>
              </child>
 
              <child>
-               <widget class="GtkMenuItem" id="view1">
+               <widget class="GtkMenuItem" id="menu_view">
                  <property name="visible">True</property>
                  <property name="stock_item">GNOMEUIINFO_MENU_VIEW_TREE</property>
 
                  <child>
-                   <widget class="GtkMenu" id="view1_menu">
+                   <widget class="GtkMenu" id="menu_view_menu">
 
                      <child>
-                       <widget class="GtkImageMenuItem" id="refresh">
+                       <widget class="GtkImageMenuItem" id="menu_view_refresh">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">_Refresh</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_refresh_activate" last_modification_time="Thu, 31 Aug 2006 09:40:44 GMT"/>
+                         <signal name="activate" handler="on_menu_refresh_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                          <accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
                          <child internal-child="image">
-                           <widget class="GtkImage" id="image25">
+                           <widget class="GtkImage" id="image29">
                              <property name="visible">True</property>
                              <property name="stock">gtk-refresh</property>
                              <property name="icon_size">1</property>
                      </child>
 
                      <child>
-                       <widget class="GtkMenuItem" id="toolbar">
+                       <widget class="GtkMenuItem" id="menu_view_toolbar">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">_Toolbar</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_toolbar_activate" last_modification_time="Thu, 31 Aug 2006 09:21:48 GMT"/>
+                         <signal name="activate" handler="on_menu_toolbar_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
 
                      <child>
-                       <widget class="GtkMenuItem" id="statusbar">
+                       <widget class="GtkMenuItem" id="menu_view_statusbar">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">St_atusbar</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_statusbar_activate" last_modification_time="Thu, 31 Aug 2006 09:21:48 GMT"/>
+                         <signal name="activate" handler="on_menu_statusbar_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
                    </widget>
              </child>
 
              <child>
-               <widget class="GtkMenuItem" id="bookmarks1">
+               <widget class="GtkMenuItem" id="menu_bookmarks">
                  <property name="visible">True</property>
                  <property name="label" translatable="yes">_Bookmarks</property>
                  <property name="use_underline">True</property>
 
                  <child>
-                   <widget class="GtkMenu" id="bookmarks1_menu">
+                   <widget class="GtkMenu" id="menu_bookmarks_menu">
 
                      <child>
-                       <widget class="GtkMenuItem" id="add_bookmark">
+                       <widget class="GtkMenuItem" id="menu_bookmarks_add_bookmark">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">Bookmark This Page</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_add_bookmark_activate" last_modification_time="Thu, 14 Sep 2006 12:21:26 GMT"/>
+                         <signal name="activate" handler="on_menu_add_bookmark_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
 
                      <child>
-                       <widget class="GtkMenuItem" id="manage_bookmarks">
+                       <widget class="GtkMenuItem" id="menu_bookmarks_manage_bookmarks">
                          <property name="visible">True</property>
                          <property name="label" translatable="yes">Show Bookmarks</property>
                          <property name="use_underline">True</property>
-                         <signal name="activate" handler="on_manage_bookmarks_activate" last_modification_time="Thu, 14 Sep 2006 12:21:26 GMT"/>
+                         <signal name="activate" handler="on_menu_manage_bookmarks_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
                    </widget>
              </child>
 
              <child>
-               <widget class="GtkMenuItem" id="help1">
+               <widget class="GtkMenuItem" id="menu_help">
                  <property name="visible">True</property>
                  <property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property>
 
                  <child>
-                   <widget class="GtkMenu" id="help1_menu">
+                   <widget class="GtkMenu" id="menu_help_menu">
 
                      <child>
-                       <widget class="GtkImageMenuItem" id="about1">
+                       <widget class="GtkImageMenuItem" id="menu_help_about">
                          <property name="visible">True</property>
                          <property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
-                         <signal name="activate" handler="on_about1_activate" last_modification_time="Wed, 02 Aug 2006 06:14:00 GMT"/>
+                         <signal name="activate" handler="on_menu_about_activate" last_modification_time="Tue, 19 Sep 2006 09:30:07 GMT"/>
                        </widget>
                      </child>
                    </widget>
              <property name="show_arrow">True</property>
 
              <child>
-               <widget class="GtkToolButton" id="toolbarbutton_refresh">
+               <widget class="GtkToolButton" id="toolbutton_refresh">
                  <property name="visible">True</property>
                  <property name="stock_id">gtk-refresh</property>
                  <property name="visible_horizontal">True</property>
                  <property name="visible_vertical">True</property>
                  <property name="is_important">False</property>
-                 <signal name="clicked" handler="on_refresh_activate" last_modification_time="Thu, 31 Aug 2006 09:43:06 GMT"/>
+                 <signal name="clicked" handler="on_menu_refresh_activate" last_modification_time="Tue, 19 Sep 2006 09:30:37 GMT"/>
                </widget>
                <packing>
                  <property name="expand">False</property>
                  <property name="visible_horizontal">True</property>
                  <property name="visible_vertical">True</property>
                  <property name="is_important">False</property>
-                 <signal name="clicked" handler="on_delete_activate" last_modification_time="Thu, 14 Sep 2006 07:02:05 GMT"/>
+                 <signal name="clicked" handler="on_menu_delete_activate" last_modification_time="Tue, 19 Sep 2006 09:30:47 GMT"/>
                </widget>
                <packing>
                  <property name="expand">False</property>
   </child>
 </widget>
 
-<widget class="GtkMenu" id="popup_menu">
+<widget class="GtkMenu" id="popup_treeview_menu">
 
   <child>
-    <widget class="GtkImageMenuItem" id="popup_menu_open">
+    <widget class="GtkImageMenuItem" id="popup_treeview_menu_open">
       <property name="visible">True</property>
       <property name="stock_item">GNOMEUIINFO_MENU_OPEN_ITEM</property>
-      <signal name="activate" handler="on_popup_menu_open_activate" last_modification_time="Wed, 09 Aug 2006 23:44:38 GMT"/>
+      <signal name="activate" handler="on_menu_open_activate" last_modification_time="Tue, 19 Sep 2006 09:34:55 GMT"/>
     </widget>
   </child>
 
   </child>
 
   <child>
-    <widget class="GtkImageMenuItem" id="delete">
+    <widget class="GtkImageMenuItem" id="popup_treeview_menu_delete">
       <property name="visible">True</property>
       <property name="label" translatable="yes">_Delete</property>
       <property name="use_underline">True</property>
-      <signal name="activate" handler="on_delete_activate" last_modification_time="Thu, 14 Sep 2006 06:54:58 GMT"/>
+      <signal name="activate" handler="on_menu_delete_activate" last_modification_time="Tue, 19 Sep 2006 09:34:55 GMT"/>
 
       <child internal-child="image">
-       <widget class="GtkImage" id="image18">
+       <widget class="GtkImage" id="image30">
          <property name="visible">True</property>
          <property name="stock">gtk-delete</property>
          <property name="icon_size">1</property>