[gnome-builder/global-search: 2/4] search: stub out search interfaces and base classes



commit c45d575b1fd04a1469795ddea41dcee3417969f6
Author: Christian Hergert <christian hergert me>
Date:   Fri Dec 12 22:54:20 2014 -0800

    search: stub out search interfaces and base classes

 src/gnome-builder.mk            |    9 +++
 src/search/gb-search-context.c  |  112 +++++++++++++++++++++++++++++++++++
 src/search/gb-search-context.h  |   58 ++++++++++++++++++
 src/search/gb-search-manager.c  |  122 +++++++++++++++++++++++++++++++++++++++
 src/search/gb-search-manager.h  |   61 +++++++++++++++++++
 src/search/gb-search-provider.c |   69 ++++++++++++++++++++++
 src/search/gb-search-provider.h |   51 ++++++++++++++++
 src/search/gb-search-result.c   |   91 +++++++++++++++++++++++++++++
 src/search/gb-search-result.h   |   54 +++++++++++++++++
 src/search/gb-search-types.h    |   39 ++++++++++++
 10 files changed, 666 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index 1eadffe..54673eb 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -123,6 +123,15 @@ libgnome_builder_la_SOURCES = \
        src/preferences/gb-preferences-page-git.h \
        src/preferences/gb-preferences-page-language.c \
        src/preferences/gb-preferences-page-language.h \
+       src/search/gb-search-context.c \
+       src/search/gb-search-context.h \
+       src/search/gb-search-manager.c \
+       src/search/gb-search-manager.h \
+       src/search/gb-search-provider.c \
+       src/search/gb-search-provider.h \
+       src/search/gb-search-result.c \
+       src/search/gb-search-result.h \
+       src/search/gb-search-types.h \
        src/snippets/gb-source-snippet-chunk.c \
        src/snippets/gb-source-snippet-chunk.h \
        src/snippets/gb-source-snippet-completion-item.c \
