[gnome-builder/wip/plugins] devhelp: rename Ide items to Gb



commit 91d39d98db142132995505bf79d6928f7613d3db
Author: Christian Hergert <christian hergert me>
Date:   Fri Jun 12 11:45:21 2015 -0700

    devhelp: rename Ide items to Gb
    
    Since these have been extracted from libide and placed into the devhelp
    plugin, lets rename them appropriately.

 plugins/devhelp/Makefile.am                        |   14 ++--
 plugins/devhelp/gb-devhelp-plugin.c                |    5 +-
 ...rch-provider.c => gb-devhelp-search-provider.c} |   68 ++++++++++----------
 ...rch-provider.h => gb-devhelp-search-provider.h} |   14 ++--
 ...-search-result.c => gb-devhelp-search-result.c} |   44 ++++++------
 ...-search-result.h => gb-devhelp-search-result.h} |   14 ++--
 src/search/gb-search-box.c                         |   39 -----------
 7 files changed, 78 insertions(+), 120 deletions(-)
---
diff --git a/plugins/devhelp/Makefile.am b/plugins/devhelp/Makefile.am
index 14dd0ce..18e72da 100644
--- a/plugins/devhelp/Makefile.am
+++ b/plugins/devhelp/Makefile.am
@@ -10,15 +10,15 @@ libdevhelp_la_SOURCES = \
        gb-devhelp-document.h \
        gb-devhelp-panel.c \
        gb-devhelp-panel.h \
-       gb-devhelp-view.c \
-       gb-devhelp-view.h \
+       gb-devhelp-plugin.c \
        gb-devhelp-resources.c \
        gb-devhelp-resources.h \
-       ide-devhelp-search-provider.c \
-       ide-devhelp-search-provider.h \
-       ide-devhelp-search-result.c \
-       ide-devhelp-search-result.h \
-       gb-devhelp-plugin.c \
+       gb-devhelp-search-provider.c \
+       gb-devhelp-search-provider.h \
+       gb-devhelp-search-result.c \
+       gb-devhelp-search-result.h \
+       gb-devhelp-view.c \
+       gb-devhelp-view.h \
        $(NULL)
 
 libdevhelp_la_CFLAGS = \
diff --git a/plugins/devhelp/gb-devhelp-plugin.c b/plugins/devhelp/gb-devhelp-plugin.c
index e81841e..28a1b23 100644
--- a/plugins/devhelp/gb-devhelp-plugin.c
+++ b/plugins/devhelp/gb-devhelp-plugin.c
@@ -20,13 +20,12 @@
 
 #include "gb-devhelp-panel.h"
 #include "gb-devhelp-resources.h"
+#include "gb-devhelp-search-provider.h"
 #include "gb-plugins.h"
 #include "gb-workbench-addin.h"
 
