Commit c45ee0bf authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Get rid of broken "can_edit" and "can_activate" properties in favor of

Tue Sep 18 13:51:35 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
	"can_activate" properties in favor of
	GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
	and GTK_CELL_RENDERER_MODE_EDITABLE
parent f724f836
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
Tue Sep 18 13:51:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcellrenderer.h (enum): Get rid of broken "can_edit" and
"can_activate" properties in favor of
GTK_CELL_RENDERER_MODE_INERT, GTK_CELL_RENDERER_MODE_ACTIVATABLE,
and GTK_CELL_RENDERER_MODE_EDITABLE
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
......
......@@ -34,8 +34,7 @@ static void gtk_cell_renderer_set_property (GObject *object,
enum {
PROP_ZERO,
PROP_CAN_ACTIVATE,
PROP_CAN_EDIT,
PROP_MODE,
PROP_VISIBLE,
PROP_XALIGN,
PROP_YALIGN,
......@@ -77,8 +76,7 @@ gtk_cell_renderer_get_type (void)
static void
gtk_cell_renderer_init (GtkCellRenderer *cell)
{
cell->can_activate = FALSE;
cell->can_edit = FALSE;
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
cell->visible = TRUE;
cell->width = -1;
cell->height = -1;
......@@ -100,23 +98,15 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
class->get_size = NULL;
g_object_class_install_property (object_class,
PROP_CAN_ACTIVATE,
g_param_spec_boolean ("can_activate",
_("can_activate"),
_("Cell can get activate events."),
FALSE,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
PROP_MODE,
g_param_spec_enum ("mode",
_("mode"),
_("Editable mode of the CellRenderer"),
GTK_TYPE_CELL_RENDERER_MODE,
GTK_CELL_RENDERER_MODE_INERT,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_CAN_EDIT,
g_param_spec_boolean ("can_edit",
_("can_edit"),
_("Cell supports CellEditable interface."),
FALSE,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_VISIBLE,
g_param_spec_boolean ("visible",
......@@ -222,11 +212,8 @@ gtk_cell_renderer_get_property (GObject *object,
switch (param_id)
{
case PROP_CAN_ACTIVATE:
g_value_set_boolean (value, cell->can_activate);
break;
case PROP_CAN_EDIT:
g_value_set_boolean (value, cell->can_edit);
case PROP_MODE:
g_value_set_enum (value, cell->mode);
break;
case PROP_VISIBLE:
g_value_set_boolean (value, cell->visible);
......@@ -272,25 +259,9 @@ gtk_cell_renderer_set_property (GObject *object,
switch (param_id)
{
case PROP_CAN_ACTIVATE:
cell->can_activate = g_value_get_boolean (value);
g_object_notify (object, "can_activate");
/* can_activate and can_edit are mutually exclusive */
if (cell->can_activate && cell->can_edit)
{
cell->can_edit = FALSE;
g_object_notify (object, "can_edit");
}
break;
case PROP_CAN_EDIT:
cell->can_edit = g_value_get_boolean (value);
g_object_notify (object, "can_edit");
/* can_activate and can_edit are mutually exclusive */
if (cell->can_activate && cell->can_edit)
{
cell->can_activate = FALSE;
g_object_notify (object, "can_activate");
}
case PROP_MODE:
cell->mode = g_value_get_enum (value);
g_object_notify (object, "mode");
break;
case PROP_VISIBLE:
cell->visible = g_value_get_boolean (value);
......@@ -457,7 +428,7 @@ gtk_cell_renderer_activate (GtkCellRenderer *cell,
{
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE);
if (! cell->can_activate)
if (cell->mode != GTK_CELL_RENDERER_MODE_ACTIVATABLE)
return FALSE;
if (GTK_CELL_RENDERER_GET_CLASS (cell)->activate == NULL)
......@@ -499,7 +470,7 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
{
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
if (! cell->can_edit)
if (cell->mode != GTK_CELL_RENDERER_MODE_EDITABLE)
return NULL;
if (GTK_CELL_RENDERER_GET_CLASS (cell)->start_editing == NULL)
......
......@@ -35,6 +35,13 @@ typedef enum
GTK_CELL_RENDERER_SORTED = 1 << 3
} GtkCellRendererState;
typedef enum
{
GTK_CELL_RENDERER_MODE_INERT,
GTK_CELL_RENDERER_MODE_ACTIVATABLE,
GTK_CELL_RENDERER_MODE_EDITABLE,
} GtkCellRendererMode;
#define GTK_TYPE_CELL_RENDERER (gtk_cell_renderer_get_type ())
#define GTK_CELL_RENDERER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRenderer))
#define GTK_CELL_RENDERER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
......@@ -58,8 +65,7 @@ struct _GtkCellRenderer
guint16 xpad;
guint16 ypad;
guint can_activate : 1;
guint can_edit : 1;
guint mode : 2;
guint visible : 1;
guint is_expander : 1;
guint is_expanded : 1;
......
......@@ -103,7 +103,7 @@ gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
{
celltoggle->active = FALSE;
celltoggle->radio = FALSE;
GTK_CELL_RENDERER (celltoggle)->can_activate = TRUE;
GTK_CELL_RENDERER (celltoggle)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
GTK_CELL_RENDERER (celltoggle)->xpad = 2;
GTK_CELL_RENDERER (celltoggle)->ypad = 2;
}
......@@ -289,7 +289,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
state = GTK_STATE_ACTIVE;
}
}
else if (! cell->can_activate)
else if (cell->mode == GTK_CELL_RENDERER_MODE_INERT)
{
state = GTK_STATE_INSENSITIVE;
}
......
......@@ -2238,16 +2238,15 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
GdkRectangle *cell_area,
guint flags)
{
gboolean visible, can_activate, can_edit;
gboolean visible, mode;
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
g_object_get (G_OBJECT (((GtkTreeViewColumnCellInfo *) tree_column->cell_list->data)->cell),
"visible", &visible,
"can_activate", &can_activate,
"can_edit", &can_edit,
"mode", &mode,
NULL);
if (visible && can_activate)
if (visible && mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
{
if (gtk_cell_renderer_activate (((GtkTreeViewColumnCellInfo *) tree_column->cell_list->data)->cell,
event,
......@@ -2258,7 +2257,7 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
flags))
return TRUE;
}
else if (visible && can_edit)
else if (visible && mode == GTK_CELL_RENDERER_MODE_EDITABLE)
{
*editable_widget = gtk_cell_renderer_start_editing (((GtkTreeViewColumnCellInfo *) tree_column->cell_list->data)->cell,
event,
......
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