[gnome-builder/wip/chergert/headerbar: 26/34] workbench: stub out IdeOmniBar



commit beceddd86688ffadf418c65f4c8d568837d8ae2d
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 21 00:03:35 2016 -0700

    workbench: stub out IdeOmniBar
    
    This will eventually track the important bits of state for the IDE. Still
    requires some plumbing.

 data/theme/Adwaita-shared.css                |    5 ++
 libide/Makefile.am                           |    2 +
 libide/resources/libide.gresource.xml        |    1 +
 libide/workbench/ide-omni-bar.c              |   97 ++++++++++++++++++++++++++
 libide/workbench/ide-omni-bar.h              |   34 +++++++++
 libide/workbench/ide-omni-bar.ui             |   58 +++++++++++++++
 libide/workbench/ide-workbench-header-bar.ui |    6 ++
 7 files changed, 203 insertions(+), 0 deletions(-)
---
diff --git a/data/theme/Adwaita-shared.css b/data/theme/Adwaita-shared.css
index 9742de7..e36d767 100644
--- a/data/theme/Adwaita-shared.css
+++ b/data/theme/Adwaita-shared.css
@@ -145,3 +145,8 @@ popover.perspectives-selector list row image {
   min-width: 16px;
   margin-right: 12px;
 }
+
+
+omnibar entry {
+  background-color: @theme_bg_color;
+}
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 84d702f..ad06fb2 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -153,6 +153,7 @@ libide_1_0_la_public_headers =                            \
        workbench/ide-layout-stack.h                      \
        workbench/ide-layout-view.h                       \
        workbench/ide-layout.h                            \
+       workbench/ide-omni-bar.h                          \
        workbench/ide-perspective.h                       \
        workbench/ide-workbench-addin.h                   \
        workbench/ide-workbench-header-bar.h              \
@@ -294,6 +295,7 @@ libide_1_0_la_public_sources =                            \
        workbench/ide-layout-stack.c                      \
        workbench/ide-layout-view.c                       \
        workbench/ide-layout.c                            \
+       workbench/ide-omni-bar.c                          \
        workbench/ide-perspective.c                       \
        workbench/ide-workbench-addin.c                   \
        workbench/ide-workbench-header-bar.c              \
diff --git a/libide/resources/libide.gresource.xml b/libide/resources/libide.gresource.xml
index c4680e5..c74c021 100644
--- a/libide/resources/libide.gresource.xml
+++ b/libide/resources/libide.gresource.xml
@@ -61,6 +61,7 @@
     <file compressed="true" alias="ide-layout-tab-bar.ui">../workbench/ide-layout-tab-bar.ui</file>
     <file compressed="true" alias="ide-layout-pane.ui">../workbench/ide-layout-pane.ui</file>
     <file compressed="true" alias="ide-layout-stack.ui">../workbench/ide-layout-stack.ui</file>
+    <file compressed="true" alias="ide-omni-bar.ui">../workbench/ide-omni-bar.ui</file>
     <file compressed="true" alias="ide-omni-search-group.ui">../search/ide-omni-search-group.ui</file>
     <file compressed="true" alias="ide-omni-search-row.ui">../search/ide-omni-search-row.ui</file>
     <file compressed="true" 
