Skip to content

Commit dcd4110

Browse files
committed
Move pane switching to GActions
This does remove it from the menu, which doesn't help discoverability... but on the other hand, no one is going to the menu to switch panes.
1 parent 069e071 commit dcd4110

7 files changed

Lines changed: 48 additions & 70 deletions

File tree

data/ui/filediff-ui.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
<menuitem action="MergeAll"/>
2222
</placeholder>
2323
</menu>
24-
<menu action="ViewMenu">
25-
<placeholder name="ViewPlaceholder">
26-
<menuitem action="PrevPane" />
27-
<menuitem action="NextPane" />
28-
</placeholder>
29-
</menu>
3024
</menubar>
3125

3226
<popup name="Popup">

data/ui/meldapp-ui.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<menu action="ChangesMenu">
1616
<placeholder name="ChangesActions" />
1717
</menu>
18-
<menu action="ViewMenu">
19-
<placeholder name="ViewPlaceholder" />
20-
</menu>
2118
</menubar>
2219

2320
<popup name="Popup">

meld/accelerators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ def register_accels(app: Gtk.Application):
99
('view.folder-copy-right', '<Alt>Right'),
1010
('view.folder-delete', 'Delete'),
1111
("view.next-change", ("<Alt>Down", "<Alt>KP_Down", "<Primary>D")),
12+
('view.next-pane', '<Alt>Page_Down'),
1213
("view.previous-change", ("<Alt>Up", "<Alt>KP_Up", "<Primary>E")),
14+
('view.previous-pane', '<Alt>Page_Up'),
1315
('view.redo', '<Primary><Shift>Z'),
1416
("view.refresh", ("<control>R", "F5")),
1517
('view.save', '<Primary>S'),

meld/filediff.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ def __init__(self, num_panes):
293293
('clear-sync-point', self.clear_sync_points),
294294
('format-as-patch', self.action_format_as_patch),
295295
('next-change', self.action_next_change),
296+
('next-pane', self.action_next_pane),
296297
('open-external', self.action_open_external),
297298
('previous-change', self.action_previous_change),
299+
('previous-pane', self.action_prev_pane),
298300
('redo', self.action_redo),
299301
('refresh', self.action_refresh),
300302
('revert', self.action_revert),
@@ -591,10 +593,8 @@ def on_current_diff_changed(self, *args):
591593
self.actiongroup.get_action("CopyRightUp").set_sensitive(copy_right)
592594
self.actiongroup.get_action("CopyRightDown").set_sensitive(copy_right)
593595

594-
prev_pane = pane > 0
595-
next_pane = pane < self.num_panes - 1
596-
self.actiongroup.get_action("PrevPane").set_sensitive(prev_pane)
597-
self.actiongroup.get_action("NextPane").set_sensitive(next_pane)
596+
self.set_action_enabled('previous-pane', pane > 0)
597+
self.set_action_enabled('next-pane', pane < self.num_panes - 1)
598598
# FIXME: don't queue_draw() on everything... just on what changed
599599
self.queue_draw()
600600

@@ -912,13 +912,11 @@ def move_cursor_pane(self, pane, new_pane):
912912
new_line = self._corresponding_chunk_line(chunk, line, pane, new_pane)
913913
self.move_cursor(new_pane, new_line)
914914

915-
@Template.Callback()
916915
def action_prev_pane(self, *args):
917916
pane = self._get_focused_pane()
918917
new_pane = (pane - 1) % self.num_panes
919918
self.move_cursor_pane(pane, new_pane)
920919

921-
@Template.Callback()
922920
def action_next_pane(self, *args):
923921
pane = self._get_focused_pane()
924922
new_pane = (pane + 1) % self.num_panes

meld/meldwindow.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ def __init__(self):
8787
self.on_menu_go_to_line_activate),
8888

8989
("ChangesMenu", None, _("_Changes")),
90-
91-
("ViewMenu", None, _("_View")),
92-
("FileStatus", None, _("File Status")),
93-
("VcStatus", None, _("Version Status")),
9490
)
9591
self.actiongroup = Gtk.ActionGroup(name='MainActions')
9692
self.actiongroup.set_translation_domain("meld")

