diff options
-rw-r--r-- | widgets/misc/e-canvas.c | 181 | ||||
-rw-r--r-- | widgets/misc/e-canvas.h | 12 |
2 files changed, 3 insertions, 190 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index f1b7713f43..62ff8b89df 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -802,183 +802,7 @@ e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc } void -e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func) -{ - g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func); -} - -void -e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func) -{ - g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func); -} - -void -e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id) -{ - GList *list; - gint flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - canvas = E_CANVAS(item->canvas); - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - g_message ("ECANVAS: free info (2): item %p, id %p", - (gpointer) info->item, (gpointer) info->id); - g_object_unref (info->item); - g_free(info); - } - g_list_free(canvas->selection); - - canvas->selection = NULL; - - gnome_canvas_item_grab_focus(item); - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - g_object_ref (info->item); - info->id = id; - g_message ("ECANVAS: new info item %p, id %p", (gpointer) item, (gpointer) id); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id) -{ -} - -void -e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id) -{ - gint flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_SELECT; - canvas = E_CANVAS(item->canvas); - - if (canvas->cursor) { - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(canvas->cursor->item), - "ECanvasItem::selection_callback"); - if (func) - func(canvas->cursor->item, flags, canvas->cursor->id); - } - - gnome_canvas_item_grab_focus(item); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - - for (list = canvas->selection; list; list = g_list_next(list)) { - ECanvasSelectionInfo *search; - search = list->data; - - if (search->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(search->item), - "ECanvasItem::selection_compare_callback"); - - if (compare_func(search->item, search->id, id, 0) == 0) { - canvas->cursor = search; - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, search->id); - return; - } - } - } - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - g_object_ref (info->item); - info->id = id; - g_message ("ECANVAS: new info (2): item %p, id %p", (gpointer) item, (gpointer) id); - - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id) -{ - gint flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - canvas = E_CANVAS(item->canvas); - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - if (info->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_compare_callback"); - - if (compare_func(info->item, info->id, id, 0) == 0) { - ECanvasItemSelectionFunc func; - func = (ECanvasItemSelectionFunc) g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - canvas->selection = g_list_remove_link(canvas->selection, list); - - if (canvas->cursor == info) - canvas->cursor = NULL; - - g_message ("ECANVAS: removing info: item %p, info %p", - (gpointer) info->item, (gpointer) info->id); - g_object_unref (info->item); - g_free(info); - g_list_free_1(list); - break; - } - } - } -} - -void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, gint x, gint y) +e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, gint x, gint y) { if (canvas->tooltip_window && canvas->tooltip_window != widget) { e_canvas_hide_tooltip(canvas); @@ -999,7 +823,8 @@ void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, gint x, gint y) gtk_widget_show (widget); } -void e_canvas_hide_tooltip (ECanvas *canvas) +void +e_canvas_hide_tooltip (ECanvas *canvas) { if (canvas->tooltip_window) { gtk_widget_destroy (canvas->tooltip_window); diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h index a78824e1ef..7b7ac36315 100644 --- a/widgets/misc/e-canvas.h +++ b/widgets/misc/e-canvas.h @@ -112,16 +112,6 @@ void e_canvas_item_request_reflow (GnomeCanvasItem void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item); void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func); -void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, - ECanvasItemSelectionFunc func); -void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, - ECanvasItemSelectionCompareFunc func); -void e_canvas_item_set_cursor (GnomeCanvasItem *item, - gpointer id); -void e_canvas_item_add_selection (GnomeCanvasItem *item, - gpointer id); -void e_canvas_item_remove_selection (GnomeCanvasItem *item, - gpointer id); gint e_canvas_item_grab (ECanvas *canvas, GnomeCanvasItem *item, @@ -135,8 +125,6 @@ void e_canvas_item_ungrab (ECanvas guint32 etime); /* Not implemented yet. */ -void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, - gpointer id); void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, gint x, |