[meld] Respond to context menu signal for FileDiff textviews



commit 2e53a6c986786a32cf4f0f830059570544c9521a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 15 12:24:35 2011 +1000

    Respond to context menu signal for FileDiff textviews
    
    This commit also slightly reorders the FileDiff context menu to look
    more like the default GtkSourceView one.

 data/ui/filediff-ui.xml |    6 ++++--
 data/ui/filediff.ui     |    3 +++
 meld/filediff.py        |   12 ++++++++----
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/filediff-ui.xml b/data/ui/filediff-ui.xml
index c5c7700..873f42a 100644
--- a/data/ui/filediff-ui.xml
+++ b/data/ui/filediff-ui.xml
@@ -37,14 +37,16 @@
   </menubar>
 
   <popup name="Popup">
-    <menuitem action="Save" />
-    <menuitem action="SaveAs" />
+    <menuitem action="Undo"/>
+    <menuitem action="Redo"/>
     <separator/>
     <menuitem action="Cut" />
     <menuitem action="Copy" />
     <menuitem action="Paste" />
     <separator/>
     <menuitem action="FileOpen" />
+    <menuitem action="Save" />
+    <menuitem action="SaveAs" />
   </popup>
 
 </ui>
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 7f0737c..815f032 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -81,6 +81,7 @@
                         <signal handler="on_textview_focus_in_event" name="focus_in_event"/>
                         <signal handler="on_key_press_event" name="key_press_event"/>
                         <signal handler="on_key_release_event" name="key_release_event"/>
+                        <signal handler="on_textview_popup_menu" name="popup-menu"/>
                       </object>
                     </child>
                   </object>
@@ -155,6 +156,7 @@
                         <signal handler="on_textview_focus_in_event" name="focus_in_event"/>
                         <signal handler="on_key_press_event" name="key_press_event"/>
                         <signal handler="on_key_release_event" name="key_release_event"/>
+                        <signal handler="on_textview_popup_menu" name="popup-menu"/>
                       </object>
                     </child>
                   </object>
@@ -191,6 +193,7 @@
                         <signal handler="on_textview_focus_in_event" name="focus_in_event"/>
                         <signal handler="on_key_press_event" name="key_press_event"/>
                         <signal handler="on_key_release_event" name="key_release_event"/>
+                        <signal handler="on_textview_popup_menu" name="popup-menu"/>
                       </object>
                     </child>
                   </object>
diff --git a/meld/filediff.py b/meld/filediff.py
index 737ef84..bd2e6ec 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -751,13 +751,17 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         if index == 1 or index == 2:
             self.linkmap[1].queue_draw()
 
+    def on_textview_popup_menu(self, textview):
+        self.popup_menu.popup(None, None, None, 0,
+                              gtk.get_current_event_time())
+        return True
+
     def on_textview_button_press_event(self, textview, event):
         if event.button == 3:
             textview.grab_focus()
-            self.popup_menu.popup(None, None, None, event.button,
-                                  gtk.get_current_event_time())
-            return 1
-        return 0
+            self.popup_menu.popup(None, None, None, event.button, event.time)
+            return True
+        return False
 
     def on_textview_toggle_overwrite(self, view):
         self.textview_overwrite = not self.textview_overwrite



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