OSDN Git Service

Opening url command in ThreadWIndow is implemented using gobject signals.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 19 Apr 2009 04:23:58 +0000 (13:23 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 19 Apr 2009 04:23:58 +0000 (13:23 +0900)
src/FukuiNoNamari/thread_view.py
src/FukuiNoNamari/thread_window.py

index 214e279..6647dac 100644 (file)
@@ -476,7 +476,9 @@ class ResLayout:
 class ThreadView(gtk.HBox):
     __gsignals__ = {
         "cursor-over-link-event":
-        (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (object, object, ))
+        (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (object, object, )),
+        "uri-clicked-event":
+        (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (object, ))
         }
 
     hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
@@ -525,8 +527,6 @@ class ThreadView(gtk.HBox):
 
         self.initialize_buffer()
 
-        self.on_uri_clicked = self._on_uri_clicked
-
         self.button1_pressed = False
         self.current_pressed_uri = None
             
@@ -544,9 +544,6 @@ class ThreadView(gtk.HBox):
         self.button_pressed_pt = (None, None, None)
         self.button_moving_pt = (None, None, None)
 
-    def _on_uri_clicked(self, uri):
-        print uri, "clicked!!!!"
-
     def initialize_buffer(self):
         self.res_layout_list = []
 
@@ -930,7 +927,7 @@ class ThreadView(gtk.HBox):
                 self.current_pressed_uri = None
                 if (uri == p_uri and layout == p_layout and
                     element == p_element):
-                    self.on_uri_clicked(uri)
+                    self.emit("uri-clicked-event", uri)
 
     def on_drawingarea_style_set(self, widget, previous_style, data=None):
         if previous_style is None:
index 472df57..cce975f 100644 (file)
@@ -153,7 +153,7 @@ class WinWrap(winwrapbase.WinWrapBase):
         self.vbox.reorder_child(self.threadview, 2)
         self.window.set_focus(self.threadview.drawingarea)
 
-        self.threadview.on_uri_clicked = self.on_threadview_uri_clicked
+        self.threadview.connect("uri-clicked-event", self.on_threadview_uri_clicked)
 
         self.statusbar_context_id = self.statusbar.get_context_id(
             "Thread Window Status")
@@ -274,7 +274,7 @@ class WinWrap(winwrapbase.WinWrapBase):
         except OSError:
             traceback.print_exc()
 
-    def on_threadview_uri_clicked(self, uri):
+    def on_threadview_uri_clicked(self, widget, uri):
 
         if not uri.startswith("http://"):
             # maybe a relative uri.