[meld] Add preference for highlighting current line
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Add preference for highlighting current line
- Date: Sat, 3 Aug 2013 22:23:55 +0000 (UTC)
commit 01bbca1fa11062473a1897f19d81d5fca93c35a3
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Aug 4 08:23:26 2013 +1000
Add preference for highlighting current line
data/ui/preferences.ui | 25 +++++++++++++++++++++----
meld/filediff.py | 3 ++-
meld/preferences.py | 11 ++++++++---
3 files changed, 31 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index d269cea..6501f79 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -342,7 +342,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -372,6 +372,23 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="checkbutton_highlight_current_line">
+ <property name="label" translatable="yes">Highlight _current line</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_checkbutton_highlight_current_line_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="checkbutton_show_line_numbers">
<property name="label" translatable="yes">Show _line numbers</property>
<property name="visible">True</property>
@@ -385,7 +402,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -402,7 +419,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -419,7 +436,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
diff --git a/meld/filediff.py b/meld/filediff.py
index 98af94a..625ad29 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1461,7 +1461,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
context.set_source_color(self.line_colors[change[0]])
context.stroke()
- if textview.is_focus() and self.cursor.line is not None:
+ if (self.prefs.highlight_current_line and textview.is_focus() and
+ self.cursor.line is not None):
it = textbuffer.get_iter_at_line(self.cursor.line)
ypos, line_height = textview.get_line_yrange(it)
context.save()
diff --git a/meld/preferences.py b/meld/preferences.py
index 0f723be..802c58e 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -156,6 +156,8 @@ class PreferencesDialog(gnomeglade.Component):
self.fontpicker.set_font_name(self.prefs.custom_font)
self.fontpicker.set_font_name( self.prefs.custom_font )
self.spinbutton_tabsize.set_value( self.prefs.tab_size )
+ self.checkbutton_highlight_current_line.set_active(
+ self.prefs.highlight_current_line)
if srcviewer.gsv is not None:
self.checkbutton_spaces_instead_of_tabs.set_active( self.prefs.spaces_instead_of_tabs )
self.checkbutton_show_line_numbers.set_active( self.prefs.show_line_numbers )
@@ -268,10 +270,15 @@ class PreferencesDialog(gnomeglade.Component):
else:
self.prefs.edit_wrap_lines = 1
+ def on_checkbutton_highlight_current_line_toggled(self, check):
+ self.prefs.highlight_current_line = check.get_active()
+
def on_checkbutton_show_line_numbers_toggled(self, check):
self.prefs.show_line_numbers = check.get_active()
+
def on_checkbutton_show_whitespace_toggled(self, check):
self.prefs.show_whitespace = check.get_active()
+
def on_checkbutton_use_syntax_highlighting_toggled(self, check):
self.prefs.use_syntax_highlighting = check.get_active()
@@ -287,9 +294,6 @@ class PreferencesDialog(gnomeglade.Component):
# Called on "activate" and "focus-out-event"
self.prefs.edit_command_custom = entry.props.text
- def on_checkbutton_show_line_numbers_toggled(self, check):
- self.prefs.show_line_numbers = check.get_active()
-
def on_checkbutton_show_commit_margin_toggled(self, check):
show_margin = check.get_active()
self.prefs.vc_show_commit_margin = show_margin
@@ -337,6 +341,7 @@ class MeldPreferences(prefs.Preferences):
"custom_font": prefs.Value(prefs.STRING,"monospace, 14"),
"tab_size": prefs.Value(prefs.INT, 4),
"spaces_instead_of_tabs": prefs.Value(prefs.BOOL, False),
+ "highlight_current_line": prefs.Value(prefs.BOOL, False),
"show_line_numbers": prefs.Value(prefs.BOOL, 0),
"show_whitespace": prefs.Value(prefs.BOOL, False),
"use_syntax_highlighting": prefs.Value(prefs.BOOL, 0),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]