[gnome-builder] libide/editor: add reload action for pages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/editor: add reload action for pages
- Date: Sun, 4 Sep 2022 16:19:37 +0000 (UTC)
commit a1fa9032f5ffd2b359f22f86df21c0369bc86755
Author: Christian Hergert <chergert redhat com>
Date: Sun Sep 4 09:18:06 2022 -0700
libide/editor: add reload action for pages
src/libide/editor/ide-editor-page.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index 8bf6ebb1e..7734d89e5 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -524,6 +524,32 @@ format_action (GtkWidget *widget,
IDE_EXIT;
}
+static void
+reload_action (GtkWidget *widget,
+ const char *action_name,
+ GVariant *param)
+{
+ IdeEditorPage *self = (IdeEditorPage *)widget;
+ IdeBufferManager *buffer_manager;
+ IdeContext *context;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (IDE_IS_EDITOR_PAGE (self));
+
+ context = ide_widget_get_context (widget);
+ buffer_manager = ide_buffer_manager_from_context (context);
+
+ ide_buffer_manager_load_file_async (buffer_manager,
+ ide_buffer_get_file (self->buffer),
+ IDE_BUFFER_OPEN_FLAGS_FORCE_RELOAD,
+ NULL, /* TODO: Progress */
+ NULL, NULL, NULL);
+
+ IDE_EXIT;
+}
+
static void
ide_editor_page_constructed (GObject *object)
{
@@ -680,6 +706,7 @@ ide_editor_page_class_init (IdeEditorPageClass *klass)
panel_widget_class_install_action (panel_widget_class, "search.begin-replace", NULL,
search_begin_replace_action);
panel_widget_class_install_action (panel_widget_class, "editor.print", NULL, print_action);
panel_widget_class_install_action (panel_widget_class, "editor.format", NULL, format_action);
+ panel_widget_class_install_action (panel_widget_class, "editor.reload", NULL, reload_action);
g_type_ensure (IDE_TYPE_EDITOR_INFO_BAR);
g_type_ensure (IDE_TYPE_EDITOR_SEARCH_BAR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]