diff options
author | Mike Kestner <mkestner@src.gnome.org> | 2002-11-01 05:30:57 +0800 |
---|---|---|
committer | Mike Kestner <mkestner@src.gnome.org> | 2002-11-01 05:30:57 +0800 |
commit | 613453b1095e325149b8d37e5731d415e1d5f9bd (patch) | |
tree | 1c0d7f9be4d4a87aa67d8e185ae2bb23d02254b7 /widgets/table | |
parent | ec242d6c30d7bf056c8f59710b8576c942f93583 (diff) | |
download | gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.gz gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.bz2 gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.lz gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.xz gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.zst gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.zip |
merging the gal-2 branch back to the trunk.
merging the gal-2 branch back to the trunk.
svn path=/trunk/; revision=18471
Diffstat (limited to 'widgets/table')
108 files changed, 1421 insertions, 1507 deletions
diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c index 1ce2514b0c..0f842c5507 100644 --- a/widgets/table/e-cell-checkbox.c +++ b/widgets/table/e-cell-checkbox.c @@ -26,7 +26,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-checkbox.h" #include "gal/util/e-util.h" #include "e-table-item.h" diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h index 7d19b5f3c1..f77f33c5d8 100644 --- a/widgets/table/e-cell-checkbox.h +++ b/widgets/table/e-cell-checkbox.h @@ -24,9 +24,8 @@ #define _E_CELL_CHECKBOX_H_ #include <gal/e-table/e-cell-toggle.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) #define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) @@ -45,7 +44,7 @@ typedef struct { GtkType e_cell_checkbox_get_type (void); ECell *e_cell_checkbox_new (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_CHECKBOX_H_ */ diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 70b5d1ccf7..1f54952de7 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -55,6 +55,7 @@ #include <config.h> #include <string.h> /* strcmp() */ #include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> #include "gal/util/e-util.h" #include "gal/widgets/e-unicode.h" #include "e-table-item.h" @@ -202,7 +203,8 @@ e_cell_combo_destroy (GtkObject *object) { ECellCombo *ecc = E_CELL_COMBO (object); - gtk_widget_destroy (ecc->popup_window); + if (ecc->popup_window) + gtk_widget_destroy (ecc->popup_window); ecc->popup_window = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); @@ -405,7 +407,7 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, *y += y1 + 1; scrollbar_width = popup->vscrollbar->requisition.width - + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; + + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing; avail_height = gdk_screen_height () - *y; @@ -422,11 +424,11 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, /* Calculate the desired width. */ *width = list_requisition.width - + 2 * popwin->child->style->klass->xthickness + + 2 * popwin->child->style->xthickness + 2 * GTK_CONTAINER (popwin->child)->border_width + 2 * GTK_CONTAINER (popup)->border_width + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness; + + 2 * GTK_BIN (popup)->child->style->xthickness; /* Use at least the same width as the column. */ if (*width < column_width) @@ -440,16 +442,16 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, } /* Calculate all the borders etc. that we need to add to the height. */ - work_height = (2 * popwin->child->style->klass->ythickness + work_height = (2 * popwin->child->style->ythickness + 2 * GTK_CONTAINER (popwin->child)->border_width + 2 * GTK_CONTAINER (popup)->border_width + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness); + + 2 * GTK_BIN (popup)->child->style->xthickness); /* Add on the height of the horizontal scrollbar if we need it. */ if (show_hscroll) work_height += popup->hscrollbar->requisition.height + - GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing; /* Check if it fits in the available height. */ if (work_height + list_requisition.height > avail_height) { diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h index 6d1490c814..6e64deeb0c 100644 --- a/widgets/table/e-cell-combo.h +++ b/widgets/table/e-cell-combo.h @@ -3,8 +3,8 @@ * e-cell-combo.h: Combo cell renderer * Copyright 2001, Ximian, Inc. * - * Author: - * Damon Chaplin <damon@ximian.com> + * Author : + * Damon Chaplin <damon@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/widgets/table/e-cell-date.h b/widgets/table/e-cell-date.h index 2fff8ed1c6..f86eb5a1a5 100644 --- a/widgets/table/e-cell-date.h +++ b/widgets/table/e-cell-date.h @@ -24,9 +24,8 @@ #define _E_CELL_DATE_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_DATE_TYPE (e_cell_date_get_type ()) #define E_CELL_DATE(o) (GTK_CHECK_CAST ((o), E_CELL_DATE_TYPE, ECellDate)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_date_get_type (void); ECell *e_cell_date_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_DATE_H_ */ diff --git a/widgets/table/e-cell-float.c b/widgets/table/e-cell-float.c index 9b1880be71..aff6c88cc5 100644 --- a/widgets/table/e-cell-float.c +++ b/widgets/table/e-cell-float.c @@ -1,4 +1,4 @@ -/* +/* * e-cell-float.c - Float item for e-table. * Copyright 2001, CodeFactory AB * Copyright 2001, Mikael Hallendal <micke@codefactory.se> diff --git a/widgets/table/e-cell-float.h b/widgets/table/e-cell-float.h index 5ad547fc22..46223bc271 100644 --- a/widgets/table/e-cell-float.h +++ b/widgets/table/e-cell-float.h @@ -1,4 +1,4 @@ -/* +/* * e-cell-float.h - Float item for e-table. * Copyright 2001, CodeFactory AB * Copyright 2001, Mikael Hallendal <micke@codefactory.se> @@ -28,9 +28,8 @@ #define _E_CELL_FLOAT_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_FLOAT_TYPE (e_cell_float_get_type ()) #define E_CELL_FLOAT(o) (GTK_CHECK_CAST ((o), E_CELL_FLOAT_TYPE, ECellFloat)) @@ -49,6 +48,6 @@ typedef struct { GtkType e_cell_float_get_type (void); ECell *e_cell_float_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_FLOAT_H_ */ diff --git a/widgets/table/e-cell-number.h b/widgets/table/e-cell-number.h index 8ea312d4b2..026a1ba2e5 100644 --- a/widgets/table/e-cell-number.h +++ b/widgets/table/e-cell-number.h @@ -24,9 +24,8 @@ #define _E_CELL_NUMBER_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_NUMBER_TYPE (e_cell_number_get_type ()) #define E_CELL_NUMBER(o) (GTK_CHECK_CAST ((o), E_CELL_NUMBER_TYPE, ECellNumber)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_number_get_type (void); ECell *e_cell_number_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_NUMBER_H_ */ diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index 3fc8ead3f9..d58a75dd1c 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -22,7 +22,7 @@ */ #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-pixbuf.h" static ECellClass *parent_class; @@ -43,6 +43,23 @@ enum { ARG_UNSELECTED_COLUMN }; +static int +gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf) +{ + if (gdk_pixbuf_get_has_alpha (pixbuf)) + return gnome_print_rgbaimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); + else + return gnome_print_rgbimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); +} + /* * ECellPixbuf functions */ @@ -370,7 +387,7 @@ e_cell_pixbuf_class_init (GtkObjectClass *object_class) GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_UNSELECTED_COLUMN); } -guint +GtkType e_cell_pixbuf_get_type (void) { static guint type = 0; @@ -382,8 +399,7 @@ e_cell_pixbuf_get_type (void) sizeof (ECellPixbufClass), (GtkClassInitFunc) e_cell_pixbuf_class_init, (GtkObjectInitFunc) e_cell_pixbuf_init, - NULL, - NULL, + NULL, NULL, }; type = gtk_type_unique (e_cell_get_type (), &type_info); diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h index 938cb84bb4..c405752723 100644 --- a/widgets/table/e-cell-pixbuf.h +++ b/widgets/table/e-cell-pixbuf.h @@ -1,4 +1,4 @@ -/* +/* * e-cell-pixbuf.h - An ECell that displays a GdkPixbuf * Copyright 2001, Ximian, Inc. * diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index 96eebfb6f0..8b7ed04679 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -42,7 +42,7 @@ static void e_cell_popup_class_init (GtkObjectClass *object_class); static void e_cell_popup_init (ECellPopup *ecp); -static void e_cell_popup_destroy (GtkObject *object); +static void e_cell_popup_dispose (GObject *object); static ECellView* ecp_new_view (ECell *ecell, @@ -122,7 +122,7 @@ e_cell_popup_class_init (GtkObjectClass *object_class) { ECellClass *ecc = (ECellClass *) object_class; - object_class->destroy = e_cell_popup_destroy; + G_OBJECT_CLASS (object_class)->dispose = e_cell_popup_dispose; ecc->new_view = ecp_new_view; ecc->kill_view = ecp_kill_view; @@ -171,13 +171,15 @@ e_cell_popup_new (void) * GtkObject::destroy method */ static void -e_cell_popup_destroy (GtkObject *object) +e_cell_popup_dispose (GObject *object) { ECellPopup *ecp = E_CELL_POPUP (object); - gtk_object_unref (GTK_OBJECT (ecp->child)); + if (ecp->child) + gtk_object_unref (GTK_OBJECT (ecp->child)); + ecp->child = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -277,11 +279,6 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable, if (flags & E_CELL_CURSOR) ecp->popup_arrow_shown = show_popup_arrow; -#if 0 - g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n", - row, view_col, x1, y1, x2, y2, show_popup_arrow); -#endif - if (show_popup_arrow) { e_cell_draw (ecp_view->child_view, drawable, model_col, view_col, row, flags, @@ -500,7 +497,7 @@ e_cell_popup_do_popup (ECellPopupView *ecp_view, ecp->popup_cell_view = ecp_view; - popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT (ecp)->klass)->popup; + popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT_GET_CLASS (ecp))->popup; ecp->popup_view_col = view_col; ecp->popup_row = row; diff --git a/widgets/table/e-cell-popup.h b/widgets/table/e-cell-popup.h index eba0d941df..a42a4d4f28 100644 --- a/widgets/table/e-cell-popup.h +++ b/widgets/table/e-cell-popup.h @@ -32,7 +32,7 @@ #ifndef _E_CELL_POPUP_H_ #define _E_CELL_POPUP_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> #define E_CELL_POPUP_TYPE (e_cell_popup_get_type ()) @@ -94,4 +94,8 @@ void e_cell_popup_set_shown (ECellPopup *ecp, gboolean shown); void e_cell_popup_queue_cell_redraw (ECellPopup *ecp); +void e_cell_popup_set_shown (ECellPopup *ecp, + gboolean shown); +void e_cell_popup_queue_cell_redraw (ECellPopup *ecp); + #endif /* _E_CELL_POPUP_H_ */ diff --git a/widgets/table/e-cell-progress.c b/widgets/table/e-cell-progress.c index d38adb5082..6f90a0cb3b 100644 --- a/widgets/table/e-cell-progress.c +++ b/widgets/table/e-cell-progress.c @@ -38,7 +38,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-progress.h" #include "gal/util/e-util.h" #include "e-table-item.h" diff --git a/widgets/table/e-cell-progress.h b/widgets/table/e-cell-progress.h index 4cd09ed0de..f71081016c 100644 --- a/widgets/table/e-cell-progress.h +++ b/widgets/table/e-cell-progress.h @@ -25,11 +25,11 @@ #ifndef _E_CELL_PROGRESS_H_ #define _E_CELL_PROGRESS_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gal/e-table/e-cell.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_PROGRESS_TYPE (e_cell_progress_get_type ()) #define E_CELL_PROGRESS(o) (GTK_CHECK_CAST ((o), E_CELL_PROGRESS_TYPE, ECellProgress)) @@ -67,7 +67,7 @@ void e_cell_progress_set_padding (ECellProgress *eprog, int padding); void e_cell_progress_set_border (ECellProgress *eprog, int border); void e_cell_progress_set_color (ECellProgress *eprog, guchar red, guchar green, guchar blue); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_PROGRESS_H_ */ diff --git a/widgets/table/e-cell-size.h b/widgets/table/e-cell-size.h index 3316b2a5ff..c8c4b40b75 100644 --- a/widgets/table/e-cell-size.h +++ b/widgets/table/e-cell-size.h @@ -24,9 +24,8 @@ #define _E_CELL_SIZE_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_SIZE_TYPE (e_cell_size_get_type ()) #define E_CELL_SIZE(o) (GTK_CHECK_CAST ((o), E_CELL_SIZE_TYPE, ECellSize)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_size_get_type (void); ECell *e_cell_size_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_SIZE_H_ */ diff --git a/widgets/table/e-cell-spin-button.c b/widgets/table/e-cell-spin-button.c index 917cb9e310..9c11e6c22f 100644 --- a/widgets/table/e-cell-spin-button.c +++ b/widgets/table/e-cell-spin-button.c @@ -348,7 +348,7 @@ ecsb_event (ECellView *ecv, ecsb_view = (ECellSpinButtonView *) ecv; ecsb = E_CELL_SPIN_BUTTON (ecsb_view->cell_view.ecell); - ecsb_class = E_CELL_SPIN_BUTTON_CLASS (GTK_OBJECT(ecsb)->klass); + ecsb_class = E_CELL_SPIN_BUTTON_CLASS (GTK_OBJECT_GET_CLASS (ecsb)); eti = E_TABLE_ITEM (ecsb_view->cell_view.e_table_item_view); switch (event->type) { @@ -474,12 +474,11 @@ ecsb_focus (ECellView *ecell_view, ecsb_view = (ECellSpinButtonView *) ecell_view; - klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass); + klass = E_CELL_GET_CLASS (ecell_view->ecell); - if (klass->focus) { + if (klass->focus) klass->focus (ecell_view, model_col, view_col, row, x1, y1, x2, y2); - } } static void @@ -489,12 +488,10 @@ ecsb_unfocus (ECellView *ecell_view) ECellSpinButtonView *ecsb_view; ecsb_view = (ECellSpinButtonView *) ecell_view; - klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass); + klass = E_CELL_GET_CLASS (ecell_view->ecell); - if (klass->unfocus) { + if (klass->unfocus) klass->unfocus (ecell_view); - } - } static void @@ -516,7 +513,7 @@ ecsb_show_tooltip (ECellView *ecv, } static void -ecsb_destroy (GtkObject *object) +ecsb_destroy (GtkObject *object) { ECellSpinButton *mcsp; @@ -543,7 +540,7 @@ e_cell_spin_button_new (gint min, GTK_JUSTIFY_LEFT); gtk_signal_connect (GTK_OBJECT (ecsb), "step", - e_cell_spin_button_step, + GTK_SIGNAL_FUNC (e_cell_spin_button_step), NULL); } @@ -568,7 +565,7 @@ e_cell_spin_button_new_float (gfloat min, if (!child_cell) { child_cell = e_cell_float_new (NULL, GTK_JUSTIFY_LEFT); gtk_signal_connect (GTK_OBJECT (ecsb), "step", - e_cell_spin_button_step_float, + GTK_SIGNAL_FUNC (e_cell_spin_button_step_float), NULL); } diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index edbea905e7..c72e5248b4 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -5,7 +5,7 @@ * * Authors: * Miguel de Icaza <miguel@ximian.com> - * Chris Lahey <clahey@ximian.com> + * Chris Lahey <clahey@ximian.com> * * A lot of code taken from: * @@ -40,15 +40,10 @@ #include <math.h> #include <string.h> #include <gdk/gdkx.h> /* for BlackPixel */ -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <gtk/gtkwidget.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtk.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-cell-text.h" #include "gal/util/e-util.h" #include "gal/widgets/e-canvas.h" @@ -58,9 +53,11 @@ #include "gal/util/e-text-event-processor.h" #include "gal/e-text/e-text.h" #include "gal/util/e-text-event-processor-emacs-like.h" +#include "gal/util/e-i18n.h" #include "e-table-tooltip.h" #define d(x) +#define DO_SELECTION 1 #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -68,7 +65,7 @@ #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x))) #endif -#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT((c))->klass)) +#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT_GET_CLASS ((c)))) /* This defines a line of text */ struct line { @@ -132,19 +129,16 @@ typedef struct { } ECellTextView; -typedef struct _CurrentCell{ +struct _CellEdit { + ECellTextView *text_view; - int width; - char *text; - int model_col, view_col, row; - ECellTextLineBreaks *breaks; - EFontStyle style; -} CurrentCell; -#define CURRENT_CELL(x) ((CurrentCell *)(x)) + int model_col, view_col, row; + int cell_width; -struct _CellEdit { - CurrentCell cell; + PangoLayout *layout; + + char *text; char *old_text; @@ -193,33 +187,11 @@ static void e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProces static void e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time); static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length); -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit); -static int number_of_lines (char *text); -static void split_into_lines (CurrentCell *cell); -static void unref_lines (CurrentCell *cell); -static void calc_line_widths (CurrentCell *cell); -static int get_line_ypos (CurrentCell *cell, struct line *line); -static int get_line_xpos (CurrentCell *cell, struct line *line); static void _get_tep (CellEdit *edit); -static gint _get_position_from_xy (CurrentCell *cell, gint x, gint y); -static void _get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp); +static gint get_position_from_xy (CellEdit *edit, gint x, gint y); static gboolean _blink_scroll_timeout (gpointer data); -static void build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row); -static void unbuild_current_cell (CurrentCell *cell); static void calc_ellipsis (ECellTextView *text_view); static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap); static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec); @@ -280,6 +252,14 @@ ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row) view_col, view_row, view_col, view_row); } +static void +invisible_finalize (gpointer data, + GObject *invisible) +{ + CellEdit *edit = data; + edit->invisible = NULL; +} + /* * Shuts down the editing process */ @@ -289,19 +269,19 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit) CellEdit *edit = text_view->edit; int row, view_col, model_col; char *old_text, *text; - CurrentCell *cell = (CurrentCell *) text_view->edit; if (!edit) return; - row = cell->row; - view_col = cell->view_col; - model_col = cell->model_col; + row = edit->row; + view_col = edit->view_col; + model_col = edit->model_col; old_text = edit->old_text; - text = cell->text; - if (edit->invisible) - gtk_widget_unref (edit->invisible); + text = edit->text; + if (edit->invisible) { + g_object_weak_unref (G_OBJECT (edit->invisible), invisible_finalize, edit); + } if (edit->tep) gtk_object_unref (GTK_OBJECT(edit->tep)); if (edit->primary_selection) @@ -322,6 +302,9 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit) edit->timer = NULL; } + if (edit->layout) + g_object_unref (edit->layout); + g_free (edit); text_view->edit = NULL; @@ -402,7 +385,8 @@ ect_realize (ECellView *ecell_view) text_view->font = e_font_from_gdk_name (ect->font_name); } if (!text_view->font){ - text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font); + gdk_font_ref (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style)); + text_view->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style)); } calc_ellipsis (text_view); @@ -452,29 +436,133 @@ ect_unrealize (ECellView *ecv) static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap) { - g_free (color_spec); /* This frees the color. Note we don't free it if it is the special value. */ if (color != (GdkColor*) 1) { - gdk_colors_free (colormap, &color->pixel, 1, 0); + gulong pix = color->pixel; + + gdk_colors_free (colormap, &pix, 1, 0); /* This frees the memory for the GdkColor. */ gdk_color_free (color); } } -static void -set_style(ECellView *ecell_view, CurrentCell *cell, int row) +static PangoLayout * +build_layout (ECellTextView *text_view, int row, const char *text) { - EFontStyle style = E_FONT_PLAIN; + ECellView *ecell_view = (ECellView *) text_view; ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; + gboolean bold, strikeout; + + layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text); + + bold = ect->bold_column >= 0 && + row >= 0 && + e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row); + strikeout = ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row); + + if (bold || strikeout) { + PangoAttrList *attrs; + int length = strlen (text); + attrs = pango_attr_list_new (); + if (bold) { + PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); + attr->start_index = 0; + attr->end_index = length; + + pango_attr_list_insert_before (attrs, attr); + } + if (strikeout) { + PangoAttribute *attr = pango_attr_strikethrough_new (TRUE); + attr->start_index = 0; + attr->end_index = length; - if (ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row)) - style = E_FONT_BOLD; + pango_attr_list_insert_before (attrs, attr); + } + pango_layout_set_attributes (layout, attrs); + pango_attr_list_unref (attrs); + } - cell->style = style; + return layout; +} + +static PangoLayout * +generate_layout (ECellTextView *text_view, int model_col, int view_col, int row) +{ + ECellView *ecell_view = (ECellView *) text_view; + ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; + CellEdit *edit = text_view->edit; + + if (edit && edit->model_col == model_col && edit->row == row) { + g_object_ref (edit->layout); + return edit->layout; + } + + if (row >= 0) { + char *temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); + layout = build_layout (text_view, row, temp); + e_cell_text_free_text(ect, temp); + } else + layout = build_layout (text_view, row, "Mumbo Jumbo"); + + return layout; +} + +static void +draw_pango_rectangle (GdkDrawable *drawable, GdkGC *gc, int x1, int y1, PangoRectangle rect) +{ + int width = rect.width / PANGO_SCALE; + int height = rect.height / PANGO_SCALE; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + gdk_draw_rectangle (drawable, gc, TRUE, + x1 + rect.x / PANGO_SCALE, y1 + rect.y / PANGO_SCALE, width, height); +} + +static gboolean +show_pango_rectangle (CellEdit *edit, PangoRectangle rect) +{ + int x1 = rect.x / PANGO_SCALE; + int x2 = (rect.x + rect.width) / PANGO_SCALE; +#if 0 + int y1 = rect.y / PANGO_SCALE; + int y2 = (rect.y + rect.height) / PANGO_SCALE; +#endif + + int new_xofs_edit = edit->xofs_edit; + int new_yofs_edit = edit->yofs_edit; + + if (x1 < new_xofs_edit) + new_xofs_edit = x1; + if (2 + x2 - edit->cell_width > new_xofs_edit) + new_xofs_edit = 2 + x2 - edit->cell_width; + if (new_xofs_edit < 0) + new_xofs_edit = 0; + +#if 0 + if (y1 < new_yofs_edit) + new_yofs_edit = y1; + if (2 + y2 - edit->cell_height > new_yofs_edit) + new_yofs_edit = 2 + y2 - edit->cell_height; + if (new_yofs_edit < 0) + new_yofs_edit = 0; +#endif + + if (new_xofs_edit != edit->xofs_edit || + new_yofs_edit != edit->yofs_edit) { + edit->xofs_edit = new_xofs_edit; + edit->yofs_edit = new_yofs_edit; + return TRUE; + } + + return FALSE; } /* @@ -485,70 +573,39 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, int model_col, int view_col, int row, ECellFlags flags, int x1, int y1, int x2, int y2) { - /* New ECellText */ - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - EFont *font = text_view->font; - const int height = e_font_height (text_view->font); + ECellText *ect = E_CELL_TEXT (ecell_view->ecell); CellEdit *edit = text_view->edit; - gboolean edit_display = FALSE; - ECellTextLineBreaks *linebreaks; - GdkColor *foreground, *cell_foreground, *cursor_color; - gchar *color_spec; gboolean selected; - EFontStyle style = E_FONT_PLAIN; + GdkColor *foreground, *cursor_color; + GtkWidget *canvas = GTK_WIDGET (text_view->canvas); + GdkRectangle clip_rect; + int x_origin, y_origin; selected = flags & E_CELL_SELECTED; - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - fg_gc = canvas->style->fg_gc[edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - } else - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } else { - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } - - /* - * Be a nice citizen: clip to the region we are supposed to draw on - */ - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if (selected){ + if (selected) { if (flags & E_CELL_FOCUSED) - foreground = &canvas->style->text [GTK_STATE_SELECTED]; + foreground = &canvas->style->fg [GTK_STATE_SELECTED]; else - foreground = &canvas->style->text [GTK_STATE_ACTIVE]; + foreground = &canvas->style->fg [GTK_STATE_ACTIVE]; + cursor_color = foreground; } else { foreground = &canvas->style->text [GTK_STATE_NORMAL]; - } - - cursor_color = foreground; - - if (ect->color_column != -1 && ! selected) { - color_spec = e_table_model_value_at (ecell_view->e_table_model, - ect->color_column, row); - cell_foreground = e_cell_text_get_color (text_view, - color_spec); - if (cell_foreground) - foreground = cell_foreground; + cursor_color = foreground; + + if (ect->color_column != -1) { + char *color_spec; + GdkColor *cell_foreground; + + color_spec = e_table_model_value_at (ecell_view->e_table_model, + ect->color_column, row); + cell_foreground = e_cell_text_get_color (text_view, + color_spec); + if (cell_foreground) + foreground = cell_foreground; + } } gdk_gc_set_foreground (text_view->gc, foreground); @@ -558,179 +615,98 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, x2 -= 4; y2 -= 1; - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ + x_origin = x1 + ect->x + text_view->xofs - (edit ? edit->xofs_edit : 0); + y_origin = y1 + ect->y + text_view->yofs - (edit ? edit->yofs_edit : 0); + + clip_rect.x = x1; + clip_rect.y = y1; + clip_rect.width = x2 - x1; + clip_rect.height = y2 - y1; + + gdk_gc_set_clip_rectangle (text_view->gc, &clip_rect); + /* clip_rect = ▭*/ + + layout = generate_layout (text_view, model_col, view_col, row); + + gdk_draw_layout (drawable, text_view->gc, + x_origin, y_origin, + layout); + + if (edit && edit->view_col == view_col && edit->row == row) { + if (edit->selection_start != edit->selection_end) { + int start_index, end_index; + PangoLayoutLine *line; + gint *ranges; + gint n_ranges, i; + PangoRectangle logical_rect; + GdkRegion *clip_region = gdk_region_new (); + GdkRegion *rect_region; + GdkGC *selection_gc; + GdkGC *text_gc; + + start_index = MIN (edit->selection_start, edit->selection_end); + end_index = edit->selection_start ^ edit->selection_end ^ start_index; + + if (edit->has_selection) { + selection_gc = canvas->style->base_gc [GTK_STATE_SELECTED]; + text_gc = canvas->style->text_gc[GTK_STATE_SELECTED]; + } else { + selection_gc = canvas->style->base_gc [GTK_STATE_ACTIVE]; + text_gc = canvas->style->text_gc[GTK_STATE_ACTIVE]; + } - if (edit_display){ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); + gdk_gc_set_clip_rectangle (selection_gc, &clip_rect); - set_style(ecell_view, cell, row); + line = pango_layout_get_lines (layout)->data; - style = cell->style; + pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges); - cell->width = x2 - x1; - - split_into_lines (cell); + pango_layout_get_extents (layout, NULL, &logical_rect); - linebreaks = cell->breaks; - - lines = linebreaks->lines; - ypos = get_line_ypos (cell, lines); - ypos += e_font_ascent (text_view->font); - ypos -= edit->yofs_edit; + for (i=0; i < n_ranges; i++) { + GdkRectangle sel_rect; - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (cell, lines); - xpos -= edit->xofs_edit; + sel_rect.x = x_origin + ranges[2*i] / PANGO_SCALE; + sel_rect.y = y_origin; + sel_rect.width = (ranges[2*i + 1] - ranges[2*i]) / PANGO_SCALE; + sel_rect.height = logical_rect.height / PANGO_SCALE; - /* start_char, end_char, sel_start and sel_end are IN BYTES */ + gdk_draw_rectangle (drawable, selection_gc, TRUE, + sel_rect.x, sel_rect.y, sel_rect.width, sel_rect.height); - start_char = lines->text - cell->text; - end_char = start_char + lines->length; - - sel_start = edit->selection_start; - sel_end = edit->selection_end; - - if (sel_start > sel_end){ - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if (sel_start < start_char) - sel_start = start_char; - if (sel_end > end_char) - sel_end = end_char; - - if (sel_start < sel_end){ - sel_rect.x = xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char); - sel_rect.y = ypos + y1 - e_font_ascent (font); - sel_rect.width = e_font_utf8_text_width (font, style, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = height; - gtk_paint_flat_box (canvas->style, - drawable, - - edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - canvas, - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - - e_font_draw_utf8_text (drawable, font, style, text_view->gc, xpos + x1, ypos + y1, - lines->text, - sel_start - start_char); - e_font_draw_utf8_text (drawable, font, style, fg_gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1, - lines->text + sel_start - start_char, - sel_end - sel_start); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_end - start_char), - ypos + y1, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->length); - } - if (edit->selection_start == edit->selection_end && - edit->selection_start >= start_char && - edit->selection_start <= end_char && - edit->show_cursor) { - gdk_gc_set_foreground (text_view->gc, cursor_color); - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1 - e_font_ascent (font), - 1, - height); + gdk_region_union_with_rect (clip_region, &sel_rect); } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); - } - ypos += height; - lines ++; - } - unref_lines (cell); - } else { - - ECellTextLineBreaks *linebreaks; - CurrentCell cell; - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - style = cell.style; + rect_region = gdk_region_rectangle (&clip_rect); + gdk_region_intersect (clip_region, rect_region); + gdk_region_destroy (rect_region); - cell.width = x2 - x1; - - split_into_lines (&cell); - - linebreaks = cell.breaks; - lines = linebreaks->lines; - ypos = get_line_ypos (&cell, lines); - ypos += e_font_ascent (text_view->font); - - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (&cell, lines); - if (ect->use_ellipsis && lines->ellipsis_length < lines->length) { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->ellipsis_length); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + lines->width - text_view->ellipsis_width[style], - ypos + y1, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); + gdk_gc_set_clip_region (text_gc, clip_region); + gdk_draw_layout (drawable, text_gc, + x_origin, y_origin, + layout); + gdk_gc_set_clip_region (text_gc, NULL); + gdk_gc_set_clip_region (selection_gc, NULL); + + gdk_region_destroy (clip_region); + g_free (ranges); + } else { + if (edit->show_cursor) { + PangoRectangle strong_pos, weak_pos; + pango_layout_get_cursor_pos (layout, edit->selection_start, &strong_pos, &weak_pos); + draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, strong_pos); + if (strong_pos.x != weak_pos.x || + strong_pos.y != weak_pos.y || + strong_pos.width != weak_pos.width || + strong_pos.height != weak_pos.height) + draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, weak_pos); } - ypos += height; - lines++; } - unref_lines (&cell); - unbuild_current_cell (&cell); } - gdk_gc_set_clip_rectangle (text_view->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); + g_object_unref (G_OBJECT (layout)); } - /* * Get the background color */ @@ -750,20 +726,6 @@ ect_get_bg_color(ECellView *ecell_view, int row) } -static void -ect_style_set(ECellView *ecell_view, GtkStyle *old_style) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - ECellText *ect = (ECellText *) ecell_view->ecell; - - if (!ect->font_name) { - e_font_unref (text_view->font); - text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font); - } -} - - - /* * Selects the entire string */ @@ -773,7 +735,7 @@ ect_edit_select_all (ECellTextView *text_view) g_assert (text_view->edit); text_view->edit->selection_start = 0; - text_view->edit->selection_end = strlen (text_view->edit->cell.text); + text_view->edit->selection_end = strlen (text_view->edit->text); } static gboolean @@ -797,28 +759,15 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, CellEdit *edit = text_view->edit; GtkWidget *canvas = GTK_WIDGET (text_view->canvas); gint return_val = 0; - CurrentCell cell, *cellptr; d(gboolean press = FALSE); if (!(flags & E_CELL_EDITING)) return 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - cellptr = CURRENT_CELL(edit); - } else { - cellptr = &cell; - } - } else { - cellptr = &cell; + if (edit && edit->view_col == view_col && edit->row == row) { + edit_display = TRUE; } - set_style(ecell_view, cellptr, row); - e_tep_event.type = event->type; switch (event->type) { case GDK_FOCUS_CHANGE: @@ -837,7 +786,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); ect_edit_select_all (text_view); edit = text_view->edit; - cellptr = CURRENT_CELL(edit); edit_display = TRUE; } if (edit_display) { @@ -886,14 +834,13 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); edit = text_view->edit; - cellptr = CURRENT_CELL(edit); edit_display = TRUE; e_tep_event.button.type = GDK_BUTTON_PRESS; e_tep_event.button.time = button.time; e_tep_event.button.state = button.state; e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); + e_tep_event.button.position = get_position_from_xy (edit, event->button.x, event->button.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -910,13 +857,13 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, edit->last_state = button.state; e_tep_event.button.type = GDK_BUTTON_RELEASE; - } + } if (edit_display) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; e_tep_event.button.state = button.state; e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); + e_tep_event.button.position = get_position_from_xy (edit, event->button.x, event->button.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -940,7 +887,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, GdkEventMotion motion = event->motion; e_tep_event.motion.time = motion.time; e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy (cellptr, motion.x, motion.y); + e_tep_event.motion.position = get_position_from_xy (edit, event->motion.x, event->motion.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -977,7 +924,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, break; } - unbuild_current_cell (&cell); if (return_val) return return_val; #if 0 @@ -996,22 +942,13 @@ static int ect_height (ECellView *ecell_view, int model_col, int view_col, int row) { ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - gchar *string; - gint value; - - font = text_view->font; + gint height; + PangoLayout *layout; - if (row == -1) { - value = e_font_height (font) + TEXT_PAD; - } else { - string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); - value = e_font_height (font) * number_of_lines(string) + TEXT_PAD; - e_cell_text_free_text(ect, string); - } - - return value; + layout = generate_layout (text_view, model_col, view_col, row); + pango_layout_get_pixel_size (layout, NULL, &height); + g_object_unref (layout); + return height + 2; } /* @@ -1028,9 +965,19 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) edit = g_new (CellEdit, 1); text_view->edit = edit; - build_current_cell (CURRENT_CELL(edit), text_view, model_col, view_col, row); + edit->view_col = -1; + edit->model_col = -1; + edit->row = -1; + + edit->layout = generate_layout (text_view, model_col, view_col, row); - set_style(ecell_view, CURRENT_CELL(edit), row); + edit->text_view = text_view; + edit->model_col = model_col; + edit->view_col = view_col; + edit->row = row; + edit->cell_width = e_table_header_get_column ( + ((ETableItem *)ecell_view->e_table_item_view)->header, + view_col)->width - 8; edit->xofs_edit = 0.0; edit->yofs_edit = 0.0; @@ -1068,7 +1015,7 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); edit->old_text = g_strdup (temp); e_cell_text_free_text(ect, temp); - edit->cell.text = g_strdup (edit->old_text); + edit->text = g_strdup (edit->old_text); #if 0 if (edit->pointer_in){ @@ -1095,9 +1042,6 @@ ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, voi if (edit){ ect_stop_editing (text_view, TRUE); - /* FIXME: edit is freed in ect_stop_editing() so I've - commented this out - Damon. */ - /*unbuild_current_cell (CURRENT_CELL(edit));*/ } else { /* * We did invoke this leave edit internally @@ -1132,7 +1076,7 @@ ect_load_state (ECellView *ecell_view, int model_col, int view_col, int row, voi int length; int *selection = save_state; - length = strlen (edit->cell.text); + length = strlen (edit->text); edit->selection_start = MIN (selection[0], length); edit->selection_end = MIN (selection[1], length); @@ -1154,7 +1098,7 @@ ect_print (ECellView *ecell_view, GnomePrintContext *context, int model_col, int view_col, int row, double width, double height) { - GnomeFont *font = gnome_font_new ("Helvetica", 12); + GnomeFont *font = gnome_font_find ("Helvetica", 12); char *string; ECellText *ect = E_CELL_TEXT(ecell_view->ecell); string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); @@ -1193,32 +1137,23 @@ ect_max_width (ECellView *ecell_view, { /* New ECellText */ ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; int row; int number_of_rows; int max_width = 0; - font = text_view->font; number_of_rows = e_table_model_row_count (ecell_view->e_table_model); for (row = 0; row < number_of_rows; row++) { - CurrentCell cell; - struct line *line; + PangoLayout *layout = generate_layout (text_view, model_col, view_col, row); int width; - build_current_cell (&cell, text_view, model_col, view_col, row); - split_into_lines (&cell); - calc_line_widths (&cell); - - line = (struct line *)cell.breaks->lines; - width = e_font_utf8_text_width (font, cell.style, - line->text, line->length); + pango_layout_get_pixel_size (layout, &width, NULL); + max_width = MAX (max_width, width); - unref_lines (&cell); - unbuild_current_cell (&cell); + g_object_unref (layout); } - return max_width; + return max_width + 8; } static int @@ -1229,24 +1164,17 @@ ect_max_width_by_row (ECellView *ecell_view, { /* New ECellText */ ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - struct line *line; int width; + PangoLayout *layout; if (row >= e_table_model_row_count (ecell_view->e_table_model)) return 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - split_into_lines (&cell); - calc_line_widths (&cell); - - line = (struct line *)cell.breaks->lines; - width = e_font_utf8_text_width (text_view->font, cell.style, - line->text, line->length); - unref_lines (&cell); - unbuild_current_cell (&cell); + layout = generate_layout (text_view, model_col, view_col, row); + pango_layout_get_pixel_size (layout, &width, NULL); + g_object_unref (layout); - return width; + return width + 8; } static gint @@ -1298,12 +1226,7 @@ ect_show_tooltip (ECellView *ecell_view, ETableTooltip *tooltip) { ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - struct line *lines; GtkWidget *canvas; - int i; - gdouble max_width; - gboolean cut_off; double i2c[6]; ArtPoint origin = {0, 0}; ArtPoint pixel_origin; @@ -1314,33 +1237,17 @@ ect_show_tooltip (ECellView *ecell_view, double tooltip_x; double tooltip_y; GnomeCanvasItem *rect; - double text_height; ECellText *ect = E_CELL_TEXT(ecell_view->ecell); GtkWidget *window; + PangoLayout *layout; + int width, height; tooltip->timer = 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - - cell.width = col_width - 8; - split_into_lines (&cell); - calc_line_widths (&cell); - - cut_off = FALSE; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - if (lines->length > lines->ellipsis_length) { - cut_off = TRUE; - break; - } - } + layout = generate_layout (text_view, model_col, view_col, row); - if (!cut_off) { - tooltip->timer = 0; - unref_lines (&cell); - unbuild_current_cell (&cell); + pango_layout_get_pixel_size (layout, &width, &height); + if (width < col_width - 8) { return; } @@ -1362,24 +1269,12 @@ ect_show_tooltip (ECellView *ecell_view, GTK_WIDGET_UNSET_FLAGS (canvas, GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (window, GTK_CAN_FOCUS); - max_width = 0.0; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - gdouble line_width; - - line_width = e_font_utf8_text_width (text_view->font, - cell.style, lines->text, - lines->length); - max_width = MAX (max_width, line_width); - } - - text_height = e_font_height (text_view->font) * cell.breaks->num_lines + 4; 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) max_width + 4, - "y2", (double) text_height, + "x2", (double) width + 4, + "y2", (double) height, "fill_color_gdk", tooltip->background, NULL); @@ -1390,18 +1285,18 @@ ect_show_tooltip (ECellView *ecell_view, "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), "fill_color_gdk", tooltip->foreground, - "text", cell.text, + "text", pango_layout_get_text (layout), "editable", FALSE, - "clip_width", max_width, - "clip_height", (double) text_height, + "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 = max_width; - tooltip_height = text_height; + tooltip_width = width; + tooltip_height = height; tooltip_y = tooltip->y; switch (E_CELL_TEXT (text_view->cell_view.ecell)->justify) { @@ -1435,9 +1330,6 @@ ect_show_tooltip (ECellView *ecell_view, e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x, pixel_origin.y + tooltip->y - 1); - unref_lines (&cell); - unbuild_current_cell (&cell); - return; } @@ -1445,13 +1337,13 @@ ect_show_tooltip (ECellView *ecell_view, * GtkObject::destroy method */ static void -ect_destroy (GtkObject *object) +ect_finalize (GObject *object) { ECellText *ect = E_CELL_TEXT (object); g_free (ect->font_name); - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } /* Set_arg handler for the text item */ static void @@ -1532,7 +1424,7 @@ e_cell_text_class_init (GtkObjectClass *object_class) ECellTextClass *ectc = (ECellTextClass *) object_class; char *ellipsis_env; - object_class->destroy = ect_destroy; + G_OBJECT_CLASS (object_class)->finalize = ect_finalize; ecc->new_view = ect_new_view; ecc->kill_view = ect_kill_view; @@ -1552,7 +1444,6 @@ e_cell_text_class_init (GtkObjectClass *object_class) ecc->max_width_by_row = ect_max_width_by_row; ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; - ecc->style_set = ect_style_set; ectc->get_text = ect_real_get_text; ectc->free_text = ect_real_free_text; @@ -1654,163 +1545,28 @@ e_cell_text_new (const char *fontname, GtkJustification justify) return (ECell *) ect; } -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (CurrentCell *cell, struct line *line) -{ - int x; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - - x = text_view->xofs + ect->x; - - switch (ect->justify) { - case GTK_JUSTIFY_RIGHT: - x += cell->width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (cell->width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_ypos (CurrentCell *cell, struct line *line) -{ - int y; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - - struct line *lines = linebreaks->lines; - - EFont *font; - - font = text_view->font; - - y = text_view->yofs + ect->y; - y += (line - lines) * e_font_height (font); - - return y; -} /* fixme: Handle Font attributes */ /* position is in BYTES */ -static void -_get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines; - int x, y; - int j; - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - lines = linebreaks->lines; - - x = get_line_xpos (cell, lines); - y = get_line_ypos (cell, lines); - for (j = 0, lines = linebreaks->lines; j < linebreaks->num_lines; lines++, j++) { - if (lines->text > cell->text + position) - break; - y += e_font_height (font); - } - lines --; - y -= e_font_descent (font); - - x += e_font_utf8_text_width (font, cell->style, - lines->text, - position - (lines->text - cell->text)); - if ((CellEdit *) cell == cell->text_view->edit){ - x -= ((CellEdit *)cell)->xofs_edit; - y -= ((CellEdit *)cell)->yofs_edit; - } - if (xp) - *xp = x; - if (yp) - *yp = y; - unref_lines (cell); - } -} - static gint -_get_position_from_xy (CurrentCell *cell, gint x, gint y) +get_position_from_xy (CellEdit *edit, gint x, gint y) { - int i, j; - int xpos, ypos; - struct line *lines; - int return_val; - gchar *p; - - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - - if ((CellEdit *) cell == cell->text_view->edit){ - x += ((CellEdit *)cell)->xofs_edit; - y += ((CellEdit *)cell)->yofs_edit; - } - - ypos = get_line_ypos (cell, linebreaks->lines); - j = 0; - while (y > ypos) { - ypos += e_font_height (font); - j ++; - } - j--; - if (j >= linebreaks->num_lines) - j = linebreaks->num_lines - 1; - if (j < 0) - j = 0; - i = 0; + int index; + int trailing; + const char *text; + PangoLayout *layout = edit->layout; + ECellTextView *text_view = edit->text_view; + ECellText *ect = (ECellText *) ((ECellView *)text_view)->ecell; - lines += j; - xpos = get_line_xpos (cell, lines); + x -= (ect->x + text_view->xofs - edit->xofs_edit); + y -= (ect->y + text_view->yofs - edit->yofs_edit); - for (p = lines->text; p < lines->text + lines->length && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - gint charwidth; + pango_layout_xy_to_index (layout, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); - charwidth = e_font_utf8_char_width (font, cell->style, p); + text = pango_layout_get_text (layout); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - - return_val = p - cell->text; - - unref_lines (cell); - - return return_val; + return g_utf8_offset_to_pointer (text + index, trailing) - text; } #define SCROLL_WAIT_TIME 30000 @@ -1821,11 +1577,11 @@ _blink_scroll_timeout (gpointer data) ECellTextView *text_view = (ECellTextView *) data; ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); gulong current_time; gboolean scroll = FALSE; gboolean redraw = FALSE; + int width, height; g_timer_elapsed (edit->timer, ¤t_time); @@ -1838,19 +1594,18 @@ _blink_scroll_timeout (gpointer data) current_time < edit->scroll_start) scroll = TRUE; } + + pango_layout_get_pixel_size (edit->layout, &width, &height); + if (scroll && edit->button_down) { /* FIXME: Copy this for y. */ - if (edit->lastx - ect->x > cell->width) { - ECellTextLineBreaks *linebreaks; - split_into_lines (cell); - linebreaks = cell->breaks; - if (edit->xofs_edit < linebreaks->max_width - cell->width) { + if (edit->lastx - ect->x > edit->cell_width) { + if (edit->xofs_edit < width - edit->cell_width) { edit->xofs_edit += 4; - if (edit->xofs_edit > linebreaks->max_width - cell->width + 1) - edit->xofs_edit = linebreaks->max_width - cell->width + 1; + if (edit->xofs_edit > width - edit->cell_width + 1) + edit->xofs_edit = width - edit->cell_width + 1; redraw = TRUE; } - unref_lines (cell); } if (edit->lastx - ect->x < 0 && edit->xofs_edit > 0) { @@ -1864,7 +1619,7 @@ _blink_scroll_timeout (gpointer data) e_tep_event.type = GDK_MOTION_NOTIFY; e_tep_event.motion.state = edit->last_state; e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy (cell, edit->lastx, edit->lasty); + e_tep_event.motion.position = get_position_from_xy (edit, edit->lastx, edit->lasty); _get_tep (edit); e_text_event_processor_handle_event (edit->tep, &e_tep_event); @@ -1882,7 +1637,7 @@ _blink_scroll_timeout (gpointer data) edit->show_cursor = FALSE; } if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); + ect_queue_redraw (text_view, edit->view_col, edit->row); } return TRUE; } @@ -1890,36 +1645,35 @@ _blink_scroll_timeout (gpointer data) static int next_word (CellEdit *edit, int start) { - CurrentCell *cell = CURRENT_CELL(edit); char *p; int length; - length = strlen (cell->text); + length = strlen (edit->text); if (start >= length) return length; - p = g_utf8_next_char (cell->text + start); + p = g_utf8_next_char (edit->text + start); while (*p && g_unichar_validate (g_utf8_get_char (p))) { gunichar unival = g_utf8_get_char (p); if (g_unichar_isspace (unival)) - return p - cell->text; + return p - edit->text; p = g_utf8_next_char (p); } - return p - cell->text; + return p - edit->text; } static int _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) { int length; - int x, y; CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); EFont *font; gchar *p; int unival; + int index; + int trailing; font = text_view->font; @@ -1937,57 +1691,57 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) /* fixme: this probably confuses TEP */ case E_TEP_END_OF_BUFFER: - return strlen (cell->text); + return strlen (edit->text); case E_TEP_START_OF_LINE: if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); - if (p == cell->text) return 0; + if (p == edit->text) return 0; - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); - while (p && p > cell->text) { - if (*p == '\n') return p - cell->text + 1; - p = g_utf8_find_prev_char (cell->text, p); + while (p && p > edit->text) { + if (*p == '\n') return p - edit->text + 1; + p = g_utf8_find_prev_char (edit->text, p); } return 0; case E_TEP_END_OF_LINE: - length = strlen (cell->text); + length = strlen (edit->text); if (edit->selection_end >= length) return length; - p = g_utf8_next_char (cell->text + edit->selection_end); + p = g_utf8_next_char (edit->text + edit->selection_end); while (*p && g_unichar_validate (g_utf8_get_char (p))) { - if (*p == '\n') return p - cell->text; + if (*p == '\n') return p - edit->text; p = g_utf8_next_char (p); } - return p - cell->text; + return p - edit->text; case E_TEP_FORWARD_CHARACTER: - length = strlen (cell->text); + length = strlen (edit->text); if (edit->selection_end >= length) return length; - p = g_utf8_next_char (cell->text + edit->selection_end); + p = g_utf8_next_char (edit->text + edit->selection_end); - return p - cell->text; + return p - edit->text; case E_TEP_BACKWARD_CHARACTER: if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); if (p == NULL) return 0; - return p - cell->text; + return p - edit->text; case E_TEP_FORWARD_WORD: return next_word (edit, edit->selection_end); @@ -1996,31 +1750,53 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); - if (p == cell->text) return 0; + if (p == edit->text) return 0; - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); - while (p && p > cell->text && g_unichar_validate (g_utf8_get_char (p))) { + while (p && p > edit->text && g_unichar_validate (g_utf8_get_char (p))) { unival = g_utf8_get_char (p); if (g_unichar_isspace (unival)) { - return (g_utf8_next_char (p) - cell->text); + return (g_utf8_next_char (p) - edit->text); } - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); } return 0; case E_TEP_FORWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y += e_font_height (font); - return _get_position_from_xy (cell, x, y); + pango_layout_move_cursor_visually (edit->layout, + TRUE, + edit->selection_end, + 0, + TRUE, + &index, + &trailing); + index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text; + if (index < 0) + return 0; + length = strlen (edit->text); + if (index >= length) + return length; + return index; case E_TEP_BACKWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y -= e_font_height (font); - return _get_position_from_xy (cell, x, y); - + pango_layout_move_cursor_visually (edit->layout, + TRUE, + edit->selection_end, + 0, + TRUE, + &index, + &trailing); + + index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text; + if (index < 0) + return 0; + length = strlen (edit->text); + if (index >= length) + return length; + return index; case E_TEP_FORWARD_PARAGRAPH: case E_TEP_BACKWARD_PARAGRAPH: @@ -2038,7 +1814,6 @@ static void _delete_selection (ECellTextView *text_view) { CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); gint length; gchar *sp, *ep; @@ -2050,8 +1825,8 @@ _delete_selection (ECellTextView *text_view) edit->selection_end ^= edit->selection_start; } - sp = cell->text + edit->selection_start; - ep = cell->text + edit->selection_end; + sp = edit->text + edit->selection_start; + ep = edit->text + edit->selection_end; length = strlen (ep) + 1; memmove (sp, ep, length); @@ -2066,20 +1841,19 @@ static void _insert (ECellTextView *text_view, char *string, int value) { CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); char *temp; if (value <= 0) return; - temp = g_new (gchar, strlen (cell->text) + value + 1); + temp = g_new (gchar, strlen (edit->text) + value + 1); - strncpy (temp, cell->text, edit->selection_start); + strncpy (temp, edit->text, edit->selection_start); strncpy (temp + edit->selection_start, string, value); - strcpy (temp + edit->selection_start + value, cell->text + edit->selection_end); + strcpy (temp + edit->selection_start + value, edit->text + edit->selection_end); - g_free (cell->text); + g_free (edit->text); - cell->text = temp; + edit->text = temp; edit->selection_start += value; edit->selection_end = edit->selection_start; @@ -2088,13 +1862,12 @@ _insert (ECellTextView *text_view, char *string, int value) static void capitalize (CellEdit *edit, int start, int end, ETextEventProcessorCaps type) { - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; + ECellTextView *text_view = edit->text_view; gboolean first = TRUE; - int character_length = g_utf8_strlen (cell->text + start, start - end); - const char *p = cell->text + start; - const char *text_end = cell->text + end; + int character_length = g_utf8_strlen (edit->text + start, start - end); + const char *p = edit->text + start; + const char *text_end = edit->text + end; char *new_text = g_new0 (char, character_length * 6 + 1); char *output = new_text; @@ -2141,8 +1914,7 @@ static void e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) { CellEdit *edit = (CellEdit *) data; - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; + ECellTextView *text_view = edit->text_view; ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell); gboolean change = FALSE; @@ -2176,7 +1948,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * sel_end = MAX(edit->selection_start, edit->selection_end); if (sel_start != sel_end) { e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY, - cell->text + sel_start, + edit->text + sel_start, sel_end - sel_start); } else if (edit->timer) { g_timer_reset (edit->timer); @@ -2211,7 +1983,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * sel_end = MAX(edit->selection_start, edit->selection_end); if (sel_start != sel_end) { e_cell_text_view_supply_selection (edit, command->time, clipboard_atom, - cell->text + sel_start, + edit->text + sel_start, sel_end - sel_start); } if (edit->timer) { @@ -2259,88 +2031,33 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * break; } - if (!edit->button_down) { - int x; - int i; - struct line *lines; - ECellTextLineBreaks *linebreaks; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - for (lines = linebreaks->lines, i = 0; i < linebreaks->num_lines ; i++, lines ++) { - if ((lines->text - cell->text) > edit->selection_end) { - break; - } - } - lines --; - x = e_font_utf8_text_width (font, cell->style, - lines->text, - edit->selection_end - (lines->text - cell->text)); - + if (change) { + if (edit->layout) + g_object_unref (edit->layout); + edit->layout = build_layout (text_view, edit->row, edit->text); + } - if (x < edit->xofs_edit) { - edit->xofs_edit = x; - redraw = TRUE; + if (!edit->button_down) { + PangoRectangle strong_pos, weak_pos; + pango_layout_get_cursor_pos (edit->layout, edit->selection_end, &strong_pos, &weak_pos); + if (strong_pos.x != weak_pos.x || + strong_pos.y != weak_pos.y || + strong_pos.width != weak_pos.width || + strong_pos.height != weak_pos.height) { + if (show_pango_rectangle (edit, weak_pos)) + redraw = TRUE; } - - if (2 + x - cell->width > edit->xofs_edit) { - edit->xofs_edit = 2 + x - cell->width; + if (show_pango_rectangle (edit, strong_pos)) { redraw = TRUE; } - unref_lines (cell); } if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif -} - -static void _invisible_destroy (GtkInvisible *invisible, - CellEdit *edit) -{ - edit->invisible = NULL; -} - -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit) -{ - GtkWidget *invisible; - if (edit->invisible) { - invisible = edit->invisible; - } else { - invisible = gtk_invisible_new (); - edit->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - edit); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - edit); + ect_queue_redraw (text_view, edit->view_col, edit->row); } - return invisible; } +#ifdef DO_SELECTION static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -2403,9 +2120,41 @@ _selection_received (GtkInvisible *invisible, } } +static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit) +{ + if (edit->invisible == NULL) { + GtkWidget *invisible = gtk_invisible_new (); + edit->invisible = invisible; + + gtk_selection_add_target (invisible, + GDK_SELECTION_PRIMARY, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_PRIMARY); + gtk_selection_add_target (invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_CLIPBOARD); + + gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", + GTK_SIGNAL_FUNC (_selection_get), + edit); + gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", + GTK_SIGNAL_FUNC (_selection_clear_event), + edit); + gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", + GTK_SIGNAL_FUNC (_selection_received), + edit); + + g_object_weak_ref (G_OBJECT (invisible), invisible_finalize, edit); + } + return edit->invisible; +} +#endif + static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length) { +#if DO_SELECTION gboolean successful; GtkWidget *invisible; @@ -2431,17 +2180,20 @@ e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection if (selection == GDK_SELECTION_PRIMARY) edit->has_selection = successful; +#endif } static void e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time) { +#if DO_SELECTION GtkWidget *invisible; invisible = e_cell_text_view_get_invisible (edit); gtk_selection_convert (invisible, selection, GDK_SELECTION_TYPE_STRING, time); +#endif } static void @@ -2458,89 +2210,6 @@ _get_tep (CellEdit *edit) } } -static int -number_of_lines (char *text) -{ - int num_lines = 0; - gchar *p; - - if (!text) return 0; - - for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - if (*p == '\n') num_lines++; - } - - num_lines++; - return num_lines; -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (CurrentCell *cell) -{ - char *p; - struct line *lines; - gint len; - - char *text = cell->text; - ECellTextLineBreaks *linebreaks; - - if (! cell->breaks) { - cell->breaks = g_new (ECellTextLineBreaks, 1); - cell->breaks->ref_count = 1; - } else { - cell->breaks->ref_count ++; - return; - } - linebreaks = cell->breaks; - - /* Check if already split. */ - linebreaks->lines = NULL; - linebreaks->num_lines = 0; - - if (!text) - return; - - /* First, count the number of lines */ - - linebreaks->num_lines = number_of_lines(cell->text); - - /* Allocate array of lines and calculate split positions */ - - linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines); - - len = 0; - for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - if (len == 0) lines->text = p; - if (*p == '\n') { - lines->length = p - lines->text; - lines++; - len = 0; - } else - len++; - } - - if (len == 0) - lines->text = p; - lines->length = p - lines->text; - - calc_line_widths (cell); -} - -/* Free lines structure. */ -static void -unref_lines (CurrentCell *cell) -{ - if (cell->breaks){ - cell->breaks->ref_count --; - if (cell->breaks->ref_count <= 0){ - g_free (cell->breaks->lines); - g_free (cell->breaks); - cell->breaks = NULL; - } - } -} - static void calc_ellipsis (ECellTextView *text_view) { @@ -2560,101 +2229,6 @@ calc_ellipsis (ECellTextView *text_view) } } -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (CurrentCell *cell) -{ - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - struct line *lines; - int i; - int j; - EFont *font; - - font = text_view->font; - - lines = linebreaks->lines; - linebreaks->max_width = 0; - - if (!lines) return; - - for (i = 0; i < linebreaks->num_lines; i++) { - if (lines->length != 0) { - if (font) { - lines->width = e_font_utf8_text_width (font, cell->style, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (ect->use_ellipsis && - (!(text_view->edit && - cell->row == text_view->edit->cell.row && - cell->view_col == text_view->edit->cell.view_col)) && - lines->width > cell->width) { - if (font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++){ - if (e_font_utf8_text_width (font, cell->style, lines->text, j) + - text_view->ellipsis_width[cell->style] < cell->width) { - lines->ellipsis_length = j; - } - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = e_font_utf8_text_width (font, cell->style, lines->text, lines->ellipsis_length) + - text_view->ellipsis_width[cell->style]; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > linebreaks->max_width) - linebreaks->max_width = lines->width; - } else { - lines->width = 0; - lines->ellipsis_length = 0; - } - - lines++; - } -} - -static void -build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row) -{ - ECellView *ecell_view = (ECellView *) text_view; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - char *temp; - - cell->text_view = text_view; - cell->model_col = model_col; - cell->view_col = view_col; - cell->row = row; - cell->breaks = NULL; - - temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); - cell->text = g_strdup(temp); - e_cell_text_free_text(ect, temp); - - cell->width = e_table_header_get_column ( - ((ETableItem *)ecell_view->e_table_item_view)->header, - view_col)->width - 8; - cell->style = 0; -} - -static void -unbuild_current_cell (CurrentCell *cell) -{ - g_free(cell->text); - cell->text = NULL; -} - - static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec) { diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h index 476e40c51e..6612a0213b 100644 --- a/widgets/table/e-cell-text.h +++ b/widgets/table/e-cell-text.h @@ -8,7 +8,7 @@ * Chris Lahey <clahey@ximian.com> * * A lot of code taken from: - * + * * Text item type for GnomeCanvas widget * * GnomeCanvas is basically a port of the Tk toolkit's most excellent @@ -37,11 +37,10 @@ #ifndef _E_CELL_TEXT_H_ #define _E_CELL_TEXT_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TEXT_TYPE (e_cell_text_get_type ()) #define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText)) @@ -101,7 +100,7 @@ void e_cell_text_free_text (ECellText *cell, char *text); /* Sets the ETableModel value, based on the given string. */ void e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row, const char *text); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TEXT_H_ */ diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index c787b8f07e..26904d284a 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-cell-toggle.c - Multi-state image toggle cell object. * Copyright 1999, 2000, Ximian, Inc. * @@ -27,7 +27,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-toggle.h" #include "gal/util/e-util.h" #include "gal/widgets/e-hsv-utils.h" @@ -46,6 +46,23 @@ static ECellClass *parent_class; #define CACHE_SEQ_COUNT 6 +static int +gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf) +{ + if (gdk_pixbuf_get_has_alpha (pixbuf)) + return gnome_print_rgbaimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); + else + return gnome_print_rgbimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); +} + /* * ECell::realize method */ @@ -378,7 +395,7 @@ etog_style_set (ECellView *ecell_view, GtkStyle *previous_style) } static void -etog_destroy (GtkObject *object) +etog_finalize (GObject *object) { ECellToggle *etog = E_CELL_TOGGLE (object); int i; @@ -391,7 +408,7 @@ etog_destroy (GtkObject *object) etog->images = NULL; etog->n_states = 0; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void @@ -399,7 +416,7 @@ e_cell_toggle_class_init (GtkObjectClass *object_class) { ECellClass *ecc = (ECellClass *) object_class; - object_class->destroy = etog_destroy; + G_OBJECT_CLASS (object_class)->finalize = etog_finalize; ecc->new_view = etog_new_view; ecc->kill_view = etog_kill_view; diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h index da60321259..3e105773f6 100644 --- a/widgets/table/e-cell-toggle.h +++ b/widgets/table/e-cell-toggle.h @@ -24,12 +24,11 @@ #ifndef _E_CELL_TOGGLE_H_ #define _E_CELL_TOGGLE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ()) #define E_CELL_TOGGLE(o) (GTK_CHECK_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle)) @@ -56,7 +55,7 @@ ECell *e_cell_toggle_new (int border, int n_states, GdkPixbuf **images void e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TOGGLE_H_ */ diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index b6d51038cf..d5ccbd2e8c 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -40,7 +40,7 @@ #include <gtk/gtkinvisible.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-tree-table-adapter.h" #include "e-tree-model.h" @@ -667,8 +667,13 @@ ect_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (ect->subcell)); ect->subcell = NULL; - gdk_pixbuf_unref (ect->open_pixbuf); - gdk_pixbuf_unref (ect->closed_pixbuf); + if (ect->open_pixbuf) + gdk_pixbuf_unref (ect->open_pixbuf); + ect->open_pixbuf = NULL; + + if (ect->closed_pixbuf) + gdk_pixbuf_unref (ect->closed_pixbuf); + ect->closed_pixbuf = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h index c821a35fe7..daba990be6 100644 --- a/widgets/table/e-cell-tree.h +++ b/widgets/table/e-cell-tree.h @@ -30,11 +30,10 @@ #ifndef _E_CELL_TREE_H_ #define _E_CELL_TREE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TREE_TYPE (e_cell_tree_get_type ()) #define E_CELL_TREE(o) (GTK_CHECK_CAST ((o), E_CELL_TREE_TYPE, ECellTree)) @@ -69,7 +68,7 @@ void e_cell_tree_construct (ECellTree *ect, ECell *subcell); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TREE_H_ */ diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h index c5207561f5..f815d40512 100644 --- a/widgets/table/e-cell-vbox.h +++ b/widgets/table/e-cell-vbox.h @@ -30,11 +30,10 @@ #ifndef _E_CELL_VBOX_H_ #define _E_CELL_VBOX_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_VBOX_TYPE (e_cell_vbox_get_type ()) #define E_CELL_VBOX(o) (GTK_CHECK_CAST ((o), E_CELL_VBOX_TYPE, ECellVbox)) @@ -61,8 +60,6 @@ void e_cell_vbox_append (ECellVbox *vbox, int model_col); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_VBOX_H_ */ - - diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index 5d3e261cb0..a447bcffbf 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-cell.c - base class for cell renderers in e-table * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -28,7 +28,7 @@ #define PARENT_TYPE gtk_object_get_type () -#define ECVIEW_EC_CLASS(v) (E_CELL_CLASS (GTK_OBJECT ((v)->ecell)->klass)) +#define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell)) static ECellView * ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) @@ -200,7 +200,7 @@ e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_co ECellView * e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) { - return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view ( + return E_CELL_GET_CLASS (ecell)->new_view ( ecell, table_model, e_table_item_view); } diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index e821ce60c3..d21aeaec60 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -27,17 +27,18 @@ #include <gdk/gdktypes.h> #include <libgnomeprint/gnome-print.h> +#include <libgnomeprint/gnome-font.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-tooltip.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) +#define E_CELL_TYPE (e_cell_get_type ()) +#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) +#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) +#define E_CELL_GET_CLASS(o) (GTK_CHECK_GET_CLASS((o), E_CELL_TYPE, ECellClass)) +#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) +#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) typedef gboolean (*ETableSearchFunc) (gconstpointer haystack, const char *needle); @@ -216,7 +217,6 @@ void e_cell_free_state (ECellView *ecell_view, int row, void *state); - -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_H_ */ diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 12cc466d9e..4e1294c36f 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-click-to-add.c * Copyright 2000, 2001, Ximian, Inc. * @@ -24,9 +24,9 @@ #include <config.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "e-table-header.h" @@ -154,13 +154,16 @@ etcta_drop_message (ETableClickToAdd *etcta) static void -etcta_destroy (GtkObject *object){ +etcta_destroy (GtkObject *object) +{ ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object); etcta_drop_table_header (etcta); etcta_drop_model (etcta); etcta_drop_message (etcta); - gtk_object_unref(GTK_OBJECT(etcta->selection)); + if (etcta->selection) + gtk_object_unref (GTK_OBJECT(etcta->selection)); + etcta->selection = NULL; if (GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (*GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (object); diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index 694b52a7aa..39371150e4 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -24,15 +24,14 @@ #ifndef _E_TABLE_CLICK_TO_ADD_H_ #define _E_TABLE_CLICK_TO_ADD_H_ -#include <gnome-xml/tree.h> -#include <libgnomeui/gnome-canvas.h> +#include <libxml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-item.h> #include <gal/e-table/e-table-selection-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ()) #define E_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) @@ -73,6 +72,6 @@ GtkType e_table_click_to_add_get_type (void); void e_table_click_to_add_commit (ETableClickToAdd *etcta); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CLICK_TO_ADD_H_ */ diff --git a/widgets/table/e-table-col-dnd.h b/widgets/table/e-table-col-dnd.h index ebc6f76431..d31c94ed26 100644 --- a/widgets/table/e-table-col-dnd.h +++ b/widgets/table/e-table-col-dnd.h @@ -24,9 +24,9 @@ #ifndef _E_TABLE_COL_DND_H_ #define _E_TABLE_COL_DND_H_ -#include <libgnome/gnome-defs.h> +#include <glib.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header" @@ -34,6 +34,6 @@ enum { TARGET_ETABLE_COL_HEADER }; -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_COL_DND_H_ */ diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c index fa53fb0d0c..bf538280c6 100644 --- a/widgets/table/e-table-col.c +++ b/widgets/table/e-table-col.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-col.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -29,7 +29,7 @@ #define PARENT_TYPE (gtk_object_get_type ()) -static GtkObjectClass *parent_class; +static GObjectClass *parent_class; enum { @@ -39,21 +39,25 @@ enum { }; static void -etc_destroy (GtkObject *object) +etc_finalize (GObject *object) { ETableCol *etc = E_TABLE_COL (object); - gtk_object_unref (GTK_OBJECT(etc->ecell)); + if (etc->ecell) + gtk_object_unref (GTK_OBJECT(etc->ecell)); + etc->ecell = NULL; if (etc->pixbuf) gdk_pixbuf_unref (etc->pixbuf); + etc->pixbuf = NULL; + if (etc->text) g_free (etc->text); + etc->text = NULL; - (*parent_class->destroy)(object); + parent_class->finalize (object); } - static void etc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { @@ -91,10 +95,11 @@ static void e_table_col_class_init (GtkObjectClass *object_class) { parent_class = gtk_type_class (PARENT_TYPE); - object_class->destroy = etc_destroy; object_class->get_arg = etc_get_arg; object_class->set_arg = etc_set_arg; + G_OBJECT_CLASS (object_class)->finalize = etc_finalize; + gtk_object_add_arg_type ("ETableCol::sortable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SORTABLE); gtk_object_add_arg_type ("ETableCol::compare_col", diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index bc296e0885..2ee2833e63 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-column-specification.c - Savable specification of a column. * Copyright 2000, 2001, Ximian, Inc. * @@ -24,8 +24,8 @@ #include <config.h> #include <stdlib.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-xml-utils.h" #include "gal/util/e-util.h" #include "e-table-column-specification.h" @@ -38,10 +38,15 @@ static void free_strings (ETableColumnSpecification *etcs) { g_free(etcs->title); + etcs->title = NULL; g_free(etcs->pixbuf); + etcs->pixbuf = NULL; g_free(etcs->cell); + etcs->cell = NULL; g_free(etcs->compare); + etcs->compare = NULL; g_free(etcs->search); + etcs->search = NULL; } static void diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h index 67bf7afb48..2641eb82df 100644 --- a/widgets/table/e-table-column-specification.h +++ b/widgets/table/e-table-column-specification.h @@ -26,7 +26,7 @@ #include <glib.h> #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c index 2736a4381b..6d8f1c3aef 100644 --- a/widgets/table/e-table-column.c +++ b/widgets/table/e-table-column.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-column.c * Copyright 2000, 2001, Ximian, Inc. * @@ -35,7 +35,7 @@ static guint etc_signals [LAST_SIGNAL] = { 0, }; static GtkObjectClass *e_table_column_parent_class; static void -e_table_column_destroy (GtkObject *object) +e_table_column_finalize (GObject *object) { ETableColumn *etc = E_TABLE_COLUMN (object); const int cols = etc->col_count; @@ -54,14 +54,13 @@ e_table_column_destroy (GtkObject *object) for (i = 0; i < cols; i++) e_table_column_remove (etc, i); - if (e_table_column_parent_class->destroy) - e_table_column_parent_class->destroy (object); + G_OBJECT_CLASS (e_table_column_parent_class)->finalize (object); } static void e_table_column_class_init (GtkObjectClass *object_class) { - object_class->destroy = e_table_column_destroy; + G_OBJECT_CLASS (object_class)->finalize = e_table_column_finalize; e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ())); diff --git a/widgets/table/e-table-config-field.c b/widgets/table/e-table-config-field.c index e0ae8f169c..5bcd5456a7 100644 --- a/widgets/table/e-table-config-field.c +++ b/widgets/table/e-table-config-field.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-config-field.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,10 @@ #include <config.h> #include <stdlib.h> +#include <gtk/gtk.h> +#include <gtk/gtkbox.h> #include "gal/util/e-util.h" +#include "gal/util/e-i18n.h" #include "e-table-config-field.h" #define PARENT_TYPE (gtk_vbox_get_type()) @@ -35,8 +38,13 @@ etcf_destroy (GtkObject *object) { ETableConfigField *etcf = E_TABLE_CONFIG_FIELD (object); - gtk_object_unref(GTK_OBJECT(etcf->spec)); - gtk_object_unref(GTK_OBJECT(etcf->sort_info)); + if (etct->spec) + gtk_object_unref(GTK_OBJECT(etcf->spec)); + etct->spec = NULL; + + if (etct->sort_info) + gtk_object_unref(GTK_OBJECT(etcf->sort_info)); + etct->sort_info = NULL; GTK_OBJECT_CLASS (etcf_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-config-field.h b/widgets/table/e-table-config-field.h index 495c29a76a..2a7a8b308b 100644 --- a/widgets/table/e-table-config-field.h +++ b/widgets/table/e-table-config-field.h @@ -27,9 +27,8 @@ #include <gtk/gtkvbox.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-specification.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CONFIG_FIELD_TYPE (e_table_config_field_get_type ()) #define E_TABLE_CONFIG_FIELD(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigField)) @@ -65,6 +64,6 @@ ETableConfigField *e_table_config_field_construct (ETableConfigField *field, ETableSortInfo *sort_info, gboolean grouping); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CONFIG_FIELD_H_ */ diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index a3e9554d3a..9d7354e38b 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-config.c * Copyright 2000, 2001, Ximian, Inc. * @@ -67,13 +67,20 @@ enum { static guint e_table_config_signals [LAST_SIGNAL] = { 0, }; static void -config_destroy (GtkObject *object) +config_finalize (GObject *object) { ETableConfig *config = E_TABLE_CONFIG (object); gtk_object_destroy (GTK_OBJECT (config->state)); - gtk_object_unref (GTK_OBJECT (config->source_state)); - gtk_object_unref (GTK_OBJECT (config->source_spec)); + + if (config->source_state) + gtk_object_unref (GTK_OBJECT (config->source_state)); + config->source_state = NULL; + + if (config->source_spec) + gtk_object_unref (GTK_OBJECT (config->source_spec)); + config->source_spec = NULL; + g_free (config->header); config->header = NULL; @@ -82,8 +89,8 @@ config_destroy (GtkObject *object) g_free (config->domain); config->domain = NULL; - - GTK_OBJECT_CLASS (config_parent_class)->destroy (object); + + G_OBJECT_CLASS (config_parent_class)->finalize (object); } static void @@ -123,7 +130,7 @@ config_class_init (GtkObjectClass *object_class) klass->changed = NULL; object_class->get_arg = config_get_arg; - object_class->destroy = config_destroy; + G_OBJECT_CLASS (object_class)->finalize = config_finalize; e_table_config_signals [CHANGED] = gtk_signal_new ("changed", @@ -615,7 +622,7 @@ sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort) ETableConfigSortWidgets *base = &config->sort[0]; int idx = sort - base; - char *s = gtk_entry_get_text (entry); + const char *s = gtk_entry_get_text (entry); if (s && s [0] && g_hash_table_lookup (sort->combo->elements, s)){ ETableSortColumn c; @@ -702,11 +709,13 @@ configure_sort_dialog (ETableConfig *config, GladeXML *gui) for (i = 0; i < 4; i++){ config->sort [i].changed_id = gtk_signal_connect ( GTK_OBJECT (config->sort [i].combo->entry), - "changed", sort_entry_changed, &config->sort [i]); + "changed", GTK_SIGNAL_FUNC (sort_entry_changed), + &config->sort [i]); config->sort [i].toggled_id = gtk_signal_connect ( GTK_OBJECT (config->sort [i].radio_ascending), - "toggled", sort_ascending_toggled, &config->sort [i]); + "toggled", GTK_SIGNAL_FUNC (sort_ascending_toggled), + &config->sort [i]); } } @@ -717,7 +726,7 @@ group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group) ETableSortInfo *sort_info = config->temp_state->sort_info; ETableConfigSortWidgets *base = &config->group[0]; int idx = group - base; - char *s = gtk_entry_get_text (entry); + const char *s = gtk_entry_get_text (entry); if (s && s [0] && g_hash_table_lookup (group->combo->elements, s)){ ETableSortColumn c; @@ -812,11 +821,13 @@ configure_group_dialog (ETableConfig *config, GladeXML *gui) for (i = 0; i < 4; i++){ config->group [i].changed_id = gtk_signal_connect ( GTK_OBJECT (config->group [i].combo->entry), - "changed", group_entry_changed, &config->group [i]); + "changed", GTK_SIGNAL_FUNC (group_entry_changed), + &config->group [i]); config->group [i].toggled_id = gtk_signal_connect ( GTK_OBJECT (config->group [i].radio_ascending), - "toggled", group_ascending_toggled, &config->group [i]); + "toggled", GTK_SIGNAL_FUNC (group_ascending_toggled), + &config->group [i]); } } @@ -990,10 +1001,10 @@ configure_fields_dialog (ETableConfig *config, GladeXML *gui) "model", &config->shown_model, NULL); - connect_button (config, gui, "button-add", config_button_add); - connect_button (config, gui, "button-remove", config_button_remove); - connect_button (config, gui, "button-up", config_button_up); - connect_button (config, gui, "button-down", config_button_down); + connect_button (config, gui, "button-add", GTK_SIGNAL_FUNC (config_button_add)); + connect_button (config, gui, "button-remove", GTK_SIGNAL_FUNC (config_button_remove)); + connect_button (config, gui, "button-up", GTK_SIGNAL_FUNC (config_button_up)); + connect_button (config, gui, "button-down", GTK_SIGNAL_FUNC (config_button_down)); setup_fields (config); } @@ -1006,9 +1017,9 @@ setup_gui (ETableConfig *config) create_global_store (config); if (e_table_sort_info_get_can_group (config->state->sort_info)) { - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN); } else { - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN); } gtk_object_unref (GTK_OBJECT (global_store)); @@ -1040,9 +1051,9 @@ setup_gui (ETableConfig *config) config->fields_label = glade_xml_get_widget ( gui, "label-fields"); - connect_button (config, gui, "button-sort", config_button_sort); - connect_button (config, gui, "button-group", config_button_group); - connect_button (config, gui, "button-fields", config_button_fields); + connect_button (config, gui, "button-sort", GTK_SIGNAL_FUNC (config_button_sort)); + connect_button (config, gui, "button-group", GTK_SIGNAL_FUNC (config_button_group)); + connect_button (config, gui, "button-fields", GTK_SIGNAL_FUNC (config_button_fields)); configure_sort_dialog (config, gui); configure_group_dialog (config, gui); diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h index d5640f73cd..9c52895d94 100644 --- a/widgets/table/e-table-config.h +++ b/widgets/table/e-table-config.h @@ -25,7 +25,6 @@ #ifndef _E_TABLE_CONFIG_H_ #define _E_TABLE_CONFIG_H_ -#include <libgnome/gnome-defs.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-specification.h> #include <gal/widgets/gtk-combo-text.h> @@ -33,7 +32,7 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CONFIG_TYPE (e_table_config_get_type ()) #define E_TABLE_CONFIG(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig)) @@ -107,6 +106,6 @@ ETableConfig *e_table_config_construct (ETableConfig *etco, ETableState *state); void e_table_config_raise (ETableConfig *config); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CONFIG_H */ diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c index 257867ebed..2321e4e7dd 100644 --- a/widgets/table/e-table-example-2.c +++ b/widgets/table/e-table-example-2.c @@ -338,7 +338,6 @@ main (int argc, char *argv []) gnome_init ("TableExample", "TableExample", argc, argv); e_cursors_init (); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); create_table (); diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index 9c5b5fb935..b3c0efa27c 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-extras.c - Set of hash table sort of thingies. * Copyright 2000, 2001, Ximian, Inc. * @@ -64,15 +64,25 @@ ete_destroy (GtkObject *object) { ETableExtras *ete = E_TABLE_EXTRAS (object); - g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL); - g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL); - g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL); - g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL); + if (ete->cells) { + g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL); + g_hash_table_destroy (ete->cells); + } + + if (ete->compares) { + g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL); + g_hash_table_destroy (ete->compares); + } + + if (ete->searches) { + g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL); + g_hash_table_destroy (ete->searches); + } - g_hash_table_destroy (ete->cells); - g_hash_table_destroy (ete->compares); - g_hash_table_destroy (ete->searches); - g_hash_table_destroy (ete->pixbufs); + if (ete->pixbufs) { + g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL); + g_hash_table_destroy (ete->pixbufs); + } ete->cells = NULL; ete->compares = NULL; @@ -99,6 +109,40 @@ e_strint_compare(gconstpointer data1, gconstpointer data2) return g_int_compare(GINT_TO_POINTER(int1), GINT_TO_POINTER(int2)); } +/* UTF-8 strncasecmp - not optimized */ + +static gint +g_utf8_strncasecmp (const gchar *s1, + const gchar *s2, + guint n) +{ + gunichar c1, c2; + + g_return_val_if_fail (s1 != NULL && g_utf8_validate (s1, -1, NULL), 0); + g_return_val_if_fail (s2 != NULL && g_utf8_validate (s2, -1, NULL), 0); + + while (n && *s1 && *s2) + { + + n -= 1; + + c1 = g_unichar_tolower (g_utf8_get_char (s1)); + c2 = g_unichar_tolower (g_utf8_get_char (s2)); + + /* Collation is locale-dependent, so this totally fails to do the right thing. */ + if (c1 != c2) + return c1 < c2 ? -1 : 1; + + s1 = g_utf8_next_char (s1); + s2 = g_utf8_next_char (s2); + } + + if (n == 0 || (*s1 == '\0' && *s2 == '\0')) + return 0; + + return *s1 ? 1 : -1; +} + static gboolean e_string_search(gconstpointer haystack, const char *needle) { diff --git a/widgets/table/e-table-extras.h b/widgets/table/e-table-extras.h index a077319aec..01da79a53d 100644 --- a/widgets/table/e-table-extras.h +++ b/widgets/table/e-table-extras.h @@ -27,9 +27,8 @@ #include <gtk/gtkobject.h> #include <gal/e-table/e-cell.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_EXTRAS_TYPE (e_table_extras_get_type ()) #define E_TABLE_EXTRAS(o) (GTK_CHECK_CAST ((o), E_TABLE_EXTRAS_TYPE, ETableExtras)) @@ -77,6 +76,6 @@ void e_table_extras_add_pixbuf (ETableExtras *extras, GdkPixbuf *e_table_extras_get_pixbuf (ETableExtras *extras, char *id); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_EXTRAS_H_ */ diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c index fa9def8a6f..906dadc52a 100644 --- a/widgets/table/e-table-field-chooser-dialog.c +++ b/widgets/table/e-table-field-chooser-dialog.c @@ -23,7 +23,6 @@ #include <config.h> #include "e-table-field-chooser-dialog.h" -#include <libgnomeui/gnome-stock.h> #include "gal/util/e-i18n.h" static void e_table_field_chooser_dialog_init (ETableFieldChooserDialog *card); @@ -105,7 +104,7 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos e_table_field_chooser_dialog->header = NULL; gnome_dialog_append_buttons(GNOME_DIALOG(e_table_field_chooser_dialog), - GNOME_STOCK_BUTTON_CLOSE, + GTK_STOCK_CLOSE, NULL); gtk_window_set_policy(GTK_WINDOW(e_table_field_chooser_dialog), FALSE, TRUE, FALSE); @@ -138,11 +137,17 @@ static void e_table_field_chooser_dialog_destroy (GtkObject *object) { ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object); - g_free(etfcd->dnd_code); + + g_free (etfcd->dnd_code); + etfcd->dnd_code = NULL; + if (etfcd->full_header) gtk_object_unref(GTK_OBJECT(etfcd->full_header)); + etfcd->full_header = NULL; + if (etfcd->header) gtk_object_unref(GTK_OBJECT(etfcd->header)); + etfcd->header = NULL; } static void diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index d09dfd6e11..b4555685cb 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-field-chooser-item.c * Copyright 2000, 2001, Ximian, Inc. * @@ -25,10 +25,10 @@ #include <string.h> #include <gtk/gtksignal.h> #include <gtk/gtkdnd.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-polygon.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "gal/util/e-util.h" @@ -72,15 +72,20 @@ enum { }; static void -etfci_destroy (GtkObject *object){ +etfci_destroy (GtkObject *object) +{ ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (object); etfci_drop_table_header (etfci); etfci_drop_full_header (etfci); - if (etfci->combined_header != NULL) + + if (etfci->combined_header) gtk_object_unref (GTK_OBJECT (etfci->combined_header)); - - gdk_font_unref(etfci->font); + etfci->combined_header = NULL; + + if (etfci->font) + gdk_font_unref(etfci->font); + etfci->font = NULL; if (GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (*GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (object); @@ -206,8 +211,12 @@ etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flag item->y1 = c1.y; item->x2 = c2.x; item->y2 = c2.y; - +#ifndef NO_WARNINGS +#warning Group Child bounds !? +#endif +#if 0 gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); +#endif } gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); } @@ -217,8 +226,8 @@ etfci_font_load (ETableFieldChooserItem *etfci) { if (etfci->font) gdk_font_unref (etfci->font); - - etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font; + + etfci->font = gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style); gdk_font_ref(etfci->font); } diff --git a/widgets/table/e-table-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h index 77a15b8811..8db4587955 100644 --- a/widgets/table/e-table-field-chooser-item.h +++ b/widgets/table/e-table-field-chooser-item.h @@ -24,12 +24,11 @@ #ifndef _E_TABLE_FIELD_CHOOSER_ITEM_H_ #define _E_TABLE_FIELD_CHOOSER_ITEM_H_ -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ()) #define E_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem)) @@ -71,6 +70,6 @@ typedef struct { GtkType e_table_field_chooser_item_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_FIELD_CHOOSER_ITEM_H_ */ diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 85d65817b0..5a74ae788c 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -22,7 +22,10 @@ */ #include <config.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtksignal.h> +#include <gtk/gtk.h> +#include <gtk/gtkbox.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-field-chooser.h" #include "e-table-field-chooser-item.h" @@ -131,7 +134,7 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) GladeXML *gui; GtkWidget *widget; - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL, PACKAGE); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL, PACKAGE); etfc->gui = gui; widget = glade_xml_get_widget(gui, "vbox-top"); @@ -141,7 +144,6 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) gtk_widget_reparent(widget, GTK_WIDGET(etfc)); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons")); @@ -176,7 +178,6 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) GTK_SIGNAL_FUNC (allocate_callback), etfc); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); gtk_widget_show(widget); } @@ -186,14 +187,20 @@ e_table_field_chooser_destroy (GtkObject *object) { ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); - g_free(etfc->dnd_code); + g_free (etfc->dnd_code); + etfc->dnd_code = NULL; + if (etfc->full_header) gtk_object_unref(GTK_OBJECT(etfc->full_header)); + etfc->full_header = NULL; + if (etfc->header) gtk_object_unref(GTK_OBJECT(etfc->header)); + etfc->header = NULL; if (etfc->gui) gtk_object_unref(GTK_OBJECT(etfc->gui)); + etfc->gui = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h index c5e5ae34e4..d422e74f9b 100644 --- a/widgets/table/e-table-field-chooser.h +++ b/widgets/table/e-table-field-chooser.h @@ -25,12 +25,10 @@ #define __E_TABLE_FIELD_CHOOSER_H__ #include <glade/glade.h> +#include <gtk/gtkvbox.h> #include <gal/e-table/e-table-header.h> -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ +G_BEGIN_DECLS /* ETableFieldChooser - A dialog displaying information about a contact. * @@ -76,9 +74,6 @@ struct _ETableFieldChooserClass GtkWidget *e_table_field_chooser_new(void); GtkType e_table_field_chooser_get_type (void); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - +G_END_DECLS #endif /* __E_TABLE_FIELD_CHOOSER_H__ */ diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index c7185d9007..87e5e40a14 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group-container.c * Copyright 2000, 2001, Ximian, Inc. * @@ -25,12 +25,11 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> #include <libgnome/libgnome.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group-container.h" #include "e-table-group-leaf.h" #include "e-table-item.h" #include "gal/util/e-util.h" -#include "gal/util/e-unicode-i18n.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/widgets/e-unicode.h" @@ -100,6 +99,7 @@ e_table_group_container_list_free (ETableGroupContainer *etgc) } g_list_free (etgc->children); + etgc->children = NULL; } static void @@ -109,19 +109,23 @@ etgc_destroy (GtkObject *object) if (etgc->font) gdk_font_unref (etgc->font); - etgc->font = NULL; + etgc->font = NULL; if (etgc->ecol) gtk_object_unref (GTK_OBJECT(etgc->ecol)); + etgc->ecol = NULL; if (etgc->sort_info) gtk_object_unref (GTK_OBJECT(etgc->sort_info)); + etgc->sort_info = NULL; if (etgc->selection_model) gtk_object_unref (GTK_OBJECT(etgc->selection_model)); + etgc->selection_model = NULL; if (etgc->rect) gtk_object_destroy (GTK_OBJECT(etgc->rect)); + etgc->rect = NULL; e_table_group_container_list_free (etgc); @@ -161,8 +165,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine etgc->n = n; etgc->ascending = column.ascending; - etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font; - + etgc->font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style); + gdk_font_ref (etgc->font); etgc->open = TRUE; @@ -347,14 +351,14 @@ compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_n if (etgc->ecol->text) { text = g_strdup_printf ((child_node->count == 1) - ? U_("%s : %s (%d item)") - : U_("%s : %s (%d items)"), + ? _("%s : %s (%d item)") + : _("%s : %s (%d items)"), etgc->ecol->text, child_node->string, (gint) child_node->count); } else { text = g_strdup_printf ((child_node->count == 1) - ? U_("%s (%d item)") - : U_("%s (%d items)"), + ? _("%s (%d item)") + : _("%s (%d items)"), child_node->string, (gint) child_node->count); } @@ -1046,7 +1050,7 @@ e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *clos (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure); } else { g_error ("Unknown ETableGroup found: %s", - gtk_type_name (GTK_OBJECT (etg)->klass->type)); + g_type_name (G_TYPE_FROM_INSTANCE (etg))); } } @@ -1102,8 +1106,7 @@ e_table_group_container_print_page (EPrintable *ep, GList *child; EPrintable *child_printable; gchar *string; - - GnomeFont *font = gnome_font_new ("Helvetica", TEXT_HEIGHT); + GnomeFont *font = gnome_font_find ("Helvetica", TEXT_HEIGHT); child_printable = groupcontext->child_printable; child = groupcontext->child; @@ -1399,7 +1402,7 @@ e_table_group_container_will_fit (EPrintable *ep, static void e_table_group_container_printable_destroy (GtkObject *object, - ETGCPrintContext *groupcontext) + ETGCPrintContext *groupcontext) { gtk_object_unref(GTK_OBJECT(groupcontext->etgc)); if (groupcontext->child_printable) diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index 7bb9a706da..fd5c2c348d 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -24,14 +24,13 @@ #ifndef _E_TABLE_GROUP_CONTAINER_H_ #define _E_TABLE_GROUP_CONTAINER_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-group.h> #include <gal/e-table/e-table-item.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) #define E_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) @@ -94,6 +93,6 @@ void e_table_group_container_construct (GnomeCanvasGroup *parent, ETable GtkType e_table_group_container_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_CONTAINER_H_ */ diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index f9e34a8920..32f3a82913 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group-leaf.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,7 @@ #include <config.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group-leaf.h" #include "e-table-item.h" #include "e-table-sorted-variable.h" @@ -128,6 +128,8 @@ e_table_group_leaf_construct (GnomeCanvasGroup *parent, full_header, sort_info)); + gtk_object_ref (GTK_OBJECT (etgl->ets)); + gtk_object_sink (GTK_OBJECT (etgl->ets)); e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); } @@ -449,8 +451,9 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) if (etgl->selection_model) gtk_object_unref(GTK_OBJECT(etgl->selection_model)); etgl->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); - if (etgl->selection_model) + if (etgl->selection_model) { gtk_object_ref(GTK_OBJECT(etgl->selection_model)); + } if (etgl->item) { gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), "selection_model", etgl->selection_model, diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h index afb0e51cf6..a6a5e54a53 100644 --- a/widgets/table/e-table-group-leaf.h +++ b/widgets/table/e-table-group-leaf.h @@ -24,13 +24,12 @@ #ifndef _E_TABLE_GROUP_LEAF_H_ #define _E_TABLE_GROUP_LEAF_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-group.h> #include <gal/e-table/e-table-subset.h> #include <gal/e-table/e-table-item.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) #define E_TABLE_GROUP_LEAF(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) @@ -85,7 +84,7 @@ ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, GtkType e_table_group_leaf_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_LEAF_H_ */ diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index 6973d7c387..6123eb9862 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,7 @@ #include <config.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group.h" #include "e-table-group-container.h" #include "e-table-group-leaf.h" @@ -32,7 +32,7 @@ #define PARENT_TYPE gnome_canvas_group_get_type () -#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) +#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT_GET_CLASS(e))) static GnomeCanvasGroupClass *etg_parent_class; @@ -135,7 +135,7 @@ e_table_group_construct (GnomeCanvasGroup *parent, gtk_object_ref (GTK_OBJECT(etg->header)); etg->model = model; gtk_object_ref (GTK_OBJECT(etg->model)); - gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); + gnome_canvas_item_construct (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); } /** @@ -661,40 +661,44 @@ etg_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 6cad768d57..8457e4e4f7 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -24,16 +24,15 @@ #ifndef _E_TABLE_GROUP_H_ #define _E_TABLE_GROUP_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-defines.h> #include <gal/util/e-util.h> #include <gal/widgets/e-printable.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) #define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) @@ -174,6 +173,6 @@ void e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_H_ */ diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 142e63b809..01718c2bf6 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-header-item.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -29,15 +29,17 @@ #include <string.h> #include <gtk/gtksignal.h> #include <gtk/gtkdnd.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtkimage.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-polygon.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "gal/widgets/e-cursors.h" #include "gal/util/e-i18n.h" #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" +#include "gal/util/e-marshal.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-popup-menu.h" #include "gal/widgets/e-gui-utils.h" @@ -136,9 +138,11 @@ ethi_destroy (GtkObject *object){ if (ethi->full_header) gtk_object_unref (GTK_OBJECT(ethi->full_header)); + ethi->full_header = NULL; if (ethi->config) gtk_object_destroy (GTK_OBJECT (ethi->config)); + ethi->config = NULL; if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object); @@ -211,8 +215,12 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags item->y1 = c1.y; item->x2 = c2.x; item->y2 = c2.y; - +#ifndef NO_WARNINGS +#warning FOO BAA +#endif +#if 0 gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); +#endif } gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); } @@ -239,7 +247,7 @@ ethi_font_load (ETableHeaderItem *ethi, char *fontname) font = gdk_fontset_load (fontname); if (font == NULL) { - font = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style->font; + font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style); gdk_font_ref (font); } @@ -471,14 +479,13 @@ make_shaped_window_from_xpm (const char **xpm) gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 128); gdk_pixbuf_unref (pixbuf); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); win = gtk_window_new (GTK_WINDOW_POPUP); - pix = gtk_pixmap_new (pixmap, bitmap); + + pix = gtk_image_new_from_pixmap (pixmap, bitmap); gtk_widget_realize (win); gtk_container_add (GTK_CONTAINER (win), pix); gtk_widget_shape_combine_mask (win, bitmap, 0, 0); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); gdk_pixmap_unref (pixmap); @@ -594,6 +601,7 @@ do_drag_motion(ETableHeaderItem *ethi, { d(g_print("In do_drag_motion\n")); d(g_print("x = %d, y = %d, ethi->width = %d, ethi->height = %d\n", x, y, ethi->width, ethi->height)); + if ((x >= 0) && (x <= (ethi->width)) && (y >= 0) && (y <= (ethi->height))){ int col; @@ -681,13 +689,13 @@ static void context_destroyed (gpointer data) { ETableHeaderItem *ethi = data; - if (!GTK_OBJECT_DESTROYED (ethi)) { - ethi->last_drop_x = 0; - ethi->last_drop_y = 0; - ethi->last_drop_time = 0; - ethi->last_drop_context = NULL; - scroll_off (ethi); - } + + ethi->last_drop_x = 0; + ethi->last_drop_y = 0; + ethi->last_drop_time = 0; + ethi->last_drop_context = NULL; + scroll_off (ethi); + gtk_object_unref (GTK_OBJECT (ethi)); } @@ -723,10 +731,8 @@ ethi_drag_motion (GtkWidget *widget, GdkDragContext *context, d(g_print ("y = %d, widget->allocation.y = %d, GTK_LAYOUT (widget)->vadjustment->value = %f\n", y, widget->allocation.y, GTK_LAYOUT (widget)->vadjustment->value)); -#if 0 x -= widget->allocation.x; y -= widget->allocation.y; -#endif if (x < 20) direction |= ET_SCROLL_LEFT; @@ -891,7 +897,7 @@ ethi_realize (GnomeCanvasItem *item) window = GTK_WIDGET (item->canvas)->window; if (!ethi->font) - ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font); + ethi_font_set (ethi, gtk_style_get_font (GTK_WIDGET (item->canvas)->style)); /* * Now, configure DnD @@ -1753,8 +1759,8 @@ ethi_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableHeaderItemClass, button_pressed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__BOXED, + GTK_TYPE_NONE, 1, GDK_TYPE_EVENT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, ethi_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 7371a20540..594ede0e7a 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -27,13 +27,12 @@ #include <gal/e-table/e-table.h> #include <gal/e-table/e-tree.h> -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ()) #define E_TABLE_HEADER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem)) @@ -110,6 +109,6 @@ typedef struct { GtkType e_table_header_item_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_HEADER_ITEM_H_ */ diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c index 9668250961..60cc9f9e32 100644 --- a/widgets/table/e-table-header-utils.c +++ b/widgets/table/e-table-header-utils.c @@ -5,8 +5,8 @@ * * Authors: * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> + * Miguel de Icaza <miguel@ximian.com> + * Federico Mena-Quintero <federico@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -31,6 +31,8 @@ #include <string.h> /* strlen() */ #include <glib.h> +#include <gtk/gtkbutton.h> +#include <gtk/gtkwindow.h> #include "e-table-defines.h" #include <gal/widgets/e-unicode.h> @@ -56,7 +58,7 @@ e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font) g_return_val_if_fail (E_IS_TABLE_COL (ecol), -1); g_return_val_if_fail (style != NULL, -1); - ythick = style->klass->ythickness; + ythick = style->ythickness; if (font) height = font->ascent + font->descent; @@ -80,7 +82,7 @@ e_table_header_width_extras (GtkStyle *style) { g_return_val_if_fail (style != NULL, -1); - return 2 * (style->klass->xthickness + HEADER_PADDING); + return 2 * (style->xthickness + HEADER_PADDING); } /* Creates a pixmap that is a composite of a background color and the upper-left @@ -250,8 +252,8 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol, gc = g_label->style->fg_gc[GTK_STATE_NORMAL]; - xthick = style->klass->xthickness; - ythick = style->klass->ythickness; + xthick = style->xthickness; + ythick = style->ythickness; /* Button bevel */ diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h index 4d14652f48..50166010e5 100644 --- a/widgets/table/e-table-header-utils.h +++ b/widgets/table/e-table-header-utils.h @@ -5,8 +5,8 @@ * * Authors: * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> + * Miguel de Icaza <miguel@ximian.com> + * Federico Mena-Quintero <federico@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 70d9b5583e..e57a8f38a0 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-header.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -26,6 +26,8 @@ #include <string.h> #include <gtk/gtkobject.h> #include <gtk/gtksignal.h> +#include <gtk/gtkimage.h> +#include <gal/util/e-util.h> #include "e-table-header.h" #include "e-table-defines.h" #include "gal/util/e-util.h" @@ -153,12 +155,18 @@ eth_destroy (GtkObject *object) gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id); gtk_object_unref(GTK_OBJECT(eth->sort_info)); + eth->sort_info = NULL; } if (eth->idle) g_source_remove(eth->idle); - g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL); - g_slist_free(eth->change_queue); + eth->idle = 0; + + if (eth->change_queue) { + g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL); + g_slist_free(eth->change_queue); + eth->change_queue = NULL; + } /* * Destroy columns @@ -168,6 +176,9 @@ eth_destroy (GtkObject *object) } g_free (eth->columns); + eth->col_count = 0; + eth->columns = NULL; + if (e_table_header_parent_class->destroy) e_table_header_parent_class->destroy (object); } @@ -277,7 +288,7 @@ e_table_header_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableHeaderClass, request_width), - gtk_marshal_INT__INT, + e_marshal_INT__INT, GTK_TYPE_INT, 1, GTK_TYPE_INT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, eth_signals, LAST_SIGNAL); diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index c20fd0be6e..c2ce0b2d71 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -29,9 +29,8 @@ #include <gdk/gdk.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-col.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct _ETableHeader ETableHeader; @@ -115,7 +114,7 @@ ETableCol *e_table_header_prioritized_column_selected (ETableHeader *e gpointer user_data); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_HEADER_H_ */ diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index cc4c52ad4b..e85eeb7106 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-item.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -35,6 +35,7 @@ #include <math.h> #include <stdio.h> #include <gtk/gtksignal.h> +#include <gtk/gtkmain.h> #include <gdk/gdkkeysyms.h> #include "e-table-subset.h" #include "e-cell.h" @@ -42,6 +43,7 @@ #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/util/e-util.h" +#include "gal/util/e-i18n.h" #include <string.h> #include <stdlib.h> @@ -50,7 +52,6 @@ #define FOCUSED_BORDER 2 #define d(x) -#define DO_TOOLTIPS #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -941,6 +942,13 @@ eti_check_cursor_bounds (ETableItem *eti) return; } + if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized)) + return; + + if (eti->frozen_count > 0) { + return; + } + gtk_object_get(GTK_OBJECT(eti->selection), "cursor_row", &cursor_row, NULL); @@ -985,10 +993,12 @@ static gboolean eti_idle_show_cursor_cb (gpointer data) { ETableItem *eti = data; - if (!GTK_OBJECT_DESTROYED (eti)) { + + if (eti->selection) { eti_show_cursor (eti, 0); eti_check_cursor_bounds (eti); } + gtk_object_unref (GTK_OBJECT (eti)); return FALSE; } @@ -1270,6 +1280,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model) } eti_freeze (eti); + eti_table_model_changed (table_model, eti); } @@ -1388,25 +1399,29 @@ eti_destroy (GtkObject *object) g_source_remove(eti->height_cache_idle_id); eti->height_cache_idle_id = 0; } + eti->height_cache_idle_count = 0; if (eti->height_cache) g_free (eti->height_cache); eti->height_cache = NULL; - eti->height_cache_idle_count = 0; e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); if (eti->tooltip) { if (eti->tooltip->background) gdk_color_free (eti->tooltip->background); + eti->tooltip->background = NULL; + if (eti->tooltip->foreground) gdk_color_free (eti->tooltip->foreground); + eti->tooltip->foreground = NULL; + if (eti->tooltip->timer) { gtk_timeout_remove (eti->tooltip->timer); eti->tooltip->timer = 0; } g_free (eti->tooltip); + eti->tooltip = NULL; } - eti->tooltip = NULL; if (GTK_OBJECT_CLASS (eti_parent_class)->destroy) (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object); @@ -1849,6 +1864,11 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, return; } + last_row = row; + + if (first_row == -1) + return; + /* * Draw cells */ @@ -2309,6 +2329,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) eti->drag_x = realx; eti->drag_y = realy; eti->drag_state = e->button.state; + eti->grabbed = TRUE; d(g_print ("%s: eti_grab\n", __FUNCTION__)); eti_grab (eti, e->button.time); } @@ -2454,11 +2475,6 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e->button.x -= e_table_header_col_diff (eti->header, 0, model_to_view_col (eti, model_col)); e->button.y -= e_table_item_row_diff (eti, 0, model_to_view_row (eti, model_row)); -#if 0 - button.x = x1; - button.y = y1; -#endif - if (e->button.button == 1) { if (eti->maybe_in_drag) { eti->maybe_in_drag = FALSE; @@ -2518,7 +2534,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); #ifdef DO_TOOLTIPS - if (g_getenv ("GAL_DO_TOOLTIPS")) { + if (!g_getenv ("GAL_DONT_DO_TOOLTIPS")) { if (eti->tooltip->timer > 0) gtk_timeout_remove (eti->tooltip->timer); eti->tooltip->col = col; @@ -2886,7 +2902,7 @@ eti_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, cursor_activated), - gtk_marshal_NONE__INT, + e_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); eti_signals [DOUBLE_CLICK] = @@ -2894,40 +2910,45 @@ eti_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [STYLE_SET] = gtk_signal_new ("style_set", @@ -2938,7 +2959,6 @@ eti_class_init (GtkObjectClass *object_class) GTK_TYPE_NONE, 1, GTK_TYPE_STYLE); E_OBJECT_CLASS_ADD_SIGNALS (object_class, eti_signals, LAST_SIGNAL); - } GtkType diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index f1f055f1a1..e9044590d5 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -25,16 +25,15 @@ #ifndef _E_TABLE_ITEM_H_ #define _E_TABLE_ITEM_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-defines.h> #include <gal/e-table/e-table-tooltip.h> #include <gal/widgets/e-selection-model.h> #include <gal/widgets/e-printable.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) #define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) @@ -221,6 +220,6 @@ int e_table_item_row_diff (ETableItem *eti, int start_row, int end_row); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_ITEM_H_ */ diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c index 7a2771843d..3b804ab9cc 100644 --- a/widgets/table/e-table-memory-callbacks.c +++ b/widgets/table/e-table-memory-callbacks.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-memory-callbacks.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h index 979359bdb6..5368b39417 100644 --- a/widgets/table/e-table-memory-store.h +++ b/widgets/table/e-table-memory-store.h @@ -26,9 +26,8 @@ #include <gal/e-table/e-table-memory.h> #include <gal/e-table/e-table-memory-callbacks.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ()) #define E_TABLE_MEMORY_STORE(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore)) @@ -133,6 +132,6 @@ void e_table_memory_store_remove (ETableMemoryStore int row); void e_table_memory_store_clear (ETableMemoryStore *etms); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_MEMORY_STORE_H_ */ diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index 84e9fe3378..0e53c80b09 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-memory.c * Copyright 2000, 2001, Ximian, Inc. * @@ -32,8 +32,8 @@ #include <fcntl.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" @@ -59,9 +59,11 @@ etmm_destroy (GtkObject *object) ETableMemoryPriv *priv = etmm->priv; /* XXX lots of stuff to free here */ - - g_free (priv->data); - g_free (priv); + if (priv) { + g_free (priv->data); + g_free (priv); + } + etmm->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index f731dc396a..93d8cfece8 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,7 +26,7 @@ #include "e-table-model.h" #include "gal/util/e-util.h" -#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass) +#define ETM_CLASS(e) ((ETableModelClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () @@ -366,7 +366,7 @@ e_table_model_class_init (GtkObjectClass *object_class) } -guint +GtkType e_table_model_get_type (void) { static guint type = 0; diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c index cd6be49753..15193c46d3 100644 --- a/widgets/table/e-table-one.c +++ b/widgets/table/e-table-one.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-one.c * Copyright 2000, 2001, Ximian, Inc. * @@ -133,35 +133,42 @@ one_value_to_string (ETableModel *etm, int col, const void *value) } static void -one_destroy (GtkObject *object) +one_finalize (GObject *object) { - ETableOne *one = E_TABLE_ONE(object); - - if (one->source) { + ETableOne *one = E_TABLE_ONE (object); + + if (one->data) { int i; int col_count; col_count = e_table_model_column_count(one->source); - - if (one->data) { - for (i = 0; i < col_count; i++) { - e_table_model_free_value(one->source, i, one->data[i]); - } - } - gtk_object_unref(GTK_OBJECT(one->source)); + for (i = 0; i < col_count; i++) + e_table_model_free_value(one->source, i, one->data[i]); + g_free (one->data); } + one->data = NULL; - g_free(one->data); + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +one_dispose (GObject *object) +{ + ETableOne *one = E_TABLE_ONE (object); + + if (one->source) + gtk_object_unref(GTK_OBJECT(one->source)); + one->source = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + G_OBJECT_CLASS (parent_class)->dispose (object); } static void e_table_one_class_init (GtkObjectClass *object_class) { ETableModelClass *model_class = (ETableModelClass *) object_class; + GObjectClass *gobject_class = (GObjectClass *) object_class; parent_class = gtk_type_class (E_TABLE_MODEL_TYPE); @@ -176,7 +183,8 @@ e_table_one_class_init (GtkObjectClass *object_class) model_class->value_is_empty = one_value_is_empty; model_class->value_to_string = one_value_to_string; - object_class->destroy = one_destroy; + gobject_class->dispose = one_dispose; + gobject_class->finalize = one_finalize; } static void diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c index 6bcc2cb008..080c685d6e 100644 --- a/widgets/table/e-table-scrolled.c +++ b/widgets/table/e-table-scrolled.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-scrolled.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "e-table.h" #include "e-table-scrolled.h" @@ -188,13 +188,13 @@ ets_grab_focus (GtkWidget *widget) /* Focus handler for the scrolled ETable */ static gint -ets_focus (GtkContainer *container, GtkDirectionType direction) +ets_focus (GtkWidget *container, GtkDirectionType direction) { ETableScrolled *ets; ets = E_TABLE_SCROLLED (container); - return gtk_container_focus (GTK_CONTAINER (ets->table), direction); + return gtk_widget_child_focus (GTK_WIDGET (ets->table), direction); } static void @@ -214,7 +214,7 @@ e_table_scrolled_class_init (ETableScrolledClass *class) widget_class->grab_focus = ets_grab_focus; - container_class->focus = ets_focus; + widget_class->focus = ets_focus; gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_TABLE); diff --git a/widgets/table/e-table-scrolled.h b/widgets/table/e-table-scrolled.h index ce12a8cefd..58241f25b6 100644 --- a/widgets/table/e-table-scrolled.h +++ b/widgets/table/e-table-scrolled.h @@ -27,9 +27,8 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SCROLLED_TYPE (e_table_scrolled_get_type ()) #define E_TABLE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TABLE_SCROLLED_TYPE, ETableScrolled)) @@ -71,7 +70,7 @@ GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm, ETable *e_table_scrolled_get_table (ETableScrolled *ets); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SCROLLED_H_ */ diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 1ec3583076..0348189446 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -132,8 +132,8 @@ e_table_search_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableSearchClass, search), - e_marshal_BOOL__STRING_ENUM, - GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_ENUM); + e_marshal_BOOLEAN__STRING_INT, + GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_INT); e_table_search_signals [SEARCH_ACCEPT] = gtk_signal_new ("accept", @@ -160,7 +160,7 @@ e_table_search_init (ETableSearch *ets) } -guint +GtkType e_table_search_get_type (void) { static guint type = 0; diff --git a/widgets/table/e-table-search.h b/widgets/table/e-table-search.h index bd614206a0..0c3e8b9bd9 100644 --- a/widgets/table/e-table-search.h +++ b/widgets/table/e-table-search.h @@ -25,10 +25,8 @@ #define _E_TABLE_SEARCH_H_ #include <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> -#include <gal/unicode/gunicode.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SEARCH_TYPE (e_table_search_get_type ()) #define E_TABLE_SEARCH(o) (GTK_CHECK_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch)) @@ -67,6 +65,6 @@ void e_table_search_input_character (ETableSearch *e_table_search, gboolean e_table_search_backspace (ETableSearch *e_table_search); void e_table_search_cancel (ETableSearch *e_table_search); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SEARCH_H_ */ diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 5de3ced003..e4d2767ea5 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-selection-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -236,9 +236,10 @@ etsm_destroy (GtkObject *object) etsm = E_TABLE_SELECTION_MODEL (object); - if (etsm->model_changed_idle_id) { - g_source_remove(etsm->model_changed_idle_id); - } + if (etsm->model_changed_idle_id) + g_source_remove (etsm->model_changed_idle_id); + etsm->model_changed_idle_id = 0; + drop_model(etsm); free_hash(etsm); diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c index 11cfafd01f..c8a7d4fe16 100644 --- a/widgets/table/e-table-simple.c +++ b/widgets/table/e-table-simple.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-simple.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h index 6dfe28f573..36ffa02de9 100644 --- a/widgets/table/e-table-simple.h +++ b/widgets/table/e-table-simple.h @@ -26,9 +26,8 @@ #define _E_TABLE_SIMPLE_H_ #include <gal/e-table/e-table-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ()) #define E_TABLE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple)) @@ -117,7 +116,6 @@ char *e_table_simple_string_value_to_string (ETableModel const void *val, void *data); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SIMPLE_H_ */ - diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c index a523bcf6d9..05a4245899 100644 --- a/widgets/table/e-table-size-test.c +++ b/widgets/table/e-table-size-test.c @@ -295,7 +295,6 @@ main (int argc, char *argv []) gnome_init ("TableExample", "TableExample", argc, argv); e_cursors_init (); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); create_table (); diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c index 3d49e4ba88..de9e7be4ea 100644 --- a/widgets/table/e-table-sort-info.c +++ b/widgets/table/e-table-sort-info.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sort-info.c * Copyright 2000, 2001, Ximian, Inc. * @@ -54,8 +54,11 @@ etsi_destroy (GtkObject *object) if (etsi->groupings) g_free(etsi->groupings); + etsi->groupings = NULL; + if (etsi->sortings) g_free(etsi->sortings); + etsi->sortings = NULL; GTK_OBJECT_CLASS (e_table_sort_info_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h index e7f7bea5cb..7a398fbb85 100644 --- a/widgets/table/e-table-sort-info.h +++ b/widgets/table/e-table-sort-info.h @@ -25,7 +25,7 @@ #define _E_TABLE_SORT_INFO_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index 7689d1f33f..93e103e1cc 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorted-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -50,20 +50,27 @@ etsv_destroy (GtkObject *object) { ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + if (etsv->sort_info_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); + etsv->sort_info_changed_id = 0; if (etsv->sort_idle_id) { g_source_remove(etsv->sort_idle_id); + etsv->sort_idle_id = 0; } if (etsv->insert_idle_id) { g_source_remove(etsv->insert_idle_id); + etsv->insert_idle_id = 0; } if (etsv->sort_info) gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + etsv->sort_info = NULL; + if (etsv->full_header) gtk_object_unref(GTK_OBJECT(etsv->full_header)); + etsv->full_header = NULL; GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index 5cc9c5bfd7..c84d6c15c0 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorted.c * Copyright 2000, 2001, Ximian, Inc. * @@ -53,21 +53,24 @@ ets_destroy (GtkObject *object) { ETableSorted *ets = E_TABLE_SORTED (object); - if (ets->sort_idle_id) { + if (ets->sort_idle_id) g_source_remove(ets->sort_idle_id); - } - if (ets->insert_idle_id) { + ets->sort_idle_id = 0; + + if (ets->insert_idle_id) g_source_remove(ets->insert_idle_id); - } + ets->insert_idle_id = 0; if (ets->sort_info) { gtk_signal_disconnect (GTK_OBJECT (ets->sort_info), ets->sort_info_changed_id); gtk_object_unref(GTK_OBJECT(ets->sort_info)); + ets->sort_info = NULL; } if (ets->full_header) gtk_object_unref(GTK_OBJECT(ets->full_header)); + ets->full_header = NULL; GTK_OBJECT_CLASS (ets_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 7a0c9d9126..8c530dca90 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorter.c * Copyright 2000, 2001, Ximian, Inc. * @@ -88,10 +88,15 @@ ets_destroy (GtkObject *object) if (ets->sort_info) gtk_object_unref(GTK_OBJECT(ets->sort_info)); + ets->sort_info = NULL; + if (ets->full_header) gtk_object_unref(GTK_OBJECT(ets->full_header)); + ets->full_header = NULL; + if (ets->source) gtk_object_unref(GTK_OBJECT(ets->source)); + ets->source = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorter.h b/widgets/table/e-table-sorter.h index b0097b9155..4bee51fbbd 100644 --- a/widgets/table/e-table-sorter.h +++ b/widgets/table/e-table-sorter.h @@ -30,9 +30,8 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ()) #define E_TABLE_SORTER(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter)) @@ -70,6 +69,6 @@ GtkType e_table_sorter_get_type (void); ETableSorter *e_table_sorter_new (ETableModel *etm, ETableHeader *full_header, ETableSortInfo *sort_info); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SORTER_H_ */ diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 7395ce60aa..6d8653b6d6 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-specification.c * Copyright 2000, 2001, Ximian, Inc. * @@ -31,8 +31,8 @@ #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" @@ -51,17 +51,17 @@ etsp_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (etsp->columns[i])); } g_free (etsp->columns); + etsp->columns = NULL; } if (etsp->state) gtk_object_unref (GTK_OBJECT (etsp->state)); + etsp->state = NULL; + g_free (etsp->click_to_add_message); + etsp->click_to_add_message = NULL; g_free (etsp->domain); - - etsp->columns = NULL; - etsp->state = NULL; - etsp->click_to_add_message = NULL; etsp->domain = NULL; GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object); @@ -251,6 +251,8 @@ e_table_specification_load_from_node (ETableSpecification *specification, if (!strcmp (children->name, "ETableColumn")) { ETableColumnSpecification *col_spec = e_table_column_specification_new (); + gtk_object_ref (GTK_OBJECT (col_spec)); + gtk_object_sink (GTK_OBJECT (col_spec)); e_table_column_specification_load_from_node (col_spec, children); list = g_list_append (list, col_spec); } else if (specification->state == NULL && !strcmp (children->name, "ETableState")) { @@ -260,6 +262,11 @@ e_table_specification_load_from_node (ETableSpecification *specification, } } + if (specification->state == NULL) { + /* Make the default state. */ + specification->state = e_table_state_vanilla (g_list_length (list)); + } + specification->columns = g_new (ETableColumnSpecification *, g_list_length (list) + 1); for (list2 = list, i = 0; list2; list2 = g_list_next (list2), i++) { specification->columns[i] = list2->data; @@ -293,7 +300,7 @@ e_table_specification_save_to_file (ETableSpecification *specification, xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); - ret = e_xml_save_file (filename, doc); + ret = xmlSaveFile (filename, doc); xmlFreeDoc (doc); diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index 3f21426390..92f52a4f42 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -25,7 +25,7 @@ #define _E_TABLE_SPECIFICATION_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/widgets/e-selection-model.h> #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-column-specification.h> diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index c9117add68..64b911f38f 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-state.c * Copyright 2000, 2001, Ximian, Inc. * @@ -21,7 +21,6 @@ * 02111-1307, USA. */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -31,8 +30,8 @@ #include <gtk/gtksignal.h> #include <gtk/gtkobject.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-table-state.h" @@ -95,6 +94,26 @@ e_table_state_new (void) return (ETableState *) etst; } +ETableState * +e_table_state_vanilla (int col_count) +{ + GString *str; + int i; + ETableState *res; + + str = g_string_new ("<ETableState>\n"); + for (i = 0; i < col_count; i++) + g_string_append_printf (str, " <column source=\"%d\"/>\n", i); + g_string_append (str, " <grouping></grouping>\n"); + g_string_append (str, "</ETableState>\n"); + + res = e_table_state_new (); + e_table_state_load_from_string (res, str->str); + + g_string_free (str, TRUE); + return res; +} + gboolean e_table_state_load_from_file (ETableState *state, const char *filename) @@ -191,7 +210,7 @@ e_table_state_save_to_file (ETableState *state, xmlDocSetRootElement (doc, e_table_state_save_to_node (state, NULL)); - e_xml_save_file (filename, doc); + xmlSaveFile (filename, doc); xmlFreeDoc (doc); } diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h index b4d64ad453..0532ba3771 100644 --- a/widgets/table/e-table-state.h +++ b/widgets/table/e-table-state.h @@ -25,7 +25,7 @@ #define _E_TABLE_STATE_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-sort-info.h> #ifdef __cplusplus @@ -55,6 +55,8 @@ typedef struct { GtkType e_table_state_get_type (void); ETableState *e_table_state_new (void); +ETableState *e_table_state_vanilla (int col_count); + gboolean e_table_state_load_from_file (ETableState *state, const char *filename); void e_table_state_load_from_string (ETableState *state, diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index 474fb5586d..16ff83d3f3 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-subset-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -28,7 +28,7 @@ #include "gal/util/e-util.h" #include "e-table-subset-variable.h" -#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)((GtkObject *)e)->klass) +#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE E_TABLE_SUBSET_TYPE diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 9518d4a2db..fe1c0c3962 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-subset.c - Implements a table that contains a subset of another table. * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -41,7 +41,7 @@ static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel static ETableModelClass *etss_parent_class; -#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT(object)->klass)) +#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT_GET_CLASS(object))) static gint etss_get_view_row (ETableSubset *etss, int row) @@ -112,6 +112,7 @@ etss_destroy (GtkObject *object) } g_free (etss->map_table); + etss->map_table = NULL; GTK_OBJECT_CLASS (etss_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-tooltip.h b/widgets/table/e-table-tooltip.h index 0438b52f40..81c00f9e34 100644 --- a/widgets/table/e-table-tooltip.h +++ b/widgets/table/e-table-tooltip.h @@ -24,10 +24,9 @@ #ifndef _E_TABLE_TOOLTIP_H_ #define _E_TABLE_TOOLTIP_H_ -#include <libgnomeui/gnome-canvas.h> -#include <libgnome/gnome-defs.h> +#include <libgnomecanvas/gnome-canvas.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct { gint timer; @@ -40,6 +39,6 @@ typedef struct { GnomeCanvasItem *eti; } ETableTooltip; -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h index b99372a474..5648fc2f06 100644 --- a/widgets/table/e-table-tree.h +++ b/widgets/table/e-table-tree.h @@ -25,9 +25,8 @@ #define _E_TABLE_TREE_H_ #include <gal/e-table/e-table-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct { char *title; @@ -44,6 +43,6 @@ typedef struct { ETableGroup *e_table_group_new (const char *title, ETableModel *table); ETableGroup *e_table_group_new_leaf (const char *title); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_TREE_H_ */ diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index c0e51e5bec..3af68ea2a3 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-utils.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h index 35277583c0..3c7fd937b6 100644 --- a/widgets/table/e-table-utils.h +++ b/widgets/table/e-table-utils.h @@ -28,9 +28,8 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-specification.h> #include <gal/e-table/e-table-extras.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS ETableHeader *e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, @@ -44,7 +43,7 @@ ETableCol *e_table_util_calculate_current_search_col (ETableHeader *h ETableSortInfo *sort_info, gboolean always_search); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_UTILS_H_ */ diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 7aa4a2fc1d..8691796062 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-without.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index bf9e850322..5772c26fc7 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table.c - A graphical view of a Table. * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -22,18 +22,18 @@ * 02111-1307, USA. */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdlib.h> #include <string.h> - +#include <stdio.h> +#include <gdk/gdk.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "gal/util/e-i18n.h" #include "gal/util/e-util.h" @@ -158,7 +158,7 @@ static void et_drag_data_received(GtkWidget *widget, guint time, ETable *et); -static gint et_focus (GtkContainer *container, GtkDirectionType direction); +static gint et_focus (GtkWidget *container, GtkDirectionType direction); static void scroll_off (ETable *et); static void scroll_on (ETable *et, guint scroll_direction); @@ -292,13 +292,13 @@ connect_header (ETable *e_table, ETableState *state) e_table->structure_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "structure_change", - structure_changed, e_table); + GTK_SIGNAL_FUNC (structure_changed), e_table); e_table->expansion_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "expansion_change", - expansion_changed, e_table); + GTK_SIGNAL_FUNC (expansion_changed), e_table); e_table->dimension_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "dimension_change", - dimension_changed, e_table); + GTK_SIGNAL_FUNC (dimension_changed), e_table); } static void @@ -316,40 +316,76 @@ et_destroy (GtkObject *object) gtk_signal_disconnect (GTK_OBJECT (et->search), et->search_accept_id); gtk_object_unref (GTK_OBJECT (et->search)); + et->search = NULL; } - if (et->group_info_change_id) + if (et->group_info_change_id) { gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->group_info_change_id); - if (et->sort_info_change_id) + et->group_info_change_id = 0; + } + + if (et->sort_info_change_id) { gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->sort_info_change_id); + et->sort_info_change_id = 0; + } - if (et->reflow_idle_id) + if (et->reflow_idle_id) { g_source_remove(et->reflow_idle_id); - et->reflow_idle_id = 0; + et->reflow_idle_id = 0; + } scroll_off (et); disconnect_header (et); - - gtk_object_unref (GTK_OBJECT (et->model)); - gtk_object_unref (GTK_OBJECT (et->full_header)); - gtk_object_unref (GTK_OBJECT (et->sort_info)); - gtk_object_unref (GTK_OBJECT (et->sorter)); - gtk_object_unref (GTK_OBJECT (et->selection)); - if (et->spec) + + if (et->model) { + gtk_object_unref (GTK_OBJECT (et->model)); + et->model = NULL; + } + + if (et->full_header) { + gtk_object_unref (GTK_OBJECT (et->full_header)); + et->full_header = NULL; + } + + if (et->sort_info) { + gtk_object_unref (GTK_OBJECT (et->sort_info)); + et->sort_info = NULL; + } + + if (et->sorter) { + gtk_object_unref (GTK_OBJECT (et->sorter)); + et->sorter = NULL; + } + + if (et->selection) { + gtk_object_unref (GTK_OBJECT (et->selection)); + et->selection = NULL; + } + + if (et->spec) { gtk_object_unref (GTK_OBJECT (et->spec)); + et->spec = NULL; + } - if (et->header_canvas != NULL) + if (et->header_canvas != NULL) { gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); + et->header_canvas = NULL; + } - if (et->site != NULL) + if (et->site != NULL) { e_table_drag_source_unset (et); + et->site = NULL; + } - gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); + if (et->table_canvas != NULL) { + gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); + et->table_canvas = NULL; + } - if (et->rebuild_idle_id) { + if (et->rebuild_idle_id != 0) { g_source_remove (et->rebuild_idle_id); et->rebuild_idle_id = 0; } @@ -458,6 +494,19 @@ init_search (ETable *e_table) } static void +et_finalize (GObject *object) +{ + ETable *et = E_TABLE (object); + + g_free (et->click_to_add_message); + et->click_to_add_message = NULL; + + g_free(et->domain); + et->domain = NULL; + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void e_table_init (GtkObject *object) { ETable *e_table = E_TABLE (object); @@ -528,18 +577,18 @@ et_grab_focus (GtkWidget *widget) /* Focus handler for the ETable */ static gint -et_focus (GtkContainer *container, GtkDirectionType direction) +et_focus (GtkWidget *container, GtkDirectionType direction) { ETable *e_table; e_table = E_TABLE (container); - if (container->focus_child) { - gtk_container_set_focus_child (container, NULL); + if (GTK_CONTAINER (container)->focus_child) { + gtk_container_set_focus_child (GTK_CONTAINER (container), NULL); return FALSE; } - return gtk_container_focus (GTK_CONTAINER (e_table->table_canvas), direction); + return gtk_widget_child_focus (GTK_WIDGET (e_table->table_canvas), direction); } static void @@ -1003,6 +1052,7 @@ static void et_eti_leave_edit (ETable *et) { GnomeCanvas *canvas = et->table_canvas; + if (GTK_WIDGET_HAS_FOCUS(canvas)) { GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item; @@ -1393,11 +1443,17 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { int row = 0; + int col_count, i; if (ete) gtk_object_ref(GTK_OBJECT(ete)); - else + else { ete = e_table_extras_new(); + gtk_object_ref(GTK_OBJECT(ete)); + gtk_object_sink(GTK_OBJECT(ete)); + } + + e_table->domain = g_strdup (specification->domain); e_table->domain = g_strdup (specification->domain); @@ -1410,11 +1466,22 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->draw_focus = specification->draw_focus; e_table->cursor_mode = specification->cursor_mode; e_table->full_header = e_table_spec_to_full_header(specification, ete); + gtk_object_ref (GTK_OBJECT (e_table->full_header)); + gtk_object_sink (GTK_OBJECT (e_table->full_header)); + + col_count = e_table_header_count (e_table->full_header); + for (i = 0; i < col_count; i++) { + ETableCol *col = e_table_header_get_column(e_table->full_header, i); + if (col && col->search) { + e_table->current_search_col = col; + e_table->search_col_set = TRUE; + break; + } + } e_table->model = etm; gtk_object_ref (GTK_OBJECT (etm)); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); connect_header (e_table, state); @@ -1440,6 +1507,8 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, NULL); e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info); + gtk_object_ref (GTK_OBJECT (e_table->sorter)); + gtk_object_sink (GTK_OBJECT (e_table->sorter)); gtk_object_set (GTK_OBJECT (e_table->selection), "model", etm, @@ -1482,7 +1551,6 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, 0, 0); gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); gtk_object_unref(GTK_OBJECT(ete)); @@ -1517,13 +1585,21 @@ e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); g_return_val_if_fail(spec_str != NULL, NULL); + gtk_object_ref (GTK_OBJECT (etm)); + gtk_object_sink (GTK_OBJECT (etm)); + specification = e_table_specification_new(); + gtk_object_ref (GTK_OBJECT (specification)); + gtk_object_sink (GTK_OBJECT (specification)); if (!e_table_specification_load_from_string(specification, spec_str)) { gtk_object_unref(GTK_OBJECT(specification)); return NULL; } + if (state_str) { state = e_table_state_new(); + gtk_object_ref (GTK_OBJECT (state)); + gtk_object_sink (GTK_OBJECT (state)); e_table_state_load_from_string(state, state_str); if (state->col_count <= 0) { gtk_object_unref(GTK_OBJECT(state)); @@ -2804,7 +2880,11 @@ static void context_destroyed (gpointer data) { ETable *et = data; - if (!GTK_OBJECT_DESTROYED (et)) { + /* if (!GTK_OBJECT_DESTROYED (et)) */ +#ifndef NO_WARNINGS +#warning FIXME +#endif + { et->last_drop_x = 0; et->last_drop_y = 0; et->last_drop_time = 0; @@ -2980,6 +3060,7 @@ e_table_class_init (ETableClass *class) parent_class = gtk_type_class (PARENT_TYPE); object_class->destroy = et_destroy; + G_OBJECT_CLASS (object_class)->finalize = et_finalize; object_class->set_arg = et_set_arg; object_class->get_arg = et_get_arg; @@ -2987,7 +3068,7 @@ e_table_class_init (ETableClass *class) widget_class->unrealize = et_unrealize; widget_class->size_request = et_size_request; - container_class->focus = et_focus; + widget_class->focus = et_focus; class->cursor_change = NULL; class->cursor_activated = NULL; @@ -3039,40 +3120,45 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [STATE_CHANGE] = gtk_signal_new ("state_change", @@ -3088,38 +3174,38 @@ e_table_class_init (ETableClass *class) E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, white_space_event), gtk_marshal_INT__POINTER, - GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT); + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals[TABLE_DRAG_BEGIN] = gtk_signal_new ("table_drag_begin", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_begin), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_END] = gtk_signal_new ("table_drag_end", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_end), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_DATA_GET] = gtk_signal_new ("table_drag_data_get", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_get), - e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT, + e_marshal_NONE__INT_INT_OBJECT_POINTER_UINT_UINT, GTK_TYPE_NONE, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_SELECTION_DATA, GTK_TYPE_UINT, GTK_TYPE_UINT); @@ -3128,33 +3214,33 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_delete), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_LEAVE] = gtk_signal_new ("table_drag_leave", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_leave), - e_marshal_NONE__INT_INT_POINTER_UINT, + e_marshal_NONE__INT_INT_OBJECT_UINT, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_UINT); et_signals[TABLE_DRAG_MOTION] = gtk_signal_new ("table_drag_motion", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_motion), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3163,11 +3249,11 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_drop), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3176,11 +3262,11 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_received), - e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT, + e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT, GTK_TYPE_NONE, 8, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_SELECTION_DATA, @@ -3196,7 +3282,7 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, set_scroll_adjustments), - gtk_marshal_NONE__POINTER_POINTER, + e_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); gtk_object_add_arg_type ("ETable::length_threshold", GTK_TYPE_INT, diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index f67e0078b1..175c8d58db 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -25,9 +25,10 @@ #ifndef _E_TABLE_H_ #define _E_TABLE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <gtk/gtkdnd.h> #include <gtk/gtktable.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-group.h> @@ -40,9 +41,8 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-sorter.h> #include <gal/e-table/e-table-search.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_TYPE (e_table_get_type ()) #define E_TABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_TYPE, ETable)) @@ -350,7 +350,9 @@ void e_table_right_click_up (ETable *table) void e_table_commit_click_to_add (ETable *table); -END_GNOME_DECLS +void e_table_commit_click_to_add (ETable *table); + +G_END_DECLS #endif /* _E_TABLE_H_ */ diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c index e129891656..bce925b335 100644 --- a/widgets/table/e-tree-memory-callbacks.c +++ b/widgets/table/e-tree-memory-callbacks.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-memory-callbacks.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index 27948727f7..f8898903d6 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-memory.c * Copyright 2000, 2001, Ximian, Inc. * @@ -30,8 +30,8 @@ #include <fcntl.h> #include <stdlib.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" @@ -219,12 +219,15 @@ etmm_destroy (GtkObject *object) ETreeMemory *etmm = E_TREE_MEMORY (object); ETreeMemoryPriv *priv = etmm->priv; + if (priv) { /* XXX lots of stuff to free here */ - if (priv->root) - e_tree_memory_node_remove (etmm, priv->root); + if (priv->root) + e_tree_memory_node_remove (etmm, priv->root); - g_free (priv); + g_free (priv); + } + etmm->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 193a79914d..89de484496 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -1,10 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-model.c * Copyright 2000, 2001, Ximian, Inc. * * Authors: - * Chris Lahey <clahey@ximian.com> + * Chris Lahey <clahey@ximian.com> * Chris Toshok <toshok@ximian.com> * * This library is free software; you can redistribute it and/or @@ -30,15 +30,15 @@ #include <unistd.h> #include <fcntl.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-tree-model.h" -#define ETM_CLASS(e) ((ETreeModelClass *)((GtkObject *)e)->klass) +#define ETM_CLASS(e) ((ETreeModelClass *)(GTK_OBJECT_GET_CLASS(e))) #define PARENT_TYPE (gtk_object_get_type()) @@ -106,7 +106,7 @@ e_tree_model_class_init (GtkObjectClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (klass), GTK_SIGNAL_OFFSET (ETreeModelClass, node_col_changed), - gtk_marshal_NONE__POINTER_INT, + e_marshal_NONE__POINTER_INT, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); e_tree_model_signals [NODE_INSERTED] = @@ -114,7 +114,7 @@ e_tree_model_class_init (GtkObjectClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (klass), GTK_SIGNAL_OFFSET (ETreeModelClass, node_inserted), - gtk_marshal_NONE__POINTER_POINTER, + e_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); e_tree_model_signals [NODE_REMOVED] = diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index cf4a7ac68c..dac0f85505 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -27,9 +27,9 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS + +G_BEGIN_DECLS #define E_TREE_MODEL_TYPE (e_tree_model_get_type ()) @@ -220,6 +220,7 @@ void e_tree_model_node_deleted (ETreeModel *tree_model, void e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath deleted_node); -END_GNOME_DECLS + +G_END_DECLS #endif /* _E_TREE_MODEL_H */ diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c index 93a5e6c702..f788a909f8 100644 --- a/widgets/table/e-tree-scrolled.c +++ b/widgets/table/e-tree-scrolled.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-scrolled.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gal/util/e-util.h> #include "e-tree-scrolled.h" @@ -187,13 +187,13 @@ ets_grab_focus (GtkWidget *widget) /* Focus handler for the scrolled ETree */ static gint -ets_focus (GtkContainer *container, GtkDirectionType direction) +ets_focus (GtkWidget *container, GtkDirectionType direction) { ETreeScrolled *ets; ets = E_TREE_SCROLLED (container); - return gtk_container_focus (GTK_CONTAINER (ets->tree), direction); + return gtk_widget_child_focus (GTK_WIDGET (ets->tree), direction); } static void @@ -213,7 +213,7 @@ e_tree_scrolled_class_init (ETreeScrolledClass *class) widget_class->grab_focus = ets_grab_focus; - container_class->focus = ets_focus; + widget_class->focus = ets_focus; gtk_object_add_arg_type ("ETreeScrolled::tree", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_TREE); diff --git a/widgets/table/e-tree-scrolled.h b/widgets/table/e-tree-scrolled.h index c1debd0afb..b528042eed 100644 --- a/widgets/table/e-tree-scrolled.h +++ b/widgets/table/e-tree-scrolled.h @@ -27,9 +27,8 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-table/e-tree-model.h> #include <gal/e-table/e-tree.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_SCROLLED_TYPE (e_tree_scrolled_get_type ()) #define E_TREE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TREE_SCROLLED_TYPE, ETreeScrolled)) @@ -71,7 +70,7 @@ GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm, ETree *e_tree_scrolled_get_tree (ETreeScrolled *ets); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_SCROLLED_H_ */ diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 4e1b626259..dc1a4610d1 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-selection-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -635,15 +635,19 @@ etsm_destroy (GtkObject *object) etsm = E_TREE_SELECTION_MODEL (object); - etsm_real_clear (etsm); - etsm->priv->cursor_path = NULL; - drop_model(etsm); - drop_ets(etsm); + if (etsm->priv) { + etsm_real_clear (etsm); + etsm->priv->cursor_path = NULL; - g_free (etsm->priv->cursor_save_id); + drop_model(etsm); + drop_ets(etsm); + + g_free (etsm->priv->cursor_save_id); + etsm->priv->cursor_save_id = NULL; - g_free(etsm->priv); - etsm->priv = NULL; + g_free (etsm->priv); + etsm->priv = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -1326,6 +1330,8 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->frozen_count = 0; + priv->frozen_count = 0; + priv->tree_model_pre_change_id = 0; priv->tree_model_no_change_id = 0; @@ -1337,7 +1343,6 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->tree_model_node_deleted_id = 0; priv->sorted_model_node_resorted_id = 0; - priv->selected_row = -1; priv->selected_range_end = -1; } diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c index 3abea69acf..c2c8c4314f 100644 --- a/widgets/table/e-tree-simple.c +++ b/widgets/table/e-tree-simple.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-simple.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c index f2a753222a..9fa587022f 100644 --- a/widgets/table/e-tree-sorted-variable.c +++ b/widgets/table/e-tree-sorted-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-sorted-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -62,32 +62,40 @@ etsv_destroy (GtkObject *object) { ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); + if (etsv->table_model_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etsv->table_model_changed_id); + etsv->table_model_changed_id = 0; + #if 0 gtk_signal_disconnect (GTK_OBJECT (etss->source), etsv->table_model_row_changed_id); gtk_signal_disconnect (GTK_OBJECT (etss->source), etsv->table_model_cell_changed_id); + + etsv->table_model_row_changed_id = 0; + etsv->table_model_cell_changed_id = 0; #endif - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + if (etsv->sort_info_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); + etsv->sort_info_changed_id = 0; - if (etsv->sort_idle_id) { + if (etsv->sort_idle_id) g_source_remove(etsv->sort_idle_id); - } - if (etsv->insert_idle_id) { + etsv->sort_idle_id = 0; + + if (etsv->insert_idle_id) g_source_remove(etsv->insert_idle_id); - } - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; + etsv->insert_idle_id = 0; if (etsv->sort_info) gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + etsv->sort_info = NULL; + if (etsv->full_header) gtk_object_unref(GTK_OBJECT(etsv->full_header)); + etsv->full_header = NULL; GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-sorted-variable.h b/widgets/table/e-tree-sorted-variable.h index 23d80eed10..7818ee8182 100644 --- a/widgets/table/e-tree-sorted-variable.h +++ b/widgets/table/e-tree-sorted-variable.h @@ -29,9 +29,8 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ()) #define E_TREE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable)) @@ -80,6 +79,6 @@ void e_tree_sorted_variable_decrement (ETreeSortedVariable *ets, gint amount); void e_tree_sorted_variable_set_allocation (ETreeSortedVariable *ets, gint total); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 7069369a38..0e6cf3ebf9 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-sorted.c * Copyright 2000, 2001, Ximian, Inc. * @@ -38,8 +38,8 @@ #include <fcntl.h> #include <string.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" @@ -594,6 +594,10 @@ ets_destroy (GtkObject *object) ETreeSortedPriv *priv = ets->priv; /* FIXME lots of stuff to free here */ + if (!priv) { + GTK_OBJECT_CLASS (parent_class)->destroy (object); + return; + } if (priv->root) free_path(priv->root); @@ -653,6 +657,8 @@ ets_destroy (GtkObject *object) g_free (priv); + ets->priv = NULL; + GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 92c33668de..201e121369 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-table-adapter.c * Copyright 2000, 2001, Ximian, Inc. * @@ -31,8 +31,8 @@ #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> +#include <libxml/tree.h> +#include <libxml/parser.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-tree-table-adapter.h" @@ -405,6 +405,11 @@ etta_destroy (GtkObject *object) { ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object); + if (!etta->priv) { + GTK_OBJECT_CLASS (parent_class)->destroy (object); + return; + } + if (etta->priv->source && e_tree_model_has_save_id(etta->priv->source)) { g_hash_table_foreach(etta->priv->attributes, free_string, NULL); } @@ -444,6 +449,7 @@ etta_destroy (GtkObject *object) g_free (etta->priv->map_table); g_free (etta->priv); + etta->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -961,7 +967,7 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f save_expanded_state_func, &tar); - e_xml_save_file (filename, doc); + xmlSaveFile (filename, doc); xmlFreeDoc (doc); } @@ -1006,6 +1012,8 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f e_table_model_pre_change(E_TABLE_MODEL(etta)); + e_table_model_pre_change(E_TABLE_MODEL(etta)); + for (child = root->xmlChildrenNode; child; child = child->next) { char *id; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 46ff8a9f27..1dd7b8a4ad 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree.c * Copyright 2000, 2001, Ximian, Inc. * @@ -28,9 +28,9 @@ #include <stdio.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include "gal/util/e-i18n.h" +#include <gal/util/e-i18n.h> #include <gal/util/e-util.h> #include <gal/widgets/e-canvas.h> #include <gal/widgets/e-canvas-background.h> @@ -241,7 +241,6 @@ static void et_drag_data_received(GtkWidget *widget, guint time, ETree *et); -static gint et_focus (GtkContainer *container, GtkDirectionType direction); static void scroll_off (ETree *et); static void scroll_on (ETree *et, guint scroll_direction); @@ -352,20 +351,20 @@ connect_header (ETree *e_tree, ETableState *state) e_tree->priv->structure_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "structure_change", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); e_tree->priv->expansion_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "expansion_change", - change_trigger, e_tree); + GTK_SIGNAL_FUNC (change_trigger), e_tree); if (state->sort_info) { e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info); e_table_sort_info_set_can_group (e_tree->priv->sort_info, FALSE); e_tree->priv->sort_info_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "sort_info_changed", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); e_tree->priv->group_info_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "group_info_changed", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); } else e_tree->priv->sort_info = NULL; @@ -379,50 +378,54 @@ et_destroy (GtkObject *object) { ETree *et = E_TREE (object); - if (et->priv->search) { - if (et->priv->search_search_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_search_id); - if (et->priv->search_accept_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_accept_id); - gtk_object_unref (GTK_OBJECT (et->priv->search)); - } + if (et->priv) { - if (et->priv->reflow_idle_id) - g_source_remove(et->priv->reflow_idle_id); - et->priv->reflow_idle_id = 0; + if (et->priv->search) { + if (et->priv->search_search_id) + gtk_signal_disconnect (GTK_OBJECT (et->priv->search), + et->priv->search_search_id); + if (et->priv->search_accept_id) + gtk_signal_disconnect (GTK_OBJECT (et->priv->search), + et->priv->search_accept_id); + gtk_object_unref (GTK_OBJECT (et->priv->search)); + } - scroll_off (et); - hover_off (et); - e_free_string_list (et->priv->expanded_list); + if (et->priv->reflow_idle_id) + g_source_remove(et->priv->reflow_idle_id); + et->priv->reflow_idle_id = 0; + + scroll_off (et); + hover_off (et); + e_free_string_list (et->priv->expanded_list); - et_disconnect_from_etta (et); + et_disconnect_from_etta (et); - gtk_object_unref (GTK_OBJECT (et->priv->etta)); - gtk_object_unref (GTK_OBJECT (et->priv->model)); - gtk_object_unref (GTK_OBJECT (et->priv->sorted)); - gtk_object_unref (GTK_OBJECT (et->priv->full_header)); - disconnect_header (et); - gtk_object_unref (GTK_OBJECT (et->priv->selection)); - if (et->priv->spec) - gtk_object_unref (GTK_OBJECT (et->priv->spec)); + gtk_object_unref (GTK_OBJECT (et->priv->etta)); + gtk_object_unref (GTK_OBJECT (et->priv->model)); + gtk_object_unref (GTK_OBJECT (et->priv->sorted)); + gtk_object_unref (GTK_OBJECT (et->priv->full_header)); + disconnect_header (et); + gtk_object_unref (GTK_OBJECT (et->priv->selection)); + if (et->priv->spec) + gtk_object_unref (GTK_OBJECT (et->priv->spec)); - if (et->priv->sorter) - gtk_object_unref (GTK_OBJECT (et->priv->sorter)); + if (et->priv->sorter) + gtk_object_unref (GTK_OBJECT (et->priv->sorter)); - if (et->priv->header_canvas) - gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); + if (et->priv->header_canvas) + gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); - if (et->priv->site) - e_tree_drag_source_unset (et); + if (et->priv->site) + e_tree_drag_source_unset (et); - gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas)); + gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas)); - g_free(et->priv); - et->priv = NULL; + g_free(et->priv); + et->priv = NULL; + } - (*parent_class->destroy)(object); + if (parent_class->destroy) + parent_class->destroy (object); } static void @@ -447,7 +450,7 @@ search_search_callback (ETreeModel *model, ETreePath path, gpointer data) const void *value; ETableCol *col = current_search_col (cb_data->et); - value = e_tree_model_value_at (model, path, col->col_idx); + value = e_tree_model_value_at (model, path, cb_data->et->priv->current_search_col->col_idx); return col->search (value, cb_data->string); } @@ -624,18 +627,18 @@ et_grab_focus (GtkWidget *widget) /* Focus handler for the ETree */ static gint -et_focus (GtkContainer *container, GtkDirectionType direction) +et_focus (GtkWidget *container, GtkDirectionType direction) { ETree *e_tree; e_tree = E_TREE (container); - if (container->focus_child) { - gtk_container_set_focus_child (container, NULL); + if (GTK_CONTAINER (container)->focus_child) { + gtk_container_set_focus_child (GTK_CONTAINER (container), NULL); return FALSE; } - return gtk_container_focus (GTK_CONTAINER (e_tree->priv->table_canvas), direction); + return gtk_widget_child_focus (GTK_WIDGET (e_tree->priv->table_canvas), direction); } static void @@ -1362,6 +1365,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { int row = 0; + int i, col_count; if (ete) gtk_object_ref(GTK_OBJECT(ete)); @@ -1376,6 +1380,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, e_tree->priv->full_header = e_table_spec_to_full_header(specification, ete); connect_header (e_tree, state); + e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling; e_tree->priv->model = etm; @@ -1387,7 +1392,6 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, et_connect_to_etta (e_tree); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_tree->priv->sorter = e_sorter_new(); @@ -1437,7 +1441,6 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, 0, 0); gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); gtk_object_unref(GTK_OBJECT(ete)); @@ -1777,7 +1780,6 @@ et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_ALWAYS_SEARCH: GTK_VALUE_BOOL (*arg) = etree->priv->always_search; break; - default: break; } @@ -3040,7 +3042,7 @@ e_tree_class_init (ETreeClass *class) widget_class->grab_focus = et_grab_focus; widget_class->unrealize = et_unrealize; - container_class->focus = et_focus; + widget_class->focus = et_focus; class->cursor_change = NULL; class->cursor_activated = NULL; @@ -3068,7 +3070,7 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, cursor_change), - gtk_marshal_NONE__INT_POINTER, + e_marshal_NONE__INT_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER); et_signals [CURSOR_ACTIVATED] = @@ -3076,7 +3078,7 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, cursor_activated), - gtk_marshal_NONE__INT_POINTER, + e_marshal_NONE__INT_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER); et_signals [SELECTION_CHANGE] = @@ -3092,40 +3094,61 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, double_click), - e_marshal_NONE__INT_POINTER_INT_POINTER, - GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_POINTER_INT_BOXED, + GTK_TYPE_NONE, 4, GTK_TYPE_INT, + GTK_TYPE_POINTER, GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, right_click), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, click), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, key_press), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, start_drag), - e_marshal_NONE__INT_POINTER_INT_POINTER, - GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_POINTER_INT_BOXED, + GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); + + et_signals [STATE_CHANGE] = + gtk_signal_new ("state_change", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETreeClass, state_change), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + et_signals [WHITE_SPACE_EVENT] = + gtk_signal_new ("white_space_event", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETreeClass, white_space_event), + gtk_marshal_INT__POINTER, + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals [STATE_CHANGE] = gtk_signal_new ("state_change", @@ -3141,41 +3164,41 @@ e_tree_class_init (ETreeClass *class) E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, white_space_event), gtk_marshal_INT__POINTER, - GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT); + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals[TREE_DRAG_BEGIN] = gtk_signal_new ("tree_drag_begin", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_begin), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_BOXED, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_END] = gtk_signal_new ("tree_drag_end", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_end), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_BOXED, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_DATA_GET] = gtk_signal_new ("tree_drag_data_get", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_get), - e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_BOXED_UINT_UINT, GTK_TYPE_NONE, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_SELECTION_DATA, GTK_TYPE_UINT, GTK_TYPE_UINT); @@ -3184,36 +3207,36 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_delete), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_OBJECT, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_LEAVE] = gtk_signal_new ("tree_drag_leave", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_leave), - e_marshal_NONE__INT_POINTER_INT_POINTER_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_UINT, GTK_TYPE_NONE, 5, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_UINT); et_signals[TREE_DRAG_MOTION] = gtk_signal_new ("tree_drag_motion", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_motion), - e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3222,12 +3245,12 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_drop), - e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3236,12 +3259,12 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_received), - e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_INT_INT_BOXED_UINT_UINT, GTK_TYPE_NONE, 9, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_SELECTION_DATA, @@ -3257,8 +3280,9 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, set_scroll_adjustments), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); + e_marshal_NONE__POINTER_POINTER, + GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, + GTK_TYPE_ADJUSTMENT); gtk_object_add_arg_type ("ETree::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index b877b00d1f..c66311b1c3 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -24,10 +24,10 @@ #ifndef _E_TREE_H_ #define _E_TREE_H_ +#include <gtk/gtkdnd.h> #include <gtk/gtktable.h> -#include <gnome-xml/tree.h> -#include <libgnomeui/gnome-canvas.h> - +#include <libxml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/widgets/e-printable.h> #include <gal/e-table/e-table-extras.h> @@ -35,7 +35,6 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-tree-model.h> #include <gal/e-table/e-tree-table-adapter.h> -#include <libgnome/gnome-defs.h> #define E_TREE_USE_TREE_SELECTION @@ -43,7 +42,7 @@ #include <gal/e-table/e-tree-selection-model.h> #endif -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_TYPE (e_tree_get_type ()) #define E_TREE(o) (GTK_CHECK_CAST ((o), E_TREE_TYPE, ETree)) @@ -305,7 +304,7 @@ gboolean e_tree_find_next (ETree *et, void e_tree_right_click_up (ETree *et); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_H_ */ diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c index 20faa35e57..fe211e9d21 100644 --- a/widgets/table/table-test.c +++ b/widgets/table/table-test.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * table-test.c * Copyright 1999, 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c index 1b717009ef..2c0c4f72e9 100644 --- a/widgets/table/test-check.c +++ b/widgets/table/test-check.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-check.c * Copyright 2000, 2001, Ximian, Inc. * @@ -160,7 +160,6 @@ check_test (void) GdkPixbuf *pixbuf; GnomeCanvasItem *item; - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_table_model = e_table_simple_new ( diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c index d6bbe4d2be..6fd0059f4b 100644 --- a/widgets/table/test-cols.c +++ b/widgets/table/test-cols.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-cols.c * Copyright 2000, 2001, Ximian, Inc. * @@ -159,7 +159,6 @@ multi_cols_test (void) ECell *cell_left_just, *cell_image_toggle; GnomeCanvasItem *item; - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_table_model = e_table_simple_new ( diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c index 55a432e995..9ef77c6c2d 100644 --- a/widgets/table/test-table.c +++ b/widgets/table/test-table.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-table.c * Copyright 2000, 2001, Ximian, Inc. * |