[tepl] WindowActionsEdit: move tepl-undo GAction
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] WindowActionsEdit: move tepl-undo GAction
- Date: Sun, 3 May 2020 22:50:04 +0000 (UTC)
commit 34b5bbd9172c00a869f41f834b789df42bb00002
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon May 4 00:44:13 2020 +0200
WindowActionsEdit: move tepl-undo GAction
tepl/tepl-application-window.c | 25 ++-----------------------
tepl/tepl-window-actions-edit.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/tepl/tepl-application-window.c b/tepl/tepl-application-window.c
index a30d15f..1e7a467 100644
--- a/tepl/tepl-application-window.c
+++ b/tepl/tepl-application-window.c
@@ -11,6 +11,7 @@
#include "tepl-signal-group.h"
#include "tepl-view.h"
#include "tepl-window-actions-file.h"
+#include "tepl-window-actions-edit.h"
/**
* SECTION:application-window
@@ -111,28 +112,6 @@ G_DEFINE_TYPE_WITH_CODE (TeplApplicationWindow,
G_IMPLEMENT_INTERFACE (TEPL_TYPE_TAB_GROUP,
tepl_tab_group_interface_init))
-static void
-undo_cb (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
- TeplView *view;
-
- view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window));
-
- if (view != NULL)
- {
- TeplBuffer *buffer;
-
- buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window));
-
- gtk_source_buffer_undo (GTK_SOURCE_BUFFER (buffer));
- tepl_view_scroll_to_cursor (view);
- gtk_widget_grab_focus (GTK_WIDGET (view));
- }
-}
-
static void
redo_cb (GSimpleAction *action,
GVariant *parameter,
@@ -570,7 +549,6 @@ add_actions (TeplApplicationWindow *tepl_window)
*/
const GActionEntry entries[] = {
/* Edit menu */
- { "tepl-undo", undo_cb },
{ "tepl-redo", redo_cb },
{ "tepl-cut", cut_cb },
{ "tepl-copy", copy_cb },
@@ -590,6 +568,7 @@ add_actions (TeplApplicationWindow *tepl_window)
tepl_window);
_tepl_window_actions_file_add_actions (tepl_window);
+ _tepl_window_actions_edit_add_actions (tepl_window);
update_actions_sensitivity (tepl_window);
}
diff --git a/tepl/tepl-window-actions-edit.c b/tepl/tepl-window-actions-edit.c
index ecc69ed..0866156 100644
--- a/tepl/tepl-window-actions-edit.c
+++ b/tepl/tepl-window-actions-edit.c
@@ -4,15 +4,40 @@
#include "tepl-window-actions-edit.h"
#include <amtk/amtk.h>
+#include "tepl-tab-group.h"
+#include "tepl-view.h"
/* TeplApplicationWindow GActions for the Edit menu. */
+static void
+undo_activate_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+ TeplView *view;
+
+ view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (tepl_window));
+
+ if (view != NULL)
+ {
+ TeplBuffer *buffer;
+
+ buffer = tepl_tab_group_get_active_buffer (TEPL_TAB_GROUP (tepl_window));
+
+ gtk_source_buffer_undo (GTK_SOURCE_BUFFER (buffer));
+ tepl_view_scroll_to_cursor (view);
+ gtk_widget_grab_focus (GTK_WIDGET (view));
+ }
+}
+
void
_tepl_window_actions_edit_add_actions (TeplApplicationWindow *tepl_window)
{
GtkApplicationWindow *gtk_window;
const GActionEntry entries[] = {
+ { "tepl-undo", undo_activate_cb },
};
g_return_if_fail (TEPL_IS_APPLICATION_WINDOW (tepl_window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]