[gnome-builder] plugins/retab: track changes to GtkSourceView 5
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/retab: track changes to GtkSourceView 5
- Date: Tue, 12 Jul 2022 06:39:18 +0000 (UTC)
commit af31c39364679657ecbac41c6a4af063501524d0
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 11 23:16:03 2022 -0700
plugins/retab: track changes to GtkSourceView 5
src/plugins/retab/gbp-retab-editor-page-addin.c | 21 +++++++++------------
src/plugins/retab/gtk/menus.ui | 18 +++++++-----------
src/plugins/retab/retab.plugin | 1 -
3 files changed, 16 insertions(+), 24 deletions(-)
---
diff --git a/src/plugins/retab/gbp-retab-editor-page-addin.c b/src/plugins/retab/gbp-retab-editor-page-addin.c
index 57b4b8cd3..61c07e171 100644
--- a/src/plugins/retab/gbp-retab-editor-page-addin.c
+++ b/src/plugins/retab/gbp-retab-editor-page-addin.c
@@ -121,7 +121,7 @@ gbp_retab_editor_page_addin_action (GSimpleAction *action,
GbpRetabEditorPageAddin *self = user_data;
IdeSourceView *source_view;
GtkTextBuffer *buffer;
- IdeCompletion *completion;
+ GtkSourceCompletion *completion;
guint tab_width;
gint start_line;
gint end_line;
@@ -140,7 +140,7 @@ gbp_retab_editor_page_addin_action (GSimpleAction *action,
g_assert (IDE_IS_SOURCE_VIEW (source_view));
editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (source_view));
- completion = ide_source_view_get_completion (IDE_SOURCE_VIEW (source_view));
+ completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (source_view));
tab_width = gtk_source_view_get_tab_width(GTK_SOURCE_VIEW (source_view));
to_spaces = gtk_source_view_get_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW (source_view));
@@ -156,7 +156,7 @@ gbp_retab_editor_page_addin_action (GSimpleAction *action,
start_line = gtk_text_iter_get_line (&begin);
end_line = gtk_text_iter_get_line (&end);
- ide_completion_block_interactive (completion);
+ gtk_source_completion_block_interactive (completion);
gtk_text_buffer_begin_user_action (buffer);
for (gint line = start_line; line <= end_line; ++line)
@@ -167,7 +167,7 @@ gbp_retab_editor_page_addin_action (GSimpleAction *action,
}
gtk_text_buffer_end_user_action (buffer);
- ide_completion_unblock_interactive (completion);
+ gtk_source_completion_unblock_interactive (completion);
}
static const GActionEntry actions[] = {
@@ -179,28 +179,26 @@ gbp_retab_editor_page_addin_load (IdeEditorPageAddin *addin,
IdeEditorPage *view)
{
GbpRetabEditorPageAddin *self = (GbpRetabEditorPageAddin *)addin;
- GActionGroup *group;
+ g_autoptr(GSimpleActionGroup) group = NULL;
g_assert (GBP_IS_RETAB_EDITOR_PAGE_ADDIN (addin));
g_assert (IDE_IS_EDITOR_PAGE (view));
self->editor_view = view;
- group = gtk_widget_get_action_group (GTK_WIDGET (view), "editor-page");
+ group = g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (group), actions, G_N_ELEMENTS (actions), self);
+ gtk_widget_insert_action_group (GTK_WIDGET (view), "retab", G_ACTION_GROUP (group));
}
static void
gbp_retab_editor_page_addin_unload (IdeEditorPageAddin *addin,
IdeEditorPage *view)
{
- GActionGroup *group;
-
g_assert (GBP_IS_RETAB_EDITOR_PAGE_ADDIN (addin));
g_assert (IDE_IS_EDITOR_PAGE (view));
- group = gtk_widget_get_action_group (GTK_WIDGET (view), "editor-page");
- g_action_map_remove_action (G_ACTION_MAP (group), "retab");
+ gtk_widget_insert_action_group (GTK_WIDGET (view), "retab", NULL);
}
static void
@@ -211,8 +209,7 @@ editor_view_addin_iface_init (IdeEditorPageAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpRetabEditorPageAddin, gbp_retab_editor_page_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_PAGE_ADDIN,
- editor_view_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_PAGE_ADDIN,
editor_view_addin_iface_init))
static void
diff --git a/src/plugins/retab/gtk/menus.ui b/src/plugins/retab/gtk/menus.ui
index 2eacfae68..661f16386 100644
--- a/src/plugins/retab/gtk/menus.ui
+++ b/src/plugins/retab/gtk/menus.ui
@@ -1,16 +1,12 @@
<?xml version="1.0"?>
<interface>
- <menu id="ide-source-view-popup-menu">
- <section id="ide-source-view-popup-menu-selection-section">
- <submenu id="ide-source-view-popup-menu-selection-submenu">
- <section id="ide-source-view-popup-menu-selection-retab-section">
- <attribute name="after">ide-source-view-popup-menu-line-section</attribute>
- <item>
- <attribute name="label" translatable="yes">_Reformat tabs</attribute>
- <attribute name="action">editor-view.retab</attribute>
- </item>
- </section>
- </submenu>
+ <menu id="ide-source-view-popup-menu-selection-submenu">
+ <section id="ide-source-view-popup-menu-selection-retab-section">
+ <attribute name="after">ide-source-view-popup-menu-line-section</attribute>
+ <item>
+ <attribute name="label" translatable="yes">_Reformat tabs</attribute>
+ <attribute name="action">retab.retab</attribute>
+ </item>
</section>
</menu>
</interface>
diff --git a/src/plugins/retab/retab.plugin b/src/plugins/retab/retab.plugin
index c7bc1aa42..7782d9be1 100644
--- a/src/plugins/retab/retab.plugin
+++ b/src/plugins/retab/retab.plugin
@@ -2,7 +2,6 @@
Authors=Lucie Charvat <luci charvat gmail com>
Builtin=true
Copyright=Copyright © 2017 Lucie Charvat
-Depends=editor
Description=Retab lines with Builder editor.
Embedded=_gbp_retab_register_types
Hidden=true
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]