mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Use GtkCellEditable::editing-canceled
GtkCellEditable::editing-canceled property was added in 2.19 cycle, so we should make the code that currently uses entry->editing_canceled directly go through the property Fixes https://bugzilla.gnome.org/show_bug.cgi?id=599213
This commit is contained in:
parent
46f5ee1d0c
commit
325bd9299a
@ -332,7 +332,9 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
|
||||
cell->focus_out_id = 0;
|
||||
}
|
||||
|
||||
canceled = _gtk_combo_box_editing_canceled (GTK_COMBO_BOX (combo));
|
||||
g_object_get (combo,
|
||||
"editing-canceled", &canceled,
|
||||
NULL);
|
||||
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data), canceled);
|
||||
if (canceled)
|
||||
{
|
||||
|
@ -230,7 +230,9 @@ gtk_cell_renderer_spin_focus_out_event (GtkWidget *widget,
|
||||
const gchar *new_text;
|
||||
gboolean canceled;
|
||||
|
||||
canceled = GTK_ENTRY (widget)->editing_canceled;
|
||||
g_object_get (widget,
|
||||
"editing-canceled", &canceled,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (widget,
|
||||
gtk_cell_renderer_spin_focus_out_event,
|
||||
|
@ -1701,6 +1701,7 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
|
||||
{
|
||||
const gchar *path;
|
||||
const gchar *new_text;
|
||||
gboolean canceled;
|
||||
GtkCellRendererTextPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
|
||||
@ -1725,9 +1726,12 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
|
||||
priv->entry_menu_popdown_timeout = 0;
|
||||
}
|
||||
|
||||
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data),
|
||||
GTK_ENTRY (entry)->editing_canceled);
|
||||
if (GTK_ENTRY (entry)->editing_canceled)
|
||||
g_object_get (entry,
|
||||
"editing-canceled", &canceled,
|
||||
NULL);
|
||||
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data), canceled);
|
||||
|
||||
if (canceled)
|
||||
return;
|
||||
|
||||
path = g_object_get_data (G_OBJECT (entry), GTK_CELL_RENDERER_TEXT_PATH);
|
||||
@ -1801,7 +1805,9 @@ gtk_cell_renderer_text_focus_out_event (GtkWidget *entry,
|
||||
if (priv->in_entry_menu)
|
||||
return FALSE;
|
||||
|
||||
GTK_ENTRY (entry)->editing_canceled = TRUE;
|
||||
g_object_set (entry,
|
||||
"editing-canceled", TRUE,
|
||||
NULL);
|
||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
|
||||
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
|
||||
|
||||
|
@ -3198,7 +3198,9 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
combo_box->priv->editing_canceled = FALSE;
|
||||
g_object_set (combo_box,
|
||||
"editing-canceled", FALSE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5510,8 +5512,9 @@ gtk_cell_editable_key_press (GtkWidget *widget,
|
||||
|
||||
if (event->keyval == GDK_Escape)
|
||||
{
|
||||
combo_box->priv->editing_canceled = TRUE;
|
||||
|
||||
g_object_set (combo_box,
|
||||
"editing-canceled", TRUE,
|
||||
NULL);
|
||||
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
|
||||
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box));
|
||||
|
||||
@ -5566,7 +5569,9 @@ popup_idle (gpointer data)
|
||||
combo_box, 0);
|
||||
|
||||
/* we unset this if a menu item is activated */
|
||||
combo_box->priv->editing_canceled = TRUE;
|
||||
g_object_set (combo_box,
|
||||
"editing-canceled", TRUE,
|
||||
NULL);
|
||||
gtk_combo_box_popup (combo_box);
|
||||
|
||||
combo_box->priv->popup_idle_id = 0;
|
||||
@ -5727,14 +5732,6 @@ gtk_combo_box_set_title (GtkComboBox *combo_box,
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_combo_box_editing_canceled (GtkComboBox *combo_box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), TRUE);
|
||||
|
||||
return combo_box->priv->editing_canceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_get_popup_accessible:
|
||||
* @combo_box: a #GtkComboBox
|
||||
|
@ -136,8 +136,6 @@ void gtk_combo_box_popup (GtkComboBox *combo_box);
|
||||
void gtk_combo_box_popdown (GtkComboBox *combo_box);
|
||||
AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
|
||||
|
||||
/* private */
|
||||
gboolean _gtk_combo_box_editing_canceled (GtkComboBox *combo_box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user