Commit fb526d23 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Fix #130969.

2004-01-16  Federico Mena Quintero  <federico@ximian.com>

	Fix #130969.

	* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
	editing_canceled signal.

	* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
	"editing-canceled" signal.
	(gtk_cell_renderer_editing_canceled): New function.

	* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
	Call gtk_cell_renderer_editing_canceled().
parent c6860c11
2004-01-16 Federico Mena Quintero <federico@ximian.com>
Fix #130969.
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
editing_canceled signal.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
"editing-canceled" signal.
(gtk_cell_renderer_editing_canceled): New function.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
Call gtk_cell_renderer_editing_canceled().
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
......
2004-01-16 Federico Mena Quintero <federico@ximian.com>
Fix #130969.
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
editing_canceled signal.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
"editing-canceled" signal.
(gtk_cell_renderer_editing_canceled): New function.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
Call gtk_cell_renderer_editing_canceled().
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
......
2004-01-16 Federico Mena Quintero <federico@ximian.com>
Fix #130969.
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
editing_canceled signal.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
"editing-canceled" signal.
(gtk_cell_renderer_editing_canceled): New function.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
Call gtk_cell_renderer_editing_canceled().
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
......
2004-01-16 Federico Mena Quintero <federico@ximian.com>
Fix #130969.
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
editing_canceled signal.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
"editing-canceled" signal.
(gtk_cell_renderer_editing_canceled): New function.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
Call gtk_cell_renderer_editing_canceled().
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
......
2004-01-16 Federico Mena Quintero <federico@ximian.com>
Fix #130969.
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): Added an
editing_canceled signal.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_class_init): Create the
"editing-canceled" signal.
(gtk_cell_renderer_editing_canceled): New function.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done):
Call gtk_cell_renderer_editing_canceled().
2004-01-16 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
......
......@@ -19,6 +19,7 @@
#include "gtkcellrenderer.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtktreeprivate.h"
static void gtk_cell_renderer_init (GtkCellRenderer *cell);
......@@ -61,6 +62,15 @@ enum {
PROP_CELL_BACKGROUND_SET
};
/* Signal IDs */
enum {
EDITING_CANCELED,
LAST_SIGNAL
};
static guint cell_renderer_signals[LAST_SIGNAL] = { 0 };
GType
gtk_cell_renderer_get_type (void)
{
......@@ -113,6 +123,27 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
class->render = NULL;
class->get_size = NULL;
/**
* GtkCellRenderer::editing-canceled:
*
* This signal gets emitted when the user cancels the process of editing a
* cell. For example, an editable cell renderer could be written to cancel
* editing when the user presses Escape.
*
* See also: gtk_cell_renderer_editing_canceled()
*
* Since: 2.4
*/
cell_renderer_signals[EDITING_CANCELED] =
g_signal_new ("editing-canceled",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkCellRendererClass, editing_canceled),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_MODE,
g_param_spec_enum ("mode",
......@@ -654,3 +685,22 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
if (height)
(* height) = cell->height;
}
/**
* gtk_cell_renderer_editing_canceled:
* @cell: A #GtkCellRenderer
*
* Causes the cell renderer to emit the "editing-canceled" signal. This
* function is for use only by implementations of cell renderers that need to
* notify the client program that an editing process was canceled and the
* changes were not committed.
*
* Since: 2.4
**/
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);
}
......@@ -107,11 +107,13 @@ struct _GtkCellRendererClass
GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Signals */
void (* editing_canceled) (GtkCellRenderer *cell);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType gtk_cell_renderer_get_type (void) G_GNUC_CONST;
......@@ -151,8 +153,10 @@ void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
gint *width,
gint *height);
/* For use by cell renderer implementations only */
void gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell);
G_END_DECLS
#endif /* __GTK_CELL_RENDERER_H__ */
......@@ -1439,7 +1439,10 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
}
if (GTK_ENTRY (entry)->editing_canceled)
return;
{
gtk_cell_renderer_editing_canceled (GTK_CELL_RENDERER (data));
return;
}
path = g_object_get_data (G_OBJECT (entry), GTK_CELL_RENDERER_TEXT_PATH);
new_text = gtk_entry_get_text (GTK_ENTRY (entry));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment