[gnome-builder] prefs: another round of preferences cleanup



commit 99c70ed8b5a3c88e37ddf8b506de2d2091096a0d
Author: Christian Hergert <christian hergert me>
Date:   Sat May 16 02:41:58 2015 -0700

    prefs: another round of preferences cleanup
    
     - Move autocompletion items to "Code Insight".
     - Make the prefs slightly taller.
     - Shrink the scheme selector a bit.
     - Drop "Experimental", similar things belong together, even if
       experimental.

 data/ui/gb-greeter-window.ui                       |    2 +-
 data/ui/gb-preferences-page-editor.ui              |   27 +--------
 data/ui/gb-preferences-page-experimental.ui        |   34 ----------
 data/ui/gb-preferences-page-insight.ui             |   67 ++++++++++++++++++++
 data/ui/gb-preferences-window.ui                   |   18 +++---
 src/Makefile.am                                    |    4 +-
 src/preferences/gb-preferences-page-editor.c       |    7 --
 src/preferences/gb-preferences-page-experimental.c |   59 -----------------
 src/preferences/gb-preferences-page-experimental.h |   33 ----------
 src/preferences/gb-preferences-page-insight.c      |   67 ++++++++++++++++++++
 src/preferences/gb-preferences-page-insight.h      |   33 ++++++++++
 src/preferences/gb-preferences-window.c            |    4 +-
 src/resources/gnome-builder.gresource.xml          |    2 +-
 13 files changed, 183 insertions(+), 174 deletions(-)
---
diff --git a/data/ui/gb-greeter-window.ui b/data/ui/gb-greeter-window.ui
index 92673c5..25392e2 100644
--- a/data/ui/gb-greeter-window.ui
+++ b/data/ui/gb-greeter-window.ui
@@ -3,7 +3,7 @@
   <!-- interface-requires gtk+ 3.16 -->
   <template class="GbGreeterWindow" parent="GtkApplicationWindow">
     <property name="default-width">1280</property>
-    <property name="default-height">720</property>
+    <property name="default-height">800</property>
     <child type="titlebar">
       <object class="GtkHeaderBar" id="header_bar">
         <property name="show-close-button">true</property>
diff --git a/data/ui/gb-preferences-page-editor.ui b/data/ui/gb-preferences-page-editor.ui
index 24d02a7..4a8a837 100644
--- a/data/ui/gb-preferences-page-editor.ui
+++ b/data/ui/gb-preferences-page-editor.ui
@@ -53,7 +53,7 @@
                 <property name="margin">6</property>
                 <property name="visible">true</property>
                 <property name="vexpand">true</property>
-                <property name="min-content-height">200</property>
+                <property name="min-content-height">150</property>
                 <property name="shadow-type">in</property>
                 <child>
                   <object class="GtkSourceStyleSchemeChooserWidget" id="style_scheme_widget">
@@ -165,31 +165,6 @@
             <child>
               <object class="GtkLabel">
                 <property name="visible">true</property>
-                <property name="label" translatable="yes">Auto Completion</property>
-                <property name="xalign">0.0</property>
-                <property name="margin-top">12</property>
-                <property name="margin-bottom">6</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-            </child>
-            <child>
-              <object class="GbPreferencesSwitch" id="word_completion_switch">
-                <property name="title" translatable="yes">Suggest Word Completion</property>
-                <property name="description" translatable="yes">Suggest completion of words found within the 
current document.</property>
-                <property name="settings">editor_settings</property>
-                <property name="settings-schema-key">word-completion</property>
-                <property name="size-group">control_group</property>
-                <property name="visible">true</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkLabel">
-                <property name="visible">true</property>
                 <property name="label" translatable="yes">Cursor Placement</property>
                 <property name="xalign">0.0</property>
                 <property name="margin-top">12</property>
