[gnome-builder: 115/139] quick-highlight: port to libide-sourceview



commit e5922085b553e88e1cd91eadeb85f018b560dd97
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:35:10 2019 -0800

    quick-highlight: port to libide-sourceview

 ...n.c => gbp-quick-highlight-editor-page-addin.c} | 74 +++++++++++-----------
 ...n.h => gbp-quick-highlight-editor-page-addin.h} |  6 +-
 .../gbp-quick-highlight-preferences.h              |  2 +-
 src/plugins/quick-highlight/meson.build            | 21 +++---
 ...highlight-plugin.c => quick-highlight-plugin.c} | 16 +++--
 .../quick-highlight/quick-highlight.gresource.xml  |  2 +-
 src/plugins/quick-highlight/quick-highlight.plugin | 11 ++--
 7 files changed, 66 insertions(+), 66 deletions(-)
---
diff --git a/src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.c 
b/src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.c
similarity index 78%
rename from src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.c
rename to src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.c
index ea4210682..fd0d14428 100644
--- a/src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.c
+++ b/src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.c
@@ -1,4 +1,4 @@
-/* gbp-quick-highlight-editor-view-addin.c
+/* gbp-quick-highlight-editor-page-addin.c
  *
  * Copyright 2016 Martin Blanchard <tchaik gmx com>
  * Copyright 2017-2019 Christian Hergert <chergert redhat com>
@@ -19,19 +19,19 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#define G_LOG_DOMAIN "gbp-quick-highlight-editor-view-addin"
+#define G_LOG_DOMAIN "gbp-quick-highlight-editor-page-addin"
 
-#include <ide.h>
+#include <libide-editor.h>
 
-#include "gbp-quick-highlight-editor-view-addin.h"
+#include "gbp-quick-highlight-editor-page-addin.h"
 
 #define HIGHLIGHT_STYLE_NAME "quick-highlight-match"
 
-struct _GbpQuickHighlightEditorViewAddin
+struct _GbpQuickHighlightEditorPageAddin
 {
   GObject                 parent_instance;
 
-  IdeEditorView          *view;
+  IdeEditorPage          *view;
 
   DzlSignalGroup         *buffer_signals;
   DzlSignalGroup         *search_signals;
@@ -44,7 +44,7 @@ struct _GbpQuickHighlightEditorViewAddin
 };
 
 static gboolean
-do_delayed_quick_highlight (GbpQuickHighlightEditorViewAddin *self)
+do_delayed_quick_highlight (GbpQuickHighlightEditorPageAddin *self)
 {
   GtkSourceSearchSettings *search_settings;
   g_autofree gchar *slice = NULL;
@@ -52,7 +52,7 @@ do_delayed_quick_highlight (GbpQuickHighlightEditorViewAddin *self)
   GtkTextIter begin;
   GtkTextIter end;
 
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (self));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (self));
   g_assert (self->view != NULL);
 
   self->queued_match_source = 0;
@@ -61,7 +61,7 @@ do_delayed_quick_highlight (GbpQuickHighlightEditorViewAddin *self)
    * Get the curretn selection, if any. Short circuit if we find a situation
    * that should have caused us to cancel the current quick-highlight.
    */
-  buffer = ide_editor_view_get_buffer (self->view);
+  buffer = ide_editor_page_get_buffer (self->view);
   if (self->search_active ||
       !self->has_selection ||
       !gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (buffer), &begin, &end))
@@ -124,11 +124,11 @@ do_delayed_quick_highlight (GbpQuickHighlightEditorViewAddin *self)
 }
 
 static void
-buffer_cursor_moved (GbpQuickHighlightEditorViewAddin *self,
+buffer_cursor_moved (GbpQuickHighlightEditorPageAddin *self,
                      const GtkTextIter                *location,
                      IdeBuffer                        *buffer)
 {
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (self));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (self));
   g_assert (location != NULL);
   g_assert (IDE_IS_BUFFER (buffer));
 