-#include "ide-devhelp-search-provider.h"
-
 GB_DEFINE_EMBEDDED_PLUGIN (gb_devhelp,
                            gb_devhelp_get_resource (),
                            "resource:///org/gnome/builder/plugins/devhelp/gb-devhelp.plugin",
                            GB_DEFINE_PLUGIN_TYPE (GB_TYPE_WORKBENCH_ADDIN, GB_TYPE_DEVHELP_PANEL)
-                           GB_DEFINE_PLUGIN_TYPE (IDE_TYPE_SEARCH_PROVIDER, 
IDE_TYPE_DEVHELP_SEARCH_PROVIDER))
+                           GB_DEFINE_PLUGIN_TYPE (IDE_TYPE_SEARCH_PROVIDER, GB_TYPE_DEVHELP_SEARCH_PROVIDER))
diff --git a/plugins/devhelp/ide-devhelp-search-provider.c b/plugins/devhelp/gb-devhelp-search-provider.c
similarity index 71%
rename from plugins/devhelp/ide-devhelp-search-provider.c
rename to plugins/devhelp/gb-devhelp-search-provider.c
index dace3f8..3523c67 100644
--- a/plugins/devhelp/ide-devhelp-search-provider.c
+++ b/plugins/devhelp/gb-devhelp-search-provider.c
@@ -1,4 +1,4 @@
-/* ide-devhelp-search-provider.c
+/* gb-devhelp-search-provider.c
  *
  * Copyright (C) 2015 Erick Pérez Castellanos <erick red gmail com>
  *
@@ -23,18 +23,17 @@
 #include <devhelp/devhelp.h>
 #include <ide.h>
 
-#include "ide-devhelp-search-provider.h"
-#include "ide-devhelp-search-result.h"
-
 #include "gb-devhelp-document.h"
 #include "gb-devhelp-panel.h"
+#include "gb-devhelp-search-provider.h"
+#include "gb-devhelp-search-result.h"
 #include "gb-search-display-row.h"
 #include "gb-view-grid.h"
 #include "gb-widget.h"
 #include "gb-workbench.h"
 #include "gb-workspace.h"
 
-struct _IdeDevhelpSearchProvider
+struct _GbDevhelpSearchProvider
 {
   IdeObject          parent;
 
@@ -44,18 +43,18 @@ struct _IdeDevhelpSearchProvider
 
 static void search_provider_iface_init (IdeSearchProviderInterface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (IdeDevhelpSearchProvider, ide_devhelp_search_provider, IDE_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (GbDevhelpSearchProvider, gb_devhelp_search_provider, IDE_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (IDE_TYPE_SEARCH_PROVIDER,
                                                 search_provider_iface_init))
 
 static void
-ide_devhelp_search_provider_populate (IdeSearchProvider *provider,
-                                      IdeSearchContext  *context,
-                                      const gchar       *search_terms,
-                                      gsize              max_results,
-                                      GCancellable      *cancellable)
+gb_devhelp_search_provider_populate (IdeSearchProvider *provider,
+                                     IdeSearchContext  *context,
+                                     const gchar       *search_terms,
+                                     gsize              max_results,
+                                     GCancellable      *cancellable)
 {
-  IdeDevhelpSearchProvider *self = (IdeDevhelpSearchProvider *)provider;
+  GbDevhelpSearchProvider *self = (GbDevhelpSearchProvider *)provider;
   g_auto(IdeSearchReducer) reducer = { 0 };
   IdeContext *idecontext;
   GtkTreeIter iter;
@@ -63,7 +62,7 @@ ide_devhelp_search_provider_populate (IdeSearchProvider *provider,
   gint count = 0;
   gint total;
 
-  g_assert (IDE_IS_DEVHELP_SEARCH_PROVIDER (self));
+  g_assert (GB_IS_DEVHELP_SEARCH_PROVIDER (self));
   g_assert (IDE_IS_SEARCH_CONTEXT (context));
   g_assert (search_terms);
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
@@ -110,7 +109,7 @@ ide_devhelp_search_provider_populate (IdeSearchProvider *provider,
           name = italic_name;
         }
 
-      result = g_object_new (IDE_TYPE_DEVHELP_SEARCH_RESULT,
+      result = g_object_new (GB_TYPE_DEVHELP_SEARCH_RESULT,
                              "context", idecontext,
                              "provider", provider,
                              "title", name,
@@ -126,23 +125,23 @@ ide_devhelp_search_provider_populate (IdeSearchProvider *provider,
 }
 
 static const gchar *
-ide_devhelp_search_provider_get_verb (IdeSearchProvider *provider)
+gb_devhelp_search_provider_get_verb (IdeSearchProvider *provider)
 {
   return _("Documentation");
 }
 
 static void
-ide_devhelp_search_provider_constructed (GObject *object)
+gb_devhelp_search_provider_constructed (GObject *object)
 {
-  IdeDevhelpSearchProvider *self = IDE_DEVHELP_SEARCH_PROVIDER (object);
+  GbDevhelpSearchProvider *self = GB_DEVHELP_SEARCH_PROVIDER (object);
 
   dh_book_manager_populate (self->book_manager);
   dh_keyword_model_set_words (self->keywords_model, self->book_manager);
 }
 
 static GtkWidget *
-ide_devhelp_search_provider_create_row (IdeSearchProvider *provider,
-                                        IdeSearchResult   *result)
+gb_devhelp_search_provider_create_row (IdeSearchProvider *provider,
+                                       IdeSearchResult   *result)
 {
   g_assert (IDE_IS_SEARCH_PROVIDER (provider));
   g_assert (IDE_IS_SEARCH_RESULT (result));
@@ -154,18 +153,17 @@ ide_devhelp_search_provider_create_row (IdeSearchProvider *provider,
 }
 
 static void
-ide_devhelp_search_provider_activate (IdeSearchProvider *provider,
-                                      GtkWidget         *row,
-                                      IdeSearchResult   *result)
+gb_devhelp_search_provider_activate (IdeSearchProvider *provider,
+                                     GtkWidget         *row,
+                                     IdeSearchResult   *result)
 {
-  g_autoptr(GbDocument) copy = NULL;
   GbDevhelpPanel *panel;
   GtkWidget *workspace;
   GtkWidget *toplevel;
   GtkWidget *pane;
   gchar *uri;
 
-  g_return_if_fail (IDE_IS_DEVHELP_SEARCH_PROVIDER (provider));
+  g_return_if_fail (GB_IS_DEVHELP_SEARCH_PROVIDER (provider));
   g_return_if_fail (GTK_IS_WIDGET (row));
   g_return_if_fail (IDE_IS_SEARCH_RESULT (result));
 
@@ -187,26 +185,26 @@ ide_devhelp_search_provider_activate (IdeSearchProvider *provider,
 }
 
 static void
-ide_devhelp_search_provider_finalize (GObject *object)
+gb_devhelp_search_provider_finalize (GObject *object)
 {
-  IdeDevhelpSearchProvider *self = IDE_DEVHELP_SEARCH_PROVIDER (object);
+  GbDevhelpSearchProvider *self = GB_DEVHELP_SEARCH_PROVIDER (object);
 
   g_clear_object (&self->book_manager);
 
-  G_OBJECT_CLASS (ide_devhelp_search_provider_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gb_devhelp_search_provider_parent_class)->finalize (object);
 }
 
 static void
-ide_devhelp_search_provider_class_init (IdeDevhelpSearchProviderClass *klass)
+gb_devhelp_search_provider_class_init (GbDevhelpSearchProviderClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->constructed = ide_devhelp_search_provider_constructed;
-  object_class->finalize = ide_devhelp_search_provider_finalize;
+  object_class->constructed = gb_devhelp_search_provider_constructed;
+  object_class->finalize = gb_devhelp_search_provider_finalize;
 }
 
 static void
-ide_devhelp_search_provider_init (IdeDevhelpSearchProvider *self)
+gb_devhelp_search_provider_init (GbDevhelpSearchProvider *self)
 {
   self->book_manager = dh_book_manager_new ();
   self->keywords_model = dh_keyword_model_new ();
@@ -215,8 +213,8 @@ ide_devhelp_search_provider_init (IdeDevhelpSearchProvider *self)
 static void
 search_provider_iface_init (IdeSearchProviderInterface *iface)
 {
-  iface->create_row = ide_devhelp_search_provider_create_row;
-  iface->get_verb = ide_devhelp_search_provider_get_verb;
-  iface->populate = ide_devhelp_search_provider_populate;
-  iface->activate = ide_devhelp_search_provider_activate;
+  iface->create_row = gb_devhelp_search_provider_create_row;
+  iface->get_verb = gb_devhelp_search_provider_get_verb;
+  iface->populate = gb_devhelp_search_provider_populate;
+  iface->activate = gb_devhelp_search_provider_activate;
 }
diff --git a/plugins/devhelp/ide-devhelp-search-provider.h b/plugins/devhelp/gb-devhelp-search-provider.h
similarity index 69%
rename from plugins/devhelp/ide-devhelp-search-provider.h
rename to plugins/devhelp/gb-devhelp-search-provider.h
index 67ba706..fa2a3e6 100644
--- a/plugins/devhelp/ide-devhelp-search-provider.h
+++ b/plugins/devhelp/gb-devhelp-search-provider.h
@@ -1,4 +1,4 @@
-/* ide-devhelp-search-provider.h
+/* gb-devhelp-search-provider.h
  *
  * Copyright (C) 2015 Erick Pérez Castellanos <erick red gmail com>
  *
@@ -16,19 +16,19 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef IDE_DEVHELP_SEARCH_PROVIDER_H
-#define IDE_DEVHELP_SEARCH_PROVIDER_H
+#ifndef GB_DEVHELP_SEARCH_PROVIDER_H
+#define GB_DEVHELP_SEARCH_PROVIDER_H
 
 #include "ide-search-provider.h"
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_DEVHELP_SEARCH_PROVIDER (ide_devhelp_search_provider_get_type())
+#define GB_TYPE_DEVHELP_SEARCH_PROVIDER (gb_devhelp_search_provider_get_type())
 
-G_DECLARE_FINAL_TYPE (IdeDevhelpSearchProvider, ide_devhelp_search_provider,
-                      IDE, DEVHELP_SEARCH_PROVIDER,
+G_DECLARE_FINAL_TYPE (GbDevhelpSearchProvider, gb_devhelp_search_provider,
+                      GB, DEVHELP_SEARCH_PROVIDER,
                       IdeObject)
 
 G_END_DECLS
 
-#endif /* IDE_DEVHELP_SEARCH_PROVIDER_H */
+#endif /* GB_DEVHELP_SEARCH_PROVIDER_H */
diff --git a/plugins/devhelp/ide-devhelp-search-result.c b/plugins/devhelp/gb-devhelp-search-result.c
similarity index 57%
rename from plugins/devhelp/ide-devhelp-search-result.c
rename to plugins/devhelp/gb-devhelp-search-result.c
index ddef127..b16bba6 100644
--- a/plugins/devhelp/ide-devhelp-search-result.c
+++ b/plugins/devhelp/gb-devhelp-search-result.c
@@ -1,4 +1,4 @@
-/* ide-devhelp-search-result.c
+/* gb-devhelp-search-result.c
  *
  * Copyright (C) 2015 Christian Hergert <christian hergert me>
  *
@@ -18,9 +18,9 @@
 
 #include <glib/gi18n.h>
 
-#include "ide-devhelp-search-result.h"
+#include "gb-devhelp-search-result.h"
 
-struct _IdeDevhelpSearchResult
+struct _GbDevhelpSearchResult
 {
   IdeSearchResult  parent_instance;
   gchar           *uri;
@@ -33,27 +33,27 @@ enum
   LAST_PROP
 };
 
-G_DEFINE_TYPE (IdeDevhelpSearchResult, ide_devhelp_search_result, IDE_TYPE_SEARCH_RESULT)
+G_DEFINE_TYPE (GbDevhelpSearchResult, gb_devhelp_search_result, IDE_TYPE_SEARCH_RESULT)
 
 static GParamSpec *gParamSpecs [LAST_PROP];
 
 static void
-ide_devhelp_search_result_finalize (GObject *object)
+gb_devhelp_search_result_finalize (GObject *object)
 {
-  IdeDevhelpSearchResult *self = (IdeDevhelpSearchResult *)object;
+  GbDevhelpSearchResult *self = (GbDevhelpSearchResult *)object;
 
   g_clear_pointer (&self->uri, g_free);
 
-  G_OBJECT_CLASS (ide_devhelp_search_result_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gb_devhelp_search_result_parent_class)->finalize (object);
 }
 
 static void
-ide_devhelp_search_result_get_property (GObject    *object,
-                                        guint       prop_id,
-                                        GValue     *value,
-                                        GParamSpec *pspec)
+gb_devhelp_search_result_get_property (GObject    *object,
+                                       guint       prop_id,
+                                       GValue     *value,
+                                       GParamSpec *pspec)
 {
-  IdeDevhelpSearchResult *self = IDE_DEVHELP_SEARCH_RESULT (object);
+  GbDevhelpSearchResult *self = GB_DEVHELP_SEARCH_RESULT (object);
 
   switch (prop_id)
     {
@@ -67,12 +67,12 @@ ide_devhelp_search_result_get_property (GObject    *object,
 }
 
 static void
-ide_devhelp_search_result_set_property (GObject      *object,
-                                        guint         prop_id,
-                                        const GValue *value,
-                                        GParamSpec   *pspec)
+gb_devhelp_search_result_set_property (GObject      *object,
+                                       guint         prop_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
 {
-  IdeDevhelpSearchResult *self = IDE_DEVHELP_SEARCH_RESULT (object);
+  GbDevhelpSearchResult *self = GB_DEVHELP_SEARCH_RESULT (object);
 
   switch (prop_id)
     {
@@ -86,13 +86,13 @@ ide_devhelp_search_result_set_property (GObject      *object,
 }
 
 static void
-ide_devhelp_search_result_class_init (IdeDevhelpSearchResultClass *klass)
+gb_devhelp_search_result_class_init (GbDevhelpSearchResultClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->finalize = ide_devhelp_search_result_finalize;
-  object_class->get_property = ide_devhelp_search_result_get_property;
-  object_class->set_property = ide_devhelp_search_result_set_property;
+  object_class->finalize = gb_devhelp_search_result_finalize;
+  object_class->get_property = gb_devhelp_search_result_get_property;
+  object_class->set_property = gb_devhelp_search_result_set_property;
 
   gParamSpecs [PROP_URI] =
     g_param_spec_string ("uri",
@@ -105,6 +105,6 @@ ide_devhelp_search_result_class_init (IdeDevhelpSearchResultClass *klass)
 }
 
 static void
-ide_devhelp_search_result_init (IdeDevhelpSearchResult *result)
+gb_devhelp_search_result_init (GbDevhelpSearchResult *result)
 {
 }
diff --git a/plugins/devhelp/ide-devhelp-search-result.h b/plugins/devhelp/gb-devhelp-search-result.h
similarity index 68%
rename from plugins/devhelp/ide-devhelp-search-result.h
rename to plugins/devhelp/gb-devhelp-search-result.h
index 0b4a434..fea8f23 100644
--- a/plugins/devhelp/ide-devhelp-search-result.h
+++ b/plugins/devhelp/gb-devhelp-search-result.h
@@ -1,4 +1,4 @@
-/* ide-devhelp-search-result.h
+/* gb-devhelp-search-result.h
  *
  * Copyright (C) 2015 Christian Hergert <christian hergert me>
  *
@@ -16,18 +16,18 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef IDE_DEVHELP_SEARCH_RESULT_H
-#define IDE_DEVHELP_SEARCH_RESULT_H
+#ifndef GB_DEVHELP_SEARCH_RESULT_H
+#define GB_DEVHELP_SEARCH_RESULT_H
 
 #include "ide-search-result.h"
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_DEVHELP_SEARCH_RESULT (ide_devhelp_search_result_get_type())
+#define GB_TYPE_DEVHELP_SEARCH_RESULT (gb_devhelp_search_result_get_type())
 
-G_DECLARE_FINAL_TYPE (IdeDevhelpSearchResult, ide_devhelp_search_result,
-                      IDE, DEVHELP_SEARCH_RESULT, IdeSearchResult)
+G_DECLARE_FINAL_TYPE (GbDevhelpSearchResult, gb_devhelp_search_result,
+                      GB, DEVHELP_SEARCH_RESULT, IdeSearchResult)
 
 G_END_DECLS
 
-#endif /* IDE_DEVHELP_SEARCH_RESULT_H */
+#endif /* GB_DEVHELP_SEARCH_RESULT_H */
diff --git a/src/search/gb-search-box.c b/src/search/gb-search-box.c
index 63fffb9..45a3423 100644
--- a/src/search/gb-search-box.c
+++ b/src/search/gb-search-box.c
@@ -28,9 +28,6 @@
 #include "gb-widget.h"
 #include "gb-workbench.h"
 