diff --git a/data/ui/gb-preferences-page-insight.ui b/data/ui/gb-preferences-page-insight.ui
new file mode 100644
index 0000000..8eeee16
--- /dev/null
+++ b/data/ui/gb-preferences-page-insight.ui
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <template class="GbPreferencesPageInsight" parent="GbPreferencesPage">
+    <property name="title" translatable="yes">Code Insight</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">true</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">true</property>
+            <property name="label" translatable="yes">Auto Completion</property>
+            <property name="margin-bottom">6</property>
+            <property name="xalign">0.0</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+        <child>
+          <object class="GbPreferencesSwitch" id="word_autocompletion">
+            <property name="title" translatable="yes">Suggest Word Completion</property>
+            <property name="description" translatable="yes">Suggest completion of words found within all 
open documents.</property>
+            <property name="settings">editor_settings</property>
+            <property name="settings-schema-key">word-completion</property>
+            <property name="size-group">control_group</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+        <child>
+          <object class="GbPreferencesSwitch" id="ctags_autocompletion">
+            <property name="settings">experimental_settings</property>
+            <property name="settings-schema-key">ctags-autocompletion</property>
+            <property name="title" translatable="yes">Suggest Completions using Ctags</property>
+            <property name="description" translatable="yes">Use Ctags for completions in supported 
languages.</property>
+            <property name="size-group">control_group</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+        <child>
+          <object class="GbPreferencesSwitch" id="clang_autocompletion">
+            <property name="settings">experimental_settings</property>
+            <property name="settings-schema-key">clang-autocompletion</property>
+            <property name="title" translatable="yes">Suggest Completions using Clang 
(Experimental)</property>
+            <property name="description" translatable="yes">Use Clang for completions in the C and C++ 
languages.</property>
+            <property name="size-group">control_group</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GSettings" id="experimental_settings">
+    <property name="schema-id">org.gnome.builder.experimental</property>
+  </object>
+  <object class="GSettings" id="editor_settings">
+    <property name="schema-id">org.gnome.builder.editor</property>
+  </object>
+  <object class="GtkSizeGroup" id="control_group">
+    <property name="mode">horizontal</property>
+  </object>
+</interface>
diff --git a/data/ui/gb-preferences-window.ui b/data/ui/gb-preferences-window.ui
index c9bddaf..4f6a515 100644
--- a/data/ui/gb-preferences-window.ui
+++ b/data/ui/gb-preferences-window.ui
@@ -135,33 +135,33 @@
               </packing>
             </child>
             <child>
-              <object class="GbPreferencesPageKeybindings" id="keybindings_page">
+              <object class="GbPreferencesPageInsight" id="insight_page">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
               </object>
               <packing>
-                <property name="name">keybindings</property>
-                <property name="title" translatable="yes">Keyboard</property>
+                <property name="name">insight</property>
+                <property name="title" translatable="yes">Code Insight</property>
               </packing>
             </child>
             <child>
-              <object class="GbPreferencesPageGit" id="git_page">
+              <object class="GbPreferencesPageKeybindings" id="keybindings_page">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
               </object>
               <packing>
-                <property name="name">git</property>
-                <property name="title" translatable="yes">Version Control</property>
+                <property name="name">keybindings</property>
+                <property name="title" translatable="yes">Keyboard</property>
               </packing>
             </child>
             <child>
-              <object class="GbPreferencesPageExperimental" id="experimental_page">
+              <object class="GbPreferencesPageGit" id="git_page">
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
               </object>
               <packing>
-                <property name="name">experimental</property>
-                <property name="title" translatable="yes">Experimental</property>
+                <property name="name">git</property>
+                <property name="title" translatable="yes">Version Control</property>
               </packing>
             </child>
           </object>
diff --git a/src/Makefile.am b/src/Makefile.am
index ea51501..5706e28 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,8 +86,8 @@ libgnome_builder_la_SOURCES = \
        keybindings/gb-keybindings.h \
        preferences/gb-preferences-page-editor.c \
        preferences/gb-preferences-page-editor.h \
-       preferences/gb-preferences-page-experimental.c \
-       preferences/gb-preferences-page-experimental.h \
+       preferences/gb-preferences-page-insight.c \
+       preferences/gb-preferences-page-insight.h \
        preferences/gb-preferences-page-git.c \
        preferences/gb-preferences-page-git.h \
        preferences/gb-preferences-page-keybindings.c \
