Commit 2e53a6c9 authored by Kai Willadsen's avatar Kai Willadsen

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.
parent 3f61db98
......@@ -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>
......
......@@ -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>
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment