[gnome-builder: 73/139] devhelp: port to new libide-editor
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder: 73/139] devhelp: port to new libide-editor
- Date: Thu, 10 Jan 2019 04:23:27 +0000 (UTC)
commit 55a74adb73a554b4422beeab42ca2a40c51a633a
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 9 17:14:33 2019 -0800
devhelp: port to new libide-editor
This ports the devhelp plugin to use our new libide-editor abstractions.
It is mostly a renaming to follow the naming semantics that were changed.
.../{gbp-devhelp-plugin.c => devhelp-plugin.c} | 16 +--
src/plugins/devhelp/devhelp.gresource.xml | 6 +-
src/plugins/devhelp/devhelp.plugin | 13 +--
src/plugins/devhelp/gbp-devhelp-editor-addin.c | 43 ++++----
src/plugins/devhelp/gbp-devhelp-editor-addin.h | 2 +-
...out-stack-addin.c => gbp-devhelp-frame-addin.c} | 112 ++++++++++-----------
...out-stack-addin.h => gbp-devhelp-frame-addin.h} | 8 +-
src/plugins/devhelp/gbp-devhelp-hover-provider.c | 6 +-
src/plugins/devhelp/gbp-devhelp-hover-provider.h | 2 +-
src/plugins/devhelp/gbp-devhelp-menu-button.c | 8 +-
.../{gbp-devhelp-view.c => gbp-devhelp-page.c} | 82 +++++++--------
.../{gbp-devhelp-view.h => gbp-devhelp-page.h} | 10 +-
.../{gbp-devhelp-view.ui => gbp-devhelp-page.ui} | 2 +-
src/plugins/devhelp/gbp-devhelp-search-private.h | 2 +-
src/plugins/devhelp/gbp-devhelp-search.c | 4 +-
src/plugins/devhelp/gbp-devhelp-search.h | 2 +-
src/plugins/devhelp/gtk/menus.ui | 2 +-
src/plugins/devhelp/meson.build | 35 ++++---
18 files changed, 180 insertions(+), 175 deletions(-)
---
diff --git a/src/plugins/devhelp/gbp-devhelp-plugin.c b/src/plugins/devhelp/devhelp-plugin.c
similarity index 80%
rename from src/plugins/devhelp/gbp-devhelp-plugin.c
rename to src/plugins/devhelp/devhelp-plugin.c
index ecd913692..72c5b2fed 100644
--- a/src/plugins/devhelp/gbp-devhelp-plugin.c
+++ b/src/plugins/devhelp/devhelp-plugin.c
@@ -1,4 +1,4 @@
-/* gbp-devhelp-plugin.c
+/* devhelp-plugin.c
*
* Copyright 2015-2019 Christian Hergert <chergert redhat com>
*
@@ -18,15 +18,17 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#include <ide.h>
+#include "config.h"
+
+#include <libide-editor.h>
#include <libpeas/peas.h>
#include "gbp-devhelp-editor-addin.h"
#include "gbp-devhelp-hover-provider.h"
-#include "gbp-devhelp-layout-stack-addin.h"
+#include "gbp-devhelp-frame-addin.h"
-void
-gbp_devhelp_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_devhelp_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_EDITOR_ADDIN,
@@ -35,6 +37,6 @@ gbp_devhelp_register_types (PeasObjectModule *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);
+ IDE_TYPE_FRAME_ADDIN,
+ GBP_TYPE_DEVHELP_FRAME_ADDIN);
}
diff --git a/src/plugins/devhelp/devhelp.gresource.xml b/src/plugins/devhelp/devhelp.gresource.xml
index 0660faa04..34efd9b5c 100644
--- a/src/plugins/devhelp/devhelp.gresource.xml
+++ b/src/plugins/devhelp/devhelp.gresource.xml
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/builder/plugins">
+ <gresource prefix="/plugins/devhelp">
<file>devhelp.plugin</file>
- </gresource>
- <gresource prefix="/org/gnome/builder/plugins/devhelp-plugin">
<file>gtk/menus.ui</file>
<file>themes/shared.css</file>
<file>gbp-devhelp-menu-button.ui</file>
- <file>gbp-devhelp-view.ui</file>
+ <file>gbp-devhelp-page.ui</file>
<file>gbp-devhelp-search.ui</file>
</gresource>
</gresources>
diff --git a/src/plugins/devhelp/devhelp.plugin b/src/plugins/devhelp/devhelp.plugin
index c629ca26f..21e6122f1 100644
--- a/src/plugins/devhelp/devhelp.plugin
+++ b/src/plugins/devhelp/devhelp.plugin
@@ -1,10 +1,11 @@
[Plugin]
-Module=devhelp-plugin
-Name=Devhelp
-Description=Integration with devhelp documentation
Authors=Christian Hergert <christian hergert me>
-Copyright=Copyright © 2015 Christian Hergert
-Depends=editor;webkit;
Builtin=true
-Embedded=gbp_devhelp_register_types
+Copyright=Copyright © 2015-2018 Christian Hergert
+Depends=editor;webkit;
+Description=Integration with devhelp documentation
+Embedded=_gbp_devhelp_register_types
+Hidden=true
+Module=devhelp
+Name=Devhelp
X-Hover-Provider-Languages=c,chdr,cpp,cpphdr
diff --git a/src/plugins/devhelp/gbp-devhelp-editor-addin.c b/src/plugins/devhelp/gbp-devhelp-editor-addin.c
index f8ef163b0..982bd2616 100644
--- a/src/plugins/devhelp/gbp-devhelp-editor-addin.c
+++ b/src/plugins/devhelp/gbp-devhelp-editor-addin.c
@@ -21,72 +21,75 @@
#define G_LOG_DOMAIN "gbp-devhelp-editor-addin"
#include "gbp-devhelp-editor-addin.h"
-#include "gbp-devhelp-view.h"
+#include "gbp-devhelp-page.h"
struct _GbpDevhelpEditorAddin
{
GObject parent_instance;
- IdeEditorPerspective *editor;
+ IdeEditorSurface *editor;
};
static void
-gbp_devhelp_editor_addin_new_devhelp_view (GSimpleAction *action,
+gbp_devhelp_editor_addin_new_devhelp_page (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
GbpDevhelpEditorAddin *self = user_data;
- IdeLayoutGrid *grid;
+ IdeGrid *grid;
GtkWidget *view;
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (GBP_IS_DEVHELP_EDITOR_ADDIN (self));
g_assert (self->editor != NULL);
- view = g_object_new (GBP_TYPE_DEVHELP_VIEW,
+ view = g_object_new (GBP_TYPE_DEVHELP_PAGE,
"visible", TRUE,
NULL);
- grid = ide_editor_perspective_get_grid (self->editor);
+ grid = ide_editor_surface_get_grid (self->editor);
gtk_container_add (GTK_CONTAINER (grid), view);
}
static GActionEntry actions[] = {
- { "new-devhelp-view", gbp_devhelp_editor_addin_new_devhelp_view },
+ { "new-devhelp-page", gbp_devhelp_editor_addin_new_devhelp_page },
};
static void
-gbp_devhelp_editor_addin_load (IdeEditorAddin *addin,
- IdeEditorPerspective *editor)
+gbp_devhelp_editor_addin_load (IdeEditorAddin *addin,
+ IdeEditorSurface *editor)
{
GbpDevhelpEditorAddin *self = (GbpDevhelpEditorAddin *)addin;
- IdeWorkbench *workbench;
+ GtkWidget *workspace;
g_assert (GBP_IS_DEVHELP_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_PERSPECTIVE (editor));
+ g_assert (IDE_IS_EDITOR_SURFACE (editor));
self->editor = editor;
- workbench = ide_widget_get_workbench (GTK_WIDGET (editor));
+ workspace = gtk_widget_get_ancestor (GTK_WIDGET (editor), IDE_TYPE_WORKSPACE);
- if (workbench != NULL)
- g_action_map_add_action_entries (G_ACTION_MAP (workbench), actions, G_N_ELEMENTS (actions), self);
+ if (workspace != NULL)
+ g_action_map_add_action_entries (G_ACTION_MAP (workspace),
+ actions,
+ G_N_ELEMENTS (actions),
+ self);
}
static void
gbp_devhelp_editor_addin_unload (IdeEditorAddin *addin,
- IdeEditorPerspective *editor)
+ IdeEditorSurface *editor)
{
GbpDevhelpEditorAddin *self = (GbpDevhelpEditorAddin *)addin;
- GtkWidget *win;
+ GtkWidget *workspace;
g_assert (GBP_IS_DEVHELP_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_PERSPECTIVE (editor));
+ g_assert (IDE_IS_EDITOR_SURFACE (editor));
- win = gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW);
+ workspace = gtk_widget_get_ancestor (GTK_WIDGET (editor), IDE_TYPE_WORKSPACE);
- if (G_IS_ACTION_MAP (win))
+ if (G_IS_ACTION_MAP (workspace))
{
for (guint i = 0; i < G_N_ELEMENTS (actions); i++)
- g_action_map_remove_action (G_ACTION_MAP (win), actions[i].name);
+ g_action_map_remove_action (G_ACTION_MAP (workspace), actions[i].name);
}
self->editor = NULL;
diff --git a/src/plugins/devhelp/gbp-devhelp-editor-addin.h b/src/plugins/devhelp/gbp-devhelp-editor-addin.h
index ee03592dc..d6a5ef564 100644
--- a/src/plugins/devhelp/gbp-devhelp-editor-addin.h
+++ b/src/plugins/devhelp/gbp-devhelp-editor-addin.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-layout-stack-addin.c
b/src/plugins/devhelp/gbp-devhelp-frame-addin.c
similarity index 55%
rename from src/plugins/devhelp/gbp-devhelp-layout-stack-addin.c
rename to src/plugins/devhelp/gbp-devhelp-frame-addin.c
index 0b1d008b3..d9c8ae8f3 100644
--- a/src/plugins/devhelp/gbp-devhelp-layout-stack-addin.c
+++ b/src/plugins/devhelp/gbp-devhelp-frame-addin.c
@@ -1,4 +1,4 @@
-/* gbp-devhelp-layout-stack-addin.c
+/* gbp-devhelp-frame-addin.c
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -18,31 +18,31 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "gbp-devhelp-layout-stack-addin"
+#define G_LOG_DOMAIN "gbp-devhelp-frame-addin"
-#include "gbp-devhelp-layout-stack-addin.h"
+#include "gbp-devhelp-frame-addin.h"
#include "gbp-devhelp-menu-button.h"
-#include "gbp-devhelp-view.h"
+#include "gbp-devhelp-page.h"
-struct _GbpDevhelpLayoutStackAddin
+struct _GbpDevhelpFrameAddin
{
GObject parent_instance;
- IdeLayoutStack *stack;
+ IdeFrame *stack;
GbpDevhelpMenuButton *button;
};
static void
-gbp_devhelp_layout_stack_addin_search (GSimpleAction *action,
+gbp_devhelp_frame_addin_search (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- GbpDevhelpLayoutStackAddin *self = user_data;
+ GbpDevhelpFrameAddin *self = user_data;
const gchar *keyword;
g_assert (G_IS_SIMPLE_ACTION (action));
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
g_assert (self->stack != NULL);
- g_assert (IDE_IS_LAYOUT_STACK (self->stack));
+ g_assert (IDE_IS_FRAME (self->stack));
g_assert (variant != NULL);
g_assert (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING));
@@ -54,62 +54,62 @@ gbp_devhelp_layout_stack_addin_search (GSimpleAction *action,
}
static void
-gbp_devhelp_layout_stack_addin_new_view (GSimpleAction *action,
+gbp_devhelp_frame_addin_new_view (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- GbpDevhelpLayoutStackAddin *self = user_data;
- GbpDevhelpView *view;
+ GbpDevhelpFrameAddin *self = user_data;
+ GbpDevhelpPage *view;
g_assert (G_IS_SIMPLE_ACTION (action));
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
g_assert (self->stack != NULL);
- g_assert (IDE_IS_LAYOUT_STACK (self->stack));
+ g_assert (IDE_IS_FRAME (self->stack));
- view = g_object_new (GBP_TYPE_DEVHELP_VIEW,
+ view = g_object_new (GBP_TYPE_DEVHELP_PAGE,
"visible", TRUE,
NULL);
gtk_container_add (GTK_CONTAINER (self->stack), GTK_WIDGET (view));
}
static void
-gbp_devhelp_layout_stack_addin_navigate_to (GSimpleAction *action,
+gbp_devhelp_frame_addin_navigate_to (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
{
- GbpDevhelpLayoutStackAddin *self = user_data;
- IdeLayoutView *view;
+ GbpDevhelpFrameAddin *self = user_data;
+ IdePage *view;
const gchar *uri;
g_assert (G_IS_SIMPLE_ACTION (action));
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
g_assert (self->stack != NULL);
- g_assert (IDE_IS_LAYOUT_STACK (self->stack));
+ g_assert (IDE_IS_FRAME (self->stack));
g_assert (variant != NULL);
g_assert (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING));
uri = g_variant_get_string (variant, NULL);
- view = ide_layout_stack_get_visible_child (self->stack);
+ view = ide_frame_get_visible_child (self->stack);
- if (GBP_IS_DEVHELP_VIEW (view))
- gbp_devhelp_view_set_uri (GBP_DEVHELP_VIEW (view), uri);
+ if (GBP_IS_DEVHELP_PAGE (view))
+ gbp_devhelp_page_set_uri (GBP_DEVHELP_PAGE (view), uri);
}
static GActionEntry actions[] = {
- { "new-view", gbp_devhelp_layout_stack_addin_new_view },
- { "search", gbp_devhelp_layout_stack_addin_search, "s" },
- { "navigate-to", gbp_devhelp_layout_stack_addin_navigate_to, "s" },
+ { "new-view", gbp_devhelp_frame_addin_new_view },
+ { "search", gbp_devhelp_frame_addin_search, "s" },
+ { "navigate-to", gbp_devhelp_frame_addin_navigate_to, "s" },
};
static void
-gbp_devhelp_layout_stack_addin_load (IdeLayoutStackAddin *addin,
- IdeLayoutStack *stack)
+gbp_devhelp_frame_addin_load (IdeFrameAddin *addin,
+ IdeFrame *stack)
{
- GbpDevhelpLayoutStackAddin *self = (GbpDevhelpLayoutStackAddin *)addin;
+ GbpDevhelpFrameAddin *self = (GbpDevhelpFrameAddin *)addin;
g_autoptr(GSimpleActionGroup) group = NULL;
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
- g_assert (IDE_IS_LAYOUT_STACK (stack));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
+ g_assert (IDE_IS_FRAME (stack));
self->stack = stack;
@@ -124,13 +124,13 @@ gbp_devhelp_layout_stack_addin_load (IdeLayoutStackAddin *addin,
}
static void
-gbp_devhelp_layout_stack_addin_unload (IdeLayoutStackAddin *addin,
- IdeLayoutStack *stack)
+gbp_devhelp_frame_addin_unload (IdeFrameAddin *addin,
+ IdeFrame *stack)
{
- GbpDevhelpLayoutStackAddin *self = (GbpDevhelpLayoutStackAddin *)addin;
+ GbpDevhelpFrameAddin *self = (GbpDevhelpFrameAddin *)addin;
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
- g_assert (IDE_IS_LAYOUT_STACK (stack));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
+ g_assert (IDE_IS_FRAME (stack));
self->stack = NULL;
@@ -141,16 +141,16 @@ gbp_devhelp_layout_stack_addin_unload (IdeLayoutStackAddin *addin,
}
static void
-gbp_devhelp_layout_stack_addin_set_view (IdeLayoutStackAddin *addin,
- IdeLayoutView *view)
+gbp_devhelp_frame_addin_set_view (IdeFrameAddin *addin,
+ IdePage *view)
{
- GbpDevhelpLayoutStackAddin *self = (GbpDevhelpLayoutStackAddin *)addin;
+ GbpDevhelpFrameAddin *self = (GbpDevhelpFrameAddin *)addin;
gboolean visible = FALSE;
- g_assert (GBP_IS_DEVHELP_LAYOUT_STACK_ADDIN (self));
- g_assert (!view || IDE_IS_LAYOUT_VIEW (view));
+ g_assert (GBP_IS_DEVHELP_FRAME_ADDIN (self));
+ g_assert (!view || IDE_IS_PAGE (view));
g_assert (self->stack != NULL);
- g_assert (IDE_IS_LAYOUT_STACK (self->stack));
+ g_assert (IDE_IS_FRAME (self->stack));
/*
* We don't setup self->button until we get our first devhelp
@@ -158,13 +158,13 @@ gbp_devhelp_layout_stack_addin_set_view (IdeLayoutStackAddin *addin,
* memory footprint until it is necessary.
*/
- if (GBP_IS_DEVHELP_VIEW (view))
+ if (GBP_IS_DEVHELP_PAGE (view))
{
if (self->button == NULL)
{
GtkWidget *titlebar;
- titlebar = ide_layout_stack_get_titlebar (self->stack);
+ titlebar = ide_frame_get_titlebar (self->stack);
self->button = g_object_new (GBP_TYPE_DEVHELP_MENU_BUTTON,
"hexpand", TRUE,
@@ -173,7 +173,7 @@ gbp_devhelp_layout_stack_addin_set_view (IdeLayoutStackAddin *addin,
"destroy",
G_CALLBACK (gtk_widget_destroyed),
&self->button);
- ide_layout_stack_header_add_custom_title (IDE_LAYOUT_STACK_HEADER (titlebar),
+ ide_frame_header_add_custom_title (IDE_FRAME_HEADER (titlebar),
GTK_WIDGET (self->button),
100);
}
@@ -186,25 +186,25 @@ gbp_devhelp_layout_stack_addin_set_view (IdeLayoutStackAddin *addin,
}
static void
-layout_stack_addin_iface_init (IdeLayoutStackAddinInterface *iface)
+frame_addin_iface_init (IdeFrameAddinInterface *iface)
{
- iface->load = gbp_devhelp_layout_stack_addin_load;
- iface->unload = gbp_devhelp_layout_stack_addin_unload;
- iface->set_view = gbp_devhelp_layout_stack_addin_set_view;
+ iface->load = gbp_devhelp_frame_addin_load;
+ iface->unload = gbp_devhelp_frame_addin_unload;
+ iface->set_page = gbp_devhelp_frame_addin_set_view;
}
-G_DEFINE_TYPE_WITH_CODE (GbpDevhelpLayoutStackAddin,
- gbp_devhelp_layout_stack_addin,
+G_DEFINE_TYPE_WITH_CODE (GbpDevhelpFrameAddin,
+ gbp_devhelp_frame_addin,
G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_LAYOUT_STACK_ADDIN,
- layout_stack_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_FRAME_ADDIN,
+ frame_addin_iface_init))
static void
-gbp_devhelp_layout_stack_addin_class_init (GbpDevhelpLayoutStackAddinClass *klass)
+gbp_devhelp_frame_addin_class_init (GbpDevhelpFrameAddinClass *klass)
{
}
static void
-gbp_devhelp_layout_stack_addin_init (GbpDevhelpLayoutStackAddin *self)
+gbp_devhelp_frame_addin_init (GbpDevhelpFrameAddin *self)
{
}
diff --git a/src/plugins/devhelp/gbp-devhelp-layout-stack-addin.h
b/src/plugins/devhelp/gbp-devhelp-frame-addin.h
similarity index 75%
rename from src/plugins/devhelp/gbp-devhelp-layout-stack-addin.h
rename to src/plugins/devhelp/gbp-devhelp-frame-addin.h
index 56c6aa42d..309e358c7 100644
--- a/src/plugins/devhelp/gbp-devhelp-layout-stack-addin.h
+++ b/src/plugins/devhelp/gbp-devhelp-frame-addin.h
@@ -1,4 +1,4 @@
-/* gbp-devhelp-layout-stack-addin.h
+/* gbp-devhelp-frame-addin.h
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -20,12 +20,12 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
-#define GBP_TYPE_DEVHELP_LAYOUT_STACK_ADDIN (gbp_devhelp_layout_stack_addin_get_type())
+#define GBP_TYPE_DEVHELP_FRAME_ADDIN (gbp_devhelp_frame_addin_get_type())
-G_DECLARE_FINAL_TYPE (GbpDevhelpLayoutStackAddin, gbp_devhelp_layout_stack_addin, GBP,
DEVHELP_LAYOUT_STACK_ADDIN, GObject)
+G_DECLARE_FINAL_TYPE (GbpDevhelpFrameAddin, gbp_devhelp_frame_addin, GBP, DEVHELP_FRAME_ADDIN, GObject)
G_END_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-hover-provider.c
b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
index 8083bd6c6..9075e4da0 100644
--- a/src/plugins/devhelp/gbp-devhelp-hover-provider.c
+++ b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
@@ -23,9 +23,9 @@
#include "config.h"
#include <devhelp/devhelp.h>
+#include <libide-sourceview.h>
#include <glib/gi18n.h>
-#include "sourceview/ide-text-iter.h"
#include "gbp-devhelp-hover-provider.h"
#define DEVHELP_HOVER_PROVIDER_PRIORITY 200
@@ -47,7 +47,7 @@ hover_free (Hover *h)
{
g_clear_object (&h->context);
g_clear_pointer (&h->word, g_free);
- g_clear_pointer (&h->symbol, ide_symbol_unref);
+ g_clear_object (&h->symbol);
g_slice_free (Hover, h);
}
@@ -194,7 +194,7 @@ gbp_devhelp_hover_provider_hover_async (IdeHoverProvider *provider,
h = g_slice_new0 (Hover);
h->context = g_object_ref (context);
- h->word = _ide_text_iter_current_symbol (iter, NULL);
+ h->word = ide_text_iter_current_symbol (iter, NULL);
ide_task_set_task_data (task, h, hover_free);
buffer = IDE_BUFFER (gtk_text_iter_get_buffer (iter));
diff --git a/src/plugins/devhelp/gbp-devhelp-hover-provider.h
b/src/plugins/devhelp/gbp-devhelp-hover-provider.h
index 182b2c92c..efb853583 100644
--- a/src/plugins/devhelp/gbp-devhelp-hover-provider.h
+++ b/src/plugins/devhelp/gbp-devhelp-hover-provider.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-menu-button.c b/src/plugins/devhelp/gbp-devhelp-menu-button.c
index b6371f3dd..35287026f 100644
--- a/src/plugins/devhelp/gbp-devhelp-menu-button.c
+++ b/src/plugins/devhelp/gbp-devhelp-menu-button.c
@@ -22,7 +22,7 @@
#include <devhelp/devhelp.h>
#include <glib/gi18n.h>
-#include <ide.h>
+#include <libide-editor.h>
#include "gbp-devhelp-menu-button.h"
@@ -101,6 +101,8 @@ gbp_devhelp_menu_button_pixbuf_data_func (GtkCellLayout *cell_layout,
}
g_object_set (cell, "icon-name", icon_name, NULL);
+
+ g_clear_pointer (&link, dh_link_unref);
}
static void
@@ -167,7 +169,7 @@ monkey_patch_devhelp (GbpDevhelpMenuButton *self)
model = gtk_tree_view_get_model (tree_view);
column_type = gtk_tree_model_get_column_type (model, DH_KEYWORD_MODEL_COL_LINK);
- if (column_type != G_TYPE_POINTER)
+ if (column_type != DH_TYPE_LINK)
{
g_warning ("Link type %s does not match expectation",
g_type_name (column_type));
@@ -229,7 +231,7 @@ gbp_devhelp_menu_button_class_init (GbpDevhelpMenuButtonClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gtk_widget_class_set_template_from_resource (widget_class,
-
"/org/gnome/builder/plugins/devhelp-plugin/gbp-devhelp-menu-button.ui");
+ "/plugins/devhelp/gbp-devhelp-menu-button.ui");
gtk_widget_class_bind_template_child (widget_class, GbpDevhelpMenuButton, popover);
gtk_widget_class_bind_template_child (widget_class, GbpDevhelpMenuButton, sidebar);
diff --git a/src/plugins/devhelp/gbp-devhelp-view.c b/src/plugins/devhelp/gbp-devhelp-page.c
similarity index 73%
rename from src/plugins/devhelp/gbp-devhelp-view.c
rename to src/plugins/devhelp/gbp-devhelp-page.c
index 1b9d97a47..8bcfc86c3 100644
--- a/src/plugins/devhelp/gbp-devhelp-view.c
+++ b/src/plugins/devhelp/gbp-devhelp-page.c
@@ -1,4 +1,4 @@
-/* gbp-devhelp-view.c
+/* gbp-devhelp-page.c
*
* Copyright 2015-2019 Christian Hergert <chergert redhat com>
*
@@ -22,12 +22,12 @@
#include <glib/gi18n.h>
#include <webkit2/webkit2.h>
-#include "gbp-devhelp-view.h"
+#include "gbp-devhelp-page.h"
#include "gbp-devhelp-search.h"
-struct _GbpDevhelpView
+struct _GbpDevhelpPage
{
- IdeLayoutView parent_instance;
+ IdePage parent_instance;
WebKitWebView *web_view1;
WebKitFindController *web_controller;
@@ -49,16 +49,16 @@ enum {
LAST_SIGNAL
};
-G_DEFINE_TYPE (GbpDevhelpView, gbp_devhelp_view, IDE_TYPE_LAYOUT_VIEW)
+G_DEFINE_TYPE (GbpDevhelpPage, gbp_devhelp_page, IDE_TYPE_PAGE)
static GParamSpec *properties [LAST_PROP];
static guint signals [LAST_SIGNAL];
void
-gbp_devhelp_view_set_uri (GbpDevhelpView *self,
+gbp_devhelp_page_set_uri (GbpDevhelpPage *self,
const gchar *uri)
{
- g_return_if_fail (GBP_IS_DEVHELP_VIEW (self));
+ g_return_if_fail (GBP_IS_DEVHELP_PAGE (self));
if (uri == NULL)
return;
@@ -67,48 +67,48 @@ gbp_devhelp_view_set_uri (GbpDevhelpView *self,
}
static void
-gbp_devhelp_view_notify_title (GbpDevhelpView *self,
+gbp_devhelp_page_notify_title (GbpDevhelpPage *self,
GParamSpec *pspec,
WebKitWebView *web_view)
{
const gchar *title;
- g_assert (GBP_IS_DEVHELP_VIEW (self));
+ g_assert (GBP_IS_DEVHELP_PAGE (self));
g_assert (WEBKIT_IS_WEB_VIEW (web_view));
title = webkit_web_view_get_title (self->web_view1);
- ide_layout_view_set_title (IDE_LAYOUT_VIEW (self), title);
+ ide_page_set_title (IDE_PAGE (self), title);
}
-static IdeLayoutView *
-gbp_devhelp_view_create_split_view (IdeLayoutView *view)
+static IdePage *
+gbp_devhelp_page_create_split (IdePage *view)
{
- GbpDevhelpView *self = (GbpDevhelpView *)view;
- GbpDevhelpView *other;
+ GbpDevhelpPage *self = (GbpDevhelpPage *)view;
+ GbpDevhelpPage *other;
const gchar *uri;
- g_assert (GBP_IS_DEVHELP_VIEW (self));
+ g_assert (GBP_IS_DEVHELP_PAGE (self));
uri = webkit_web_view_get_uri (self->web_view1);
- other = g_object_new (GBP_TYPE_DEVHELP_VIEW,
+ other = g_object_new (GBP_TYPE_DEVHELP_PAGE,
"visible", TRUE,
"uri", uri,
NULL);
- return IDE_LAYOUT_VIEW (other);
+ return IDE_PAGE (other);
}
static void
-gbp_devhelp_view_actions_print (GSimpleAction *action,
+gbp_devhelp_page_actions_print (GSimpleAction *action,
GVariant *param,
gpointer user_data)
{
- GbpDevhelpView *self = user_data;
+ GbpDevhelpPage *self = user_data;
WebKitPrintOperation *operation;
GtkWidget *window;
- g_assert (GBP_IS_DEVHELP_VIEW (self));
+ g_assert (GBP_IS_DEVHELP_PAGE (self));
operation = webkit_print_operation_new (self->web_view1);
window = gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_WINDOW);
@@ -117,17 +117,17 @@ gbp_devhelp_view_actions_print (GSimpleAction *action,
}
static void
-gbp_devhelp_view_set_property (GObject *object,
+gbp_devhelp_page_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- GbpDevhelpView *self = GBP_DEVHELP_VIEW (object);
+ GbpDevhelpPage *self = GBP_DEVHELP_PAGE (object);
switch (prop_id)
{
case PROP_URI:
- gbp_devhelp_view_set_uri (self, g_value_get_string (value));
+ gbp_devhelp_page_set_uri (self, g_value_get_string (value));
break;
default:
@@ -136,34 +136,34 @@ gbp_devhelp_view_set_property (GObject *object,
}
static void
-gbp_devhelp_search_reveal (GbpDevhelpView *self)
+gbp_devhelp_search_reveal (GbpDevhelpPage *self)
{
- g_assert (GBP_IS_DEVHELP_VIEW (self));
+ g_assert (GBP_IS_DEVHELP_PAGE (self));
webkit_web_view_can_execute_editing_command (self->web_view1, WEBKIT_EDITING_COMMAND_COPY, NULL, NULL,
NULL);
gtk_revealer_set_reveal_child (self->search_revealer, TRUE);
}
static void
-gbp_devhelp_focus_in_event (GbpDevhelpView *self,
+gbp_devhelp_focus_in_event (GbpDevhelpPage *self,
GdkEvent *event)
{
- g_assert (GBP_IS_DEVHELP_VIEW (self));
+ g_assert (GBP_IS_DEVHELP_PAGE (self));
webkit_find_controller_search_finish (self->web_controller);
gtk_revealer_set_reveal_child (self->search_revealer, FALSE);
}
static void
-gbp_devhelp_view_class_init (GbpDevhelpViewClass *klass)
+gbp_devhelp_page_class_init (GbpDevhelpPageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- IdeLayoutViewClass *view_class = IDE_LAYOUT_VIEW_CLASS (klass);
+ IdePageClass *view_class = IDE_PAGE_CLASS (klass);
- object_class->set_property = gbp_devhelp_view_set_property;
+ object_class->set_property = gbp_devhelp_page_set_property;
- view_class->create_split_view = gbp_devhelp_view_create_split_view;
+ view_class->create_split = gbp_devhelp_page_create_split;
properties [PROP_URI] =
g_param_spec_string ("uri",
@@ -187,28 +187,28 @@ gbp_devhelp_view_class_init (GbpDevhelpViewClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, properties);
- gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/plugins/devhelp-plugin/gbp-devhelp-view.ui");
- gtk_widget_class_bind_template_child (widget_class, GbpDevhelpView, web_view1);
- gtk_widget_class_bind_template_child (widget_class, GbpDevhelpView, devhelp_overlay);
+ gtk_widget_class_set_template_from_resource (widget_class, "/plugins/devhelp/gbp-devhelp-page.ui");
+ gtk_widget_class_bind_template_child (widget_class, GbpDevhelpPage, web_view1);
+ gtk_widget_class_bind_template_child (widget_class, GbpDevhelpPage, devhelp_overlay);
g_type_ensure (WEBKIT_TYPE_WEB_VIEW);
}
static const GActionEntry actions[] = {
- { "print", gbp_devhelp_view_actions_print },
+ { "print", gbp_devhelp_page_actions_print },
};
static void
-gbp_devhelp_view_init (GbpDevhelpView *self)
+gbp_devhelp_page_init (GbpDevhelpPage *self)
{
g_autoptr(GSimpleActionGroup) group = NULL;
gtk_widget_init_template (GTK_WIDGET (self));
- ide_layout_view_set_title (IDE_LAYOUT_VIEW (self), _("Documentation"));
- ide_layout_view_set_can_split (IDE_LAYOUT_VIEW (self), TRUE);
- ide_layout_view_set_icon_name (IDE_LAYOUT_VIEW (self), "org.gnome.Devhelp-symbolic");
- ide_layout_view_set_menu_id (IDE_LAYOUT_VIEW (self), "devhelp-view-document-menu");
+ ide_page_set_title (IDE_PAGE (self), _("Documentation"));
+ ide_page_set_can_split (IDE_PAGE (self), TRUE);
+ ide_page_set_icon_name (IDE_PAGE (self), "org.gnome.Devhelp-symbolic");
+ ide_page_set_menu_id (IDE_PAGE (self), "devhelp-view-document-menu");
self->search = g_object_new (GBP_TYPE_DEVHELP_SEARCH, NULL);
self->search_revealer = gbp_devhelp_search_get_revealer (self->search);
@@ -224,7 +224,7 @@ gbp_devhelp_view_init (GbpDevhelpView *self)
g_signal_connect_object (self->web_view1,
"notify::title",
- G_CALLBACK (gbp_devhelp_view_notify_title),
+ G_CALLBACK (gbp_devhelp_page_notify_title),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->web_view1,
diff --git a/src/plugins/devhelp/gbp-devhelp-view.h b/src/plugins/devhelp/gbp-devhelp-page.h
similarity index 77%
rename from src/plugins/devhelp/gbp-devhelp-view.h
rename to src/plugins/devhelp/gbp-devhelp-page.h
index dea168fa9..69a32b10f 100644
--- a/src/plugins/devhelp/gbp-devhelp-view.h
+++ b/src/plugins/devhelp/gbp-devhelp-page.h
@@ -1,4 +1,4 @@
-/* gbp-devhelp-view.h
+/* gbp-devhelp-page.h
*
* Copyright 2015-2019 Christian Hergert <chergert redhat com>
*
@@ -20,15 +20,15 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
-#define GBP_TYPE_DEVHELP_VIEW (gbp_devhelp_view_get_type())
+#define GBP_TYPE_DEVHELP_PAGE (gbp_devhelp_page_get_type())
-G_DECLARE_FINAL_TYPE (GbpDevhelpView, gbp_devhelp_view, GBP, DEVHELP_VIEW, IdeLayoutView)
+G_DECLARE_FINAL_TYPE (GbpDevhelpPage, gbp_devhelp_page, GBP, DEVHELP_PAGE, IdePage)
-void gbp_devhelp_view_set_uri (GbpDevhelpView *self,
+void gbp_devhelp_page_set_uri (GbpDevhelpPage *self,
const gchar *uri);
G_END_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-view.ui b/src/plugins/devhelp/gbp-devhelp-page.ui
similarity index 93%
rename from src/plugins/devhelp/gbp-devhelp-view.ui
rename to src/plugins/devhelp/gbp-devhelp-page.ui
index fdd8ad78b..28fa7cb95 100644
--- a/src/plugins/devhelp/gbp-devhelp-view.ui
+++ b/src/plugins/devhelp/gbp-devhelp-page.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.18 -->
- <template class="GbpDevhelpView" parent="IdeLayoutView">
+ <template class="GbpDevhelpPage" parent="IdePage">
<child>
<object class="GtkPaned" id="paned">
<property name="expand">true</property>
diff --git a/src/plugins/devhelp/gbp-devhelp-search-private.h
b/src/plugins/devhelp/gbp-devhelp-search-private.h
index e79e255b9..b8a9e15bd 100644
--- a/src/plugins/devhelp/gbp-devhelp-search-private.h
+++ b/src/plugins/devhelp/gbp-devhelp-search-private.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
diff --git a/src/plugins/devhelp/gbp-devhelp-search.c b/src/plugins/devhelp/gbp-devhelp-search.c
index dc80f557c..4391122a6 100644
--- a/src/plugins/devhelp/gbp-devhelp-search.c
+++ b/src/plugins/devhelp/gbp-devhelp-search.c
@@ -23,7 +23,7 @@
#include <fcntl.h>
#include <glib/gi18n.h>
-#include <ide.h>
+#include <libide-editor.h>
#include <webkit2/webkit2.h>
#include "gbp-devhelp-search.h"
@@ -95,7 +95,7 @@ gbp_devhelp_search_class_init (GbpDevhelpSearchClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/plugins/devhelp-plugin/gbp-devhelp-search.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/plugins/devhelp/gbp-devhelp-search.ui");
gtk_widget_class_bind_template_child (widget_class, GbpDevhelpSearch, search_prev_button);
gtk_widget_class_bind_template_child (widget_class, GbpDevhelpSearch, search_next_button);
diff --git a/src/plugins/devhelp/gbp-devhelp-search.h b/src/plugins/devhelp/gbp-devhelp-search.h
index 97d21fc02..5d8d8ca02 100644
--- a/src/plugins/devhelp/gbp-devhelp-search.h
+++ b/src/plugins/devhelp/gbp-devhelp-search.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
diff --git a/src/plugins/devhelp/gtk/menus.ui b/src/plugins/devhelp/gtk/menus.ui
index 0594ead18..8467da226 100644
--- a/src/plugins/devhelp/gtk/menus.ui
+++ b/src/plugins/devhelp/gtk/menus.ui
@@ -19,7 +19,7 @@
<attribute name="id">new-documentation-page</attribute>
<attribute name="after">new-file</attribute>
<attribute name="label" translatable="yes">New Documentation Page</attribute>
- <attribute name="action">win.new-devhelp-view</attribute>
+ <attribute name="action">win.new-devhelp-page</attribute>
</item>
</section>
</menu>
diff --git a/src/plugins/devhelp/meson.build b/src/plugins/devhelp/meson.build
index b07e9f952..685f73f51 100644
--- a/src/plugins/devhelp/meson.build
+++ b/src/plugins/devhelp/meson.build
@@ -1,26 +1,25 @@
-if get_option('with_devhelp')
+if get_option('plugin_devhelp')
-devhelp_resources = gnome.compile_resources(
- 'devhelp-resources',
- 'devhelp.gresource.xml',
- c_name: 'gbp_devhelp',
-)
+plugins_deps += [
+ dependency('libdevhelp-3.0', version: '>=3.25.1'),
+]
-devhelp_sources = [
- 'gbp-devhelp-menu-button.c',
- 'gbp-devhelp-hover-provider.c',
- 'gbp-devhelp-layout-stack-addin.c',
+plugins_sources += files([
+ 'devhelp-plugin.c',
'gbp-devhelp-editor-addin.c',
- 'gbp-devhelp-plugin.c',
+ 'gbp-devhelp-frame-addin.c',
+ 'gbp-devhelp-hover-provider.c',
+ 'gbp-devhelp-menu-button.c',
+ 'gbp-devhelp-page.c',
'gbp-devhelp-search.c',
- 'gbp-devhelp-view.c',
-]
+])
-gnome_builder_plugins_deps += [
- dependency('libdevhelp-3.0', version: '>=3.25.1'),
-]
+plugin_devhelp_resources = gnome.compile_resources(
+ 'devhelp-resources',
+ 'devhelp.gresource.xml',
+ c_name: 'gbp_devhelp',
+)
-gnome_builder_plugins_sources += files(devhelp_sources)
-gnome_builder_plugins_sources += devhelp_resources[0]
+plugins_sources += plugin_devhelp_resources[0]
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]