[meld] filediff: Add per-textview statusbars
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Add per-textview statusbars
- Date: Sat, 25 Nov 2017 22:06:17 +0000 (UTC)
commit 57b0fe12edb0300fb52367580c5079c6e8399a46
Author: Kai Willadsen <kai willadsen gmail com>
Date: Wed Feb 11 06:32:57 2015 +1000
filediff: Add per-textview statusbars
data/ui/filediff.ui | 44 +++++++++++++++++++++++++++++++++-----------
meld/filediff.py | 29 +++++++++++++++--------------
2 files changed, 48 insertions(+), 25 deletions(-)
---
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index dbba760..39f3454 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -785,6 +785,39 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="MeldStatusBar" id="statusbar0">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="MeldStatusBar" id="statusbar1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="MeldStatusBar" id="statusbar2">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -792,17 +825,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="MeldStatusBar" id="statusbar">
- <property name="visible">True</property>
- <property name="margin-end">12</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
</child>
</object>
diff --git a/meld/filediff.py b/meld/filediff.py
index 083f75e..a0b0ff4 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -142,7 +142,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
"linkmap", "msgarea_mgr", "readonlytoggle",
"scrolledwindow", "selector_hbox", "textview", "vbox",
"dummy_toolbar_linkmap", "filelabel_toolitem", "filelabel",
- "fileentry_toolitem", "dummy_toolbar_diffmap"
+ "fileentry_toolitem", "dummy_toolbar_diffmap", "statusbar",
]
self.map_widgets_into_lists(widget_lists)
@@ -214,20 +214,20 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
for diffmap in self.diffmap:
self.linediffer.connect('diffs-changed', diffmap.on_diffs_changed)
- overwrite_label = Gtk.Label()
- overwrite_label.show()
- cursor_label = Gtk.Label()
- cursor_label.show()
- self.status_info_labels = [overwrite_label, cursor_label]
- self.statusbar.set_info_box(self.status_info_labels)
+ self.status_info_labels = []
+ for statusbar, buf in zip(self.statusbar, self.textbuffer):
+ overwrite_label = Gtk.Label()
+ overwrite_label.show()
+ cursor_label = Gtk.Label()
+ cursor_label.show()
+ pane_labels = [overwrite_label, cursor_label]
+ self.status_info_labels.append(pane_labels)
- def bind_textbuffer_to_statusbar(buf, statusbar):
+ statusbar.set_info_box(pane_labels)
buf.bind_property(
'language', statusbar, 'source-language',
GObject.BindingFlags.BIDIRECTIONAL)
- bind_textbuffer_to_statusbar(self.textbuffer[0], self.statusbar)
-
# Prototype implementation
from meld.gutterrendererchunk import GutterRendererChunkAction, GutterRendererChunkLines
@@ -359,8 +359,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
insert_overwrite = self._insert_overwrite_text[self.textview_overwrite]
line_column = self._line_column_text % (line + 1, offset + 1)
- self.status_info_labels[0].set_text(insert_overwrite)
- self.status_info_labels[1].set_text(line_column)
+ overwrite_label, cursor_label = self.status_info_labels[pane]
+ overwrite_label.set_text(insert_overwrite)
+ cursor_label.set_text(line_column)
if line != self.cursor.line or force:
chunk, prev, next_ = self.linediffer.locate_chunk(pane, line)
@@ -1772,13 +1773,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
for widget in (
self.vbox[:n] + self.file_toolbar[:n] + self.diffmap[:n] +
self.linkmap[:n - 1] + self.dummy_toolbar_linkmap[:n - 1] +
- self.dummy_toolbar_diffmap[:n - 1]):
+ self.dummy_toolbar_diffmap[:n - 1] + self.statusbar[:n]):
widget.show()
for widget in (
self.vbox[n:] + self.file_toolbar[n:] + self.diffmap[n:] +
self.linkmap[n - 1:] + self.dummy_toolbar_linkmap[n - 1:] +
- self.dummy_toolbar_diffmap[n - 1:]):
+ self.dummy_toolbar_diffmap[n - 1:] + self.statusbar[n:]):
widget.hide()
self.actiongroup.get_action("MakePatch").set_sensitive(n > 1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]