[meld/ui-next] filediff: Move go-to-line to GAction



commit a338921f687240786076d8fdbcd5527510f391b8
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Mar 1 09:14:43 2019 +1000

    filediff: Move go-to-line to GAction

 data/ui/meldapp-ui.xml |  2 --
 meld/accelerators.py   |  1 +
 meld/filediff.py       |  3 ++-
 meld/meldwindow.py     | 10 ++--------
 4 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/meldapp-ui.xml b/data/ui/meldapp-ui.xml
index 7fbde953..4af42b4a 100644
--- a/data/ui/meldapp-ui.xml
+++ b/data/ui/meldapp-ui.xml
@@ -5,8 +5,6 @@
       <menuitem action="FindNext"/>
       <menuitem action="FindPrevious"/>
       <menuitem action="Replace"/>
-      <separator/>
-      <menuitem action="GoToLine"/>
     </menu>
     <menu action="ChangesMenu">
       <placeholder name="ChangesActions" />
diff --git a/meld/accelerators.py b/meld/accelerators.py
index 0e5d9908..3db23d66 100644
--- a/meld/accelerators.py
+++ b/meld/accelerators.py
@@ -8,6 +8,7 @@ def register_accels(app: Gtk.Application):
         ('view.folder-copy-left', '<Alt>Left'),
         ('view.folder-copy-right', '<Alt>Right'),
         ('view.folder-delete', 'Delete'),
+        ('view.go-to-line', '<Primary>I'),
         ("view.next-change", ("<Alt>Down", "<Alt>KP_Down", "<Primary>D")),
         ('view.next-pane', '<Alt>Page_Down'),
         ("view.previous-change", ("<Alt>Up", "<Alt>KP_Up", "<Primary>E")),
diff --git a/meld/filediff.py b/meld/filediff.py
index b3c883dc..c8b04901 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -292,6 +292,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
             ('add-sync-point', self.add_sync_point),
             ('clear-sync-point', self.clear_sync_points),
             ('format-as-patch', self.action_format_as_patch),
+            ('go-to-line', self.action_go_to_line),
             ('merge-all-left', self.action_pull_all_changes_left),
             ('merge-all-right', self.action_pull_all_changes_right),
             ('merge-all', self.action_merge_all_changes),
@@ -1171,7 +1172,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
         self.findbar.start_find_previous(self.focus_pane)
 
     @with_focused_pane
-    def on_go_to_line_activate(self, pane, *args):
+    def action_go_to_line(self, pane, *args):
         self.statusbar[pane].emit('start-go-to-line')
 
     @Template.Callback()
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index b1ea0913..3cb08698 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -76,9 +76,6 @@ class MeldWindow(Gtk.ApplicationWindow):
                 _("_Replaceā€¦"), "<Primary>H",
                 _("Find and replace text"),
                 self.on_menu_replace_activate),
-            ("GoToLine", None, _("Go to _Line"), "<Primary>I",
-                _("Go to a specific line"),
-                self.on_menu_go_to_line_activate),
 
             ("ChangesMenu", None, _("_Changes")),
         )
@@ -239,14 +236,14 @@ class MeldWindow(Gtk.ApplicationWindow):
         if not isinstance(page, MeldDoc):
             for action in (
                            "Find", "FindNext", "FindPrevious", "Replace",
-                           "GoToLine"):
+                           ):
                 self.actiongroup.get_action(action).set_sensitive(False)
         else:
             for action in ("Find",):
                 self.actiongroup.get_action(action).set_sensitive(True)
             is_filediff = isinstance(page, FileDiff)
             for action in ("FindNext", "FindPrevious",
-                           "Replace", "GoToLine"):
+                           "Replace"):
                 self.actiongroup.get_action(action).set_sensitive(is_filediff)
 
     def handle_current_doc_switch(self, page):
@@ -305,9 +302,6 @@ class MeldWindow(Gtk.ApplicationWindow):
     def on_menu_replace_activate(self, *extra):
         self.current_doc().on_replace_activate()
 
-    def on_menu_go_to_line_activate(self, *extra):
-        self.current_doc().on_go_to_line_activate()
-
     def on_action_fullscreen_change_state(self, action, state):
         window_state = self.get_window().get_state()
         is_full = window_state & Gdk.WindowState.FULLSCREEN


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