Fix #145463, reported by Michael Natterer.

2004-12-09  Matthias Clasen  <mclasen@redhat.com>

	Fix #145463, reported by Michael Natterer.

	* gtk/gtkcellrenderer.h (struct _GtkCellRenderer): Add an
	editing flag to keep track of when editing is done.

	* gtk/gtkcellrenderer.h:
	* gtk/gtkcellrenderer.c (gtk_cell_renderer_stop_editing): New
	function to replace gtk_cell_renderer_editing_canceled().
	Deprecate gtk_cell_renderer_editing_canceled().

	* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
	* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_editing_done):
	* gtk/gtktreeview.c (gtk_tree_view_stop_editing):
	Use gtk_cell_renderer_stop_editing().
This commit is contained in:
Matthias Clasen 2004-12-09 17:55:58 +00:00 committed by Matthias Clasen
parent 08b5b675e1
commit 788bec8384
11 changed files with 121 additions and 13 deletions

View File

@ -1,3 +1,20 @@
2004-12-09 Matthias Clasen <mclasen@redhat.com>
Fix #145463, reported by Michael Natterer.
* gtk/gtkcellrenderer.h (struct _GtkCellRenderer): Add an
editing flag to keep track of when editing is done.
* gtk/gtkcellrenderer.h:
* gtk/gtkcellrenderer.c (gtk_cell_renderer_stop_editing): New
function to replace gtk_cell_renderer_editing_canceled().
Deprecate gtk_cell_renderer_editing_canceled().
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_editing_done):
* gtk/gtktreeview.c (gtk_tree_view_stop_editing):
Use gtk_cell_renderer_stop_editing().
2004-12-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkliststore.h:

View File

@ -1,3 +1,20 @@
2004-12-09 Matthias Clasen <mclasen@redhat.com>
Fix #145463, reported by Michael Natterer.
* gtk/gtkcellrenderer.h (struct _GtkCellRenderer): Add an
editing flag to keep track of when editing is done.
* gtk/gtkcellrenderer.h:
* gtk/gtkcellrenderer.c (gtk_cell_renderer_stop_editing): New
function to replace gtk_cell_renderer_editing_canceled().
Deprecate gtk_cell_renderer_editing_canceled().
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_editing_done):
* gtk/gtktreeview.c (gtk_tree_view_stop_editing):
Use gtk_cell_renderer_stop_editing().
2004-12-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkliststore.h:

View File

@ -1,3 +1,20 @@
2004-12-09 Matthias Clasen <mclasen@redhat.com>
Fix #145463, reported by Michael Natterer.
* gtk/gtkcellrenderer.h (struct _GtkCellRenderer): Add an
editing flag to keep track of when editing is done.
* gtk/gtkcellrenderer.h:
* gtk/gtkcellrenderer.c (gtk_cell_renderer_stop_editing): New
function to replace gtk_cell_renderer_editing_canceled().
Deprecate gtk_cell_renderer_editing_canceled().
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_editing_done):
* gtk/gtktreeview.c (gtk_tree_view_stop_editing):
Use gtk_cell_renderer_stop_editing().
2004-12-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkliststore.h:

View File

@ -1,3 +1,20 @@
2004-12-09 Matthias Clasen <mclasen@redhat.com>
Fix #145463, reported by Michael Natterer.
* gtk/gtkcellrenderer.h (struct _GtkCellRenderer): Add an
editing flag to keep track of when editing is done.
* gtk/gtkcellrenderer.h:
* gtk/gtkcellrenderer.c (gtk_cell_renderer_stop_editing): New
function to replace gtk_cell_renderer_editing_canceled().
Deprecate gtk_cell_renderer_editing_canceled().
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_editing_done):
* gtk/gtktreeview.c (gtk_tree_view_stop_editing):
Use gtk_cell_renderer_stop_editing().
2004-12-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkliststore.h:

View File

@ -1,6 +1,7 @@
2004-12-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt: Add new list store methods.
Add gtk_cell_renderer_stop_editing.
2004-12-08 Matthias Clasen <mclasen@redhat.com>

