[gnome-builder/wip/vim] editor: add setting for higlight-matching-brackets.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] editor: add setting for higlight-matching-brackets.
- Date: Thu, 2 Oct 2014 23:00:17 +0000 (UTC)
commit 661f429608cd3da5fde5265d5398db599cf0ff9d
Author: Christian Hergert <christian hergert me>
Date: Thu Oct 2 15:59:12 2014 -0700
editor: add setting for higlight-matching-brackets.
src/editor/gb-editor-settings.c | 40 ++++++++++++++++++++++++++++++++++++
src/editor/gb-editor-settings.h | 3 ++
src/editor/gb-editor-tab-private.h | 1 +
src/editor/gb-editor-tab.c | 4 +++
4 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-settings.c b/src/editor/gb-editor-settings.c
index 78318a7..c23adfd 100644
--- a/src/editor/gb-editor-settings.c
+++ b/src/editor/gb-editor-settings.c
@@ -40,6 +40,7 @@ struct _GbEditorSettingsPrivate
gboolean auto_indent;
gboolean highlight_current_line;
+ gboolean highlight_matching_brackets;
gboolean indent_on_tab;
gboolean insert_spaces_instead_of_tabs;
gboolean show_line_marks;
@@ -57,6 +58,7 @@ enum {
PROP_AUTO_INDENT,
PROP_FONT_DESC,
PROP_HIGHLIGHT_CURRENT_LINE,
+ PROP_HIGHLIGHT_MATCHING_BRACKETS,
PROP_INDENT_ON_TAB,
PROP_INDENT_WIDTH,
PROP_INSERT_SPACES_INSTEAD_OF_TABS,
@@ -203,6 +205,25 @@ gb_editor_settings_set_highlight_current_line (GbEditorSettings *settings,
}
gboolean
+gb_editor_settings_get_highlight_matching_brackets (GbEditorSettings *settings)
+{
+ g_return_val_if_fail (GB_IS_EDITOR_SETTINGS (settings), FALSE);
+
+ return settings->priv->highlight_matching_brackets;
+}
+
+void
+gb_editor_settings_set_highlight_matching_brackets (GbEditorSettings *settings,
+ gboolean highlight_matching_brackets)
+{
+ g_return_if_fail (GB_IS_EDITOR_SETTINGS (settings));
+
+ settings->priv->highlight_matching_brackets = highlight_matching_brackets;
+ g_object_notify_by_pspec (G_OBJECT (settings),
+ gParamSpecs [PROP_HIGHLIGHT_MATCHING_BRACKETS]);
+}
+
+gboolean
gb_editor_settings_get_indent_on_tab (GbEditorSettings *settings)
{
g_return_val_if_fail (GB_IS_EDITOR_SETTINGS (settings), FALSE);
@@ -404,6 +425,10 @@ gb_editor_settings_get_property (GObject *object,
g_value_set_boolean (value, gb_editor_settings_get_highlight_current_line (settings));
break;
+ case PROP_HIGHLIGHT_MATCHING_BRACKETS:
+ g_value_set_boolean (value, gb_editor_settings_get_highlight_matching_brackets (settings));
+ break;
+
case PROP_INDENT_ON_TAB:
g_value_set_boolean (value, gb_editor_settings_get_indent_on_tab (settings));
break;
@@ -475,6 +500,10 @@ gb_editor_settings_set_property (GObject *object,
gb_editor_settings_set_highlight_current_line (settings, g_value_get_boolean (value));
break;
+ case PROP_HIGHLIGHT_MATCHING_BRACKETS:
+ gb_editor_settings_set_highlight_matching_brackets (settings, g_value_get_boolean (value));
+ break;
+
case PROP_INDENT_ON_TAB:
gb_editor_settings_set_indent_on_tab (settings, g_value_get_boolean (value));
break;
@@ -556,6 +585,16 @@ gb_editor_settings_class_init (GbEditorSettingsClass *klass)
g_object_class_install_property (object_class, PROP_HIGHLIGHT_CURRENT_LINE,
gParamSpecs[PROP_HIGHLIGHT_CURRENT_LINE]);
+ gParamSpecs [PROP_HIGHLIGHT_MATCHING_BRACKETS] =
+ g_param_spec_boolean ("highlight-matching-brackets",
+ _("Highlight Matching Brackets"),
+ _("Highlight Matching Brackets"),
+ TRUE,
+ (G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_HIGHLIGHT_MATCHING_BRACKETS,
+ gParamSpecs [PROP_HIGHLIGHT_MATCHING_BRACKETS]);
+
gParamSpecs[PROP_INDENT_ON_TAB] =
g_param_spec_boolean ("indent-on-tab",
_ ("indent on tab"),
@@ -689,6 +728,7 @@ gb_editor_settings_init (GbEditorSettings *settings)
settings->priv->auto_indent = FALSE;
settings->priv->show_right_margin = TRUE;
settings->priv->highlight_current_line = TRUE;
+ settings->priv->highlight_matching_brackets = TRUE;
settings->priv->show_line_numbers = TRUE;
settings->priv->right_margin_position = 80;
settings->priv->insert_spaces_instead_of_tabs = TRUE;
diff --git a/src/editor/gb-editor-settings.h b/src/editor/gb-editor-settings.h
index f953969..810e99c 100644
--- a/src/editor/gb-editor-settings.h
+++ b/src/editor/gb-editor-settings.h
@@ -74,6 +74,9 @@ void gb_editor_settings_set_tab_width
gboolean gb_editor_settings_get_highlight_current_line (GbEditorSettings
*settings);
void gb_editor_settings_set_highlight_current_line (GbEditorSettings
*settings,
gboolean
highlight_current_line);
+gboolean gb_editor_settings_get_highlight_matching_brackets (GbEditorSettings
*settings);
+void gb_editor_settings_set_highlight_matching_brackets (GbEditorSettings
*settings,
+ gboolean
highlight_matching_brackets);
gboolean gb_editor_settings_get_indent_on_tab (GbEditorSettings
*settings);
void gb_editor_settings_set_indent_on_tab (GbEditorSettings
*settings,
gboolean
indent_on_tab);
diff --git a/src/editor/gb-editor-tab-private.h b/src/editor/gb-editor-tab-private.h
index 49d30e9..33da9c5 100644
--- a/src/editor/gb-editor-tab-private.h
+++ b/src/editor/gb-editor-tab-private.h
@@ -81,6 +81,7 @@ struct _GbEditorTabPrivate
GBinding *auto_indent_binding;
GBinding *font_desc_binding;
GBinding *highlight_current_line_binding;
+ GBinding *highlight_matching_brackets_binding;
GBinding *indent_on_tab_binding;
GBinding *indent_width_binding;
GBinding *insert_spaces_instead_of_tabs_binding;
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index 7b11966..31aae89 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -170,6 +170,9 @@ gb_editor_tab_connect_settings (GbEditorTab *tab,
ADD_BINDING ("highlight-current-line", priv->source_view,
"highlight-current-line",
priv->highlight_current_line_binding);
+ ADD_BINDING ("highlight-matching-brackets", priv->document,
+ "highlight-matching-brackets",
+ priv->highlight_matching_brackets_binding);
ADD_BINDING ("indent-on-tab", priv->source_view, "indent-on-tab",
priv->indent_on_tab_binding);
ADD_BINDING ("insert-spaces-instead-of-tabs", priv->source_view,
@@ -218,6 +221,7 @@ gb_editor_tab_disconnect_settings (GbEditorTab *tab)
REMOVE_BINDING (priv->auto_indent_binding);
REMOVE_BINDING (priv->highlight_current_line_binding);
+ REMOVE_BINDING (priv->highlight_matching_brackets_binding);
REMOVE_BINDING (priv->indent_on_tab_binding);
REMOVE_BINDING (priv->insert_spaces_instead_of_tabs_binding);
REMOVE_BINDING (priv->show_line_marks_binding);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]