summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrenderer.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2004-01-16 19:18:28 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2004-01-16 19:18:28 +0000
commitfb526d239af04183f5751f209c269d13b244de80 (patch)
treea3ed517b157811ca3fcc5e3f649585134f28380e /gtk/gtkcellrenderer.c
parentc6860c111b45dbe59c67a1d6c1ef646397a57812 (diff)
downloadgtk+-fb526d239af04183f5751f209c269d13b244de80.tar.gz
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().
Diffstat (limited to 'gtk/gtkcellrenderer.c')
-rw-r--r--gtk/gtkcellrenderer.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 153cc9dd13..c19ee74976 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.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);
+}