[gnome-builder/wip/gtk4-port: 579/736] libide/search: use search-engine rather than context
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 579/736] libide/search: use search-engine rather than context
- Date: Tue, 26 Apr 2022 01:46:31 +0000 (UTC)
commit e14c1afb7aa7a6d7a93a01f87f9df019357655e4
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 13 11:09:21 2022 -0700
libide/search: use search-engine rather than context
src/libide/search/ide-search-popover.c | 52 +++++++++++++++-------------------
src/libide/search/ide-search-popover.h | 6 ++--
2 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/src/libide/search/ide-search-popover.c b/src/libide/search/ide-search-popover.c
index c0d1ef2a1..a14836583 100644
--- a/src/libide/search/ide-search-popover.c
+++ b/src/libide/search/ide-search-popover.c
@@ -27,13 +27,13 @@
struct _IdeSearchPopover
{
- GtkPopover parent_instance;
- IdeContext *context;
+ GtkPopover parent_instance;
+ IdeSearchEngine *search_engine;
};
enum {
PROP_0,
- PROP_CONTEXT,
+ PROP_SEARCH_ENGINE,
N_PROPS
};
@@ -42,13 +42,13 @@ G_DEFINE_FINAL_TYPE (IdeSearchPopover, ide_search_popover, GTK_TYPE_POPOVER)
static GParamSpec *properties [N_PROPS];
static void
-ide_search_popover_set_context (IdeSearchPopover *self,
- IdeContext *context)
+ide_search_popover_set_search_engine (IdeSearchPopover *self,
+ IdeSearchEngine *search_engine)
{
g_assert (IDE_IS_SEARCH_POPOVER (self));
- g_assert (IDE_IS_CONTEXT (context));
+ g_assert (IDE_IS_SEARCH_ENGINE (search_engine));
- if (g_set_object (&self->context, context))
+ if (g_set_object (&self->search_engine, search_engine))
{
/* TODO: Setup addins */
}
@@ -59,7 +59,7 @@ ide_search_popover_dispose (GObject *object)
{
IdeSearchPopover *self = (IdeSearchPopover *)object;
- g_clear_object (&self->context);
+ g_clear_object (&self->search_engine);
G_OBJECT_CLASS (ide_search_popover_parent_class)->dispose (object);
}
@@ -74,8 +74,8 @@ ide_search_popover_get_property (GObject *object,
switch (prop_id)
{
- case PROP_CONTEXT:
- g_value_set_object (value, ide_search_popover_get_context (self));
+ case PROP_SEARCH_ENGINE:
+ g_value_set_object (value, self->search_engine);
break;
default:
@@ -93,8 +93,8 @@ ide_search_popover_set_property (GObject *object,
switch (prop_id)
{
- case PROP_CONTEXT:
- ide_search_popover_set_context (self, g_value_get_object (value));
+ case PROP_SEARCH_ENGINE:
+ ide_search_popover_set_search_engine (self, g_value_get_object (value));
break;
default:
@@ -112,11 +112,11 @@ ide_search_popover_class_init (IdeSearchPopoverClass *klass)
object_class->get_property = ide_search_popover_get_property;
object_class->set_property = ide_search_popover_set_property;
- properties [PROP_CONTEXT] =
- g_param_spec_object ("context",
- "Context",
- "The project context",
- IDE_TYPE_CONTEXT,
+ properties [PROP_SEARCH_ENGINE] =
+ g_param_spec_object ("search-engine",
+ "Search Engine",
+ "The search engine for the popover",
+ IDE_TYPE_SEARCH_ENGINE,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
@@ -132,18 +132,12 @@ ide_search_popover_init (IdeSearchPopover *self)
gtk_widget_init_template (GTK_WIDGET (self));
}
-/**
- * ide_search_popover_get_context:
- * @self: a #IdeSearchPopover
- *
- * Gets the context for the search popover.
- *
- * Returns: (transfer none) (nullable): an #IdeContext or %NULL
- */
-IdeContext *
-ide_search_popover_get_context (IdeSearchPopover *self)
+GtkWidget *
+ide_search_popover_new (IdeSearchEngine *search_engine)
{
- g_return_val_if_fail (IDE_IS_SEARCH_POPOVER (self), NULL);
+ g_return_val_if_fail (IDE_IS_SEARCH_ENGINE (search_engine), NULL);
- return self->context;
+ return g_object_new (IDE_TYPE_SEARCH_POPOVER,
+ "search-engine", search_engine,
+ NULL);
}
diff --git a/src/libide/search/ide-search-popover.h b/src/libide/search/ide-search-popover.h
index 0991be5a7..6b3f78878 100644
--- a/src/libide/search/ide-search-popover.h
+++ b/src/libide/search/ide-search-popover.h
@@ -28,6 +28,8 @@
#include <libide-core.h>
+#include "ide-search-engine.h"
+
G_BEGIN_DECLS
#define IDE_TYPE_SEARCH_POPOVER (ide_search_popover_get_type())
@@ -36,8 +38,6 @@ IDE_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (IdeSearchPopover, ide_search_popover, IDE, SEARCH_POPOVER, GtkPopover)
IDE_AVAILABLE_IN_ALL
-GtkWidget *ide_search_popover_new (IdeContext *context);
-IDE_AVAILABLE_IN_ALL
-IdeContext *ide_search_popover_get_context (IdeSearchPopover *self);
+GtkWidget *ide_search_popover_new (IdeSearchEngine *search_engine);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]