[gnome-builder/wip/gtk4-port: 644/1774] libide/editor: wire up interactive-completion gsetting
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 644/1774] libide/editor: wire up interactive-completion gsetting
- Date: Mon, 11 Jul 2022 22:31:19 +0000 (UTC)
commit 94d2e28366b90683dc7cba0a6bd822c6cedaa6c6
Author: Christian Hergert <chergert redhat com>
Date: Tue Apr 19 16:58:25 2022 -0700
libide/editor: wire up interactive-completion gsetting
Honor the gsetting to disable interactive completion.
src/libide/editor/ide-editor-page-private.h | 2 ++
src/libide/editor/ide-editor-page-settings.c | 37 ++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-page-private.h b/src/libide/editor/ide-editor-page-private.h
index 9f580c638..f9d409947 100644
--- a/src/libide/editor/ide-editor-page-private.h
+++ b/src/libide/editor/ide-editor-page-private.h
@@ -43,6 +43,8 @@ struct _IdeEditorPage
GtkScrolledWindow *scroller;
GtkSourceMap *map;
GtkRevealer *map_revealer;
+
+ guint completion_blocked : 1;
};
void _ide_editor_page_class_actions_init (IdeEditorPageClass *klass);
diff --git a/src/libide/editor/ide-editor-page-settings.c b/src/libide/editor/ide-editor-page-settings.c
index 37ea57af7..a46166ef6 100644
--- a/src/libide/editor/ide-editor-page-settings.c
+++ b/src/libide/editor/ide-editor-page-settings.c
@@ -92,6 +92,36 @@ font_name_to_font_desc (GValue *value,
return TRUE;
}
+static void
+notify_interactive_completion_cb (IdeEditorPage *self,
+ const char *key,
+ GSettings *editor_settings)
+{
+ GtkSourceCompletion *completion;
+
+ g_assert (IDE_IS_EDITOR_PAGE (self));
+ g_assert (G_IS_SETTINGS (editor_settings));
+
+ completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (self->view));
+
+ if (g_settings_get_boolean (editor_settings, "interactive-completion"))
+ {
+ if (self->completion_blocked)
+ {
+ self->completion_blocked = FALSE;
+ gtk_source_completion_unblock_interactive (completion);
+ }
+ }
+ else
+ {
+ if (!self->completion_blocked)
+ {
+ self->completion_blocked = TRUE;
+ gtk_source_completion_block_interactive (completion);
+ }
+ }
+}
+
void
_ide_editor_page_settings_init (IdeEditorPage *self)
{
@@ -169,6 +199,13 @@ _ide_editor_page_settings_init (IdeEditorPage *self)
G_BINDING_SYNC_CREATE);
#endif
+ g_signal_connect_object (editor_settings,
+ "changed::interactive-completion",
+ G_CALLBACK (notify_interactive_completion_cb),
+ self,
+ 0);
+ notify_interactive_completion_cb (self, NULL, editor_settings);
+
_ide_editor_page_settings_reload (self);
IDE_EXIT;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]