[gnome-builder/wip/vim] prefs: add search entry for searching preferences
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] prefs: add search entry for searching preferences
- Date: Fri, 3 Oct 2014 02:41:55 +0000 (UTC)
commit 9728b3bfdc18f1431feac879f5eebb5c7b535f94
Author: Christian Hergert <christian hergert me>
Date: Thu Oct 2 19:41:45 2014 -0700
prefs: add search entry for searching preferences
Searching isn't implemented, but gets the feel for how we are going
to plumb this.
src/preferences/gb-preferences-window.c | 25 ++++++++++++++-
src/resources/ui/gb-preferences-window.ui | 50 +++++++++++++++++++++++++---
2 files changed, 68 insertions(+), 7 deletions(-)
---
diff --git a/src/preferences/gb-preferences-window.c b/src/preferences/gb-preferences-window.c
index a7b5bcf..479ecbd 100644
--- a/src/preferences/gb-preferences-window.c
+++ b/src/preferences/gb-preferences-window.c
@@ -23,7 +23,9 @@
struct _GbPreferencesWindowPrivate
{
- void *d;
+ GtkToggleButton *search_toggle;
+ GtkSearchEntry *search_entry;
+ GtkSearchBar *search_bar;
};
G_DEFINE_TYPE_WITH_PRIVATE (GbPreferencesWindow, gb_preferences_window,
@@ -43,6 +45,17 @@ gb_preferences_window_new (void)
}
static void
+gb_preferences_window_constructed (GObject *object)
+{
+ GbPreferencesWindow *window = (GbPreferencesWindow *)object;
+
+ G_OBJECT_CLASS (gb_preferences_window_parent_class)->constructed (object);
+
+ gtk_search_bar_connect_entry (window->priv->search_bar,
+ GTK_ENTRY (window->priv->search_entry));
+}
+
+static void
gb_preferences_window_finalize (GObject *object)
{
GbPreferencesWindowPrivate *priv = GB_PREFERENCES_WINDOW (object)->priv;
@@ -86,12 +99,22 @@ gb_preferences_window_class_init (GbPreferencesWindowClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->constructed = gb_preferences_window_constructed;
object_class->finalize = gb_preferences_window_finalize;
object_class->get_property = gb_preferences_window_get_property;
object_class->set_property = gb_preferences_window_set_property;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/ui/gb-preferences-window.ui");
+ gtk_widget_class_bind_template_child_private (widget_class,
+ GbPreferencesWindow,
+ search_toggle);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ GbPreferencesWindow,
+ search_bar);
+ gtk_widget_class_bind_template_child_private (widget_class,
+ GbPreferencesWindow,
+ search_entry);
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 73dba69..955e047 100644
--- a/src/resources/ui/gb-preferences-window.ui
+++ b/src/resources/ui/gb-preferences-window.ui
@@ -12,6 +12,24 @@
<property name="visible">True</property>
<property name="title" translatable="yes">Preferences</property>
<property name="show-close-button">True</property>
+ <child>
+ <object class="GtkToggleButton" id="search_toggle">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="search_toggle_image">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-find-symbolic</property>
+ <property name="valign">baseline</property>
+ </object>
+ </child>
+ </object>
+ <style>
+ <class name="image-button" />
+ </style>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
</object>
</child>
<child>
@@ -20,13 +38,33 @@
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<child>
- <object class="GbSidebar" id="sidebar">
+ <object class="GtkBox" id="sidebar_vbox">
+ <property name="expand">False</property>
+ <property name="orientation">vertical</property>
<property name="visible">True</property>
- <property name="width-request">215</property>
- <property name="stack">stack</property>
- <style>
- <class name="preferences" />
- </style>
+ <child>
+ <object class="GtkSearchBar" id="search_bar">
+ <property name="visible">True</property>
+ <property name="show-close-button">False</property>
+ <property name="search-mode-enabled" bind-source="search_toggle" bind-property="active"
bind-flags="bidirectional">False</property>
+ <child>
+ <object class="GtkEntry" id="search_entry">
+ <property name="placeholder-text" translatable="yes">Search Preferences</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GbSidebar" id="sidebar">
+ <property name="visible">True</property>
+ <property name="width-request">215</property>
+ <property name="stack">stack</property>
+ <style>
+ <class name="preferences" />
+ </style>
+ </object>
+ </child>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]