[gnome-text-editor] sourceview: move spelling menu work into source view subclass
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] sourceview: move spelling menu work into source view subclass
- Date: Tue, 29 Jun 2021 22:27:29 +0000 (UTC)
commit cf1ac278a9ca6892fd62ee67d00ac17623f88a76
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 29 15:26:23 2021 -0700
sourceview: move spelling menu work into source view subclass
src/editor-page.c | 15 ---------------
src/editor-source-view.c | 14 ++++++++++++++
2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/editor-page.c b/src/editor-page.c
index 7be7640..7915daf 100644
--- a/src/editor-page.c
+++ b/src/editor-page.c
@@ -25,12 +25,10 @@
#include <glib/gi18n.h>
#include "editor-info-bar-private.h"
-#include "editor-joined-menu-private.h"
#include "editor-page-private.h"
#include "editor-sidebar-model-private.h"
#include "editor-session-private.h"
#include "editor-source-view.h"
-#include "editor-spell-menu.h"
#include "editor-utils-private.h"
enum {
@@ -581,23 +579,10 @@ editor_page_class_init (EditorPageClass *klass)
static void
editor_page_init (EditorPage *self)
{
- g_autoptr(GMenuModel) spelling_menu = NULL;
- g_autoptr(EditorJoinedMenu) joined = NULL;
- GMenuModel *extra_menu;
GtkDropTarget *dest;
gtk_widget_init_template (GTK_WIDGET (self));
- joined = editor_joined_menu_new ();
- extra_menu = gtk_text_view_get_extra_menu (GTK_TEXT_VIEW (self->view));
- editor_joined_menu_append_menu (joined, extra_menu);
-
- spelling_menu = editor_spell_menu_new ();
- editor_joined_menu_append_menu (joined, spelling_menu);
-
- gtk_text_view_set_extra_menu (GTK_TEXT_VIEW (self->view),
- G_MENU_MODEL (joined));
-
g_object_bind_property (self, "document", self->infobar, "document", 0);
g_signal_connect_object (self->view,
diff --git a/src/editor-source-view.c b/src/editor-source-view.c
index 4e8c26b..8687ac2 100644
--- a/src/editor-source-view.c
+++ b/src/editor-source-view.c
@@ -21,6 +21,8 @@
#include "config.h"
#include "editor-source-view.h"
+#include "editor-joined-menu-private.h"
+#include "editor-spell-menu.h"
struct _EditorSourceView
{
@@ -103,7 +105,10 @@ editor_source_view_class_init (EditorSourceViewClass *klass)
static void
editor_source_view_init (EditorSourceView *self)
{
+ g_autoptr(GMenuModel) spelling_menu = NULL;
+ g_autoptr(EditorJoinedMenu) joined = NULL;
GtkEventController *controller;
+ GMenuModel *extra_menu;
controller = gtk_event_controller_key_new ();
g_signal_connect (controller,
@@ -113,4 +118,13 @@ editor_source_view_init (EditorSourceView *self)
gtk_widget_add_controller (GTK_WIDGET (self), controller);
tweak_gutter_spacing (GTK_SOURCE_VIEW (self));
+
+ joined = editor_joined_menu_new ();
+ extra_menu = gtk_text_view_get_extra_menu (GTK_TEXT_VIEW (self));
+ editor_joined_menu_append_menu (joined, extra_menu);
+
+ spelling_menu = editor_spell_menu_new ();
+ editor_joined_menu_append_menu (joined, spelling_menu);
+
+ gtk_text_view_set_extra_menu (GTK_TEXT_VIEW (self), G_MENU_MODEL (joined));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]