[gnome-builder] prefs: move vim switch to Vim preferences page
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] prefs: move vim switch to Vim preferences page
- Date: Tue, 13 Jan 2015 03:53:16 +0000 (UTC)
commit eb7e80f4f58b315c273191691172091c8725f29b
Author: Christian Hergert <christian hergert me>
Date: Mon Jan 12 19:23:29 2015 -0800
prefs: move vim switch to Vim preferences page
src/preferences/gb-preferences-page-editor.c | 12 ----
src/preferences/gb-preferences-page-vim.c | 25 +++++++--
src/preferences/gb-preferences-page.c | 4 --
src/resources/ui/gb-preferences-page-editor.ui | 55 -------------------
src/resources/ui/gb-preferences-page-vim.ui | 67 +++++++++++++++++++++--
5 files changed, 82 insertions(+), 81 deletions(-)
---
diff --git a/src/preferences/gb-preferences-page-editor.c b/src/preferences/gb-preferences-page-editor.c
index 3d0490c..b269dfa 100644
--- a/src/preferences/gb-preferences-page-editor.c
+++ b/src/preferences/gb-preferences-page-editor.c
@@ -30,7 +30,6 @@ struct _GbPreferencesPageEditorPrivate
/* Widgets owned by Template */
GtkSwitch *restore_insert_mark_switch;
GtkSwitch *show_diff_switch;
- GtkSwitch *vim_mode_switch;
GtkSwitch *word_completion_switch;
GtkSwitch *show_line_numbers_switch;
GtkSwitch *highlight_current_line_switch;
@@ -40,7 +39,6 @@ struct _GbPreferencesPageEditorPrivate
GbSourceStyleSchemeButton *style_scheme_button;
/* Template widgets used for filtering */
- GtkWidget *vim_container;
GtkWidget *restore_insert_mark_container;
GtkWidget *word_completion_container;
GtkWidget *show_diff_container;
@@ -65,9 +63,6 @@ gb_preferences_page_editor_constructed (GObject *object)
priv->settings = g_settings_new ("org.gnome.builder.editor");
- g_settings_bind (priv->settings, "vim-mode",
- priv->vim_mode_switch, "active",
- G_SETTINGS_BIND_DEFAULT);
g_settings_bind (priv->settings, "restore-insert-mark",
priv->restore_insert_mark_switch, "active",
G_SETTINGS_BIND_DEFAULT);
@@ -125,14 +120,12 @@ gb_preferences_page_editor_class_init (GbPreferencesPageEditorClass *klass)
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);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
show_line_numbers_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
highlight_current_line_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
highlight_matching_brackets_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
smart_home_end_switch);
- gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, vim_container);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
restore_insert_mark_container);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor,
word_completion_container);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, show_diff_container);
@@ -152,11 +145,6 @@ gb_preferences_page_editor_init (GbPreferencesPageEditor *self)
gtk_widget_init_template (GTK_WIDGET (self));
gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
- _("vim modal"),
- self->priv->vim_container,
- self->priv->vim_mode_switch,
- NULL);
- gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
_("restore insert cursor mark"),
self->priv->restore_insert_mark_container,
self->priv->restore_insert_mark_switch,
diff --git a/src/preferences/gb-preferences-page-vim.c b/src/preferences/gb-preferences-page-vim.c
index deb642d..c9ca6f3 100644
--- a/src/preferences/gb-preferences-page-vim.c
+++ b/src/preferences/gb-preferences-page-vim.c
@@ -24,13 +24,16 @@
struct _GbPreferencesPageVimPrivate
{
- GSettings *settings;
+ GSettings *editor_settings;
+ GSettings *vim_settings;
/* Widgets owned by Template */
GtkSpinButton *scroll_off_spin;
+ GtkSwitch *vim_mode_switch;
/* Template widgets used for filtering */
GtkWidget *scroll_off_container;
+ GtkWidget *vim_container;
};
G_DEFINE_TYPE_WITH_PRIVATE (GbPreferencesPageVim, gb_preferences_page_vim,
@@ -46,9 +49,14 @@ gb_preferences_page_vim_constructed (GObject *object)
priv = vim->priv;
- priv->settings = g_settings_new ("org.gnome.builder.editor.vim");
+ priv->editor_settings = g_settings_new ("org.gnome.builder.editor");
+ priv->vim_settings = g_settings_new ("org.gnome.builder.editor.vim");
- g_settings_bind (priv->settings, "scroll-off", priv->scroll_off_spin, "value",
+ g_settings_bind (priv->vim_settings, "scroll-off",
+ priv->scroll_off_spin, "value",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (priv->editor_settings, "vim-mode",
+ priv->vim_mode_switch, "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -57,7 +65,8 @@ gb_preferences_page_vim_finalize (GObject *object)
{
GbPreferencesPageVimPrivate *priv = GB_PREFERENCES_PAGE_VIM (object)->priv;
- g_clear_object (&priv->settings);
+ g_clear_object (&priv->editor_settings);
+ g_clear_object (&priv->vim_settings);
G_OBJECT_CLASS (gb_preferences_page_vim_parent_class)->finalize (object);
}
@@ -75,8 +84,10 @@ gb_preferences_page_vim_class_init (GbPreferencesPageVimClass *klass)
"/org/gnome/builder/ui/gb-preferences-page-vim.ui");
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageVim, scroll_off_spin);
+ gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageVim, vim_mode_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageVim, scroll_off_container);
+ gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageVim, vim_container);
}
static void
@@ -91,4 +102,10 @@ gb_preferences_page_vim_init (GbPreferencesPageVim *self)
self->priv->scroll_off_container,
self->priv->scroll_off_spin,
NULL);
+
+ gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
+ _("vim modal"),
+ self->priv->vim_container,
+ self->priv->vim_mode_switch,
+ NULL);
}
diff --git a/src/preferences/gb-preferences-page.c b/src/preferences/gb-preferences-page.c
index fbc07d1..b38b999 100644
--- a/src/preferences/gb-preferences-page.c
+++ b/src/preferences/gb-preferences-page.c
@@ -115,8 +115,6 @@ gb_preferences_page_set_keywords_for_widget (GbPreferencesPage *page,
GQuark q;
gchar *downcase;
- ENTRY;
-
g_return_if_fail (GB_IS_PREFERENCES_PAGE (page));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -129,8 +127,6 @@ gb_preferences_page_set_keywords_for_widget (GbPreferencesPage *page,
g_hash_table_insert (page->priv->widgets, widget, GINT_TO_POINTER (q));
while ((widget = va_arg (args, GtkWidget *)));
va_end (args);
-
- EXIT;
}
const gchar *
diff --git a/src/resources/ui/gb-preferences-page-editor.ui b/src/resources/ui/gb-preferences-page-editor.ui
index c0881de..9c32c13 100644
--- a/src/resources/ui/gb-preferences-page-editor.ui
+++ b/src/resources/ui/gb-preferences-page-editor.ui
@@ -15,17 +15,6 @@
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkSwitch" id="vim_mode_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">0</property>
- </packing>
- </child>
- <child>
<object class="GtkSwitch" id="restore_insert_mark_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -103,50 +92,6 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="vim_container">
- <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" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes"><b>VIM Modal Editing</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" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Use VIM style modal editing in the source code
editor.</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">0</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="restore_insert_mark_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/resources/ui/gb-preferences-page-vim.ui b/src/resources/ui/gb-preferences-page-vim.ui
index e55f692..b3560a9 100644
--- a/src/resources/ui/gb-preferences-page-vim.ui
+++ b/src/resources/ui/gb-preferences-page-vim.ui
@@ -8,13 +8,24 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkGrid" id="grid1">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
+ <object class="GtkSwitch" id="vim_mode_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">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkSpinButton" id="scroll_off_spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -23,6 +34,50 @@
</object>
<packing>
<property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="vim_container">
+ <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>VIM Modal Editing</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">Use VIM style modal editing in the source code
editor.</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">0</property>
</packing>
</child>
@@ -33,11 +88,11 @@
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="label5">
+ <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>Scroll Off</b></property>
+ <property name="label" translatable="yes"><b>Scroll Offset</b></property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
</object>
@@ -48,11 +103,11 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label8">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="label" translatable="yes">Margin in lines for cursor movement.</property>
+ <property name="label" translatable="yes">Minimal number of lines to keep above and below
the cursor.</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
@@ -67,7 +122,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]