[gnome-builder] settings: add setting for displaying line changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] settings: add setting for displaying line changes
- Date: Thu, 11 Dec 2014 21:39:22 +0000 (UTC)
commit a20af08ccb837e93c79fd3c685429b85c0957fef
Author: Christian Hergert <christian hergert me>
Date: Thu Dec 11 13:39:16 2014 -0800
settings: add setting for displaying line changes
Remeber to `make install' folks.
data/org.gnome.builder.editor.gschema.xml.in | 5 ++
src/editor/gb-editor-frame.c | 8 +++
src/preferences/gb-preferences-page-editor.c | 5 ++
src/resources/ui/gb-preferences-page-editor.ui | 59 +++++++++++++++++++++++-
4 files changed, 75 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.builder.editor.gschema.xml.in b/data/org.gnome.builder.editor.gschema.xml.in
index b7b250e..ee91ceb 100644
--- a/data/org.gnome.builder.editor.gschema.xml.in
+++ b/data/org.gnome.builder.editor.gschema.xml.in
@@ -16,6 +16,11 @@
<summary>Enable auto-completion of words in document.</summary>
<description>If enabled, words within the current document will be available for
auto-completion.</description>
</key>
+ <key name="show-diff" type="b">
+ <default>true</default>
+ <summary>Show modified lines.</summary>
+ <description>If enabled, the editor will show line additions and changes next to the source
code.</description>
+ </key>
<key name="font-name" type="s">
<default>"Monospace 11"</default>
</key>
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index dbb1393..ad49990 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -1034,9 +1034,12 @@ gb_editor_frame_constructed (GObject *object)
GtkSourceGutter *gutter;
GbEditorFrame *frame = GB_EDITOR_FRAME (object);
GbSourceVim *vim;
+ GSettings *settings;
G_OBJECT_CLASS (gb_editor_frame_parent_class)->constructed (object);
+ settings = g_settings_new ("org.gnome.builder.editor");
+
if (priv->document)
monitor = gb_editor_document_get_change_monitor (priv->document);
@@ -1053,6 +1056,9 @@ gb_editor_frame_constructed (GObject *object)
gtk_source_gutter_insert (gutter,
GTK_SOURCE_GUTTER_RENDERER (priv->diff_renderer),
0);
+ g_settings_bind (settings, "show-diff",
+ priv->diff_renderer, "visible",
+ G_SETTINGS_BIND_GET);
priv->code_assistant_renderer =
g_object_new (GB_TYPE_SOURCE_CODE_ASSISTANT_RENDERER,
@@ -1148,6 +1154,8 @@ gb_editor_frame_constructed (GObject *object)
G_CALLBACK (gb_editor_frame_on_backward_search_clicked),
frame,
G_CONNECT_SWAPPED);
+
+ g_object_unref (settings);
}
static void
diff --git a/src/preferences/gb-preferences-page-editor.c b/src/preferences/gb-preferences-page-editor.c
index b8735c1..6dd80e2 100644
--- a/src/preferences/gb-preferences-page-editor.c
+++ b/src/preferences/gb-preferences-page-editor.c
@@ -24,6 +24,7 @@ struct _GbPreferencesPageEditorPrivate
GSettings *settings;
GtkSwitch *restore_insert_mark_switch;
+ GtkSwitch *show_diff_switch;
GtkSwitch *vim_mode_switch;
GtkSwitch *word_completion_switch;
GtkFontButton *font_button;
@@ -50,6 +51,9 @@ gb_preferences_page_editor_constructed (GObject *object)
g_settings_bind (priv->settings, "restore-insert-mark",
priv->restore_insert_mark_switch, "active",
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (priv->settings, "show-diff",
+ priv->show_diff_switch, "active",
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->settings, "word-completion",
priv->word_completion_switch, "active",
G_SETTINGS_BIND_DEFAULT);
@@ -87,6 +91,7 @@ gb_preferences_page_editor_class_init (GbPreferencesPageEditorClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, font_button);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
restore_insert_mark_switch);
+ gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, show_diff_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, style_scheme_button);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, vim_mode_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
word_completion_switch);
diff --git a/src/resources/ui/gb-preferences-page-editor.ui b/src/resources/ui/gb-preferences-page-editor.ui
index 8786cf0..708174d 100644
--- a/src/resources/ui/gb-preferences-page-editor.ui
+++ b/src/resources/ui/gb-preferences-page-editor.ui
@@ -49,6 +49,17 @@
</packing>
</child>
<child>
+ <object class="GtkSwitch" id="show_diff_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="box8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -147,7 +158,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="label" translatable="yes"><b>Word Completion</b></property>
+ <property name="label" translatable="yes"><b>Suggest Word
Completion</b></property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
@@ -162,7 +173,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="label" translatable="yes">Enable completion of words found within the
current document.</property>
+ <property name="label" translatable="yes">Suggest completion of words found within the
current document.</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
@@ -180,6 +191,50 @@
<property name="top_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes"><b>Display Document
Changes</b></property>
+ <property name="use_markup">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Display whether a line has been added or
modified next to the line number.</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]