Revert "text: Fix disabling of history"

This reverts commit 45d6ffcce8.
This commit is contained in:
Mat 2023-03-01 14:06:16 +02:00
parent ea1bb79566
commit 6c88cc7215

View File

@ -243,7 +243,6 @@ struct _GtkTextPrivate
guint populate_all : 1;
guint propagate_text_width : 1;
guint text_handles_enabled : 1;
guint enable_undo : 1;
};
struct _GtkTextPasswordHint
@ -394,9 +393,6 @@ static void gtk_text_set_max_width_chars (GtkText *self,
static void gtk_text_set_alignment (GtkText *self,
float xalign);
static void gtk_text_set_enable_undo (GtkText *self,
gboolean enable_undo);
/* Default signal handlers
*/
static GMenuModel *gtk_text_get_menu_model (GtkText *self);
@ -556,7 +552,6 @@ static void begin_change (GtkText *self);
static void end_change (GtkText *self);
static void emit_changed (GtkText *self);
static void gtk_text_update_history (GtkText *self);
static void gtk_text_update_clipboard_actions (GtkText *self);
static void gtk_text_update_emoji_action (GtkText *self);
static void gtk_text_update_handles (GtkText *self);
@ -1598,7 +1593,11 @@ gtk_text_set_property (GObject *object,
break;
case NUM_PROPERTIES + GTK_EDITABLE_PROP_ENABLE_UNDO:
gtk_text_set_enable_undo (self, g_value_get_boolean (value));
if (g_value_get_boolean (value) != gtk_text_history_get_enabled (priv->history))
{
gtk_text_history_set_enabled (priv->history, g_value_get_boolean (value));
g_object_notify_by_pspec (object, pspec);
}
break;
/* GtkText properties */
@ -1724,7 +1723,7 @@ gtk_text_get_property (GObject *object,
break;
case NUM_PROPERTIES + GTK_EDITABLE_PROP_ENABLE_UNDO:
g_value_set_boolean (value, priv->enable_undo);
g_value_set_boolean (value, gtk_text_history_get_enabled (priv->history));
break;
/* GtkText properties */
@ -1850,7 +1849,6 @@ gtk_text_init (GtkText *self)
priv->cursor_alpha = 1.0;
priv->invisible_char = 0;
priv->history = gtk_text_history_new (&history_funcs, self);
priv->enable_undo = TRUE;
gtk_text_history_set_max_undo_levels (priv->history, DEFAULT_MAX_UNDO);
@ -5505,7 +5503,6 @@ gtk_text_set_editable (GtkText *self,
gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
is_editable ? priv->im_context : NULL);
gtk_text_update_history (self);
gtk_text_update_clipboard_actions (self);
gtk_text_update_emoji_action (self);
@ -5586,7 +5583,7 @@ gtk_text_set_visibility (GtkText *self,
gtk_text_recompute (self);
/* disable undo when invisible text is used */
gtk_text_update_history (self);
gtk_text_history_set_enabled (priv->history, visible);
gtk_text_update_clipboard_actions (self);
}
@ -7268,28 +7265,3 @@ gtk_text_history_select_cb (gpointer funcs_data,
selection_insert,
selection_bound);
}
static void
gtk_text_set_enable_undo (GtkText *self,
gboolean enable_undo)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->enable_undo == enable_undo)
return;
priv->enable_undo = enable_undo;
gtk_text_update_history (self);
g_object_notify (G_OBJECT (self), "enable-undo");
}
static void
gtk_text_update_history (GtkText *self)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
gtk_text_history_set_enabled (priv->history,
priv->enable_undo &&
priv->visible &&
priv->editable);
}