diff --git a/src/search/gb-search-context.c b/src/search/gb-search-context.c
new file mode 100644
index 0000000..fa95d6f
--- /dev/null
+++ b/src/search/gb-search-context.c
@@ -0,0 +1,112 @@
+/* gb-search-context.c
+ *
+ * Copyright (C) 2014 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/>.
+ */
+
+#define G_LOG_DOMAIN "search-context"
+
+#include <glib/gi18n.h>
+
+#include "gb-log.h"
+#include "gb-search-context.h"
+#include "gb-search-provider.h"
+
+struct _GbSearchContextPrivate
+{
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GbSearchContext, gb_search_context, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+//static GParamSpec *gParamSpecs [LAST_PROP];
+
+GbSearchContext *
+gb_search_context_new (void)
+{
+  return g_object_new (GB_TYPE_SEARCH_CONTEXT, NULL);
+}
+
+void
+gb_search_context_add_proposals (GbSearchContext  *context,
+                                 GbSearchProvider *provider,
+                                 GList            *proposals,
+                                 gboolean          finished)
+{
+  g_return_if_fail (GB_IS_SEARCH_CONTEXT (context));
+  g_return_if_fail (GB_IS_SEARCH_PROVIDER (provider));
+}
+
+static void
+gb_search_context_finalize (GObject *object)
+{
+  //GbSearchContextPrivate *priv = GB_SEARCH_CONTEXT (object)->priv;
+
+  G_OBJECT_CLASS (gb_search_context_parent_class)->finalize (object);
+}
+
+static void
+gb_search_context_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  //GbSearchContext *self = GB_SEARCH_CONTEXT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_context_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  //GbSearchContext *self = GB_SEARCH_CONTEXT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_context_class_init (GbSearchContextClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gb_search_context_finalize;
+  object_class->get_property = gb_search_context_get_property;
+  object_class->set_property = gb_search_context_set_property;
+}
+
+static void
+gb_search_context_init (GbSearchContext *self)
+{
+  ENTRY;
+
+  self->priv = gb_search_context_get_instance_private (self);
+
+  EXIT;
+}
diff --git a/src/search/gb-search-context.h b/src/search/gb-search-context.h
new file mode 100644
index 0000000..c718679
--- /dev/null
+++ b/src/search/gb-search-context.h
@@ -0,0 +1,58 @@
+/* gb-search-context.h
+ *
+ * Copyright (C) 2014 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_SEARCH_CONTEXT_H
+#define GB_SEARCH_CONTEXT_H
+
+#include <gio/gio.h>
+
+#include "gb-search-types.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_SEARCH_CONTEXT            (gb_search_context_get_type())
+#define GB_SEARCH_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_CONTEXT, 
GbSearchContext))
+#define GB_SEARCH_CONTEXT_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_CONTEXT, 
GbSearchContext const))
+#define GB_SEARCH_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GB_TYPE_SEARCH_CONTEXT, 
GbSearchContextClass))
+#define GB_IS_SEARCH_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GB_TYPE_SEARCH_CONTEXT))
+#define GB_IS_SEARCH_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GB_TYPE_SEARCH_CONTEXT))
+#define GB_SEARCH_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GB_TYPE_SEARCH_CONTEXT, 
GbSearchContextClass))
+
+struct _GbSearchContext
+{
+  GObject parent;
+
+  /*< private >*/
+  GbSearchContextPrivate *priv;
+};
+
+struct _GbSearchContextClass
+{
+  GObjectClass parent;
+};
+
+GType            gb_search_context_get_type    (void);
+GbSearchContext *gb_search_context_new         (void);
+void             gb_search_context_add_results (GbSearchContext  *context,
+                                                GbSearchProvider *provider,
+                                                GList            *results,
+                                                gboolean          finished);
+
+G_END_DECLS
+
+#endif /* GB_SEARCH_CONTEXT_H */
diff --git a/src/search/gb-search-manager.c b/src/search/gb-search-manager.c
new file mode 100644
index 0000000..07f8d82
--- /dev/null
+++ b/src/search/gb-search-manager.c
@@ -0,0 +1,122 @@
+/* gb-search-manager.c
+ *
+ * Copyright (C) 2014 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 "gb-search-manager.h"
+#include "gb-search-provider.h"
+
+struct _GbSearchManagerPrivate
+{
+  GPtrArray *providers;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GbSearchManager, gb_search_manager, G_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+//static GParamSpec *gParamSpecs [LAST_PROP];
+
+GbSearchManager *
+gb_search_manager_new (void)
+{
+  return g_object_new (GB_TYPE_SEARCH_MANAGER, NULL);
+}
+
+static gint
+sort_provider (gconstpointer a,
+               gconstpointer b)
+{
+  gint prio1;
+  gint prio2;
+
+  prio1 = gb_search_provider_get_priority ((GbSearchProvider *)a);
+  prio2 = gb_search_provider_get_priority ((GbSearchProvider *)b);
+
+  return prio1 - prio2;
+}
+
+void
+gb_search_manager_add_provider (GbSearchManager  *manager,
+                                GbSearchProvider *provider)
+{
+  g_return_if_fail (GB_IS_SEARCH_MANAGER (manager));
+  g_return_if_fail (GB_IS_SEARCH_PROVIDER (provider));
+
+  g_ptr_array_add (manager->priv->providers, g_object_ref (provider));
+  g_ptr_array_sort (manager->priv->providers, sort_provider);
+}
+
+static void
+gb_search_manager_finalize (GObject *object)
+{
+  GbSearchManagerPrivate *priv = GB_SEARCH_MANAGER (object)->priv;
+
+  g_clear_pointer (&priv->providers, g_ptr_array_unref);
+
+  G_OBJECT_CLASS (gb_search_manager_parent_class)->finalize (object);
+}
+
+static void
+gb_search_manager_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  //GbSearchManager *self = GB_SEARCH_MANAGER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_manager_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  //GbSearchManager *self = GB_SEARCH_MANAGER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_manager_class_init (GbSearchManagerClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gb_search_manager_finalize;
+  object_class->get_property = gb_search_manager_get_property;
+  object_class->set_property = gb_search_manager_set_property;
+}
+
+static void
+gb_search_manager_init (GbSearchManager *self)
+{
+  self->priv = gb_search_manager_get_instance_private (self);
+
+  self->priv->providers = g_ptr_array_new_with_free_func (g_object_unref);
+}
diff --git a/src/search/gb-search-manager.h b/src/search/gb-search-manager.h
new file mode 100644
index 0000000..9947d85
--- /dev/null
+++ b/src/search/gb-search-manager.h
@@ -0,0 +1,61 @@
+/* gb-search-manager.h
+ *
+ * Copyright (C) 2014 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_SEARCH_MANAGER_H
+#define GB_SEARCH_MANAGER_H
+
+#include <gio/gio.h>
+
+#include "gb-search-types.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_SEARCH_MANAGER            (gb_search_manager_get_type())
+#define GB_SEARCH_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_MANAGER, 
GbSearchManager))
+#define GB_SEARCH_MANAGER_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_MANAGER, 
GbSearchManager const))
+#define GB_SEARCH_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GB_TYPE_SEARCH_MANAGER, 
GbSearchManagerClass))
+#define GB_IS_SEARCH_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GB_TYPE_SEARCH_MANAGER))
+#define GB_IS_SEARCH_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GB_TYPE_SEARCH_MANAGER))
+#define GB_SEARCH_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GB_TYPE_SEARCH_MANAGER, 
GbSearchManagerClass))
+
+typedef struct _GbSearchManager        GbSearchManager;
+typedef struct _GbSearchManagerClass   GbSearchManagerClass;
+typedef struct _GbSearchManagerPrivate GbSearchManagerPrivate;
+
+struct _GbSearchManager
+{
+  GObject parent;
+
+  /*< private >*/
+  GbSearchManagerPrivate *priv;
+};
+
+struct _GbSearchManagerClass
+{
+  GObjectClass parent;
+};
+
+GType            gb_search_manager_get_type     (void);
+GbSearchManager *gb_search_manager_new          (void);
+GbSearchManager *gb_search_manager_get_default  (void);
+void             gb_search_manager_add_provider (GbSearchManager  *manager,
+                                                 GbSearchProvider *provider);
+
+G_END_DECLS
+
+#endif /* GB_SEARCH_MANAGER_H */
diff --git a/src/search/gb-search-provider.c b/src/search/gb-search-provider.c
new file mode 100644
index 0000000..d43cab8
--- /dev/null
+++ b/src/search/gb-search-provider.c
@@ -0,0 +1,69 @@
+/* gb-search-provider.c
+ *
+ * Copyright (C) 2014 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 "gb-search-context.h"
+#include "gb-search-provider.h"
+
+G_DEFINE_INTERFACE (GbSearchProvider, gb_search_provider, G_TYPE_OBJECT)
+
+static void
+gb_search_provider_default_init (GbSearchProviderInterface *iface)
+{
+}
+
+/**
+ * gb_search_provider_get_priority:
+ * @provider: A #GbSearchProvider
+ *
+ * Retrieves the priority of the search provider. Lower integral values are
+ * of higher priority.
+ *
+ * Returns: An integer.
+ */
+gint
+gb_search_provider_get_priority (GbSearchProvider *provider)
+{
+  g_return_val_if_fail (GB_IS_SEARCH_PROVIDER (provider), 0);
+
+  if (GB_SEARCH_PROVIDER_GET_INTERFACE (provider)->get_priority)
+    return GB_SEARCH_PROVIDER_GET_INTERFACE (provider)->get_priority (provider);
+  return 0;
+}
+
+/**
+ * gb_search_provider_populate:
+ * @provider: A #GbSearchProvider
+ * @context: A #GbSearchContext
+ * @cancelalble: An optional #GCancellable to cancel the request.
+ *
+ * Requests that a search provider start populating @context with results.
+ * If @cancellable is not %NULL, then it may be used to cancel the request.
+ */
+void
+gb_search_provider_populate (GbSearchProvider *provider,
+                             GbSearchContext  *context,
+                             GCancellable     *cancellable)
+{
+  g_return_if_fail (GB_IS_SEARCH_PROVIDER (provider));
+  g_return_if_fail (GB_IS_SEARCH_CONTEXT (context));
+  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  if (GB_SEARCH_PROVIDER_GET_INTERFACE (provider)->populate)
+    GB_SEARCH_PROVIDER_GET_INTERFACE (provider)->populate (provider, context,
+                                                           cancellable);
+}
diff --git a/src/search/gb-search-provider.h b/src/search/gb-search-provider.h
new file mode 100644
index 0000000..f209d52
--- /dev/null
+++ b/src/search/gb-search-provider.h
@@ -0,0 +1,51 @@
+/* gb-search-provider.h
+ *
+ * Copyright (C) 2014 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_SEARCH_PROVIDER_H
+#define GB_SEARCH_PROVIDER_H
+
+#include <gio/gio.h>
+
+#include "gb-search-types.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_SEARCH_PROVIDER               (gb_search_provider_get_type ())
+#define GB_SEARCH_PROVIDER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj),    
GB_TYPE_SEARCH_PROVIDER, GbSearchProvider))
+#define GB_IS_SEARCH_PROVIDER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj),    
GB_TYPE_SEARCH_PROVIDER))
+#define GB_SEARCH_PROVIDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
GB_TYPE_SEARCH_PROVIDER, GbSearchProviderInterface))
+
+struct _GbSearchProviderInterface
+{
+  GTypeInterface parent;
+
+  gint  (*get_priority) (GbSearchProvider *provider);
+  void  (*populate)     (GbSearchProvider *provider,
+                         GbSearchContext  *context,
+                         GCancellable     *cancellable);
+};
+
+GType gb_search_provider_get_type     (void);
+gint  gb_search_provider_get_priority (GbSearchProvider *provider);
+void  gb_search_provider_populate     (GbSearchProvider *provider,
+                                       GbSearchContext  *context,
+                                       GCancellable     *cancellable);
+
+G_END_DECLS
+
+#endif /* GB_SEARCH_PROVIDER_H */
diff --git a/src/search/gb-search-result.c b/src/search/gb-search-result.c
new file mode 100644
index 0000000..ca41880
--- /dev/null
+++ b/src/search/gb-search-result.c
@@ -0,0 +1,91 @@
+/* gb-search-result.c
+ *
+ * Copyright (C) 2014 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 "gb-search-result.h"
+
+struct _GbSearchResultPrivate
+{
+
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GbSearchResult, gb_search_result, GTK_TYPE_BIN)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+GtkWidget *
+gb_search_result_new (void)
+{
+  return g_object_new (GB_TYPE_SEARCH_RESULT, NULL);
+}
+
+static void
+gb_search_result_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (gb_search_result_parent_class)->finalize (object);
+}
+
+static void
+gb_search_result_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  //GbSearchResult *self = GB_SEARCH_RESULT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_result_set_property (GObject      *object,
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  //GbSearchResult *self = GB_SEARCH_RESULT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gb_search_result_class_init (GbSearchResultClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gb_search_result_finalize;
+  object_class->get_property = gb_search_result_get_property;
+  object_class->set_property = gb_search_result_set_property;
+}
+
+static void
+gb_search_result_init (GbSearchResult *self)
+{
+  self->priv = gb_search_result_get_instance_private (self);
+}
diff --git a/src/search/gb-search-result.h b/src/search/gb-search-result.h
new file mode 100644
index 0000000..39f2bca
--- /dev/null
+++ b/src/search/gb-search-result.h
@@ -0,0 +1,54 @@
+/* gb-search-result.h
+ *
+ * Copyright (C) 2014 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_SEARCH_RESULT_H
+#define GB_SEARCH_RESULT_H
+
+#include <gtk/gtk.h>
+
+#include "gb-search-types.h"
+
+G_BEGIN_DECLS
+
+#define GB_TYPE_SEARCH_RESULT            (gb_search_result_get_type())
+#define GB_SEARCH_RESULT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_RESULT, 
GbSearchResult))
+#define GB_SEARCH_RESULT_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GB_TYPE_SEARCH_RESULT, 
GbSearchResult const))
+#define GB_SEARCH_RESULT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GB_TYPE_SEARCH_RESULT, 
GbSearchResultClass))
+#define GB_IS_SEARCH_RESULT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GB_TYPE_SEARCH_RESULT))
+#define GB_IS_SEARCH_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GB_TYPE_SEARCH_RESULT))
+#define GB_SEARCH_RESULT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GB_TYPE_SEARCH_RESULT, 
GbSearchResultClass))
+
+struct _GbSearchResult
+{
+  GtkBin parent;
+
+  /*< private >*/
+  GbSearchResultPrivate *priv;
+};
+
+struct _GbSearchResultClass
+{
+  GtkBinClass parent;
+};
+
+GType      gb_search_result_get_type (void);
+GtkWidget *gb_search_result_new      (void);
+
+G_END_DECLS
+
+#endif /* GB_SEARCH_RESULT_H */
diff --git a/src/search/gb-search-types.h b/src/search/gb-search-types.h
new file mode 100644
index 0000000..d6f8cd2
--- /dev/null
+++ b/src/search/gb-search-types.h
@@ -0,0 +1,39 @@
+/* gb-search-types.h
+ *
+ * Copyright (C) 2014 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_SEARCH_TYPES_H
+#define GB_SEARCH_TYPES_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GbSearchContext           GbSearchContext;
+typedef struct _GbSearchContextClass      GbSearchContextClass;
+typedef struct _GbSearchContextPrivate    GbSearchContextPrivate;
+
+typedef struct _GbSearchProvider          GbSearchProvider;
+typedef struct _GbSearchProviderInterface GbSearchProviderInterface;
+
+typedef struct _GbSearchResult            GbSearchResult;
+typedef struct _GbSearchResultClass       GbSearchResultClass;
+typedef struct _GbSearchResultPrivate     GbSearchResultPrivate;
+
+G_END_DECLS
+
+#endif /* GB_SEARCH_TYPES_H */


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