[gnome-text-editor] sourceview: add helper to prepend menu
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] sourceview: add helper to prepend menu
- Date: Tue, 22 Feb 2022 01:18:01 +0000 (UTC)
commit 30db25184c3aeed9dd11933248aeae3bbab89898
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 21 17:16:36 2022 -0800
sourceview: add helper to prepend menu
This can be used to inject more menus later on.
src/editor-source-view.c | 14 ++++++++++++++
src/editor-source-view.h | 10 ++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/editor-source-view.c b/src/editor-source-view.c
index d421be4..28610f4 100644
--- a/src/editor-source-view.c
+++ b/src/editor-source-view.c
@@ -959,3 +959,17 @@ editor_source_view_get_zoom_level (EditorSourceView *self)
return (double)alt_size / (double)size;
}
+
+void
+editor_source_view_prepend_extra_menu (EditorSourceView *self,
+ GMenuModel *extra_menu)
+{
+ GMenuModel *base;
+
+ g_return_if_fail (EDITOR_IS_SOURCE_VIEW (self));
+ g_return_if_fail (G_IS_MENU_MODEL (extra_menu));
+
+ base = gtk_text_view_get_extra_menu (GTK_TEXT_VIEW (self));
+
+ editor_joined_menu_prepend_menu (EDITOR_JOINED_MENU (base), extra_menu);
+}
diff --git a/src/editor-source-view.h b/src/editor-source-view.h
index fd30ef0..c2c4688 100644
--- a/src/editor-source-view.h
+++ b/src/editor-source-view.h
@@ -28,9 +28,11 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EditorSourceView, editor_source_view, EDITOR, SOURCE_VIEW, GtkSourceView)
-const PangoFontDescription *editor_source_view_get_font_desc (EditorSourceView *self);
-void editor_source_view_set_font_desc (EditorSourceView *self,
- const PangoFontDescription *font_desc);
-double editor_source_view_get_zoom_level (EditorSourceView *self);
+const PangoFontDescription *editor_source_view_get_font_desc (EditorSourceView *self);
+void editor_source_view_set_font_desc (EditorSourceView *self,
+ const PangoFontDescription *font_desc);
+double editor_source_view_get_zoom_level (EditorSourceView *self);
+void editor_source_view_prepend_extra_menu (EditorSourceView *self,
+ GMenuModel *extra_menu);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]