[gtk/wip/chergert/textundo: 4/8] gtk-demo: wrap text operations in irreversible actions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/textundo: 4/8] gtk-demo: wrap text operations in irreversible actions
- Date: Tue, 5 Nov 2019 02:03:27 +0000 (UTC)
commit c536a2b9b83620d3a7a80e3a0de9fd0528c8a934
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 1 11:18:21 2019 -0700
gtk-demo: wrap text operations in irreversible actions
This ensures that the actions to set the text for the demo tabs cannot
be undone. This matches the previous behavior for GtkTextBuffer.
demos/gtk-demo/main.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 6460f10388..a188fc3318 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -748,6 +748,9 @@ load_file (const gchar *demoname,
source_buffer = gtk_text_buffer_new (NULL);
+ gtk_text_buffer_begin_irreversible_action (info_buffer);
+ gtk_text_buffer_begin_irreversible_action (source_buffer);
+
resource_filename = g_strconcat ("/sources/", filename, NULL);
bytes = g_resources_lookup_data (resource_filename, 0, &err);
g_free (resource_filename);
@@ -880,9 +883,11 @@ load_file (const gchar *demoname,
fontify (source_buffer);
+ gtk_text_buffer_end_irreversible_action (source_buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
g_object_unref (source_buffer);
+ gtk_text_buffer_end_irreversible_action (info_buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (info_view), info_buffer);
g_object_unref (info_buffer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]