Fix all remaining GTK3 issues.
Work around the issue of GnomeCanvasItem amending its own flags to GtkObject::flags (which is sealed) by giving it its own flags field. This breaks libgnomecanvas ABI and API, but I see no other way. This commit didn't work the first time because gnome-pilot libraries were still pulling in the system-wide libgnomecanvas, and that was interfereing with our bundled version which has a different ABI. But gnome-pilot integration was dropped in the previous commit, so everything is now using the bundled libgnomecanvas.
This commit is contained in:
@ -266,7 +266,7 @@ ecb_set_property (GObject *object,
|
||||
if (color_changed) {
|
||||
ecb->priv->color = color;
|
||||
|
||||
if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) {
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
get_color (ecb);
|
||||
if (!item->canvas->aa) {
|
||||
gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color);
|
||||
|
||||
@ -256,7 +256,7 @@ e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
|
||||
e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
|
||||
g_object_weak_ref (G_OBJECT (item),
|
||||
e_canvas_vbox_remove_item, e_canvas_vbox);
|
||||
if (GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (GNOME_CANVAS_ITEM (e_canvas_vbox)->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
gnome_canvas_item_set(item,
|
||||
"width", (gdouble) e_canvas_vbox->minimum_width,
|
||||
NULL);
|
||||
@ -270,7 +270,7 @@ e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *i
|
||||
e_canvas_vbox->items = g_list_prepend(e_canvas_vbox->items, item);
|
||||
g_object_weak_ref (G_OBJECT (item),
|
||||
e_canvas_vbox_remove_item, e_canvas_vbox);
|
||||
if (GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (GNOME_CANVAS_ITEM (e_canvas_vbox)->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
gnome_canvas_item_set(item,
|
||||
"width", (gdouble) e_canvas_vbox->minimum_width,
|
||||
NULL);
|
||||
@ -297,7 +297,7 @@ static void
|
||||
e_canvas_vbox_reflow( GnomeCanvasItem *item, gint flags )
|
||||
{
|
||||
ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item);
|
||||
if (GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
|
||||
gdouble old_height;
|
||||
gdouble running_height;
|
||||
|
||||
@ -399,7 +399,7 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event)
|
||||
|
||||
/* find the closest item */
|
||||
|
||||
if (canvas->root->object.flags & GNOME_CANVAS_ITEM_VISIBLE)
|
||||
if (canvas->root->flags & GNOME_CANVAS_ITEM_VISIBLE)
|
||||
gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy,
|
||||
&canvas->new_current_item);
|
||||
else
|
||||
@ -593,7 +593,11 @@ e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event)
|
||||
canvas = GNOME_CANVAS (widget);
|
||||
ecanvas = E_CANVAS (widget);
|
||||
|
||||
/* XXX Can't access flags directly anymore, but is it really needed?
|
||||
* If so, could we call gtk_widget_send_focus_change() instead? */
|
||||
#if 0
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
||||
#endif
|
||||
|
||||
gtk_im_context_focus_in (ecanvas->im_context);
|
||||
|
||||
@ -616,7 +620,11 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
|
||||
canvas = GNOME_CANVAS (widget);
|
||||
ecanvas = E_CANVAS (widget);
|
||||
|
||||
/* XXX Can't access flags directly anymore, but is it really needed?
|
||||
* If so, could we call gtk_widget_send_focus_change() instead? */
|
||||
#if 0
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
|
||||
#endif
|
||||
|
||||
gtk_im_context_focus_out (ecanvas->im_context);
|
||||
|
||||
@ -700,12 +708,12 @@ e_canvas_item_invoke_reflow (GnomeCanvasItem *item, gint flags)
|
||||
group = GNOME_CANVAS_GROUP (item);
|
||||
for (list = group->item_list; list; list = list->next) {
|
||||
child = GNOME_CANVAS_ITEM (list->data);
|
||||
if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
if (child->flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
e_canvas_item_invoke_reflow (child, flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) {
|
||||
if (item->flags & E_CANVAS_ITEM_NEEDS_REFLOW) {
|
||||
ECanvasItemReflowFunc func;
|
||||
func = (ECanvasItemReflowFunc)
|
||||
g_object_get_data (G_OBJECT (item),
|
||||
@ -714,14 +722,14 @@ e_canvas_item_invoke_reflow (GnomeCanvasItem *item, gint flags)
|
||||
func (item, flags);
|
||||
}
|
||||
|
||||
item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW;
|
||||
item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
|
||||
item->flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW;
|
||||
item->flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
|
||||
}
|
||||
|
||||
static void
|
||||
do_reflow (ECanvas *canvas)
|
||||
{
|
||||
if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
if (GNOME_CANVAS(canvas)->root->flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0);
|
||||
}
|
||||
|
||||
@ -761,10 +769,10 @@ add_idle (ECanvas *canvas)
|
||||
static void
|
||||
e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item)
|
||||
{
|
||||
if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
if (item->flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
|
||||
return;
|
||||
|
||||
item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
|
||||
item->flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
|
||||
if (item->parent)
|
||||
e_canvas_item_descendent_needs_reflow(item->parent);
|
||||
}
|
||||
@ -772,8 +780,8 @@ e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item)
|
||||
void
|
||||
e_canvas_item_request_reflow (GnomeCanvasItem *item)
|
||||
{
|
||||
if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW;
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
item->flags |= E_CANVAS_ITEM_NEEDS_REFLOW;
|
||||
e_canvas_item_descendent_needs_reflow(item);
|
||||
add_idle(E_CANVAS(item->canvas));
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
|
||||
if (frozen)
|
||||
return;
|
||||
|
||||
if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
gdouble running_height = 0;
|
||||
gdouble running_width = 0;
|
||||
gdouble old_height;
|
||||
|
||||
@ -343,12 +343,15 @@ eti_free_save_state (ETableItem *eti)
|
||||
static void
|
||||
eti_realize_cell_views ( ETableItem *eti)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
gint i;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (eti->cell_views_realized)
|
||||
return;
|
||||
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
for (i = 0; i < eti->n_cells; i++)
|
||||
@ -673,7 +676,11 @@ height_cache_idle(ETableItem *eti)
|
||||
static void
|
||||
free_height_cache (ETableItem *eti)
|
||||
{
|
||||
if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS (eti)) {
|
||||
GnomeCanvasItem *item;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (eti->height_cache)
|
||||
g_free (eti->height_cache);
|
||||
eti->height_cache = NULL;
|
||||
@ -909,9 +916,12 @@ eti_request_region_show (ETableItem *eti,
|
||||
static void
|
||||
eti_show_cursor (ETableItem *eti, gint delay)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
gint cursor_row;
|
||||
|
||||
if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
|
||||
item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!((item->flags & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
|
||||
return;
|
||||
|
||||
if (eti->frozen_count > 0) {
|
||||
@ -940,17 +950,13 @@ eti_show_cursor (ETableItem *eti, gint delay)
|
||||
static void
|
||||
eti_check_cursor_bounds (ETableItem *eti)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
gint x1, y1, x2, y2;
|
||||
gint cursor_row;
|
||||
|
||||
if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
|
||||
return;
|
||||
item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (eti->frozen_count > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
|
||||
if (!((item->flags & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
|
||||
return;
|
||||
|
||||
if (eti->frozen_count > 0) {
|
||||
@ -1089,7 +1095,9 @@ eti_table_model_no_change (ETableModel *table_model, ETableItem *eti)
|
||||
static void
|
||||
eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
eti_unfreeze (eti);
|
||||
return;
|
||||
}
|
||||
@ -1111,7 +1119,9 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
|
||||
static void
|
||||
eti_table_model_row_changed (ETableModel *table_model, gint row, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
eti_unfreeze (eti);
|
||||
return;
|
||||
}
|
||||
@ -1129,7 +1139,9 @@ eti_table_model_row_changed (ETableModel *table_model, gint row, ETableItem *eti
|
||||
static void
|
||||
eti_table_model_cell_changed (ETableModel *table_model, gint col, gint row, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
eti_unfreeze (eti);
|
||||
return;
|
||||
}
|
||||
@ -1147,7 +1159,9 @@ eti_table_model_cell_changed (ETableModel *table_model, gint col, gint row, ETab
|
||||
static void
|
||||
eti_table_model_rows_inserted (ETableModel *table_model, gint row, gint count, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
eti_unfreeze (eti);
|
||||
return;
|
||||
}
|
||||
@ -1174,7 +1188,9 @@ eti_table_model_rows_inserted (ETableModel *table_model, gint row, gint count, E
|
||||
static void
|
||||
eti_table_model_rows_deleted (ETableModel *table_model, gint row, gint count, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED)) {
|
||||
eti_unfreeze (eti);
|
||||
return;
|
||||
}
|
||||
@ -1428,11 +1444,10 @@ eti_dispose (GObject *object)
|
||||
static void
|
||||
eti_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
ETableItem *eti;
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (object);
|
||||
ETableItem *eti = E_TABLE_ITEM (object);
|
||||
gint cursor_col;
|
||||
|
||||
eti = E_TABLE_ITEM (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_TABLE_HEADER:
|
||||
eti_remove_header_model (eti);
|
||||
@ -1481,7 +1496,7 @@ eti_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpe
|
||||
if ((eti->minimum_width == eti->width && g_value_get_double(value) > eti->width) ||
|
||||
g_value_get_double(value) < eti->width) {
|
||||
eti->needs_compute_width = 1;
|
||||
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti));
|
||||
e_canvas_item_request_reflow (item);
|
||||
}
|
||||
eti->minimum_width = g_value_get_double (value);
|
||||
break;
|
||||
@ -1495,18 +1510,18 @@ eti_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpe
|
||||
case PROP_UNIFORM_ROW_HEIGHT:
|
||||
if (eti->uniform_row_height != g_value_get_boolean (value)) {
|
||||
eti->uniform_row_height = g_value_get_boolean (value);
|
||||
if (GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED) {
|
||||
free_height_cache(eti);
|
||||
eti->needs_compute_height = 1;
|
||||
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
|
||||
e_canvas_item_request_reflow (item);
|
||||
eti->needs_redraw = 1;
|
||||
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
|
||||
gnome_canvas_item_request_update (item);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
eti->needs_redraw = 1;
|
||||
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(eti));
|
||||
gnome_canvas_item_request_update (item);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2765,7 +2780,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
|
||||
static void
|
||||
eti_style_set (ETableItem *eti, GtkStyle *previous_style)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
if (eti->cell_views_realized) {
|
||||
@ -3074,9 +3091,10 @@ e_table_item_get_focused_column (ETableItem *eti)
|
||||
static void
|
||||
eti_cursor_change (ESelectionModel *selection, gint row, gint col, ETableItem *eti)
|
||||
{
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
gint view_row;
|
||||
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
view_row = model_to_view_row(eti, row);
|
||||
@ -3112,10 +3130,11 @@ eti_cursor_change (ESelectionModel *selection, gint row, gint col, ETableItem *e
|
||||
static void
|
||||
eti_cursor_activated (ESelectionModel *selection, gint row, gint col, ETableItem *eti)
|
||||
{
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
gint view_row;
|
||||
gint view_col;
|
||||
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
view_row = model_to_view_row(eti, row);
|
||||
@ -3143,7 +3162,9 @@ eti_cursor_activated (ESelectionModel *selection, gint row, gint col, ETableItem
|
||||
static void
|
||||
eti_selection_change (ESelectionModel *selection, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
eti->needs_redraw = TRUE;
|
||||
@ -3153,7 +3174,9 @@ eti_selection_change (ESelectionModel *selection, ETableItem *eti)
|
||||
static void
|
||||
eti_selection_row_change (ESelectionModel *selection, gint row, ETableItem *eti)
|
||||
{
|
||||
if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
|
||||
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
if (!eti->needs_redraw) {
|
||||
|
||||
@ -730,14 +730,14 @@ e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GPar
|
||||
break;
|
||||
case PROP_MINIMUM_WIDTH:
|
||||
reflow->minimum_width = g_value_get_double (value);
|
||||
if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED)
|
||||
set_empty(reflow);
|
||||
e_canvas_item_request_reflow(item);
|
||||
break;
|
||||
case PROP_EMPTY_MESSAGE:
|
||||
g_free(reflow->empty_message);
|
||||
reflow->empty_message = g_strdup(g_value_get_string (value));
|
||||
if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
|
||||
if (item->flags & GNOME_CANVAS_ITEM_REALIZED)
|
||||
set_empty(reflow);
|
||||
break;
|
||||
case PROP_MODEL:
|
||||
@ -1382,7 +1382,7 @@ e_reflow_reflow( GnomeCanvasItem *item, gint flags )
|
||||
gint next_column;
|
||||
gint i;
|
||||
|
||||
if (!(GTK_OBJECT_FLAGS (reflow) & GNOME_CANVAS_ITEM_REALIZED))
|
||||
if (!(item->flags & GNOME_CANVAS_ITEM_REALIZED))
|
||||
return;
|
||||
|
||||
if (reflow->need_reflow_columns) {
|
||||
|
||||
Reference in New Issue
Block a user