[gnome-builder] prefs: make GbPreferencesWindow use GbPreferencesPageEditor.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] prefs: make GbPreferencesWindow use GbPreferencesPageEditor.
- Date: Mon, 13 Oct 2014 03:20:31 +0000 (UTC)
commit cf644b96b5bffe801f76180b61225a3596f9771d
Author: Christian Hergert <christian hergert me>
Date: Sun Oct 12 23:20:12 2014 -0400
prefs: make GbPreferencesWindow use GbPreferencesPageEditor.
src/preferences/gb-preferences-window.c | 35 +---------
src/resources/ui/gb-preferences-window.ui | 101 +----------------------------
2 files changed, 3 insertions(+), 133 deletions(-)
---
diff --git a/src/preferences/gb-preferences-window.c b/src/preferences/gb-preferences-window.c
index 2b1ea10..2eeadd5 100644
--- a/src/preferences/gb-preferences-window.c
+++ b/src/preferences/gb-preferences-window.c
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <libgit2-glib/ggit.h>
+#include "gb-preferences-page-editor.h"
#include "gb-preferences-window.h"
#include "gb-sidebar.h"
@@ -35,10 +36,6 @@ struct _GbPreferencesWindowPrivate
GtkSearchBar *search_bar;
GtkStack *stack;
- GtkSwitch *restore_insert_mark_switch;
- GtkSwitch *vim_switch;
- GtkSwitch *word_completion_switch;
-
GtkEntry *git_author_name_entry;
GtkEntry *git_author_email_entry;
};
@@ -75,31 +72,6 @@ gb_preferences_window_section_changed (GtkStack *stack,
}
static void
-load_editor (GbPreferencesWindow *window)
-{
- GbPreferencesWindowPrivate *priv;
- GSettings *settings;
-
- g_return_if_fail (GB_IS_PREFERENCES_WINDOW (window));
-
- priv = window->priv;
-
- settings = g_settings_new ("org.gnome.builder.editor");
-
- g_settings_bind (settings, "vim-mode",
- priv->vim_switch, "active",
- G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (settings, "restore-insert-mark",
- priv->restore_insert_mark_switch, "active",
- G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (settings, "word-completion",
- priv->word_completion_switch, "active",
- G_SETTINGS_BIND_DEFAULT);
-
- g_object_unref (settings);
-}
-
-static void
load_git (GbPreferencesWindow *window)
{
GgitConfig *config;
@@ -143,7 +115,6 @@ gb_preferences_window_constructed (GObject *object)
window);
gb_preferences_window_section_changed (window->priv->stack, NULL, window);
- load_editor (window);
load_git (window);
}
@@ -195,14 +166,12 @@ gb_preferences_window_class_init (GbPreferencesWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, git_author_email_entry);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, git_author_name_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow,
restore_insert_mark_switch);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, right_header_bar);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, search_bar);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, stack);
- gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, vim_switch);
- gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesWindow, word_completion_switch);
+ g_type_ensure (GB_TYPE_PREFERENCES_PAGE_EDITOR);
g_type_ensure (GB_TYPE_SIDEBAR);
}
diff --git a/src/resources/ui/gb-preferences-window.ui b/src/resources/ui/gb-preferences-window.ui
index 5034dd5..2d7ec35 100644
--- a/src/resources/ui/gb-preferences-window.ui
+++ b/src/resources/ui/gb-preferences-window.ui
@@ -106,88 +106,8 @@
<property name="transition-type">GTK_STACK_TRANSITION_TYPE_CROSSFADE</property>
<property name="visible_child">editor_grid</property>
<child>
- <object class="GtkGrid" id="editor_grid">
+ <object class="GbPreferencesPageEditor" id="editor_page">
<property name="visible">True</property>
- <property name="row-spacing">6</property>
- <property name="column-spacing">12</property>
- <child>
- <object class="GtkLabel" id="vim_label">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="Yes">Enable VIM compatibility mode</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="width">1</property>
- <property name="top-attach">0</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="vim_switch">
- <property name="visible">True</property>
- <property name="active">False</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="width">1</property>
- <property name="top-attach">0</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="restore_insert_mark_label">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="Yes">Jump to last position when reopening a
file.</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="width">1</property>
- <property name="top-attach">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="restore_insert_mark_switch">
- <property name="visible">True</property>
- <property name="active">False</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="width">1</property>
- <property name="top-attach">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="word_completion_label">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="Yes">Enable auto-completion of words in the
document.</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="width">1</property>
- <property name="top-attach">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="word_completion_switch">
- <property name="visible">True</property>
- <property name="active">False</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="width">1</property>
- <property name="top-attach">2</property>
- <property name="height">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="name">editor</property>
@@ -260,23 +180,4 @@
</object>
</child>
</template>
- <object class="GtkSizeGroup">
- <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
- <widgets>
- <widget name="left_header_bar"/>
- <widget name="sidebar"/>
- </widgets>
- </object>
- <object class="GtkSizeGroup">
- <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
- <widgets>
- <widget name="vim_label"/>
- </widgets>
- </object>
- <object class="GtkSizeGroup">
- <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
- <widgets>
- <widget name="vim_switch"/>
- </widgets>
- </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]