From 999074a9c6d6844c9786dfb1b141509762c7df99 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 13 Jan 2010 22:16:08 -0500 Subject: Remove unused ECell::show_tooltip method. --- widgets/table/e-cell-popup.c | 21 ------ widgets/table/e-cell-text.c | 162 ---------------------------------------- widgets/table/e-cell-tree.c | 22 ------ widgets/table/e-cell-vbox.c | 173 ------------------------------------------- widgets/table/e-cell.c | 15 ---- widgets/table/e-cell.h | 7 -- 6 files changed, 400 deletions(-) diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index c4ca572a85..62777792b3 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -99,12 +99,6 @@ static gdouble ecp_print_height (ECellView *ecv, static gint ecp_max_width (ECellView *ecv, gint model_col, gint view_col); -static void ecp_show_tooltip (ECellView *ecv, - gint model_col, - gint view_col, - gint row, - gint col_width, - ETableTooltip *tooltip); static gchar *ecp_get_bg_color (ECellView *ecell_view, gint row); static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, @@ -133,7 +127,6 @@ e_cell_popup_class_init (ECellPopupClass *klass) ecc->print = ecp_print; ecc->print_height = ecp_print_height; ecc->max_width = ecp_max_width; - ecc->show_tooltip = ecp_show_tooltip; ecc->get_bg_color = ecp_get_bg_color; gal_a11y_e_cell_registry_add_cell_type (NULL, @@ -424,20 +417,6 @@ ecp_max_width (ECellView *ecv, return e_cell_max_width (ecp_view->child_view, model_col, view_col); } -static void -ecp_show_tooltip (ECellView *ecv, - gint model_col, - gint view_col, - gint row, - gint col_width, - ETableTooltip *tooltip) -{ - ECellPopupView *ecp_view = (ECellPopupView *) ecv; - - e_cell_show_tooltip (ecp_view->child_view, model_col, view_col, row, - col_width, tooltip); -} - static gchar * ecp_get_bg_color (ECellView *ecell_view, gint row) { diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index dd8aeb949a..116ff0d848 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1480,167 +1480,6 @@ ect_max_width_by_row (ECellView *ecell_view, return width + 8; } -static gint -tooltip_event (GtkWidget *window, - GdkEvent *event, - ETableTooltip *tooltip) -{ - gint ret_val = FALSE; - - switch (event->type) { - case GDK_LEAVE_NOTIFY: - e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - if (event->type == GDK_BUTTON_RELEASE) { - e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); - } - - event->button.x = tooltip->cx; - event->button.y = tooltip->cy; - g_signal_emit_by_name (tooltip->eti, "event", - event, &ret_val); - if (!ret_val) - gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(tooltip->eti)->canvas), event); - ret_val = TRUE; - break; - case GDK_KEY_PRESS: - e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); - g_signal_emit_by_name (tooltip->eti, "event", - event, &ret_val); - if (!ret_val) - gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(tooltip->eti)->canvas), event); - ret_val = TRUE; - break; - default: - break; - } - - return ret_val; -} - -static void -ect_show_tooltip (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - gint col_width, - ETableTooltip *tooltip) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas; - double i2c[6]; - ArtPoint origin = {0, 0}; - ArtPoint pixel_origin; - gint canvas_x, canvas_y; - GnomeCanvasItem *tooltip_text; - double tooltip_width; - double tooltip_height; - double tooltip_x; - double tooltip_y; - GnomeCanvasItem *rect; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - GtkWidget *window; - PangoLayout *layout; - gint width, height; - - tooltip->timer = 0; - - layout = generate_layout (text_view, model_col, view_col, row, col_width); - - pango_layout_get_pixel_size (layout, &width, &height); - if (width < col_width - 8) { - return; - } - - gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (tooltip->eti), i2c); - art_affine_point (&pixel_origin, &origin, i2c); - - gdk_window_get_origin (GTK_WIDGET (text_view->canvas)->window, - &canvas_x, &canvas_y); - pixel_origin.x += canvas_x; - pixel_origin.y += canvas_y; - pixel_origin.x -= (gint) gtk_layout_get_hadjustment (GTK_LAYOUT (text_view->canvas))->value; - pixel_origin.y -= (gint) gtk_layout_get_vadjustment (GTK_LAYOUT (text_view->canvas))->value; - - window = gtk_window_new (GTK_WINDOW_POPUP); - gtk_container_set_border_width (GTK_CONTAINER (window), 1); - gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_TOOLTIP); - - canvas = e_canvas_new (); - gtk_container_add (GTK_CONTAINER (window), canvas); - GTK_WIDGET_UNSET_FLAGS (canvas, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (window, GTK_CAN_FOCUS); - - rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - gnome_canvas_rect_get_type (), - "x1", (double) 0.0, - "y1", (double) 0.0, - "x2", (double) width + 4, - "y2", (double) height, - "fill_color_gdk", tooltip->background, - NULL); - - tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "anchor", GTK_ANCHOR_NW, - "bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row), - "strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row), - "underline", (gboolean) ect->underline_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row), - "fill_color_gdk", tooltip->foreground, - "text", pango_layout_get_text (layout), - "editable", FALSE, - "clip_width", (double) width, - "clip_height", (double) height, - "clip", TRUE, - "line_wrap", FALSE, - "justification", E_CELL_TEXT (text_view->cell_view.ecell)->justify, - "draw_background", FALSE, - NULL); - - tooltip_width = width; - tooltip_height = height; - tooltip_y = tooltip->y; - - /* This looks very broken since tooltip_x is never used?! - * Maybe tooltip->x is what was meant here and just get rid of - * both tooltip_x and tooltip_y? - */ - switch (E_CELL_TEXT (text_view->cell_view.ecell)->justify) { - case GTK_JUSTIFY_CENTER: - tooltip_x = - tooltip_width / 2; - break; - case GTK_JUSTIFY_RIGHT: - tooltip_x = tooltip_width / 2; - break; - case GTK_JUSTIFY_FILL: - case GTK_JUSTIFY_LEFT: - tooltip_x = tooltip->x; - break; - } - - gnome_canvas_item_move (tooltip_text, 3.0, 1.0); - gnome_canvas_item_set (rect, - "x2", (double) tooltip_width + 6, - "y2", (double) tooltip->row_height + 1, - NULL); - gtk_widget_set_size_request (window, tooltip_width + 6, - tooltip->row_height + 1); - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, - (double) tooltip_width + 6, - (double) tooltip_height); - gtk_widget_show (canvas); - gtk_widget_realize (window); - g_signal_connect (window, "event", - G_CALLBACK (tooltip_event), tooltip); - - e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y - 1); - - return; -} - /* * GtkObject::destroy method */ @@ -1764,7 +1603,6 @@ e_cell_text_class_init (ECellTextClass *klass) ecc->print_height = ect_print_height; ecc->max_width = ect_max_width; ecc->max_width_by_row = ect_max_width_by_row; - ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; klass->get_text = ect_real_get_text; diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 0a1f433e6e..fac7b9784f 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -636,27 +636,6 @@ ect_max_width (ECellView *ecell_view, gint model_col, gint view_col) return max_width; } -/* - * ECellView::show_tooltip method - */ -static void -ect_show_tooltip (ECellView *ecell_view, gint model_col, gint view_col, gint row, - gint col_width, ETableTooltip *tooltip) -{ - ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); - ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row); - gint offset = offset_of_node (ecell_view->e_table_model, row); - GdkPixbuf *node_image; - - node_image = e_tree_model_icon_at (tree_model, node); - if (node_image) - offset += gdk_pixbuf_get_width (node_image); - - tooltip->x += offset; - e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip); -} - /* * ECellView::get_bg_color method */ @@ -839,7 +818,6 @@ e_cell_tree_class_init (ECellTreeClass *klass) ecc->print = ect_print; ecc->print_height = ect_print_height; ecc->max_width = ect_max_width; - ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_TREE_TYPE, gal_a11y_e_cell_tree_new); diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index db12ed14e9..767d4d1c4f 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -221,169 +221,6 @@ ecv_max_width (ECellView *ecell_view, gint model_col, gint view_col) return max_width; } -#if 0 -/* - * ECellView::show_tooltip method - */ -static void -ecv_show_tooltip (ECellView *ecell_view, gint model_col, gint view_col, gint row, - gint col_width, ETableTooltip *tooltip) -{ - ECellVboxView *vbox_view = (ECellVboxView *) ecell_view; - EVboxModel *vbox_model = e_cell_vbox_get_vbox_model (ecell_view->e_table_model, row); - EVboxPath node = e_cell_vbox_get_node (ecell_view->e_table_model, row); - gint offset = offset_of_node (ecell_view->e_table_model, row); - GdkPixbuf *node_image; - - node_image = e_vbox_model_icon_at (vbox_model, node); - if (node_image) - offset += gdk_pixbuf_get_width (node_image); - - tooltip->x += offset; - e_cell_show_tooltip (vbox_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip); -} - -/* - * ECellView::get_bg_color method - */ -static gchar * -ecv_get_bg_color (ECellView *ecell_view, gint row) -{ - ECellVboxView *vbox_view = (ECellVboxView *) ecell_view; - - return e_cell_get_bg_color (vbox_view->subcell_views[0], row); -} - -/* - * ECellView::enter_edit method - */ -static gpointer -ecv_enter_edit (ECellView *ecell_view, gint model_col, gint view_col, gint row) -{ - /* just defer to our subcell's view */ - ECellVboxView *vbox_view = (ECellVboxView *) ecell_view; - - return e_cell_enter_edit (vbox_view->subcell_view, model_col, view_col, row); -} - -/* - * ECellView::leave_edit method - */ -static void -ecv_leave_edit (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer edit_context) -{ - /* just defer to our subcell's view */ - ECellVboxView *vbox_view = (ECellVboxView *) ecell_view; - - e_cell_leave_edit (vbox_view->subcell_view, model_col, view_col, row, edit_context); -} - -static void -ecv_print (ECellView *ecell_view, GnomePrintContext *context, - gint model_col, gint view_col, gint row, - double width, double height) -{ - ECellVboxView *vbox_view = (ECellVboxView *) ecell_view; - - if (/* XXX only if we're the active sort */ TRUE) { - EVboxModel *vbox_model = e_cell_vbox_get_vbox_model (ecell_view->e_table_model, row); - EVboxTableAdapter *vbox_table_adapter = e_cell_vbox_get_vbox_table_adapter(ecell_view->e_table_model, row); - EVboxPath node = e_cell_vbox_get_node (ecell_view->e_table_model, row); - gint offset = offset_of_node (ecell_view->e_table_model, row); - gint subcell_offset = offset; - gboolean expandable = e_vbox_model_node_is_expandable (vbox_model, node); - gboolean expanded = e_vbox_table_adapter_node_is_expanded (vbox_table_adapter, node); - - /* draw our lines */ - if (E_CELL_VBOX(vbox_view->cell_view.ecell)->draw_lines) { - gint depth; - - if (!e_vbox_model_node_is_root (vbox_model, node) - || e_vbox_model_node_get_children (vbox_model, node, NULL) > 0) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height / 2); - - gnome_print_lineto (context, - offset, - height / 2); - } - - if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height); - gnome_print_lineto (context, - offset - INDENT_AMOUNT / 2, - (e_vbox_model_node_get_next (vbox_model, node) - ? 0 - : height / 2)); - } - - /* now traverse back up to the root of the vbox, checking at - each level if the node has siblings, and drawing the - correct vertical pipe for it's configuration. */ - node = e_vbox_model_node_get_parent (vbox_model, node); - depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1; - offset -= INDENT_AMOUNT; - while (node && depth != 0) { - if (e_vbox_model_node_get_next(vbox_model, node)) { - gnome_print_moveto (context, - offset - INDENT_AMOUNT / 2, - height); - gnome_print_lineto (context, - offset - INDENT_AMOUNT / 2, - 0); - } - node = e_vbox_model_node_get_parent (vbox_model, node); - depth --; - offset -= INDENT_AMOUNT; - } - } - - /* now draw our icon if we're expandable */ - if (expandable) { - double image_matrix [6] = {16, 0, 0, 16, 0, 0}; - GdkPixbuf *image = (expanded - ? E_CELL_VBOX(vbox_view->cell_view.ecell)->open_pixbuf - : E_CELL_VBOX(vbox_view->cell_view.ecell)->closed_pixbuf); - gint image_width, image_height, image_rowstride; - guchar *image_pixels; - - image_width = gdk_pixbuf_get_width(image); - image_height = gdk_pixbuf_get_height(image); - image_pixels = gdk_pixbuf_get_pixels(image); - image_rowstride = gdk_pixbuf_get_rowstride(image); - - image_matrix [4] = subcell_offset - INDENT_AMOUNT / 2 - image_width / 2; - image_matrix [5] = height / 2 - image_height / 2; - - gnome_print_gsave (context); - gnome_print_concat (context, image_matrix); - - gnome_print_rgbaimage (context, image_pixels, image_width, image_height, image_rowstride); - gnome_print_grestore (context); - } - - gnome_print_stroke (context); - - if (gnome_print_translate(context, subcell_offset, 0) == -1) - /* FIXME */; - width -= subcell_offset; - } - - e_cell_print (vbox_view->subcell_view, context, model_col, view_col, row, width, height); -} - -static gdouble -ecv_print_height (ECellView *ecell_view, GnomePrintContext *context, - gint model_col, gint view_col, gint row, - double width) -{ - return 12; /* XXX */ -} -#endif - /* * GObject::dispose method */ @@ -430,17 +267,7 @@ e_cell_vbox_class_init (ECellVboxClass *klass) ecc->draw = ecv_draw; ecc->event = ecv_event; ecc->height = ecv_height; -#if 0 - ecc->enter_edit = ecv_enter_edit; - ecc->leave_edit = ecv_leave_edit; - ecc->print = ecv_print; - ecc->print_height = ecv_print_height; -#endif ecc->max_width = ecv_max_width; -#if 0 - ecc->show_tooltip = ecv_show_tooltip; - ecc->get_bg_color = ecv_get_bg_color; -#endif gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_VBOX_TYPE, gal_a11y_e_cell_vbox_new); } diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index be674e6374..4c32c18e77 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -126,12 +126,6 @@ ec_free_state (ECellView *ecell_view, gint model_col, gint view_col, gint row, g { } -static void -ec_show_tooltip (ECellView *ecell_view, gint model_col, gint view_col, gint row, gint col_width, ETableTooltip *tooltip) -{ - /* Do nothing */ -} - static void e_cell_class_init (ECellClass *klass) { @@ -153,7 +147,6 @@ e_cell_class_init (ECellClass *klass) klass->print_height = NULL; klass->max_width = NULL; klass->max_width_by_row = NULL; - klass->show_tooltip = ec_show_tooltip; } static void @@ -473,14 +466,6 @@ e_cell_max_width_by_row_implemented (ECellView *ecell_view) return (ECVIEW_EC_CLASS(ecell_view)->max_width_by_row != NULL); } -void -e_cell_show_tooltip (ECellView *ecell_view, gint model_col, gint view_col, - gint row, gint col_width, ETableTooltip *tooltip) -{ - ECVIEW_EC_CLASS(ecell_view)->show_tooltip - (ecell_view, model_col, view_col, row, col_width, tooltip); -} - gchar * e_cell_get_bg_color(ECellView *ecell_view, gint row) { diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index 79adb5c5b4..276bc1999c 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -114,7 +114,6 @@ typedef struct { gint model_col, gint view_col, gint row, gdouble width); gint (*max_width) (ECellView *ecell_view, gint model_col, gint view_col); gint (*max_width_by_row) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - void (*show_tooltip) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gint col_width, ETableTooltip *tooltip); gchar *(*get_bg_color) (ECellView *ecell_view, gint row); void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style); @@ -169,12 +168,6 @@ gint e_cell_max_width_by_row (ECellView *ecell_view, gint view_col, gint row); gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view); -void e_cell_show_tooltip (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - gint col_width, - ETableTooltip *tooltip); gchar *e_cell_get_bg_color (ECellView *ecell_view, gint row); void e_cell_style_set (ECellView *ecell_view, -- cgit