[gnome-builder: 121/139] snippets: port plugin to libide-sourceview and friends



commit 65d9d23241daa2e9f4a0543f081972132ceea8f1
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 9 17:37:57 2019 -0800

    snippets: port plugin to libide-sourceview and friends

 src/plugins/snippets/ide-snippet-completion-item.h  |  2 +-
 .../snippets/ide-snippet-completion-provider.c      |  2 +-
 .../snippets/ide-snippet-completion-provider.h      |  2 +-
 src/plugins/snippets/ide-snippet-model.h            |  2 +-
 .../snippets/ide-snippet-preferences-addin.c        |  2 +-
 src/plugins/snippets/meson.build                    | 21 ++++++++-------------
 src/plugins/snippets/snippets-plugin.c              |  9 ++++++---
 src/plugins/snippets/snippets.gresource.xml         | 19 +++++++++++++++++--
 src/plugins/snippets/snippets.plugin                | 10 +++++-----
 9 files changed, 41 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/snippets/ide-snippet-completion-item.h 
b/src/plugins/snippets/ide-snippet-completion-item.h
index 1eaaccdcd..f8838cbda 100644
--- a/src/plugins/snippets/ide-snippet-completion-item.h
+++ b/src/plugins/snippets/ide-snippet-completion-item.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-sourceview.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/snippets/ide-snippet-completion-provider.c 
b/src/plugins/snippets/ide-snippet-completion-provider.c
index 45fa43c77..8c62bc568 100644
--- a/src/plugins/snippets/ide-snippet-completion-provider.c
+++ b/src/plugins/snippets/ide-snippet-completion-provider.c
@@ -72,7 +72,7 @@ ide_snippet_completion_provider_load (IdeCompletionProvider *provider,
   g_assert (IDE_IS_SNIPPET_COMPLETION_PROVIDER (self));
   g_assert (IDE_IS_CONTEXT (context));
 
-  storage = ide_context_get_snippets (context);
+  storage = ide_snippet_storage_from_context (context);
   self->model = ide_snippet_model_new (storage);
 }
 
diff --git a/src/plugins/snippets/ide-snippet-completion-provider.h 
b/src/plugins/snippets/ide-snippet-completion-provider.h
index 76e255cb1..74828e0ac 100644
--- a/src/plugins/snippets/ide-snippet-completion-provider.h
+++ b/src/plugins/snippets/ide-snippet-completion-provider.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-core.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/snippets/ide-snippet-model.h b/src/plugins/snippets/ide-snippet-model.h
index e05396e5b..575705507 100644
--- a/src/plugins/snippets/ide-snippet-model.h
+++ b/src/plugins/snippets/ide-snippet-model.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include <ide.h>
+#include <libide-sourceview.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/plugins/snippets/ide-snippet-preferences-addin.c 
b/src/plugins/snippets/ide-snippet-preferences-addin.c
index ce885fd64..c10a0c23d 100644
--- a/src/plugins/snippets/ide-snippet-preferences-addin.c
+++ b/src/plugins/snippets/ide-snippet-preferences-addin.c
@@ -23,7 +23,7 @@
 #include "config.h"
 
 #include <glib/gi18n.h>
-#include <ide.h>
+#include <libide-gui.h>
 
 #include "ide-snippet-preferences-addin.h"
 
diff --git a/src/plugins/snippets/meson.build b/src/plugins/snippets/meson.build
index e6652d71b..ab2e3fec2 100644
--- a/src/plugins/snippets/meson.build
+++ b/src/plugins/snippets/meson.build
@@ -1,20 +1,15 @@
-if get_option('with_snippets')
-
-snippets_resources = gnome.compile_resources(
-  'snippets-resources',
-  'snippets.gresource.xml',
-  c_name: 'gbp_snippets',
-)
-
-snippets_sources = [
+plugins_sources += files([
   'snippets-plugin.c',
   'ide-snippet-completion-provider.c',
   'ide-snippet-completion-item.c',
   'ide-snippet-model.c',
   'ide-snippet-preferences-addin.c',
-]
+])
 
-gnome_builder_plugins_sources += files(snippets_sources)
-gnome_builder_plugins_sources += snippets_resources[0]
+snippets_resources = gnome.compile_resources(
+  'snippets-resources',
+  'snippets.gresource.xml',
+  c_name: 'gbp_snippets',
+)
 
-endif
+plugins_sources += snippets_resources[0]
diff --git a/src/plugins/snippets/snippets-plugin.c b/src/plugins/snippets/snippets-plugin.c
index 0b8bb1ffa..dbcc58643 100644
--- a/src/plugins/snippets/snippets-plugin.c
+++ b/src/plugins/snippets/snippets-plugin.c
@@ -18,14 +18,17 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include <ide.h>
+#include "config.h"
+
+#include <libide-gui.h>
+#include <libide-sourceview.h>
 #include <libpeas/peas.h>
 
 #include "ide-snippet-completion-provider.h"
 #include "ide-snippet-preferences-addin.h"
 
-void
-gbp_snippets_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gbp_snippets_register_types (PeasObjectModule *module)
 {
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_COMPLETION_PROVIDER,
diff --git a/src/plugins/snippets/snippets.gresource.xml b/src/plugins/snippets/snippets.gresource.xml
index 560b08dac..a4ec9a3a6 100644
--- a/src/plugins/snippets/snippets.gresource.xml
+++ b/src/plugins/snippets/snippets.gresource.xml
@@ -1,8 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/builder/plugins">
+  <gresource prefix="/plugins/snippets">
     <file>snippets.plugin</file>
   </gresource>
-  <gresource prefix="/org/gnome/builder/plugins/snippets-plugin">
+  <gresource prefix="/org/gnome/builder">
+    <!-- compressing these would mean we waste heap to maintain internal
+         pointers, so we don't compress them. -->
+    <file>snippets/chdr.snippets</file>
+    <file>snippets/c.snippets</file>
+    <file>snippets/gobject.snippets</file>
+    <file>snippets/java.snippets</file>
+    <file>snippets/js.snippets</file>
+    <file>snippets/licenses.snippets</file>
+    <file>snippets/main.snippets</file>
+    <file>snippets/python.snippets</file>
+    <file>snippets/rpmspec.snippets</file>
+    <file>snippets/rust.snippets</file>
+    <file>snippets/shebang.snippets</file>
+    <file>snippets/vala.snippets</file>
+    <file>snippets/xml.snippets</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/snippets/snippets.plugin b/src/plugins/snippets/snippets.plugin
index 037dcec7f..a6f91aa75 100644
--- a/src/plugins/snippets/snippets.plugin
+++ b/src/plugins/snippets/snippets.plugin
@@ -1,11 +1,11 @@
 [Plugin]
-Module=snippets-plugin
-Name=Snippets
-Description=Support for snippets in a variety of languages
 Authors=Christian Hergert <christian hergert me>
+Builtin=true
 Copyright=Copyright © 2018 Christian Hergert
 Depends=editor;
-Builtin=true
+Description=Support for snippets in a variety of languages
+Embedded=_gbp_snippets_register_types
 Hidden=true
-Embedded=gbp_snippets_register_types
+Module=snippets
+Name=Snippets
 X-Completion-Provider-Languages=*


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