[meld/ui-next] filediff, preferences: Make the overview map style user-configurable
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/ui-next] filediff, preferences: Make the overview map style user-configurable
- Date: Sat, 13 Apr 2019 00:03:16 +0000 (UTC)
commit c1d427f36f84e9489bd4e975001a3926f475b6cc
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Apr 6 08:31:30 2019 +1000
filediff, preferences: Make the overview map style user-configurable
This is almost certainly going away as a visible preference, but I
really want to keep the code around for a bit at least as an option.
data/org.gnome.meld.gschema.xml | 12 +++++++
meld/filediff.py | 19 ++++++++++-
meld/preferences.py | 2 ++
meld/resources/ui/preferences.ui | 70 ++++++++++++++++++++++++++++++++++------
4 files changed, 93 insertions(+), 10 deletions(-)
---
diff --git a/data/org.gnome.meld.gschema.xml b/data/org.gnome.meld.gschema.xml
index 4bb17b1c..3f8e8635 100644
--- a/data/org.gnome.meld.gschema.xml
+++ b/data/org.gnome.meld.gschema.xml
@@ -6,6 +6,12 @@
<value nick="remote-merge-local" value="1"/>
</enum>
+ <enum id="org.gnome.meld.overviewmapstyle">
+ <value nick="chunkmap" value="0"/>
+ <value nick="compact-sourcemap" value="1"/>
+ <value nick="full-sourcemap" value="2"/>
+ </enum>
+
<enum id="org.gnome.meld.wrapmode">
<value nick="none" value="0"/>
<value nick="char" value="1"/>
@@ -121,6 +127,12 @@
<description>If true, file comparisons will have paired source maps for compared
files.</description>
</key>
+ <key name="overview-map-style" enum="org.gnome.meld.overviewmapstyle">
+ <default>"chunkmap"</default>
+ <summary>Style of overview map</summary>
+ <description>Style options for how the overview map is displayed.</description>
+ </key>
+
<!-- File comparison settings -->
<key name="ignore-blank-lines" type="b">
<default>false</default>
diff --git a/meld/filediff.py b/meld/filediff.py
index 1bbfa71f..a663cdb4 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -117,6 +117,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
__gsettings_bindings_view__ = (
('ignore-blank-lines', 'ignore-blank-lines'),
('show-sourcemap', 'show-sourcemap'),
+ ('overview-map-style', 'overview-map-style'),
)
ignore_blank_lines = GObject.Property(
@@ -126,6 +127,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
default=False,
)
show_sourcemap = GObject.Property(type=bool, default=True)
+ overview_map_style = GObject.Property(type=str, default='chunkmap')
actiongutter0 = Template.Child()
actiongutter1 = Template.Child()
@@ -134,6 +136,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
chunkmap0 = Template.Child()
chunkmap1 = Template.Child()
chunkmap2 = Template.Child()
+ chunkmap_hbox = Template.Child()
dummy_toolbar_actiongutter0 = Template.Child()
dummy_toolbar_actiongutter1 = Template.Child()
dummy_toolbar_actiongutter2 = Template.Child()
@@ -170,6 +173,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
sourcemap0 = Template.Child()
sourcemap1 = Template.Child()
sourcemap2 = Template.Child()
+ sourcemap_hbox = Template.Child()
statusbar0 = Template.Child()
statusbar1 = Template.Child()
statusbar2 = Template.Child()
@@ -350,7 +354,7 @@ class FileDiff(Gtk.VBox, MeldDoc):
self.create_text_filters()
- # Handle sourcemap visibility binding
+ # Handle overview map visibility binding
self.bind_property(
'show-sourcemap', self.sourcemap_revealer, 'reveal-child',
GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE,
@@ -358,6 +362,11 @@ class FileDiff(Gtk.VBox, MeldDoc):
self.sourcemap_revealer.bind_property(
'child-revealed', self.dummy_toolbar_sourcemap, 'visible')
+ # Handle overview map style mapping manually
+ self.connect(
+ 'notify::overview-map-style', self.on_overview_map_style_changed)
+ self.on_overview_map_style_changed()
+
for buf in self.textbuffer:
buf.undo_sequence = self.undosequence
buf.connect(
@@ -486,6 +495,14 @@ class FileDiff(Gtk.VBox, MeldDoc):
elif event.type == Gdk.EventType.KEY_RELEASE:
self.keymask &= ~mod_key
+ def on_overview_map_style_changed(self, *args):
+ style = self.props.overview_map_style
+ self.chunkmap_hbox.set_visible(style == 'chunkmap')
+ self.sourcemap_hbox.set_visible(
+ style in ('compact-sourcemap', 'full-sourcemap'))
+ for sourcemap in self.sourcemap:
+ sourcemap.props.compact_view = style == 'compact-sourcemap'
+
def on_text_filters_changed(self, app):
relevant_change = self.create_text_filters()
if relevant_change:
diff --git a/meld/preferences.py b/meld/preferences.py
index 6338b2fb..c6e935e9 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -277,6 +277,7 @@ class PreferencesDialog(Gtk.Dialog):
column_list_vbox = Template.Child()
combo_file_order = Template.Child()
combo_merge_order = Template.Child()
+ combo_overview_map = Template.Child()
combo_timestamp = Template.Child()
combobox_style_scheme = Template.Child()
custom_edit_command_entry = Template.Child()
@@ -357,6 +358,7 @@ class PreferencesDialog(Gtk.Dialog):
self.combo_timestamp.bind_to('folder-time-resolution')
self.combo_file_order.bind_to('vc-left-is-local')
+ self.combo_overview_map.bind_to('overview-map-style')
self.combo_merge_order.bind_to('vc-merge-file-order')
# Fill color schemes
diff --git a/meld/resources/ui/preferences.ui b/meld/resources/ui/preferences.ui
index 6abd912e..3a03c2b7 100644
--- a/meld/resources/ui/preferences.ui
+++ b/meld/resources/ui/preferences.ui
@@ -519,19 +519,49 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkbutton_use_compact_sourcemap">
- <property name="label" translatable="yes">Use compact overview map</property>
+ <object class="GtkHBox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Overview map style:</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GSettingsStringComboBox" id="combo_overview_map">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">overviewstylestore</property>
+ <property name="active">0</property>
+ <property name="gsettings-column">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="overview_style_renderer"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -1663,6 +1693,28 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="overviewstylestore">
+ <columns>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name label -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0">chunkmap</col>
+ <col id="1" translatable="yes">Simple change map</col>
+ </row>
+ <row>
+ <col id="0">compact-sourcemap</col>
+ <col id="1" translatable="yes">Compact source map</col>
+ </row>
+ <row>
+ <col id="0">full-sourcemap</col>
+ <col id="1" translatable="yes">Full source map</col>
+ </row>
+ </data>
+ </object>
<object class="GtkListStore" id="mergeorderstore">
<columns>
<!-- column-name id -->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]