@@ -149,11 +149,11 @@ buffer_cursor_moved (GbpQuickHighlightEditorViewAddin *self,
 }
 
 static void
-buffer_notify_style_scheme (GbpQuickHighlightEditorViewAddin *self,
+buffer_notify_style_scheme (GbpQuickHighlightEditorPageAddin *self,
                             GParamSpec                       *pspec,
                             IdeBuffer                        *buffer)
 {
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (self));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (self));
   g_assert (IDE_IS_BUFFER (buffer));
 
   if (self->search_context != NULL)
@@ -170,22 +170,22 @@ buffer_notify_style_scheme (GbpQuickHighlightEditorViewAddin *self,
 }
 
 static void
-buffer_notify_has_selection (GbpQuickHighlightEditorViewAddin *self,
+buffer_notify_has_selection (GbpQuickHighlightEditorPageAddin *self,
                              GParamSpec                       *pspec,
                              IdeBuffer                        *buffer)
 {
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (self));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (self));
   g_assert (IDE_IS_BUFFER (buffer));
 
   self->has_selection = gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (buffer));
 }
 
 static void
-search_notify_active (GbpQuickHighlightEditorViewAddin *self,
+search_notify_active (GbpQuickHighlightEditorPageAddin *self,
                       GParamSpec                       *pspec,
                       IdeEditorSearch                  *search)
 {
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (self));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (self));
   g_assert (IDE_IS_EDITOR_SEARCH (search));
 
   self->search_active = ide_editor_search_get_active (search);
@@ -193,13 +193,13 @@ search_notify_active (GbpQuickHighlightEditorViewAddin *self,
 }
 
 static void
-gbp_quick_highlight_editor_view_addin_load (IdeEditorViewAddin *addin,
-                                            IdeEditorView      *view)
+gbp_quick_highlight_editor_page_addin_load (IdeEditorPageAddin *addin,
+                                            IdeEditorPage      *view)
 {
-  GbpQuickHighlightEditorViewAddin *self = (GbpQuickHighlightEditorViewAddin *)addin;
+  GbpQuickHighlightEditorPageAddin *self = (GbpQuickHighlightEditorPageAddin *)addin;
 
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (addin));
-  g_assert (IDE_IS_EDITOR_VIEW (view));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (addin));
+  g_assert (IDE_IS_EDITOR_PAGE (view));
 
   self->view = view;
 
@@ -227,18 +227,18 @@ gbp_quick_highlight_editor_view_addin_load (IdeEditorViewAddin *addin,
                                     G_CALLBACK (search_notify_active),
                                     self);
 
-  dzl_signal_group_set_target (self->buffer_signals, ide_editor_view_get_buffer (view));
-  dzl_signal_group_set_target (self->search_signals, ide_editor_view_get_search (view));
+  dzl_signal_group_set_target (self->buffer_signals, ide_editor_page_get_buffer (view));
+  dzl_signal_group_set_target (self->search_signals, ide_editor_page_get_search (view));
 }
 
 static void
-gbp_quick_highlight_editor_view_addin_unload (IdeEditorViewAddin *addin,
-                                              IdeEditorView      *view)
+gbp_quick_highlight_editor_page_addin_unload (IdeEditorPageAddin *addin,
+                                              IdeEditorPage      *view)
 {
-  GbpQuickHighlightEditorViewAddin *self = (GbpQuickHighlightEditorViewAddin *)addin;
+  GbpQuickHighlightEditorPageAddin *self = (GbpQuickHighlightEditorPageAddin *)addin;
 
-  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (addin));
-  g_assert (IDE_IS_EDITOR_VIEW (view));
+  g_assert (GBP_IS_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (addin));
+  g_assert (IDE_IS_EDITOR_PAGE (view));
 
   g_clear_object (&self->search_context);
   dzl_clear_source (&self->queued_match_source);
