[gnome-builder] plugins/shellcmd: add stub implementation of search provider
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/shellcmd: add stub implementation of search provider
- Date: Fri, 15 Jul 2022 21:11:27 +0000 (UTC)
commit 7bbf1988a49825c60c6c0d37f7e1459ca0ab3330
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 15 14:11:20 2022 -0700
plugins/shellcmd: add stub implementation of search provider
This is just the scaffolding so that we can have search against the
shellcmd plugin's run commands.
.../shellcmd/gbp-shellcmd-search-provider.c | 83 ++++++++++++++++++++++
.../shellcmd/gbp-shellcmd-search-provider.h | 31 ++++++++
src/plugins/shellcmd/meson.build | 1 +
src/plugins/shellcmd/shellcmd-plugin.c | 5 ++
4 files changed, 120 insertions(+)
---
diff --git a/src/plugins/shellcmd/gbp-shellcmd-search-provider.c
b/src/plugins/shellcmd/gbp-shellcmd-search-provider.c
new file mode 100644
index 000000000..53880cf98
--- /dev/null
+++ b/src/plugins/shellcmd/gbp-shellcmd-search-provider.c
@@ -0,0 +1,83 @@
+/* gbp-shellcmd-search-provider.c
+ *
+ * Copyright 2022 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-shellcmd-search-provider"
+
+#include "config.h"
+
+#include <libide-gui.h>
+#include <libide-search.h>
+#include <libide-threading.h>
+
+#include "gbp-shellcmd-search-provider.h"
+
+struct _GbpShellcmdSearchProvider
+{
+ IdeObject parent_instance;
+};
+
+static void
+gbp_shellcmd_search_provider_search_async (IdeSearchProvider *provider,
+ const char *query,
+ guint max_results,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GbpShellcmdSearchProvider *self = (GbpShellcmdSearchProvider *)provider;
+ g_autoptr(IdeTask) task = NULL;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (GBP_IS_SHELLCMD_SEARCH_PROVIDER (self));
+ g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ task = ide_task_new (self, cancellable, callback, user_data);
+ ide_task_set_source_tag (task, gbp_shellcmd_search_provider_search_async);
+
+ ide_task_return_unsupported_error (task);
+}
+
+static GPtrArray *
+gbp_shellcmd_search_provider_search_finish (IdeSearchProvider *provider,
+ GAsyncResult *result,
+ GError **error)
+{
+ return ide_task_propagate_pointer (IDE_TASK (result), error);
+}
+
+static void
+search_provider_iface_init (IdeSearchProviderInterface *iface)
+{
+ iface->search_async = gbp_shellcmd_search_provider_search_async;
+ iface->search_finish = gbp_shellcmd_search_provider_search_finish;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpShellcmdSearchProvider, gbp_shellcmd_search_provider, IDE_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_SEARCH_PROVIDER, search_provider_iface_init))
+
+static void
+gbp_shellcmd_search_provider_class_init (GbpShellcmdSearchProviderClass *klass)
+{
+}
+
+static void
+gbp_shellcmd_search_provider_init (GbpShellcmdSearchProvider *self)
+{
+}
diff --git a/src/plugins/shellcmd/gbp-shellcmd-search-provider.h
b/src/plugins/shellcmd/gbp-shellcmd-search-provider.h
new file mode 100644
index 000000000..45d9dcb30
--- /dev/null
+++ b/src/plugins/shellcmd/gbp-shellcmd-search-provider.h
@@ -0,0 +1,31 @@
+/* gbp-shellcmd-search-provider.h
+ *
+ * Copyright 2022 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libide-core.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SHELLCMD_SEARCH_PROVIDER (gbp_shellcmd_search_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpShellcmdSearchProvider, gbp_shellcmd_search_provider, GBP,
SHELLCMD_SEARCH_PROVIDER, IdeObject)
+
+G_END_DECLS
diff --git a/src/plugins/shellcmd/meson.build b/src/plugins/shellcmd/meson.build
index 23251b1a6..e67207ae3 100644
--- a/src/plugins/shellcmd/meson.build
+++ b/src/plugins/shellcmd/meson.build
@@ -7,6 +7,7 @@ plugins_sources += files([
'gbp-shellcmd-preferences-addin.c',
'gbp-shellcmd-run-command.c',
'gbp-shellcmd-run-command-provider.c',
+ 'gbp-shellcmd-search-provider.c',
'gbp-shellcmd-shortcut-provider.c',
])
diff --git a/src/plugins/shellcmd/shellcmd-plugin.c b/src/plugins/shellcmd/shellcmd-plugin.c
index 4a22fe1c2..41c6c094c 100644
--- a/src/plugins/shellcmd/shellcmd-plugin.c
+++ b/src/plugins/shellcmd/shellcmd-plugin.c
@@ -24,9 +24,11 @@
#include <libide-foundry.h>
#include <libide-gui.h>
+#include <libide-search.h>
#include "gbp-shellcmd-preferences-addin.h"
#include "gbp-shellcmd-run-command-provider.h"
+#include "gbp-shellcmd-search-provider.h"
#include "gbp-shellcmd-shortcut-provider.h"
_IDE_EXTERN void
@@ -38,6 +40,9 @@ _gbp_shellcmd_register_types (PeasObjectModule *module)
peas_object_module_register_extension_type (module,
IDE_TYPE_RUN_COMMAND_PROVIDER,
GBP_TYPE_SHELLCMD_RUN_COMMAND_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_SEARCH_PROVIDER,
+ GBP_TYPE_SHELLCMD_SEARCH_PROVIDER);
peas_object_module_register_extension_type (module,
IDE_TYPE_SHORTCUT_PROVIDER,
GBP_TYPE_SHELLCMD_SHORTCUT_PROVIDER);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]