Added editing_canceled property to GtkCellEditable

GTK_ENTRY()->editing_canceled should really have been a parameter of the
GtkCellEditable::editing-done signal, it should be a property on the cell
editable interface

https://bugzilla.gnome.org/show_bug.cgi?id=594962
This commit is contained in:
Cody Russell 2009-10-21 18:40:19 +02:00 committed by Javier Jardón
parent 272e0b5b76
commit 0f33ad4ee1
3 changed files with 85 additions and 50 deletions

View File

@ -21,10 +21,11 @@
#include "config.h"
#include "gtkcelleditable.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkalias.h"
static void gtk_cell_editable_base_init (gpointer g_class);
static void gtk_cell_editable_base_init (GtkCellEditableIface *iface);
GType
gtk_cell_editable_get_type (void)
@ -35,12 +36,12 @@ gtk_cell_editable_get_type (void)
{
const GTypeInfo cell_editable_info =
{
sizeof (GtkCellEditableIface), /* class_size */
gtk_cell_editable_base_init, /* base_init */
NULL, /* base_finalize */
sizeof (GtkCellEditableIface), /* class_size */
(GBaseInitFunc) gtk_cell_editable_base_init, /* base_init */
NULL, /* base_finalize */
NULL,
NULL, /* class_finalize */
NULL, /* class_data */
NULL, /* class_finalize */
NULL, /* class_data */
0,
0,
NULL
@ -57,12 +58,26 @@ gtk_cell_editable_get_type (void)
}
static void
gtk_cell_editable_base_init (gpointer g_class)
gtk_cell_editable_base_init (GtkCellEditableIface *iface)
{
static gboolean initialized = FALSE;
if (! initialized)
{
/**
* GtkCellEditable:editing-canceled:
*
* Indicates whether editing on the cell has been canceled.
*
* Since: 2.20
**/
g_object_interface_install_property (iface,
g_param_spec_boolean ("editing-canceled",
P_("Editing Canceled"),
P_("Indicates that editing has been canceled"),
FALSE,
GTK_PARAM_READABLE));
/**
* GtkCellEditable::editing-done:
* @cell_editable: the object on which the signal was emitted

View File

@ -204,7 +204,8 @@ enum {
PROP_HAS_FRAME,
PROP_FOCUS_ON_CLICK,
PROP_POPUP_SHOWN,
PROP_BUTTON_SENSITIVITY
PROP_BUTTON_SENSITIVITY,
PROP_EDITING_CANCELED
};
static guint combo_box_signals[LAST_SIGNAL] = {0,};
@ -649,6 +650,10 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
/* properties */
g_object_class_override_property (object_class,
PROP_EDITING_CANCELED,
"editing-canceled");
/**
* GtkComboBox:model:
*
@ -960,58 +965,58 @@ gtk_combo_box_set_property (GObject *object,
switch (prop_id)
{
case PROP_MODEL:
gtk_combo_box_set_model (combo_box, g_value_get_object (value));
break;
case PROP_MODEL:
gtk_combo_box_set_model (combo_box, g_value_get_object (value));
break;
case PROP_WRAP_WIDTH:
gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value));
break;
case PROP_WRAP_WIDTH:
gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value));
break;
case PROP_ROW_SPAN_COLUMN:
gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value));
break;
case PROP_ROW_SPAN_COLUMN:
gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value));
break;
case PROP_COLUMN_SPAN_COLUMN:
gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value));
break;
case PROP_COLUMN_SPAN_COLUMN:
gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value));
break;
case PROP_ACTIVE:
gtk_combo_box_set_active (combo_box, g_value_get_int (value));
break;
case PROP_ACTIVE:
gtk_combo_box_set_active (combo_box, g_value_get_int (value));
break;
case PROP_ADD_TEAROFFS:
gtk_combo_box_set_add_tearoffs (combo_box, g_value_get_boolean (value));
break;
case PROP_ADD_TEAROFFS:
gtk_combo_box_set_add_tearoffs (combo_box, g_value_get_boolean (value));
break;
case PROP_HAS_FRAME:
combo_box->priv->has_frame = g_value_get_boolean (value);
break;
case PROP_HAS_FRAME:
combo_box->priv->has_frame = g_value_get_boolean (value);
break;
case PROP_FOCUS_ON_CLICK:
gtk_combo_box_set_focus_on_click (combo_box,
g_value_get_boolean (value));
break;
case PROP_FOCUS_ON_CLICK:
gtk_combo_box_set_focus_on_click (combo_box,
g_value_get_boolean (value));
break;
case PROP_TEAROFF_TITLE:
gtk_combo_box_set_title (combo_box, g_value_get_string (value));
break;
case PROP_TEAROFF_TITLE:
gtk_combo_box_set_title (combo_box, g_value_get_string (value));
break;
case PROP_POPUP_SHOWN:
if (g_value_get_boolean (value))
gtk_combo_box_popup (combo_box);
else
gtk_combo_box_popdown (combo_box);
break;
case PROP_POPUP_SHOWN:
if (g_value_get_boolean (value))
gtk_combo_box_popup (combo_box);
else
gtk_combo_box_popdown (combo_box);
break;
case PROP_BUTTON_SENSITIVITY:
gtk_combo_box_set_button_sensitivity (combo_box,
g_value_get_enum (value));
break;
case PROP_BUTTON_SENSITIVITY:
gtk_combo_box_set_button_sensitivity (combo_box,
g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -1022,6 +1027,7 @@ gtk_combo_box_get_property (GObject *object,
GParamSpec *pspec)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (object);
GtkComboBoxPrivate *priv = GTK_COMBO_BOX_GET_PRIVATE (combo_box);
switch (prop_id)
{
@ -1069,6 +1075,10 @@ gtk_combo_box_get_property (GObject *object,
g_value_set_enum (value, combo_box->priv->button_sensitivity);
break;
case PROP_EDITING_CANCELED:
g_value_set_boolean (value, priv->editing_canceled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View File

@ -216,7 +216,8 @@ enum {
PROP_TOOLTIP_TEXT_SECONDARY,
PROP_TOOLTIP_MARKUP_PRIMARY,
PROP_TOOLTIP_MARKUP_SECONDARY,
PROP_IM_MODULE
PROP_IM_MODULE,
PROP_EDITING_CANCELED
};
static guint signals[LAST_SIGNAL] = { 0 };
@ -622,6 +623,10 @@ gtk_entry_class_init (GtkEntryClass *class)
quark_cursor_hadjustment = g_quark_from_static_string ("gtk-hadjustment");
quark_capslock_feedback = g_quark_from_static_string ("gtk-entry-capslock-feedback");
g_object_class_override_property (gobject_class,
PROP_EDITING_CANCELED,
"editing-canceled");
g_object_class_install_property (gobject_class,
PROP_BUFFER,
g_param_spec_object ("buffer",
@ -2196,6 +2201,11 @@ gtk_entry_get_property (GObject *object,
gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_EDITING_CANCELED:
g_value_set_boolean (value,
entry->editing_canceled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;