diff --git a/src/preferences/gb-preferences-page-editor.c b/src/preferences/gb-preferences-page-editor.c
index 04e9190..60ac090 100644
--- a/src/preferences/gb-preferences-page-editor.c
+++ b/src/preferences/gb-preferences-page-editor.c
@@ -31,7 +31,6 @@ struct _GbPreferencesPageEditor
   GSettings                         *editor_settings;
   GtkSwitch                         *restore_insert_mark_switch;
   GtkSwitch                         *show_diff_switch;
-  GtkSwitch                         *word_completion_switch;
   GtkSwitch                         *show_line_numbers_switch;
   GtkSwitch                         *highlight_current_line_switch;
   GtkSwitch                         *highlight_matching_brackets_switch;
@@ -127,7 +126,6 @@ gb_preferences_page_editor_class_init (GbPreferencesPageEditorClass *klass)
   GB_WIDGET_CLASS_BIND (widget_class, GbPreferencesPageEditor, show_line_numbers_switch);
   GB_WIDGET_CLASS_BIND (widget_class, GbPreferencesPageEditor, style_scheme_container);
   GB_WIDGET_CLASS_BIND (widget_class, GbPreferencesPageEditor, style_scheme_widget);
-  GB_WIDGET_CLASS_BIND (widget_class, GbPreferencesPageEditor, word_completion_switch);
 }
 
 static void
@@ -142,11 +140,6 @@ gb_preferences_page_editor_init (GbPreferencesPageEditor *self)
                                                NULL);
   gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
   /* To translators: This is a list of keywords for the preferences page */
-                                               _("word words auto completion suggest found document"),
-                                               self->word_completion_switch,
-                                               NULL);
-  gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
-  /* To translators: This is a list of keywords for the preferences page */
                                                _("diff renderer gutter changes git vcs"),
                                                self->show_diff_switch,
                                                NULL);
diff --git a/src/preferences/gb-preferences-page-insight.c b/src/preferences/gb-preferences-page-insight.c
new file mode 100644
index 0000000..b28ed89
--- /dev/null
+++ b/src/preferences/gb-preferences-page-insight.c
@@ -0,0 +1,67 @@
+/* gb-preferences-page-insight.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n.h>
+
+#include "gb-preferences-page-insight.h"
+#include "gb-preferences-switch.h"
+#include "gb-widget.h"
+
+struct _GbPreferencesPageInsight
+{
+  GbPreferencesPage    parent_instance;
+
+  GbPreferencesSwitch *word_autocompletion;
+  GbPreferencesSwitch *ctags_autocompletion;
+  GbPreferencesSwitch *clang_autocompletion;
+};
+
+G_DEFINE_TYPE (GbPreferencesPageInsight, gb_preferences_page_insight, GB_TYPE_PREFERENCES_PAGE)
+
+static void
+gb_preferences_page_insight_class_init (GbPreferencesPageInsightClass *klass)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/gb-preferences-page-insight.ui");
+  gtk_widget_class_bind_template_child (widget_class, GbPreferencesPageInsight, ctags_autocompletion);
+  gtk_widget_class_bind_template_child (widget_class, GbPreferencesPageInsight, clang_autocompletion);
+  gtk_widget_class_bind_template_child (widget_class, GbPreferencesPageInsight, word_autocompletion);
+}
+
+static void
+gb_preferences_page_insight_init (GbPreferencesPageInsight *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
+  /* To translators: This is a list of keywords for the preferences page */
+                                               _("word words auto completion suggest found document"),
+                                               self->word_autocompletion,
+                                               NULL);
+  gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
+  /* To translators: This is a list of keywords for the preferences page */
+                                               _("experimental clang autocompletion auto complete"),
+                                               self->clang_autocompletion,
+                                               NULL);
+  gb_preferences_page_set_keywords_for_widget (GB_PREFERENCES_PAGE (self),
+  /* To translators: This is a list of keywords for the preferences page */
+                                               _("exhuberant ctags tags autocompletion auto complete"),
+                                               self->ctags_autocompletion,
+                                               NULL);
+}
diff --git a/src/preferences/gb-preferences-page-insight.h b/src/preferences/gb-preferences-page-insight.h
new file mode 100644
index 0000000..572eac7
--- /dev/null
+++ b/src/preferences/gb-preferences-page-insight.h
@@ -0,0 +1,33 @@
+/* gb-preferences-page-insight.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GB_PREFERENCES_PAGE_INSIGHT_H
+#define GB_PREFERENCES_PAGE_INSIGHT_H
+
+#include "gb-preferences-page.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_PREFERENCES_PAGE_INSIGHT (gb_preferences_page_insight_get_type())
+
+G_DECLARE_FINAL_TYPE (GbPreferencesPageInsight, gb_preferences_page_insight,
+                      GB, PREFERENCES_PAGE_INSIGHT, GbPreferencesPage)
+
+G_END_DECLS
+
+#endif /* GB_PREFERENCES_PAGE_INSIGHT_H */
diff --git a/src/preferences/gb-preferences-window.c b/src/preferences/gb-preferences-window.c
index e80ed4b..f4bb936 100644
--- a/src/preferences/gb-preferences-window.c
+++ b/src/preferences/gb-preferences-window.c
@@ -22,8 +22,8 @@
 
 #include "gb-gdk.h"
 #include "gb-preferences-page-editor.h"
