[gtksourceview/wip/chergert/gsv-gtk4: 147/259] completion: track CSS changes using css_changed vfunc
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 147/259] completion: track CSS changes using css_changed vfunc
- Date: Mon, 21 Sep 2020 23:27:45 +0000 (UTC)
commit 601f429a44f43b3aac63e0485dbb3888b14d5875
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 17 14:02:57 2020 -0700
completion: track CSS changes using css_changed vfunc
gtksourceview/gtksourcecompletion-private.h | 4 +++-
gtksourceview/gtksourcecompletion.c | 16 +++++++---------
gtksourceview/gtksourceview.c | 6 ++++++
3 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion-private.h b/gtksourceview/gtksourcecompletion-private.h
index 01015047..c7853f48 100644
--- a/gtksourceview/gtksourcecompletion-private.h
+++ b/gtksourceview/gtksourcecompletion-private.h
@@ -31,4 +31,6 @@ void _gtk_source_completion_add_proposals (GtkSourceCompletion
GtkSourceCompletionProvider *provider,
GList *proposals,
gboolean finished);
-
+G_GNUC_INTERNAL
+void _gtk_source_completion_css_changed (GtkSourceCompletion *completion,
+ GtkCssStyleChange *change);
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 70ed3ce4..eaf0405f 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -2196,11 +2196,14 @@ init_info_window (GtkSourceCompletion *completion)
gtk_widget_show (GTK_WIDGET (completion->default_info));
}
-static void
-connect_style_context (GtkSourceCompletion *completion)
+void
+_gtk_source_completion_css_changed (GtkSourceCompletion *completion,
+ GtkCssStyleChange *change)
{
GtkStyleContext *style_context;
+ g_assert (GTK_SOURCE_IS_COMPLETION (completion));
+
if (completion->view == NULL)
{
return;
@@ -2208,12 +2211,6 @@ connect_style_context (GtkSourceCompletion *completion)
style_context = gtk_widget_get_style_context (GTK_WIDGET (completion->view));
- g_signal_connect_object (style_context,
- "changed",
- G_CALLBACK (style_context_changed),
- completion,
- G_CONNECT_AFTER);
-
style_context_changed (style_context, completion);
}
@@ -2238,7 +2235,8 @@ gtk_source_completion_constructed (GObject *object)
init_tree_view (completion, builder);
init_main_window (completion, builder);
init_info_window (completion);
- connect_style_context (completion);
+
+ _gtk_source_completion_css_changed (completion, NULL);
g_object_unref (builder);
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index dfef51f6..8c45fd7b 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -4615,6 +4615,12 @@ gtk_source_view_css_changed (GtkWidget *widget,
priv->cached_right_margin_pos = -1;
update_style (view);
+
+ /* Notify completion to update styling */
+ if (priv->completion != NULL)
+ {
+ _gtk_source_completion_css_changed (priv->completion, change);
+ }
}
static MarkCategory *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]