[gnome-builder/wip/chergert/hover] wip: devhelp: stub out hover provider for devhelp



commit 341f34a1f2a8dac1f451f8d23316afe58d9917af
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 2 21:52:28 2018 -0700

    wip: devhelp: stub out hover provider for devhelp

 src/plugins/devhelp/gbp-devhelp-hover-provider.c | 86 ++++++++++++++++++++++++
 src/plugins/devhelp/gbp-devhelp-hover-provider.h | 29 ++++++++
 src/plugins/devhelp/gbp-devhelp-plugin.c         |  4 ++
 src/plugins/devhelp/meson.build                  |  9 +--
 4 files changed, 120 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/devhelp/gbp-devhelp-hover-provider.c 
b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
new file mode 100644
index 000000000..9530ab086
--- /dev/null
+++ b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
@@ -0,0 +1,86 @@
+/* gbp-devhelp-hover-provider.c
+ *
+ * Copyright 2018 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 "config.h"
+
+#define G_LOG_DOMAIN "gbp-devhelp-hover-provider"
+
+#include "gbp-devhelp-hover-provider.h"
+
+struct _GbpDevhelpHoverProvider
+{
+  GObject parent_instance;
+};
+
+static void
+gbp_devhelp_hover_provider_hover_async (IdeHoverProvider    *provider,
+                                        IdeHoverContext     *context,
+                                        const GtkTextIter   *iter,
+                                        GCancellable        *cancellable,
+                                        GAsyncReadyCallback  callback,
+                                        gpointer             user_data)
+{
+  GbpDevhelpHoverProvider *self = (GbpDevhelpHoverProvider *)provider;
+  //g_autoptr(IdeMarkedContent) content = NULL;
+  g_autoptr(IdeTask) task = NULL;
+
+  g_assert (GBP_IS_DEVHELP_HOVER_PROVIDER (self));
+  g_assert (IDE_IS_HOVER_CONTEXT (context));
+  g_assert (iter != NULL);
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  task = ide_task_new (self, cancellable, callback, user_data);
+  ide_task_set_source_tag (task, gbp_devhelp_hover_provider_hover_async);
+
+  //content = ide_marked_content_new_plaintext ("this is some docs");
+  //ide_hover_context_add_content (context, "Devhelp", content);
+
+  ide_task_return_boolean (task, TRUE);
+}
+
+static gboolean
+gbp_devhelp_hover_provider_hover_finish (IdeHoverProvider  *provider,
+                                         GAsyncResult      *result,
+                                         GError           **error)
+{
+  g_assert (GBP_IS_DEVHELP_HOVER_PROVIDER (provider));
+  g_assert (IDE_IS_TASK (result));
+
+  return ide_task_propagate_boolean (IDE_TASK (result), error);
+}
+
+static void
+hover_provider_iface_init (IdeHoverProviderInterface *iface)
+{
+  iface->hover_async = gbp_devhelp_hover_provider_hover_async;
+  iface->hover_finish = gbp_devhelp_hover_provider_hover_finish;
+}
+
+G_DEFINE_TYPE_WITH_CODE (GbpDevhelpHoverProvider, gbp_devhelp_hover_provider, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (IDE_TYPE_HOVER_PROVIDER,
+                                                hover_provider_iface_init))
+
+static void
+gbp_devhelp_hover_provider_class_init (GbpDevhelpHoverProviderClass *klass)
+{
+}
+
+static void
+gbp_devhelp_hover_provider_init (GbpDevhelpHoverProvider *self)
+{
+}
diff --git a/src/plugins/devhelp/gbp-devhelp-hover-provider.h 
b/src/plugins/devhelp/gbp-devhelp-hover-provider.h
new file mode 100644
index 000000000..c7ffb977d
--- /dev/null
+++ b/src/plugins/devhelp/gbp-devhelp-hover-provider.h
@@ -0,0 +1,29 @@
+/* gbp-devhelp-hover-provider.h
+ *
+ * Copyright 2018 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/>.
+ */
+
+#pragma once
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_DEVHELP_HOVER_PROVIDER (gbp_devhelp_hover_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpDevhelpHoverProvider, gbp_devhelp_hover_provider, GBP, DEVHELP_HOVER_PROVIDER, 
GObject)
+
+G_END_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-plugin.c b/src/plugins/devhelp/gbp-devhelp-plugin.c
index 1f5b43318..a2acd30d0 100644
--- a/src/plugins/devhelp/gbp-devhelp-plugin.c
+++ b/src/plugins/devhelp/gbp-devhelp-plugin.c
@@ -22,6 +22,7 @@
 #include "gbp-devhelp-editor-addin.h"
 #include "gbp-devhelp-editor-view-addin.h"
 #include "gbp-devhelp-documentation-provider.h"
+#include "gbp-devhelp-hover-provider.h"
 #include "gbp-devhelp-layout-stack-addin.h"
 
 void
@@ -33,6 +34,9 @@ gbp_devhelp_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_EDITOR_VIEW_ADDIN,
                                               GBP_TYPE_DEVHELP_EDITOR_VIEW_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_HOVER_PROVIDER,
+                                              GBP_TYPE_DEVHELP_HOVER_PROVIDER);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_LAYOUT_STACK_ADDIN,
                                               GBP_TYPE_DEVHELP_LAYOUT_STACK_ADDIN);
diff --git a/src/plugins/devhelp/meson.build b/src/plugins/devhelp/meson.build
index 55e82c590..c03741dd5 100644
--- a/src/plugins/devhelp/meson.build
+++ b/src/plugins/devhelp/meson.build
@@ -8,21 +8,14 @@ devhelp_resources = gnome.compile_resources(
 
 devhelp_sources = [
   'gbp-devhelp-documentation-provider.c',
-  'gbp-devhelp-documentation-provider.h',
   'gbp-devhelp-menu-button.c',
-  'gbp-devhelp-menu-button.h',
+  'gbp-devhelp-hover-provider.c',
   'gbp-devhelp-layout-stack-addin.c',
-  'gbp-devhelp-layout-stack-addin.h',
   'gbp-devhelp-editor-addin.c',
-  'gbp-devhelp-editor-addin.h',
   'gbp-devhelp-editor-view-addin.c',
-  'gbp-devhelp-editor-view-addin.h',
   'gbp-devhelp-plugin.c',
   'gbp-devhelp-search.c',
-  'gbp-devhelp-search.h',
-  'gbp-devhelp-search-private.h',
   'gbp-devhelp-view.c',
-  'gbp-devhelp-view.h',
 ]
 
 gnome_builder_plugins_deps += [


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