[gedit] tools: connect the button-press-event signal manually.



commit 6833d5da67daa038c8455d67c3d1c7a236ebf25f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Oct 9 21:02:38 2011 +0200

    tools: connect the button-press-event signal manually.
    
    For some reason this signal is not getting emitted unless
    I change it to connect it manually.

 plugins/externaltools/tools/outputpanel.py |    8 ++++----
 plugins/externaltools/tools/outputpanel.ui |    1 -
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/plugins/externaltools/tools/outputpanel.py b/plugins/externaltools/tools/outputpanel.py
index 1141427..ad47d9b 100644
--- a/plugins/externaltools/tools/outputpanel.py
+++ b/plugins/externaltools/tools/outputpanel.py
@@ -49,8 +49,7 @@ class OutputPanel(UniqueById):
         callbacks = {
             'on_stop_clicked' : self.on_stop_clicked,
             'on_view_visibility_notify_event': self.on_view_visibility_notify_event,
-            'on_view_motion_notify_event': self.on_view_motion_notify_event,
-            'on_view_button_press_event': self.on_view_button_press_event
+            'on_view_motion_notify_event': self.on_view_motion_notify_event
         }
 
         self.profile_settings = self.get_profile_settings()
@@ -62,6 +61,7 @@ class OutputPanel(UniqueById):
         self.ui = Gtk.Builder()
         self.ui.add_from_file(os.path.join(datadir, 'ui', 'outputpanel.ui'))
         self.ui.connect_signals(callbacks)
+        self['view'].connect('button-press-event', self.on_view_button_press_event)
 
         self.panel = self["output-panel"]
         self.font_changed()
@@ -175,7 +175,7 @@ class OutputPanel(UniqueById):
         panel.show()
         panel.activate_item(self.panel)
 
-    def update_cursor_style(self, view, x, y):       
+    def update_cursor_style(self, view, x, y):  
         if self.get_link_at_location(view, x, y) is not None:
             cursor = self.link_cursor
         else:
@@ -221,7 +221,7 @@ class OutputPanel(UniqueById):
         return None
 
     def on_view_button_press_event(self, view, event):
-        if event.button != 1 or event.type != Gdk.BUTTON_PRESS or \
+        if event.button != 1 or event.type != Gdk.EventType.BUTTON_PRESS or \
            event.window != view.get_window(Gtk.TextWindowType.TEXT):
             return False
 
diff --git a/plugins/externaltools/tools/outputpanel.ui b/plugins/externaltools/tools/outputpanel.ui
index f028179..3223910 100644
--- a/plugins/externaltools/tools/outputpanel.ui
+++ b/plugins/externaltools/tools/outputpanel.ui
@@ -21,7 +21,6 @@
         <property name="wrap_mode">GTK_WRAP_WORD</property>
         <property name="cursor_visible">False</property>
         <property name="accepts_tab">False</property>
-        <signal name="button_press_event" handler="on_view_button_press_event"/>
         <signal name="motion_notify_event" handler="on_view_motion_notify_event"/>
         <signal name="visibility_notify_event" handler="on_view_visibility_notify_event"/>
       </object>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]