[meld] filediff: Remove cycle-pane action in favour of prev/next (bgo#701665)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Remove cycle-pane action in favour of prev/next (bgo#701665)
- Date: Sun, 14 Dec 2014 20:51:50 +0000 (UTC)
commit b94a6ddfe125f2c2ce88cfd880f2c7088c04c808
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Dec 15 06:05:17 2014 +1000
filediff: Remove cycle-pane action in favour of prev/next (bgo#701665)
Cycling panes has always felt a little bit weird, and really it's very
straightforward to use a previous/next model instead.
data/ui/filediff-ui.xml | 3 ++-
data/ui/filediff.ui | 16 ++++++++++++----
meld/filediff.py | 21 ++++++++++++++++-----
3 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/filediff-ui.xml b/data/ui/filediff-ui.xml
index 443e380..031a168 100644
--- a/data/ui/filediff-ui.xml
+++ b/data/ui/filediff-ui.xml
@@ -51,7 +51,8 @@
<menuitem action="LockScrolling"/>
</placeholder>
<placeholder name="ViewDocSpecificPlaceholder">
- <menuitem action="CycleDocuments" />
+ <menuitem action="PrevPane" />
+ <menuitem action="NextPane" />
</placeholder>
</menu>
</menubar>
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 53ef4cd..0ce4373 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -155,12 +155,20 @@
</object>
</child>
<child>
- <object class="GtkAction" id="CycleDocuments">
- <property name="label" translatable="yes">Cycle Through Documents</property>
+ <object class="GtkAction" id="PrevPane">
+ <property name="label" translatable="yes">Previous Pane</property>
+ <property name="tooltip" translatable="yes">Move keyboard focus to the previous document in this
comparison</property>
+ <signal name="activate" handler="action_prev_pane" swapped="no"/>
+ </object>
+ <accelerator key="Page_Up" modifiers="GDK_MOD1_MASK"/>
+ </child>
+ <child>
+ <object class="GtkAction" id="NextPane">
+ <property name="label" translatable="yes">Next Pane</property>
<property name="tooltip" translatable="yes">Move keyboard focus to the next document in this
comparison</property>
- <signal name="activate" handler="action_cycle_documents" swapped="no"/>
+ <signal name="activate" handler="action_next_pane" swapped="no"/>
</object>
- <accelerator key="Escape" modifiers="GDK_CONTROL_MASK"/>
+ <accelerator key="Page_Down" modifiers="GDK_MOD1_MASK"/>
</child>
<child>
<object class="GtkToggleAction" id="LockScrolling">
diff --git a/meld/filediff.py b/meld/filediff.py
index 7444355..ef9fc9a 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -503,6 +503,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.actiongroup.get_action("CopyLeftDown").set_sensitive(copy_left)
self.actiongroup.get_action("CopyRightUp").set_sensitive(copy_right)
self.actiongroup.get_action("CopyRightDown").set_sensitive(copy_right)
+
+ prev_pane = pane > 0
+ next_pane = pane < self.num_panes - 1
+ self.actiongroup.get_action("PrevPane").set_sensitive(prev_pane)
+ self.actiongroup.get_action("NextPane").set_sensitive(next_pane)
# FIXME: don't queue_draw() on everything... just on what changed
self.queue_draw()
@@ -734,11 +739,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
return new_line
- def action_cycle_documents(self, widget):
- pane = self._get_focused_pane()
- new_pane = (pane + 1) % self.num_panes
+ def move_cursor_pane(self, pane, new_pane):
chunk, line = self.cursor.chunk, self.cursor.line
-
new_line = self._corresponding_chunk_line(chunk, line, pane, new_pane)
new_buf = self.textbuffer[new_pane]
@@ -747,6 +749,16 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.textview[new_pane].scroll_to_mark(
new_buf.get_insert(), 0.1, True, 0.5, 0.5)
+ def action_prev_pane(self, *args):
+ pane = self._get_focused_pane()
+ new_pane = (pane - 1) % self.num_panes
+ self.move_cursor_pane(pane, new_pane)
+
+ def action_next_pane(self, *args):
+ pane = self._get_focused_pane()
+ new_pane = (pane + 1) % self.num_panes
+ self.move_cursor_pane(pane, new_pane)
+
def _set_external_action_sensitivity(self):
have_file = self.focus_pane is not None
try:
@@ -1862,7 +1874,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
widget.hide()
self.actiongroup.get_action("MakePatch").set_sensitive(n > 1)
- self.actiongroup.get_action("CycleDocuments").set_sensitive(n > 1)
def coords_iter(i):
buf_index = 2 if i == 1 and self.num_panes == 3 else i
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]