-/* FIXME: make search result row creation pluggable */
-#include "ide-devhelp-search-result.h"
-
 #define SHORT_DELAY_TIMEOUT_MSEC 30
 #define LONG_DELAY_TIMEOUT_MSEC  30
 
@@ -231,46 +228,10 @@ gb_search_box_display_result_activated (GbSearchBox     *self,
                                         IdeSearchResult *result,
                                         GbSearchDisplay *display)
 {
-  GbWorkbench *workbench;
-
   g_return_if_fail (GB_IS_SEARCH_BOX (self));
   g_return_if_fail (IDE_IS_SEARCH_RESULT (result));
   g_return_if_fail (GB_IS_SEARCH_DISPLAY (display));
 
-  workbench = gb_widget_get_workbench (GTK_WIDGET (self));
-
-  /*
-   * FIXME:
-   *
-   * This is not ideal, but we don't have time before the 3.16 release to build
-   * the proper abstraction for us to keep the load hooks inside of the Builder
-   * code and out of the libide code.
-   *
-   * After release, we should revisit this, and probably add an extension
-   * point to register the handler for a given result type.
-   */
-  if (IDE_IS_GIT_SEARCH_RESULT (result))
-    {
-      g_autoptr(GFile) file = NULL;
-
-      g_object_get (result, "file", &file, NULL);
-      if (file)
-        gb_workbench_open (workbench, file);
-    }
-  else if (IDE_IS_DEVHELP_SEARCH_RESULT (result))
-    {
-      g_autofree gchar *uri = NULL;
-
-      g_object_get (result, "uri", &uri, NULL);
-      //workspace = gb_workbench_get_workspace_typed (workbench, GB_TYPE_EDITOR_WORKSPACE);
-      //gb_editor_workspace_show_help (workspace, uri);
-    }
-  else
-    {
-      g_warning (_("Builder does not know how to load %s"),
-                 g_type_name (G_TYPE_FROM_INSTANCE (result)));
-    }
-
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->button), FALSE);
   gtk_entry_set_text (GTK_ENTRY (self->entry), "");
 }


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