[gtksourceview/wip/chergert/gsv-gtk4: 146/175] completion: remove access to completion window
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 146/175] completion: remove access to completion window
- Date: Thu, 25 Jun 2020 19:55:32 +0000 (UTC)
commit 69f327c69e1d5af8a16fc9fea2da41a85d6352a0
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 26 11:53:04 2020 -0700
completion: remove access to completion window
We want to be free to make this implementation private so drop access to
the widget from public API.
gtksourceview/gtksource.h | 1 -
gtksourceview/gtksourcecompletion.c | 65 +----------------------------
gtksourceview/gtksourcecompletion.h | 2 -
gtksourceview/gtksourcecompletionprovider.c | 10 ++---
gtksourceview/gtksourcecompletionprovider.h | 4 +-
gtksourceview/gtksourcetypes-private.h | 1 +
gtksourceview/gtksourcetypes.h | 1 -
gtksourceview/meson.build | 3 +-
tests/test-completion.ui | 8 ----
9 files changed, 11 insertions(+), 84 deletions(-)
---
diff --git a/gtksourceview/gtksource.h b/gtksourceview/gtksource.h
index 517c06ae..b0434691 100644
--- a/gtksourceview/gtksource.h
+++ b/gtksourceview/gtksource.h
@@ -24,7 +24,6 @@
#include "gtksourcebuffer.h"
#include "gtksourcecompletioncontext.h"
#include "gtksourcecompletion.h"
-#include "gtksourcecompletioninfo.h"
#include "gtksourcecompletionitem.h"
#include "gtksourcecompletionproposal.h"
#include "gtksourcecompletionprovider.h"
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 1ccdfdc0..feac1f26 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -71,24 +71,6 @@
*
* A same #GtkSourceCompletionProvider object can be used for several
* #GtkSourceCompletion's.
- *
- * # GtkSourceCompletion as GtkBuildable
- *
- * The GtkSourceCompletion implementation of the #GtkBuildable interface exposes
- * the info window object (see gtk_source_completion_get_info_window()) with the
- * internal-child "info_window".
- *
- * An example of a UI definition fragment with GtkSourceCompletion:
- * |[
- * <object class="GtkSourceCompletion">
- * <property name="select_on_show">False</property>
- * <child internal-child="info_window">
- * <object class="GtkSourceCompletionInfo">
- * <property name="border_width">6</property>
- * </object>
- * </child>
- * </object>
- * ]|
*/
/* Idea to improve the code: use a composite widget template. This class is not
@@ -209,11 +191,7 @@ struct _GtkSourceCompletion
static guint signals[N_SIGNALS];
-static void gtk_source_completion_buildable_interface_init (GtkBuildableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (GtkSourceCompletion, gtk_source_completion, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_source_completion_buildable_interface_init))
+G_DEFINE_TYPE (GtkSourceCompletion, gtk_source_completion, G_TYPE_OBJECT)
static void
scroll_to_iter (GtkSourceCompletion *completion,
@@ -556,7 +534,7 @@ update_proposal_info_state (GtkSourceCompletion *completion)
gtk_source_completion_provider_update_info (provider,
proposal,
- completion->info_window);
+ info_widget);
}
else
{
@@ -2673,27 +2651,6 @@ gtk_source_completion_init (GtkSourceCompletion *completion)
completion = gtk_source_completion_get_instance_private (completion);
}
-static GObject *
-gtk_source_completion_buildable_get_internal_child (GtkBuildable *buildable,
- GtkBuilder *builder,
- const gchar *childname)
-{
- GtkSourceCompletion *completion = GTK_SOURCE_COMPLETION (buildable);
-
- if (g_strcmp0 (childname, "info_window") == 0)
- {
- return G_OBJECT (gtk_source_completion_get_info_window (completion));
- }
-
- return NULL;
-}
-
-static void
-gtk_source_completion_buildable_interface_init (GtkBuildableIface *iface)
-{
- iface->get_internal_child = gtk_source_completion_buildable_get_internal_child;
-}
-
void
_gtk_source_completion_add_proposals (GtkSourceCompletion *completion,
GtkSourceCompletionContext *context,
@@ -2958,24 +2915,6 @@ gtk_source_completion_hide (GtkSourceCompletion *completion)
}
}
-/**
- * gtk_source_completion_get_info_window:
- * @completion: a #GtkSourceCompletion.
- *
- * The info widget is the window where the completion displays optional extra
- * information of the proposal.
- *
- * Returns: (transfer none): The #GtkSourceCompletionInfo window
- * associated with @completion.
- */
-GtkSourceCompletionInfo *
-gtk_source_completion_get_info_window (GtkSourceCompletion *completion)
-{
- g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION (completion), NULL);
-
- return completion->info_window;
-}
-
/**
* gtk_source_completion_get_view:
* @completion: a #GtkSourceCompletion.
diff --git a/gtksourceview/gtksourcecompletion.h b/gtksourceview/gtksourcecompletion.h
index d50b8e96..f314a816 100644
--- a/gtksourceview/gtksourcecompletion.h
+++ b/gtksourceview/gtksourcecompletion.h
@@ -82,8 +82,6 @@ gboolean gtk_source_completion_start (GtkSource
GTK_SOURCE_AVAILABLE_IN_ALL
void gtk_source_completion_hide (GtkSourceCompletion
*completion);
GTK_SOURCE_AVAILABLE_IN_ALL
-GtkSourceCompletionInfo *gtk_source_completion_get_info_window (GtkSourceCompletion
*completion);
-GTK_SOURCE_AVAILABLE_IN_ALL
GtkSourceView *gtk_source_completion_get_view (GtkSourceCompletion
*completion);
GTK_SOURCE_AVAILABLE_IN_ALL
GtkSourceCompletionContext *gtk_source_completion_create_context (GtkSourceCompletion
*completion,
diff --git a/gtksourceview/gtksourcecompletionprovider.c b/gtksourceview/gtksourcecompletionprovider.c
index b97b39c5..1eafcc9c 100644
--- a/gtksourceview/gtksourcecompletionprovider.c
+++ b/gtksourceview/gtksourcecompletionprovider.c
@@ -97,7 +97,7 @@ gtk_source_completion_provider_get_info_widget_default (GtkSourceCompletionProvi
static void
gtk_source_completion_provider_update_info_default (GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal,
- GtkSourceCompletionInfo *info)
+ GtkWidget *widget)
{
}
@@ -319,7 +319,7 @@ gtk_source_completion_provider_get_info_widget (GtkSourceCompletionProvider *pro
* gtk_source_completion_provider_update_info:
* @provider: a #GtkSourceCompletionProvider.
* @proposal: a #GtkSourceCompletionProposal.
- * @info: a #GtkSourceCompletionInfo.
+ * @widget: a #GtkWidget provided from gtk_source_completion_provider_get_info_widget()
*
* Update extra information shown in @info for @proposal.
*
@@ -333,13 +333,13 @@ gtk_source_completion_provider_get_info_widget (GtkSourceCompletionProvider *pro
void
gtk_source_completion_provider_update_info (GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal,
- GtkSourceCompletionInfo *info)
+ GtkWidget *widget)
{
g_return_if_fail (GTK_SOURCE_IS_COMPLETION_PROVIDER (provider));
g_return_if_fail (GTK_SOURCE_IS_COMPLETION_PROPOSAL (proposal));
- g_return_if_fail (GTK_SOURCE_IS_COMPLETION_INFO (info));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
- GTK_SOURCE_COMPLETION_PROVIDER_GET_IFACE (provider)->update_info (provider, proposal, info);
+ GTK_SOURCE_COMPLETION_PROVIDER_GET_IFACE (provider)->update_info (provider, proposal, widget);
}
/**
diff --git a/gtksourceview/gtksourcecompletionprovider.h b/gtksourceview/gtksourcecompletionprovider.h
index 20d97e34..0ece40ae 100644
--- a/gtksourceview/gtksourcecompletionprovider.h
+++ b/gtksourceview/gtksourcecompletionprovider.h
@@ -85,7 +85,7 @@ struct _GtkSourceCompletionProviderInterface
GtkSourceCompletionProposal *proposal);
void (*update_info) (GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal,
- GtkSourceCompletionInfo *info);
+ GtkWidget *widget);
gboolean (*get_start_iter) (GtkSourceCompletionProvider *provider,
GtkSourceCompletionContext *context,
GtkSourceCompletionProposal *proposal,
@@ -119,7 +119,7 @@ GtkWidget *gtk_source_completion_provider_get_info_widget
GTK_SOURCE_AVAILABLE_IN_ALL
void gtk_source_completion_provider_update_info
(GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal,
- GtkSourceCompletionInfo
*info);
+ GtkWidget
*widget);
GTK_SOURCE_AVAILABLE_IN_ALL
gboolean gtk_source_completion_provider_get_start_iter
(GtkSourceCompletionProvider *provider,
GtkSourceCompletionContext *context,
diff --git a/gtksourceview/gtksourcetypes-private.h b/gtksourceview/gtksourcetypes-private.h
index 5d0570db..97efe327 100644
--- a/gtksourceview/gtksourcetypes-private.h
+++ b/gtksourceview/gtksourcetypes-private.h
@@ -25,6 +25,7 @@ G_BEGIN_DECLS
typedef struct _GtkSourceBufferInputStream GtkSourceBufferInputStream;
typedef struct _GtkSourceBufferOutputStream GtkSourceBufferOutputStream;
+typedef struct _GtkSourceCompletionInfo GtkSourceCompletionInfo;
typedef struct _GtkSourceCompletionModel GtkSourceCompletionModel;
typedef struct _GtkSourceContextEngine GtkSourceContextEngine;
typedef struct _GtkSourceEngine GtkSourceEngine;
diff --git a/gtksourceview/gtksourcetypes.h b/gtksourceview/gtksourcetypes.h
index 3ac09423..9c7a6b70 100644
--- a/gtksourceview/gtksourcetypes.h
+++ b/gtksourceview/gtksourcetypes.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
typedef struct _GtkSourceBuffer GtkSourceBuffer;
typedef struct _GtkSourceCompletionContext GtkSourceCompletionContext;
typedef struct _GtkSourceCompletion GtkSourceCompletion;
-typedef struct _GtkSourceCompletionInfo GtkSourceCompletionInfo;
typedef struct _GtkSourceCompletionItem GtkSourceCompletionItem;
typedef struct _GtkSourceCompletionProposal GtkSourceCompletionProposal;
typedef struct _GtkSourceCompletionProvider GtkSourceCompletionProvider;
diff --git a/gtksourceview/meson.build b/gtksourceview/meson.build
index 83bfc646..4f58d482 100644
--- a/gtksourceview/meson.build
+++ b/gtksourceview/meson.build
@@ -10,7 +10,6 @@ core_public_h = files([
'gtksourcebuffer.h',
'gtksourcecompletion.h',
'gtksourcecompletioncontext.h',
- 'gtksourcecompletioninfo.h',
'gtksourcecompletionitem.h',
'gtksourcecompletionproposal.h',
'gtksourcecompletionprovider.h',
@@ -50,7 +49,6 @@ core_public_c = files([
'gtksourcebuffer.c',
'gtksourcecompletion.c',
'gtksourcecompletioncontext.c',
- 'gtksourcecompletioninfo.c',
'gtksourcecompletionitem.c',
'gtksourcecompletionproposal.c',
'gtksourcecompletionprovider.c',
@@ -90,6 +88,7 @@ core_private_c = files([
'gtksourcebufferinputstream.c',
'gtksourcebufferinternal.c',
'gtksourcebufferoutputstream.c',
+ 'gtksourcecompletioninfo.c',
'gtksourcecompletionmodel.c',
'gtksourcecontextengine.c',
'gtksourceengine.c',
diff --git a/tests/test-completion.ui b/tests/test-completion.ui
index 865ff2ed..c7324fcf 100644
--- a/tests/test-completion.ui
+++ b/tests/test-completion.ui
@@ -260,14 +260,6 @@
<child internal-child="completion">
<object class="GtkSourceCompletion">
<property name="remember_info_visibility">True</property>
- <child internal-child="info_window">
- <object class="GtkSourceCompletionInfo">
- <property name="margin-top">3</property>
- <property name="margin-bottom">3</property>
- <property name="margin-start">3</property>
- <property name="margin-end">3</property>
- </object>
- </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]