@@ -253,24 +253,24 @@ gbp_quick_highlight_editor_view_addin_unload (IdeEditorViewAddin *addin,
 }
 
 static void
-editor_view_addin_iface_init (IdeEditorViewAddinInterface *iface)
+editor_view_addin_iface_init (IdeEditorPageAddinInterface *iface)
 {
-  iface->load = gbp_quick_highlight_editor_view_addin_load;
-  iface->unload = gbp_quick_highlight_editor_view_addin_unload;
+  iface->load = gbp_quick_highlight_editor_page_addin_load;
+  iface->unload = gbp_quick_highlight_editor_page_addin_unload;
 }
 
-G_DEFINE_TYPE_WITH_CODE (GbpQuickHighlightEditorViewAddin,
-                         gbp_quick_highlight_editor_view_addin,
+G_DEFINE_TYPE_WITH_CODE (GbpQuickHighlightEditorPageAddin,
+                         gbp_quick_highlight_editor_page_addin,
                          G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_VIEW_ADDIN,
+                         G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_PAGE_ADDIN,
                                                 editor_view_addin_iface_init))
 
 static void
-gbp_quick_highlight_editor_view_addin_class_init (GbpQuickHighlightEditorViewAddinClass *klass)
+gbp_quick_highlight_editor_page_addin_class_init (GbpQuickHighlightEditorPageAddinClass *klass)
 {
 }
 
 static void
-gbp_quick_highlight_editor_view_addin_init (GbpQuickHighlightEditorViewAddin *self)
+gbp_quick_highlight_editor_page_addin_init (GbpQuickHighlightEditorPageAddin *self)
 {
 }