meld/resources/gtk/help-overlay.ui

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,40 +60,40 @@
6060
<object class="GtkShortcutsGroup">
6161
<property name="visible">True</property>
6262
<property name="view">tab</property>
63-
<property name="title" translatable="yes" context="shortcut window">Tabs</property>
64-
<child>
65-
<object class="GtkShortcutsShortcut">
66-
<property name="visible">True</property>
67-
<property name="accelerator">&lt;primary&gt;&lt;alt&gt;Page_Up</property>
68-
<property name="title" translatable="yes" context="shortcut window">Go to previous tab</property>
69-
</object>
70-
</child>
63+
<property name="title" translatable="yes" context="shortcut window">Panes</property>
7164
<child>
7265
<object class="GtkShortcutsShortcut">
7366
<property name="visible">True</property>
74-
<property name="accelerator">&lt;primary&gt;&lt;alt&gt;Page_Down</property>
75-
<property name="title" translatable="yes" context="shortcut window">Go to next tab</property>
67+
<property name="accelerator">&lt;alt&gt;Page_Up</property>
68+
<property name="title" translatable="yes" context="shortcut window">Previous comparison pane</property>
7669
</object>
7770
</child>
7871
<child>
7972
<object class="GtkShortcutsShortcut">
8073
<property name="visible">True</property>
81-
<property name="accelerator">&lt;alt&gt;0...9</property>
82-
<property name="title" translatable="yes" context="shortcut window">Switch to tab</property>
74+
<property name="accelerator">&lt;alt&gt;Page_Down</property>
75+
<property name="title" translatable="yes" context="shortcut window">Next comparison pane</property>
8376
</object>
8477
</child>
78+
</object>
79+
</child>
80+
<child>
81+
<object class="GtkShortcutsGroup">
82+
<property name="visible">True</property>
83+
<property name="view">tab</property>
84+
<property name="title" translatable="yes" context="shortcut window">Changes</property>
8585
<child>
8686
<object class="GtkShortcutsShortcut">
8787
<property name="visible">True</property>
88-
<property name="accelerator">&lt;shift&gt;&lt;primary&gt;&lt;alt&gt;Page_Up</property>
89-
<property name="title" translatable="yes" context="shortcut window">Move tab left</property>
88+
<property name="accelerator">&lt;alt&gt;Up</property>
89+
<property name="title" translatable="yes" context="shortcut window">Go to previous change</property>
9090
</object>
9191
</child>
9292
<child>
9393
<object class="GtkShortcutsShortcut">
9494
<property name="visible">True</property>
95-
<property name="accelerator">&lt;shift&gt;&lt;primary&gt;&lt;alt&gt;Page_Down</property>
96-
<property name="title" translatable="yes" context="shortcut window">Move tab right</property>
95+
<property name="accelerator">&lt;alt&gt;Down</property>
96+
<property name="title" translatable="yes" context="shortcut window">Go to next change</property>
9797
</object>
9898
</child>
9999
</object>
@@ -102,19 +102,40 @@
102102
<object class="GtkShortcutsGroup">
103103
<property name="visible">True</property>
104104
<property name="view">tab</property>
105-
<property name="title" translatable="yes" context="shortcut window">Changes</property>
105+
<property name="title" translatable="yes" context="shortcut window">Tabs</property>
106106
<child>
107107
<object class="GtkShortcutsShortcut">
108108
<property name="visible">True</property>
109-
<property name="accelerator">&lt;alt&gt;Up</property>
110-
<property name="title" translatable="yes" context="shortcut window">Go to previous change</property>
109+
<property name="accelerator">&lt;primary&gt;&lt;alt&gt;Page_Up</property>
110+
<property name="title" translatable="yes" context="shortcut window">Go to previous tab</property>
111111
</object>
112112
</child>
113113
<child>
114114
<object class="GtkShortcutsShortcut">
115115
<property name="visible">True</property>
116-
<property name="accelerator">&lt;alt&gt;Down</property>
117-
<property name="title" translatable="yes" context="shortcut window">Go to next change</property>
116+
<property name="accelerator">&lt;primary&gt;&lt;alt&gt;Page_Down</property>
117+
<property name="title" translatable="yes" context="shortcut window">Go to next tab</property>
118+
</object>
119+
</child>
120+
<child>
121+
<object class="GtkShortcutsShortcut">
122+
<property name="visible">True</property>
123+
<property name="accelerator">&lt;alt&gt;0...9</property>
124+
<property name="title" translatable="yes" context="shortcut window">Switch to tab</property>
125+
</object>
126+
</child>
127+
<child>
128+
<object class="GtkShortcutsShortcut">
129+
<property name="visible">True</property>
130+
<property name="accelerator">&lt;shift&gt;&lt;primary&gt;&lt;alt&gt;Page_Up</property>
131+
<property name="title" translatable="yes" context="shortcut window">Move tab left</property>
132+
</object>
133+
</child>
134+
<child>
135+
<object class="GtkShortcutsShortcut">
136+
<property name="visible">True</property>
137+
<property name="accelerator">&lt;shift&gt;&lt;primary&gt;&lt;alt&gt;Page_Down</property>
138+
<property name="title" translatable="yes" context="shortcut window">Move tab right</property>
118139
</object>
119140
</child>
120141
</object>
@@ -292,20 +313,6 @@
292313
<property name="title" translatable="yes" context="shortcut window">Delete change</property>
293314
</object>
294315
</child>
295-
<child>
296-
<object class="GtkShortcutsShortcut">
297-
<property name="visible">True</property>
298-
<property name="accelerator">&lt;alt&gt;Page_Up</property>
299-
<property name="title" translatable="yes" context="shortcut window">Previous comparison pane</property>
300-
</object>
301-
</child>
302-
<child>
303-
<object class="GtkShortcutsShortcut">
304-
<property name="visible">True</property>
305-
<property name="accelerator">&lt;alt&gt;Page_Down</property>
306-
<property name="title" translatable="yes" context="shortcut window">Next comparison pane</property>
307-
</object>
308-
</child>
309316
</object>
310317
</child>
311318
<child>

meld/resources/ui/filediff.ui

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -845,21 +845,5 @@
845845
<signal name="activate" handler="merge_all_non_conflicting_changes" swapped="no"/>
846846
</object>
847847
</child>
848-
<child>
849-
<object class="GtkAction" id="PrevPane">
850-
<property name="label" translatable="yes">Previous Pane</property>
851-
<property name="tooltip" translatable="yes">Move keyboard focus to the previous document in this comparison</property>
852-
<signal name="activate" handler="action_prev_pane" swapped="no"/>
853-
</object>
854-
<accelerator key="Page_Up" modifiers="GDK_MOD1_MASK"/>
855-
</child>
856-
<child>
857-
<object class="GtkAction" id="NextPane">
858-
<property name="label" translatable="yes">Next Pane</property>
859-
<property name="tooltip" translatable="yes">Move keyboard focus to the next document in this comparison</property>
860-
<signal name="activate" handler="action_next_pane" swapped="no"/>
861-
</object>
862-
<accelerator key="Page_Down" modifiers="GDK_MOD1_MASK"/>
863-
</child>
864848
</object>
865849
</interface>

0 commit comments

Comments
 (0)