View File

@ -4136,6 +4136,7 @@ gtk_cell_renderer_render
gtk_cell_renderer_activate
gtk_cell_renderer_start_editing
gtk_cell_renderer_editing_canceled
gtk_cell_renderer_stop_editing
gtk_cell_renderer_get_fixed_size
gtk_cell_renderer_set_fixed_size

View File

@ -117,6 +117,7 @@ gtk_cell_renderer_init (GtkCellRenderer *cell)
cell->sensitive = TRUE;
cell->is_expander = FALSE;
cell->is_expanded = FALSE;
cell->editing = FALSE;
}
static void
@ -687,7 +688,6 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
return NULL;
editable = GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing (cell,
event,
widget,
@ -700,6 +700,8 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
cell_renderer_signals[EDITING_STARTED], 0,
editable, path);
cell->editing = TRUE;
return editable;
}
@ -770,11 +772,39 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
* changes were not committed.
*
* Since: 2.4
* Deprecated: Use gtk_cell_renderer_stop_editing() instead
**/
void
gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
gtk_cell_renderer_stop_editing (cell, TRUE);
}
/**
* gtk_cell_renderer_stop_editing:
* @cell: A #GtkCellRenderer
* @canceled: %TRUE if the editing has been canceled
*
* Informs the cell renderer that the editing is stopped.
* If @canceled is %TRUE, the cell renderer will emit the "editing-canceled"
* signal. This function should be called by cell renderer implementations
* in response to the "editing-done" signal of #GtkCellEditable.
*
* Since: 2.6
**/
void
gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
gboolean canceled)
{
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
if (cell->editing)
{
cell->editing = FALSE;
if (canceled)
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
}
}

View File

@ -72,6 +72,7 @@ struct _GtkCellRenderer
guint is_expanded : 1;
guint cell_background_set : 1;
guint sensitive : 1;
guint editing : 1;
};
struct _GtkCellRendererClass
@ -157,7 +158,11 @@ void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
gint *height);
/* For use by cell renderer implementations only */
#ifndef GTK_DISABLE_DEPRECATED
void gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell);
#endif
void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
gboolean canceled);
G_END_DECLS

View File

@ -254,6 +254,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
GtkTreeIter iter;
GtkCellRendererCombo *cell;
GtkEntry *entry;
gboolean canceled;
cell = GTK_CELL_RENDERER_COMBO (data);
@ -263,11 +264,10 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
cell->focus_out_id = 0;
}
if (_gtk_combo_box_editing_canceled (GTK_COMBO_BOX (combo)))
{
gtk_cell_renderer_editing_canceled (GTK_CELL_RENDERER (data));
return;
}
canceled = _gtk_combo_box_editing_canceled (GTK_COMBO_BOX (combo));
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data), canceled);
if (canceled)
return;
if (GTK_IS_COMBO_BOX_ENTRY (combo))
{

View File

@ -1572,11 +1572,10 @@ 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)
{
gtk_cell_renderer_editing_canceled (GTK_CELL_RENDERER (data));
return;
}
return;
path = g_object_get_data (G_OBJECT (entry), GTK_CELL_RENDERER_TEXT_PATH);
new_text = gtk_entry_get_text (GTK_ENTRY (entry));

View File

@ -12870,6 +12870,7 @@ gtk_tree_view_stop_editing (GtkTreeView *tree_view,
gboolean cancel_editing)
{
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
if (tree_view->priv->edited_column == NULL)
return;
@ -12887,7 +12888,10 @@ gtk_tree_view_stop_editing (GtkTreeView *tree_view,
column = tree_view->priv->edited_column;
tree_view->priv->edited_column = NULL;
if (! cancel_editing)
cell = _gtk_tree_view_column_get_edited_cell (column);
gtk_cell_renderer_stop_editing (cell, cancel_editing);
if (!cancel_editing)
gtk_cell_editable_editing_done (column->editable_widget);
tree_view->priv->edited_column = column;