-#include "gb-preferences-page-experimental.h"
 #include "gb-preferences-page-git.h"
+#include "gb-preferences-page-insight.h"
 #include "gb-preferences-page-keybindings.h"
 #include "gb-preferences-page-language.h"
 #include "gb-preferences-page.h"
@@ -271,8 +271,8 @@ gb_preferences_window_class_init (GbPreferencesWindowClass *klass)
 
   g_type_ensure (EGG_TYPE_SEARCH_BAR);
   g_type_ensure (GB_TYPE_PREFERENCES_PAGE_EDITOR);
-  g_type_ensure (GB_TYPE_PREFERENCES_PAGE_EXPERIMENTAL);
   g_type_ensure (GB_TYPE_PREFERENCES_PAGE_GIT);
+  g_type_ensure (GB_TYPE_PREFERENCES_PAGE_INSIGHT);
   g_type_ensure (GB_TYPE_PREFERENCES_PAGE_KEYBINDINGS);
   g_type_ensure (GB_TYPE_PREFERENCES_PAGE_LANGUAGE);
 }
diff --git a/src/resources/gnome-builder.gresource.xml b/src/resources/gnome-builder.gresource.xml
index 3022a04..a1e858b 100644
--- a/src/resources/gnome-builder.gresource.xml
+++ b/src/resources/gnome-builder.gresource.xml
@@ -50,8 +50,8 @@
     <file alias="ui/gb-new-file-popover.ui">../../data/ui/gb-new-file-popover.ui</file>
     <file alias="ui/gb-new-project-dialog.ui">../../data/ui/gb-new-project-dialog.ui</file>
     <file alias="ui/gb-preferences-page-editor.ui">../../data/ui/gb-preferences-page-editor.ui</file>
-    <file 
alias="ui/gb-preferences-page-experimental.ui">../../data/ui/gb-preferences-page-experimental.ui</file>
     <file alias="ui/gb-preferences-page-git.ui">../../data/ui/gb-preferences-page-git.ui</file>
+    <file alias="ui/gb-preferences-page-insight.ui">../../data/ui/gb-preferences-page-insight.ui</file>
     <file 
alias="ui/gb-preferences-page-keybindings.ui">../../data/ui/gb-preferences-page-keybindings.ui</file>
     <file alias="ui/gb-preferences-page-language.ui">../../data/ui/gb-preferences-page-language.ui</file>
     <file alias="ui/gb-preferences-switch.ui">../../data/ui/gb-preferences-switch.ui</file>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]