diff --git a/src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.h 
b/src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.h
similarity index 75%
rename from src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.h
rename to src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.h
index c84fb77e1..b376482b8 100644
--- a/src/plugins/quick-highlight/gbp-quick-highlight-editor-view-addin.h
+++ b/src/plugins/quick-highlight/gbp-quick-highlight-editor-page-addin.h
@@ -1,4 +1,4 @@
-/* gbp-quick-highlight-editor-view-addin.h
+/* gbp-quick-highlight-editor-page-addin.h
  *
  * Copyright 2016 Martin Blanchard <tchaik gmx com>
  *
@@ -24,8 +24,8 @@
 
 G_BEGIN_DECLS
 
-#define GBP_TYPE_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN (gbp_quick_highlight_editor_view_addin_get_type())
+#define GBP_TYPE_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN (gbp_quick_highlight_editor_page_addin_get_type())
 
-G_DECLARE_FINAL_TYPE (GbpQuickHighlightEditorViewAddin, gbp_quick_highlight_editor_view_addin, GBP, 
QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN, GObject)
+G_DECLARE_FINAL_TYPE (GbpQuickHighlightEditorPageAddin, gbp_quick_highlight_editor_page_addin, GBP, 
QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN, GObject)
 
 G_END_DECLS
diff --git a/src/plugins/quick-highlight/gbp-quick-highlight-preferences.h 
b/src/plugins/quick-highlight/gbp-quick-highlight-preferences.h
index 2e662b37b..800553a9d 100644
--- a/src/plugins/quick-highlight/gbp-quick-highlight-preferences.h
+++ b/src/plugins/quick-highlight/gbp-quick-highlight-preferences.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-gui.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/quick-highlight/meson.build b/src/plugins/quick-highlight/meson.build
index a22cdb442..5bb496fb7 100644
--- a/src/plugins/quick-highlight/meson.build
+++ b/src/plugins/quick-highlight/meson.build
@@ -1,20 +1,17 @@
-if get_option('with_quick_highlight')
+if get_option('plugin_quick_highlight')
 
-quick_highlight_resources = gnome.compile_resources(
+plugins_sources += files([
+  'quick-highlight-plugin.c',
+  'gbp-quick-highlight-editor-page-addin.c',
+  'gbp-quick-highlight-preferences.c',
+])
+
+plugin_quick_highlight_resources = gnome.compile_resources(
   'quick-highlight-resources',
   'quick-highlight.gresource.xml',
   c_name: 'gbp_quick_highlight',
 )
 
-quick_highlight_sources = [
-  'gbp-quick-highlight-plugin.c',
-  'gbp-quick-highlight-editor-view-addin.c',
-  'gbp-quick-highlight-editor-view-addin.h',
-  'gbp-quick-highlight-preferences.c',
-  'gbp-quick-highlight-preferences.h',
-]
-
-gnome_builder_plugins_sources += files(quick_highlight_sources)
-gnome_builder_plugins_sources += quick_highlight_resources[0]
+plugins_sources += plugin_quick_highlight_resources[0]
 
 endif
diff --git a/src/plugins/quick-highlight/gbp-quick-highlight-plugin.c 
b/src/plugins/quick-highlight/quick-highlight-plugin.c
similarity index 79%
rename from src/plugins/quick-highlight/gbp-quick-highlight-plugin.c
rename to src/plugins/quick-highlight/quick-highlight-plugin.c
index e599fedcc..9dc527835 100644
--- a/src/plugins/quick-highlight/gbp-quick-highlight-plugin.c
+++ b/src/plugins/quick-highlight/quick-highlight-plugin.c
@@ -1,4 +1,4 @@
-/* gbp-quick-highlight-plugin.c
+/* quick-highlight-plugin.c
  *
  * Copyright 2016 Martin Blanchard <tchaik gmx com>
  *
@@ -18,18 +18,20 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <libpeas/peas.h>
-#include <ide.h>
+#include <libide-editor.h>
 
-#include "gbp-quick-highlight-editor-view-addin.h"
+#include "gbp-quick-highlight-editor-page-addin.h"
 #include "gbp-quick-highlight-preferences.h"
 
-void
-gbp_quick_highlight_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_quick_highlight_register_types (PeasObjectModule *module)
 {
   peas_object_module_register_extension_type (module,
-                                              IDE_TYPE_EDITOR_VIEW_ADDIN,
-                                              GBP_TYPE_QUICK_HIGHLIGHT_EDITOR_VIEW_ADDIN);
+                                              IDE_TYPE_EDITOR_PAGE_ADDIN,
+                                              GBP_TYPE_QUICK_HIGHLIGHT_EDITOR_PAGE_ADDIN);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_PREFERENCES_ADDIN,
                                               GBP_TYPE_QUICK_HIGHLIGHT_PREFERENCES);
diff --git a/src/plugins/quick-highlight/quick-highlight.gresource.xml 
b/src/plugins/quick-highlight/quick-highlight.gresource.xml
index 721f6084d..53101c8d6 100644
--- a/src/plugins/quick-highlight/quick-highlight.gresource.xml
+++ b/src/plugins/quick-highlight/quick-highlight.gresource.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/quick-highlight">
     <file>quick-highlight.plugin</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/quick-highlight/quick-highlight.plugin 
b/src/plugins/quick-highlight/quick-highlight.plugin
index 5272941da..da23a6879 100644
--- a/src/plugins/quick-highlight/quick-highlight.plugin
+++ b/src/plugins/quick-highlight/quick-highlight.plugin
@@ -1,8 +1,9 @@
 [Plugin]
-Module=quick-highlight-plugin
-Name=Quick Highlight
-Description=Highlights every occurrences of selected text
 Authors=Martin Blanchard <tchaik gmx com>
-Copyright=Copyright © 2016 Martin Blanchard
 Builtin=true
-Embedded=gbp_quick_highlight_register_types
+Copyright=Copyright © 2016 Martin Blanchard
+Description=Highlights every occurrences of selected text
+Embedded=_gbp_quick_highlight_register_types
+Hidden=true
+Module=quick-highlight
+Name=Quick Highlight


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