alias="ide-perspective-menu-button.ui">../workbench/ide-perspective-menu-button.ui</file>
diff --git a/libide/workbench/ide-omni-bar.c b/libide/workbench/ide-omni-bar.c
new file mode 100644
index 0000000..ae5760b
--- /dev/null
+++ b/libide/workbench/ide-omni-bar.c
@@ -0,0 +1,97 @@
+/* ide-omni-bar.c
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * 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 "ide-omni-bar.h"
+
+struct _IdeOmniBar
+{
+  GtkBox parent_instance;
+};
+
+G_DEFINE_TYPE (IdeOmniBar, ide_omni_bar, GTK_TYPE_BOX)
+
+enum {
+  PROP_0,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+ide_omni_bar_finalize (GObject *object)
+{
+  IdeOmniBar *self = (IdeOmniBar *)object;
+
+  G_OBJECT_CLASS (ide_omni_bar_parent_class)->finalize (object);
+}
+
+static void
+ide_omni_bar_get_property (GObject    *object,
+                           guint       prop_id,
+                           GValue     *value,
+                           GParamSpec *pspec)
+{
+  IdeOmniBar *self = IDE_OMNI_BAR (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_omni_bar_set_property (GObject      *object,
+                           guint         prop_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
+{
+  IdeOmniBar *self = IDE_OMNI_BAR (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_omni_bar_class_init (IdeOmniBarClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = ide_omni_bar_finalize;
+  object_class->get_property = ide_omni_bar_get_property;
+  object_class->set_property = ide_omni_bar_set_property;
+
+  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-omni-bar.ui");
+  gtk_widget_class_set_css_name (widget_class, "omnibar");
+}
+
+static void
+ide_omni_bar_init (IdeOmniBar *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+ide_omni_bar_new (void)
+{
+  return g_object_new (IDE_TYPE_OMNI_BAR, NULL);
+}
diff --git a/libide/workbench/ide-omni-bar.h b/libide/workbench/ide-omni-bar.h
new file mode 100644
index 0000000..0bca17f
--- /dev/null
+++ b/libide/workbench/ide-omni-bar.h
@@ -0,0 +1,34 @@
+/* ide-omni-bar.h
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * 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 IDE_OMNI_BAR_H
+#define IDE_OMNI_BAR_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_OMNI_BAR (ide_omni_bar_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeOmniBar, ide_omni_bar, IDE, OMNI_BAR, GtkBox)
+
+GtkWidget *ide_omni_bar_new (void);
+
+G_END_DECLS
+
+#endif /* IDE_OMNI_BAR_H */
diff --git a/libide/workbench/ide-omni-bar.ui b/libide/workbench/ide-omni-bar.ui
new file mode 100644
index 0000000..512099e
--- /dev/null
+++ b/libide/workbench/ide-omni-bar.ui
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeOmniBar" parent="GtkBox">
+    <style>
+      <class name="linked"/>
+    </style>
+    <child type="center">
+      <object class="EggEntryBox" id="frame">
+        <property name="max-width-chars">50</property>
+        <property name="spacing">10</property>
+        <property name="visible">true</property>
+        <child>
+          <object class="GtkLabel" id="project_label">
+            <property name="label">&lt;b&gt;gnome-builder&lt;/b&gt; / master</property>
+            <property name="use-markup">true</property>
+            <property name="ellipsize">end</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="label">Target: host OS</property>
+            <property name="visible">true</property>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkButton" id="button">
+        <property name="focus-on-click">false</property>
+        <property name="visible">true</property>
+        <style>
+          <class name="linked"/>
+        </style>
+        <child>
+          <object class="GtkImage">
+            <property name="icon-name">system-run-symbolic</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">end</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </template>
+  <object class="GtkSizeGroup">
+    <property name="mode">GTK_SIZE_GROUP_VERTICAL</property>
+    <widgets>
+      <widget name="frame"/>
+      <widget name="button"/>
+    </widgets>
+  </object>
+</interface>
diff --git a/libide/workbench/ide-workbench-header-bar.ui b/libide/workbench/ide-workbench-header-bar.ui
index 4954686..6f5c324 100644
--- a/libide/workbench/ide-workbench-header-bar.ui
+++ b/libide/workbench/ide-workbench-header-bar.ui
@@ -14,6 +14,12 @@
         <property name="position">1</property>
       </packing>
     </child>
+    <child type="title">
+      <object class="IdeOmniBar" id="bar">
+        <property name="valign">center</property>
+        <property name="visible">true</property>
+      </object>
+    </child>
     <child>
       <object class="EggPriorityBox" id="right_box">
         <property name="hexpand">true</property>


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