diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-01-17 02:24:31 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-01-17 07:52:52 +0800 |
commit | 992c8b7d58025cf4d04ed3665210f191c8048339 (patch) | |
tree | ed04bd47c142c1a35820b03c6df8e8455d86f15c /widgets | |
parent | 2c476af581cc64bb3de8edc726149a7d8e9677b8 (diff) | |
download | gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar.gz gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar.bz2 gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar.lz gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar.xz gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.tar.zst gsoc2013-evolution-992c8b7d58025cf4d04ed3665210f191c8048339.zip |
libetable cleanups.
Diffstat (limited to 'widgets')
134 files changed, 4097 insertions, 3131 deletions
diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c index 38a1080992..4b98bef571 100644 --- a/widgets/menus/gal-define-views-model.c +++ b/widgets/menus/gal-define-views-model.c @@ -31,7 +31,7 @@ #include "gal-define-views-model.h" -G_DEFINE_TYPE (GalDefineViewsModel, gal_define_views_model, E_TABLE_MODEL_TYPE) +G_DEFINE_TYPE (GalDefineViewsModel, gal_define_views_model, E_TYPE_TABLE_MODEL) enum { PROP_0, diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c index 20f56b443e..de26a5df9f 100644 --- a/widgets/table/e-cell-checkbox.c +++ b/widgets/table/e-cell-checkbox.c @@ -61,9 +61,9 @@ ecc_print (ECellView *ecell_view, GtkPrintContext *context, } static void -e_cell_checkbox_class_init (ECellCheckboxClass *klass) +e_cell_checkbox_class_init (ECellCheckboxClass *class) { - ECellClass *ecc = E_CELL_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (class); ecc->print = ecc_print; checks[0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); @@ -93,5 +93,5 @@ e_cell_checkbox_init (ECellCheckbox *eccb) ECell * e_cell_checkbox_new (void) { - return g_object_new (E_CELL_CHECKBOX_TYPE, NULL); + return g_object_new (E_TYPE_CELL_CHECKBOX, NULL); } diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h index fa05ecbb06..8306b2d29a 100644 --- a/widgets/table/e-cell-checkbox.h +++ b/widgets/table/e-cell-checkbox.h @@ -26,24 +26,40 @@ #include <table/e-cell-toggle.h> +/* Standard GObject macros */ +#define E_TYPE_CELL_CHECKBOX \ + (e_cell_checkbox_get_type ()) +#define E_CELL_CHECKBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_CHECKBOX, ECellCheckbox)) +#define E_CELL_CHECKBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_CHECKBOX, ECellCheckboxClass)) +#define E_IS_CELL_CHECKBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_CHECKBOX)) +#define E_IS_CELL_CHECKBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_CHECKBOX)) +#define E_CELL_CHECKBOX_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_CHECKBOX, ECellCheckboxClass)) + G_BEGIN_DECLS -#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) -#define E_CELL_CHECKBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) -#define E_CELL_CHECKBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass)) -#define E_IS_CELL_CHECKBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_CHECKBOX_TYPE)) -#define E_IS_CELL_CHECKBOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE)) +typedef struct _ECellCheckbox ECellCheckbox; +typedef struct _ECellCheckboxClass ECellCheckboxClass; -typedef struct { +struct _ECellCheckbox { ECellToggle parent; -} ECellCheckbox; +}; -typedef struct { +struct _ECellCheckboxClass { ECellToggleClass parent_class; -} ECellCheckboxClass; +}; -GType e_cell_checkbox_get_type (void); -ECell *e_cell_checkbox_new (void); +GType e_cell_checkbox_get_type (void) G_GNUC_CONST; +ECell * e_cell_checkbox_new (void); G_END_DECLS diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index c06e5450e8..168061e4e7 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -109,13 +109,13 @@ static gint e_cell_combo_key_press (GtkWidget *popup_window, static void e_cell_combo_update_cell (ECellCombo *ecc); static void e_cell_combo_restart_edit (ECellCombo *ecc); -G_DEFINE_TYPE (ECellCombo, e_cell_combo, E_CELL_POPUP_TYPE) +G_DEFINE_TYPE (ECellCombo, e_cell_combo, E_TYPE_CELL_POPUP) static void -e_cell_combo_class_init (ECellComboClass *klass) +e_cell_combo_class_init (ECellComboClass *class) { - ECellPopupClass *ecpc = E_CELL_POPUP_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellPopupClass *ecpc = E_CELL_POPUP_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = e_cell_combo_dispose; @@ -203,11 +203,9 @@ e_cell_combo_init (ECellCombo *ecc) * Returns: an ECellCombo object. */ ECell * -e_cell_combo_new (void) +e_cell_combo_new (void) { - ECellCombo *ecc = g_object_new (E_CELL_COMBO_TYPE, NULL); - - return (ECell*) ecc; + return g_object_new (E_TYPE_CELL_COMBO, NULL); } /* diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h index 728addeed9..ec77dcd6f0 100644 --- a/widgets/table/e-cell-combo.h +++ b/widgets/table/e-cell-combo.h @@ -33,29 +33,50 @@ #include <table/e-cell-popup.h> -#define E_CELL_COMBO_TYPE (e_cell_combo_get_type ()) -#define E_CELL_COMBO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_COMBO_TYPE, ECellCombo)) -#define E_CELL_COMBO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_COMBO_TYPE, ECellComboClass)) -#define E_IS_CELL_COMBO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_COMBO_TYPE)) -#define E_IS_CELL_COMBO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_COMBO_TYPE)) +/* Standard GObject macros */ +#define E_TYPE_CELL_COMBO \ + (e_cell_combo_get_type ()) +#define E_CELL_COMBO(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_COMBO, ECellCombo)) +#define E_CELL_COMBO_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_COMBO, ECellComboClass)) +#define E_IS_CELL_COMBO(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_COMBO)) +#define E_IS_CELL_COMBO_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_COMBO)) +#define E_CELL_COMBO_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_COMBO, ECellComboClass)) -typedef struct { +G_BEGIN_DECLS + +typedef struct _ECellCombo ECellCombo; +typedef struct _ECellComboClass ECellComboClass; + +struct _ECellCombo { ECellPopup parent; GtkWidget *popup_window; GtkWidget *popup_scrolled_window; GtkWidget *popup_tree_view; -} ECellCombo; +}; -typedef struct { +struct _ECellComboClass { ECellPopupClass parent_class; -} ECellComboClass; +}; -GType e_cell_combo_get_type (void); -ECell *e_cell_combo_new (void); +GType e_cell_combo_get_type (void) G_GNUC_CONST; +ECell * e_cell_combo_new (void); /* These must be UTF-8. */ -void e_cell_combo_set_popdown_strings (ECellCombo *ecc, - GList *strings); +void e_cell_combo_set_popdown_strings + (ECellCombo *ecc, + GList *strings); + +G_END_DECLS #endif /* _E_CELL_COMBO_H_ */ diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c index 31d63d97cf..a71d3cc76c 100644 --- a/widgets/table/e-cell-date-edit.c +++ b/widgets/table/e-cell-date-edit.c @@ -114,7 +114,7 @@ enum { PROP_UPPER_HOUR }; -G_DEFINE_TYPE (ECellDateEdit, e_cell_date_edit, E_CELL_POPUP_TYPE) +G_DEFINE_TYPE (ECellDateEdit, e_cell_date_edit, E_TYPE_CELL_POPUP) static void e_cell_date_edit_class_init (ECellDateEditClass *class) diff --git a/widgets/table/e-cell-date-edit.h b/widgets/table/e-cell-date-edit.h index 4de4dc1819..5224b0ddff 100644 --- a/widgets/table/e-cell-date-edit.h +++ b/widgets/table/e-cell-date-edit.h @@ -32,11 +32,26 @@ #include <time.h> #include <table/e-cell-popup.h> -#define E_CELL_DATE_EDIT_TYPE (e_cell_date_edit_get_type ()) -#define E_CELL_DATE_EDIT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_DATE_EDIT_TYPE, ECellDateEdit)) -#define E_CELL_DATE_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_CELL_DATE_EDIT_TYPE, ECellDateEditClass)) -#define E_IS_CELL_DATE_EDIT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_DATE_EDIT_TYPE)) -#define E_IS_CELL_DATE_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_DATE_EDIT_TYPE)) +/* Standard GObject macros */ +#define E_TYPE_CELL_DATE_EDIT \ + (e_cell_date_edit_get_type ()) +#define E_CELL_DATE_EDIT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_DATE_EDIT, ECellDateEdit)) +#define E_CELL_DATE_EDIT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_DATE_EDIT, ECellDateEditClass)) +#define E_IS_CELL_DATE_EDIT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_DATE_EDIT)) +#define E_IS_CELL_DATE_EDIT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_DATE_EDIT)) +#define E_CELL_DATE_EDIT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_DATE_EDIT, ECellDateEditClass)) + +G_BEGIN_DECLS typedef struct _ECellDateEdit ECellDateEdit; typedef struct _ECellDateEditClass ECellDateEditClass; @@ -81,7 +96,7 @@ struct _ECellDateEditClass { ECellPopupClass parent_class; }; -GType e_cell_date_edit_get_type (void); +GType e_cell_date_edit_get_type (void) G_GNUC_CONST; ECell * e_cell_date_edit_new (void); /* These freeze and thaw the rebuilding of the time list. They are useful when @@ -99,4 +114,6 @@ void e_cell_date_edit_set_get_time_callback gpointer data, GDestroyNotify destroy); +G_END_DECLS + #endif /* _E_CELL_DATE_EDIT_H_ */ diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c index c005b8371d..c4a4cf3103 100644 --- a/widgets/table/e-cell-date.c +++ b/widgets/table/e-cell-date.c @@ -61,9 +61,9 @@ ecd_free_text (ECellText *cell, gchar *text) } static void -e_cell_date_class_init (ECellDateClass *klass) +e_cell_date_class_init (ECellDateClass *class) { - ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (class); ectc->get_text = ecd_get_text; ectc->free_text = ecd_free_text; diff --git a/widgets/table/e-cell-date.h b/widgets/table/e-cell-date.h index 5753d24642..c498095241 100644 --- a/widgets/table/e-cell-date.h +++ b/widgets/table/e-cell-date.h @@ -58,7 +58,7 @@ struct _ECellDateClass { ECellTextClass parent_class; }; -GType e_cell_date_get_type (void); +GType e_cell_date_get_type (void) G_GNUC_CONST; ECell * e_cell_date_new (const gchar *fontname, GtkJustification justify); void e_cell_date_set_format_component diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c index 6f587db9d2..4053452705 100644 --- a/widgets/table/e-cell-hbox.c +++ b/widgets/table/e-cell-hbox.c @@ -39,7 +39,7 @@ #include "e-cell-hbox.h" #include "e-table-item.h" -G_DEFINE_TYPE (ECellHbox, e_cell_hbox, E_CELL_TYPE) +G_DEFINE_TYPE (ECellHbox, e_cell_hbox, E_TYPE_CELL) #define INDENT_AMOUNT 16 #define MAX_CELL_SIZE 25 @@ -270,10 +270,10 @@ ecv_dispose (GObject *object) } static void -e_cell_hbox_class_init (ECellHboxClass *klass) +e_cell_hbox_class_init (ECellHboxClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ECellClass *ecc = E_CELL_CLASS (class); object_class->dispose = ecv_dispose; @@ -287,7 +287,7 @@ e_cell_hbox_class_init (ECellHboxClass *klass) ecc->max_width = ecv_max_width; -/* gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_HBOX_TYPE, gal_a11y_e_cell_hbox_new); */ +/* gal_a11y_e_cell_registry_add_cell_type (NULL, E_TYPE_CELL_HBOX, gal_a11y_e_cell_hbox_new); */ } static void @@ -309,9 +309,7 @@ e_cell_hbox_init (ECellHbox *ecv) ECell * e_cell_hbox_new (void) { - ECellHbox *ecv = g_object_new (E_CELL_HBOX_TYPE, NULL); - - return (ECell *) ecv; + return g_object_new (E_TYPE_CELL_HBOX, NULL); } void diff --git a/widgets/table/e-cell-hbox.h b/widgets/table/e-cell-hbox.h index 42b1c60e61..41cc01e6a1 100644 --- a/widgets/table/e-cell-hbox.h +++ b/widgets/table/e-cell-hbox.h @@ -27,41 +27,59 @@ #include <libgnomecanvas/libgnomecanvas.h> #include <table/e-cell.h> +/* Standard GObject macros */ +#define E_TYPE_CELL_HBOX \ + (e_cell_hbox_get_type ()) +#define E_CELL_HBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_HBOX, ECellHbox)) +#define E_CELL_HBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_HBOX, ECellHboxClass)) +#define E_IS_CELL_HBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_HBOX)) +#define E_IS_CELL_HBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_HBOX)) +#define E_CELL_HBOX_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_HBOX, ECellHboxClass)) + G_BEGIN_DECLS -#define E_CELL_HBOX_TYPE (e_cell_hbox_get_type ()) -#define E_CELL_HBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_HBOX_TYPE, ECellHbox)) -#define E_CELL_HBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_HBOX_TYPE, ECellHboxClass)) -#define E_IS_CELL_HBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_HBOX_TYPE)) -#define E_IS_CELL_HBOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_HBOX_TYPE)) +typedef struct _ECellHbox ECellHbox; +typedef struct _ECellHboxView ECellHboxView; +typedef struct _ECellHboxClass ECellHboxClass; -typedef struct { +struct _ECellHbox { ECell parent; - gint subcell_count; + gint subcell_count; ECell **subcells; - gint *model_cols; - gint *def_size_cols; -} ECellHbox; + gint *model_cols; + gint *def_size_cols; +}; + +struct _ECellHboxView { + ECellView cell_view; -typedef struct { - ECellView cell_view; - gint subcell_view_count; - ECellView **subcell_views; - gint *model_cols; - gint *def_size_cols; -} ECellHboxView; + gint subcell_view_count; + ECellView **subcell_views; + gint *model_cols; + gint *def_size_cols; +}; -typedef struct { +struct _ECellHboxClass { ECellClass parent_class; -} ECellHboxClass; +}; -GType e_cell_hbox_get_type (void); -ECell *e_cell_hbox_new (void); -void e_cell_hbox_append (ECellHbox *vbox, - ECell *subcell, - gint model_col, - gint size); +GType e_cell_hbox_get_type (void) G_GNUC_CONST; +ECell * e_cell_hbox_new (void); +void e_cell_hbox_append (ECellHbox *vbox, + ECell *subcell, + gint model_col, + gint size); G_END_DECLS diff --git a/widgets/table/e-cell-number.c b/widgets/table/e-cell-number.c index 3fd5dcb123..72f25ce2f4 100644 --- a/widgets/table/e-cell-number.c +++ b/widgets/table/e-cell-number.c @@ -45,9 +45,9 @@ ecn_free_text (ECellText *cell, gchar *text) } static void -e_cell_number_class_init (ECellNumberClass *klass) +e_cell_number_class_init (ECellNumberClass *class) { - ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (class); ectc->get_text = ecn_get_text; ectc->free_text = ecn_free_text; diff --git a/widgets/table/e-cell-number.h b/widgets/table/e-cell-number.h index 25e4d3aad6..539f27679e 100644 --- a/widgets/table/e-cell-number.h +++ b/widgets/table/e-cell-number.h @@ -58,7 +58,7 @@ struct _ECellNumberClass { ECellTextClass parent_class; }; -GType e_cell_number_get_type (void); +GType e_cell_number_get_type (void) G_GNUC_CONST; ECell * e_cell_number_new (const gchar *fontname, GtkJustification justify); diff --git a/widgets/table/e-cell-percent.h b/widgets/table/e-cell-percent.h index 691c8bc9fe..be4fdac9b7 100644 --- a/widgets/table/e-cell-percent.h +++ b/widgets/table/e-cell-percent.h @@ -63,7 +63,7 @@ struct _ECellPercentClass { ECellTextClass parent_class; }; -GType e_cell_percent_get_type (void); +GType e_cell_percent_get_type (void) G_GNUC_CONST; ECell * e_cell_percent_new (const gchar *fontname, GtkJustification justify); diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index f37d4b8757..b8662b9182 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -31,7 +31,7 @@ #include <gtk/gtk.h> #include "e-cell-pixbuf.h" -G_DEFINE_TYPE (ECellPixbuf, e_cell_pixbuf, E_CELL_TYPE) +G_DEFINE_TYPE (ECellPixbuf, e_cell_pixbuf, E_TYPE_CELL) typedef struct _ECellPixbufView ECellPixbufView; @@ -56,19 +56,7 @@ enum { ECell * e_cell_pixbuf_new (void) { - ECellPixbuf *ecp; - - ecp = g_object_new (E_CELL_PIXBUF_TYPE, NULL); - e_cell_pixbuf_construct (ecp); - - return (ECell *) ecp; -} - -void -e_cell_pixbuf_construct (ECellPixbuf *ecp) -{ - /* noop */ - return; + return g_object_new (E_TYPE_CELL_PIXBUF, NULL); } /* @@ -334,10 +322,10 @@ e_cell_pixbuf_init (ECellPixbuf *ecp) } static void -e_cell_pixbuf_class_init (ECellPixbufClass *klass) +e_cell_pixbuf_class_init (ECellPixbufClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ECellClass *ecc = E_CELL_CLASS (class); object_class->dispose = pixbuf_dispose; object_class->set_property = pixbuf_set_property; diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h index f6d3c5173d..f4848f7430 100644 --- a/widgets/table/e-cell-pixbuf.h +++ b/widgets/table/e-cell-pixbuf.h @@ -27,17 +27,32 @@ #include <table/e-table.h> -#define E_CELL_PIXBUF_TYPE (e_cell_pixbuf_get_type ()) -#define E_CELL_PIXBUF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_PIXBUF_TYPE, ECellPixbuf)) -#define E_CELL_PIXBUF_CLASS(k) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((k), E_CELL_PIXBUF_TYPE, ECellPixbufClass)) -#define E_IS_CELL_PIXBUF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_PIXBUF_TYPE)) -#define E_IS_CELL_PIXBUF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_PIXBUF_TYPE)) +/* Standard GObject macros */ +#define E_TYPE_CELL_PIXBUF \ + (e_cell_pixbuf_get_type ()) +#define E_CELL_PIXBUF(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_PIXBUF, ECellPixbuf)) +#define E_CELL_PIXBUF_CLASS(cls) \ + (G_TYPE_CHECK_INSTANCE_CAST_CLASS \ + ((cls), E_TYPE_CELL_PIXBUF, ECellPixbufClass)) +#define E_IS_CELL_PIXBUF(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_PIXBUF)) +#define E_IS_CELL_PIXBUF_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_PIXBUF)) +#define E_CELL_PIXBUF_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_PIXBUF, ECellPixbufClass)) + +G_BEGIN_DECLS typedef struct _ECellPixbuf ECellPixbuf; typedef struct _ECellPixbufClass ECellPixbufClass; struct _ECellPixbuf { - ECell parent; + ECell parent; gint selected_column; gint focused_column; @@ -45,11 +60,12 @@ struct _ECellPixbuf { }; struct _ECellPixbufClass { - ECellClass parent_class; + ECellClass parent_class; }; -GType e_cell_pixbuf_get_type (void); -ECell *e_cell_pixbuf_new (void); -void e_cell_pixbuf_construct (ECellPixbuf *ecp); +GType e_cell_pixbuf_get_type (void) G_GNUC_CONST; +ECell * e_cell_pixbuf_new (void); + +G_END_DECLS -#endif +#endif /* _E_CELL_PIXBUF_H */ diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index ad2009d0ac..5e89b6c37d 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -109,14 +109,14 @@ static gint e_cell_popup_do_popup (ECellPopupView *ecp_view, gint row, gint model_col); -G_DEFINE_TYPE (ECellPopup, e_cell_popup, E_CELL_TYPE) +G_DEFINE_TYPE (ECellPopup, e_cell_popup, E_TYPE_CELL) static void -e_cell_popup_class_init (ECellPopupClass *klass) +e_cell_popup_class_init (ECellPopupClass *class) { - ECellClass *ecc = E_CELL_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (class); - G_OBJECT_CLASS (klass)->dispose = e_cell_popup_dispose; + G_OBJECT_CLASS (class)->dispose = e_cell_popup_dispose; ecc->new_view = ecp_new_view; ecc->kill_view = ecp_kill_view; @@ -133,7 +133,7 @@ e_cell_popup_class_init (ECellPopupClass *klass) ecc->get_bg_color = ecp_get_bg_color; gal_a11y_e_cell_registry_add_cell_type (NULL, - E_CELL_POPUP_TYPE, + E_TYPE_CELL_POPUP, gal_a11y_e_cell_popup_new); } @@ -152,11 +152,9 @@ e_cell_popup_init (ECellPopup *ecp) * Returns: an ECellPopup object. */ ECell * -e_cell_popup_new (void) +e_cell_popup_new (void) { - ECellPopup *ecp = g_object_new (E_CELL_POPUP_TYPE, NULL); - - return (ECell*) ecp; + return g_object_new (E_TYPE_CELL_POPUP, NULL); } static void diff --git a/widgets/table/e-cell-popup.h b/widgets/table/e-cell-popup.h index 99b9bd8fb6..6d04fb3c8d 100644 --- a/widgets/table/e-cell-popup.h +++ b/widgets/table/e-cell-popup.h @@ -35,60 +35,79 @@ #include <libgnomecanvas/libgnomecanvas.h> #include <table/e-cell.h> -#define E_CELL_POPUP_TYPE (e_cell_popup_get_type ()) -#define E_CELL_POPUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_POPUP_TYPE, ECellPopup)) -#define E_CELL_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_POPUP_TYPE, ECellPopupClass)) -#define E_IS_CELL_POPUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_POPUP_TYPE)) -#define E_IS_CELL_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_POPUP_TYPE)) - +/* Standard GObject macros */ +#define E_TYPE_CELL_POPUP \ + (e_cell_popup_get_type ()) +#define E_CELL_POPUP(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_POPUP, ECellPopup)) +#define E_CELL_POPUP_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_POPUP, ECellPopupClass)) +#define E_IS_CELL_POPUP(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_POPUP)) +#define E_IS_CELL_POPUP_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_POPUP)) +#define E_CELL_POPUP_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_POPUP, ECellPopupClass)) + +G_BEGIN_DECLS + +typedef struct _ECellPopup ECellPopup; typedef struct _ECellPopupView ECellPopupView; +typedef struct _ECellPopupClass ECellPopupClass; -typedef struct { +struct _ECellPopup { ECell parent; ECell *child; /* This is TRUE if the popup window is shown for the cell being edited. While shown we display the arrow indented. */ - gboolean popup_shown; + gboolean popup_shown; /* This is TRUE if the popup arrow is shown for the cell being edited. This is needed to stop the first click on the cell from popping up the popup window. We only popup the window after we have drawn the arrow. */ - gboolean popup_arrow_shown; + gboolean popup_arrow_shown; /* The view in which the popup is shown. */ - ECellPopupView *popup_cell_view; - - gint popup_view_col; - gint popup_row; - ETableModel *popup_model; -} ECellPopup; + ECellPopupView *popup_cell_view; -typedef struct { - ECellClass parent_class; - - /* Virtual function for subclasses to override. */ - gint (*popup) (ECellPopup *ecp, GdkEvent *event, gint row, gint view_col); -} ECellPopupClass; + gint popup_view_col; + gint popup_row; + ETableModel *popup_model; +}; struct _ECellPopupView { - ECellView cell_view; + ECellView cell_view; - ECellView *child_view; + ECellView *child_view; }; -GType e_cell_popup_get_type (void); -ECell *e_cell_popup_new (void); +struct _ECellPopupClass { + ECellClass parent_class; + + /* Virtual function for subclasses to override. */ + gint (*popup) (ECellPopup *ecp, + GdkEvent *event, + gint row, + gint view_col); +}; -/* Get and set the child ECell. */ -ECell *e_cell_popup_get_child (ECellPopup *ecp); -void e_cell_popup_set_child (ECellPopup *ecp, - ECell *child); +GType e_cell_popup_get_type (void) G_GNUC_CONST; +ECell * e_cell_popup_new (void); +ECell * e_cell_popup_get_child (ECellPopup *ecp); +void e_cell_popup_set_child (ECellPopup *ecp, + ECell *child); +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); +G_END_DECLS #endif /* _E_CELL_POPUP_H_ */ diff --git a/widgets/table/e-cell-size.c b/widgets/table/e-cell-size.c index 90964c8f11..d624cf6cfa 100644 --- a/widgets/table/e-cell-size.c +++ b/widgets/table/e-cell-size.c @@ -57,9 +57,9 @@ ecd_free_text (ECellText *cell, gchar *text) } static void -e_cell_size_class_init (ECellSizeClass *klass) +e_cell_size_class_init (ECellSizeClass *class) { - ECellTextClass *ectc = E_CELL_TEXT_CLASS (klass); + ECellTextClass *ectc = E_CELL_TEXT_CLASS (class); ectc->get_text = ecd_get_text; ectc->free_text = ecd_free_text; diff --git a/widgets/table/e-cell-size.h b/widgets/table/e-cell-size.h index de4b56b673..8b52343b8a 100644 --- a/widgets/table/e-cell-size.h +++ b/widgets/table/e-cell-size.h @@ -59,7 +59,7 @@ struct _ECellSizeClass { ECellTextClass parent_class; }; -GType e_cell_size_get_type (void); +GType e_cell_size_get_type (void) G_GNUC_CONST; ECell * e_cell_size_new (const gchar *fontname, GtkJustification justify); diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 1b0545cc37..a4160419ae 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -105,7 +105,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; static GdkAtom clipboard_atom = GDK_NONE; -G_DEFINE_TYPE (ECellText, e_cell_text, E_CELL_TYPE) +G_DEFINE_TYPE (ECellText, e_cell_text, E_TYPE_CELL) #define UTF8_ATOM gdk_atom_intern ("UTF8_STRING", FALSE) @@ -1153,7 +1153,7 @@ ect_enter_edit (ECellView *ecell_view, gint model_col, gint view_col, gint row) } gtk_im_context_focus_in (edit->im_context); } - + #if 0 if (edit->pointer_in) { if (edit->default_cursor_shown) { @@ -1527,10 +1527,10 @@ static gchar *ellipsis_default = NULL; static gboolean use_ellipsis_default = TRUE; static void -e_cell_text_class_init (ECellTextClass *klass) +e_cell_text_class_init (ECellTextClass *class) { - ECellClass *ecc = E_CELL_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + ECellClass *ecc = E_CELL_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); const gchar *ellipsis_env; object_class->finalize = ect_finalize; @@ -1553,9 +1553,9 @@ e_cell_text_class_init (ECellTextClass *klass) ecc->max_width_by_row = ect_max_width_by_row; ecc->get_bg_color = ect_get_bg_color; - klass->get_text = ect_real_get_text; - klass->free_text = ect_real_free_text; - klass->set_value = ect_real_set_value; + class->get_text = ect_real_get_text; + class->free_text = ect_real_free_text; + class->set_value = ect_real_set_value; object_class->get_property = ect_get_property; object_class->set_property = ect_set_property; diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h index 758e6d77af..ee3e1f5202 100644 --- a/widgets/table/e-cell-text.h +++ b/widgets/table/e-cell-text.h @@ -127,7 +127,7 @@ struct _ECellTextClass { gint model_col); }; -GType e_cell_text_get_type (void); +GType e_cell_text_get_type (void) G_GNUC_CONST; ECell * e_cell_text_new (const gchar *fontname, GtkJustification justify); ECell * e_cell_text_construct (ECellText *cell, diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index c59cffa081..8ceca7c966 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -54,7 +54,7 @@ struct _ECellTogglePrivate { gint height; }; -G_DEFINE_TYPE (ECellToggle, e_cell_toggle, E_CELL_TYPE) +G_DEFINE_TYPE (ECellToggle, e_cell_toggle, E_TYPE_CELL) typedef struct { ECellView cell_view; diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h index be693b2e28..3bc223c229 100644 --- a/widgets/table/e-cell-toggle.h +++ b/widgets/table/e-cell-toggle.h @@ -64,7 +64,7 @@ struct _ECellToggleClass { ECellClass parent_class; }; -GType e_cell_toggle_get_type (void); +GType e_cell_toggle_get_type (void) G_GNUC_CONST; ECell * e_cell_toggle_new (const gchar **icon_names, guint n_icon_names); void e_cell_toggle_construct (ECellToggle *cell_toggle, diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 9129fba446..3793652524 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -48,7 +48,7 @@ #include "e-tree-model.h" #include "e-tree-table-adapter.h" -G_DEFINE_TYPE (ECellTree, e_cell_tree, E_CELL_TYPE) +G_DEFINE_TYPE (ECellTree, e_cell_tree, E_TYPE_CELL) typedef struct { ECellView cell_view; @@ -701,10 +701,10 @@ ect_dispose (GObject *object) } static void -e_cell_tree_class_init (ECellTreeClass *klass) +e_cell_tree_class_init (ECellTreeClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ECellClass *ecc = E_CELL_CLASS (class); object_class->dispose = ect_dispose; @@ -722,7 +722,7 @@ e_cell_tree_class_init (ECellTreeClass *klass) ecc->max_width = ect_max_width; ecc->get_bg_color = ect_get_bg_color; - gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_TREE_TYPE, gal_a11y_e_cell_tree_new); + gal_a11y_e_cell_registry_add_cell_type (NULL, E_TYPE_CELL_TREE, gal_a11y_e_cell_tree_new); } static void @@ -771,7 +771,7 @@ ECell * e_cell_tree_new (gboolean draw_lines, ECell *subcell) { - ECellTree *ect = g_object_new (E_CELL_TREE_TYPE, NULL); + ECellTree *ect = g_object_new (E_TYPE_CELL_TREE, NULL); e_cell_tree_construct (ect, draw_lines, subcell); diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h index 98e874cb1f..cf43c47a1c 100644 --- a/widgets/table/e-cell-tree.h +++ b/widgets/table/e-cell-tree.h @@ -34,34 +34,50 @@ #include <libgnomecanvas/libgnomecanvas.h> #include <table/e-cell.h> +/* Standard GObject macros */ +#define E_TYPE_CELL_TREE \ + (e_cell_tree_get_type ()) +#define E_CELL_TREE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_TREE, ECellTree)) +#define E_CELL_TREE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_TREE, ECellTreeClass)) +#define E_IS_CELL_TREE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_TREE)) +#define E_IS_CELL_TREE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_TREE)) +#define E_CELL_TREE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_TREE, ECellTreeClass)) + G_BEGIN_DECLS -#define E_CELL_TREE_TYPE (e_cell_tree_get_type ()) -#define E_CELL_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TREE_TYPE, ECellTree)) -#define E_CELL_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TREE_TYPE, ECellTreeClass)) -#define E_IS_CELL_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TREE_TYPE)) -#define E_IS_CELL_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_TREE_TYPE)) +typedef struct _ECellTree ECellTree; +typedef struct _ECellTreeClass ECellTreeClass; -typedef struct { +struct _ECellTree { ECell parent; gboolean draw_lines; ECell *subcell; -} ECellTree; +}; -typedef struct { +struct _ECellTreeClass { ECellClass parent_class; -} ECellTreeClass; - -GType e_cell_tree_get_type (void); -ECell *e_cell_tree_new (gboolean draw_lines, - ECell *subcell); -void e_cell_tree_construct (ECellTree *ect, - gboolean draw_lines, - ECell *subcell); +}; -ECellView *e_cell_tree_view_get_subcell_view (ECellView *ect); +GType e_cell_tree_get_type (void) G_GNUC_CONST; +ECell * e_cell_tree_new (gboolean draw_lines, + ECell *subcell); +void e_cell_tree_construct (ECellTree *ect, + gboolean draw_lines, + ECell *subcell); +ECellView * e_cell_tree_view_get_subcell_view + (ECellView *ect); G_END_DECLS diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index b170604ade..f57cd0e113 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -36,7 +36,7 @@ #include "e-cell-vbox.h" #include "e-table-item.h" -G_DEFINE_TYPE (ECellVbox, e_cell_vbox, E_CELL_TYPE) +G_DEFINE_TYPE (ECellVbox, e_cell_vbox, E_TYPE_CELL) #define INDENT_AMOUNT 16 @@ -267,10 +267,10 @@ ecv_finalize (GObject *object) } static void -e_cell_vbox_class_init (ECellVboxClass *klass) +e_cell_vbox_class_init (ECellVboxClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ECellClass *ecc = E_CELL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ECellClass *ecc = E_CELL_CLASS (class); object_class->dispose = ecv_dispose; object_class->finalize = ecv_finalize; @@ -284,7 +284,7 @@ e_cell_vbox_class_init (ECellVboxClass *klass) ecc->height = ecv_height; ecc->max_width = ecv_max_width; - gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_VBOX_TYPE, gal_a11y_e_cell_vbox_new); + gal_a11y_e_cell_registry_add_cell_type (NULL, E_TYPE_CELL_VBOX, gal_a11y_e_cell_vbox_new); } static void @@ -306,9 +306,7 @@ e_cell_vbox_init (ECellVbox *ecv) ECell * e_cell_vbox_new (void) { - ECellVbox *ecv = g_object_new (E_CELL_VBOX_TYPE, NULL); - - return (ECell *) ecv; + return g_object_new (E_TYPE_CELL_VBOX, NULL); } void diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h index 52550a952f..2ab522c4ae 100644 --- a/widgets/table/e-cell-vbox.h +++ b/widgets/table/e-cell-vbox.h @@ -32,38 +32,56 @@ #include <libgnomecanvas/libgnomecanvas.h> #include <table/e-cell.h> +/* Standard GObject macros */ +#define E_TYPE_CELL_VBOX \ + (e_cell_vbox_get_type ()) +#define E_CELL_VBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL_VBOX, ECellVbox)) +#define E_CELL_VBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL_VBOX, ECellVboxClass)) +#define E_IS_CELL_VBOX(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL_VBOX)) +#define E_IS_CELL_VBOX_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL_VBOX)) +#define E_CELL_VBOX_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL_VBOX, ECellVboxClass)) + G_BEGIN_DECLS -#define E_CELL_VBOX_TYPE (e_cell_vbox_get_type ()) -#define E_CELL_VBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_VBOX_TYPE, ECellVbox)) -#define E_CELL_VBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_VBOX_TYPE, ECellVboxClass)) -#define E_IS_CELL_VBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_VBOX_TYPE)) -#define E_IS_CELL_VBOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_VBOX_TYPE)) +typedef struct _ECellVbox ECellVbox; +typedef struct _ECellVboxView ECellVboxView; +typedef struct _ECellVboxClass ECellVboxClass; -typedef struct { +struct _ECellVbox { ECell parent; - gint subcell_count; + gint subcell_count; ECell **subcells; - gint *model_cols; -} ECellVbox; + gint *model_cols; +}; + +struct _ECellVboxView { + ECellView cell_view; -typedef struct { - ECellView cell_view; - gint subcell_view_count; - ECellView **subcell_views; - gint *model_cols; -} ECellVboxView; + gint subcell_view_count; + ECellView **subcell_views; + gint *model_cols; +}; -typedef struct { +struct _ECellVboxClass { ECellClass parent_class; -} ECellVboxClass; +}; -GType e_cell_vbox_get_type (void); -ECell *e_cell_vbox_new (void); -void e_cell_vbox_append (ECellVbox *vbox, - ECell *subcell, - gint model_col); +GType e_cell_vbox_get_type (void) G_GNUC_CONST; +ECell * e_cell_vbox_new (void); +void e_cell_vbox_append (ECellVbox *vbox, + ECell *subcell, + gint model_col); G_END_DECLS diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index c45ed680d4..f54b644045 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -127,26 +127,26 @@ ec_free_state (ECellView *ecell_view, gint model_col, gint view_col, gint row, g } static void -e_cell_class_init (ECellClass *klass) -{ - klass->realize = ec_realize; - klass->unrealize = ec_unrealize; - klass->new_view = ec_new_view; - klass->kill_view = ec_kill_view; - klass->draw = ec_draw; - klass->event = ec_event; - klass->focus = ec_focus; - klass->unfocus = ec_unfocus; - klass->height = ec_height; - klass->enter_edit = ec_enter_edit; - klass->leave_edit = ec_leave_edit; - klass->save_state = ec_save_state; - klass->load_state = ec_load_state; - klass->free_state = ec_free_state; - klass->print = NULL; - klass->print_height = NULL; - klass->max_width = NULL; - klass->max_width_by_row = NULL; +e_cell_class_init (ECellClass *class) +{ + class->realize = ec_realize; + class->unrealize = ec_unrealize; + class->new_view = ec_new_view; + class->kill_view = ec_kill_view; + class->draw = ec_draw; + class->event = ec_event; + class->focus = ec_focus; + class->unfocus = ec_unfocus; + class->height = ec_height; + class->enter_edit = ec_enter_edit; + class->leave_edit = ec_leave_edit; + class->save_state = ec_save_state; + class->load_state = ec_load_state; + class->free_state = ec_free_state; + class->print = NULL; + class->print_height = NULL; + class->max_width = NULL; + class->max_width_by_row = NULL; } static void diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index f38e47bfc4..111736f41c 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -27,14 +27,33 @@ #include <gtk/gtk.h> #include <table/e-table-model.h> +/* Standard GObject macros */ +#define E_TYPE_CELL \ + (e_cell_get_type ()) +#define E_CELL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_CELL, ECell)) +#define E_CELL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_CELL, ECellClass)) +#define E_CELL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL, ECellClass)) +#define E_IS_CELL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_CELL)) +#define E_IS_CELL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_CELL)) +#define E_CELL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_CELL, ECellClass)) + G_BEGIN_DECLS -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_CELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) +typedef struct _ECell ECell; +typedef struct _ECellClass ECellClass; +typedef struct _ECellView ECellView; typedef gboolean (*ETableSearchFunc) (gconstpointer haystack, const gchar *needle); @@ -65,11 +84,7 @@ typedef enum { E_CELL_UNGRAB = 1 << 1 } ECellActions; -typedef struct { - GObject parent; -} ECell; - -typedef struct _ECellView { +struct _ECellView { ECell *ecell; ETableModel *e_table_model; void *e_table_item_view; @@ -79,137 +94,200 @@ typedef struct _ECellView { void (*kill_view_cb) (struct _ECellView*, gpointer ); GList *kill_view_cb_data; -} ECellView; +}; #define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1) -typedef struct { +struct _ECell { + GObject parent; +}; + +struct _ECellClass { GObjectClass parent_class; - ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, gpointer e_table_item_view); - void (*kill_view) (ECellView *ecell_view); - - void (*realize) (ECellView *ecell_view); - void (*unrealize) (ECellView *ecell_view); - - void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, - gint model_col, gint view_col, gint row, - ECellFlags flags, gint x1, gint y1, gint x2, gint y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, gint model_col, gint view_col, gint row, ECellFlags flags, ECellActions *actions); - void (*focus) (ECellView *ecell_view, gint model_col, gint view_col, - gint row, gint x1, gint y1, gint x2, gint y2); - void (*unfocus) (ECellView *ecell_view); - gint (*height) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - - void *(*enter_edit) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - void (*leave_edit) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context); - void *(*save_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context); - void (*load_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer context, gpointer save_state); - void (*free_state) (ECellView *ecell_view, gint model_col, gint view_col, gint row, gpointer save_state); - void (*print) (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, gint view_col, gint row, - gdouble width, gdouble height); - gdouble (*print_height) (ECellView *ecell_view,GtkPrintContext *context, - gint model_col, gint view_col, gint row, gdouble width); - gint (*max_width) (ECellView *ecell_view, gint model_col, gint view_col); - gint (*max_width_by_row) (ECellView *ecell_view, gint model_col, gint view_col, gint row); - gchar *(*get_bg_color) (ECellView *ecell_view, gint row); - - void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style); -} ECellClass; - -GType e_cell_get_type (void); + ECellView * (*new_view) (ECell *ecell, + ETableModel *table_model, + gpointer e_table_item_view); + void (*kill_view) (ECellView *ecell_view); + + void (*realize) (ECellView *ecell_view); + void (*unrealize) (ECellView *ecell_view); + + void (*draw) (ECellView *ecell_view, + GdkDrawable *drawable, + gint model_col, + gint view_col, gint row, + ECellFlags flags, + gint x1, + gint y1, + gint x2, + gint y2); + gint (*event) (ECellView *ecell_view, + GdkEvent *event, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + ECellActions *actions); + void (*focus) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gint x1, + gint y1, + gint x2, + gint y2); + void (*unfocus) (ECellView *ecell_view); + gint (*height) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + + gpointer (*enter_edit) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + void (*leave_edit) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context); + gpointer (*save_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context); + void (*load_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer context, + gpointer save_state); + void (*free_state) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer save_state); + void (*print) (ECellView *ecell_view, + GtkPrintContext *context, + gint model_col, + gint view_col, + gint row, + gdouble width, + gdouble height); + gdouble (*print_height) (ECellView *ecell_view, + GtkPrintContext *context, + gint model_col, + gint view_col, + gint row, + gdouble width); + gint (*max_width) (ECellView *ecell_view, + gint model_col, + gint view_col); + gint (*max_width_by_row) (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); + gchar * (*get_bg_color) (ECellView *ecell_view, + gint row); + + void (*style_set) (ECellView *ecell_view, + GtkStyle *previous_style); +}; + +GType e_cell_get_type (void) G_GNUC_CONST; /* View creation methods. */ -ECellView *e_cell_new_view (ECell *ecell, - ETableModel *table_model, - void *e_table_item_view); -void e_cell_kill_view (ECellView *ecell_view); +ECellView * e_cell_new_view (ECell *ecell, + ETableModel *table_model, + gpointer e_table_item_view); +void e_cell_kill_view (ECellView *ecell_view); /* Cell View methods. */ -gint e_cell_event (ECellView *ecell_view, - GdkEvent *event, - gint model_col, - gint view_col, - gint row, - ECellFlags flags, - ECellActions *actions); -void e_cell_realize (ECellView *ecell_view); -void e_cell_unrealize (ECellView *ecell_view); -void e_cell_draw (ECellView *ecell_view, - GdkDrawable *drawable, - gint model_col, - gint view_col, - gint row, - ECellFlags flags, - gint x1, - gint y1, - gint x2, - gint y2); -void e_cell_print (ECellView *ecell_view, +gint e_cell_event (ECellView *ecell_view, + GdkEvent *event, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + ECellActions *actions); +void e_cell_realize (ECellView *ecell_view); +void e_cell_unrealize (ECellView *ecell_view); +void e_cell_draw (ECellView *ecell_view, + GdkDrawable *drawable, + gint model_col, + gint view_col, + gint row, + ECellFlags flags, + gint x1, + gint y1, + gint x2, + gint y2); +void e_cell_print (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, - gint view_col, - gint row, - gdouble width, - gdouble height); -gdouble e_cell_print_height (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gdouble width, + gdouble height); +gdouble e_cell_print_height (ECellView *ecell_view, GtkPrintContext *context, - gint model_col, - gint view_col, - gint row, - gdouble width); -gint e_cell_max_width (ECellView *ecell_view, - gint model_col, - gint view_col); -gint e_cell_max_width_by_row (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view); -gchar *e_cell_get_bg_color (ECellView *ecell_view, - gint row); -void e_cell_style_set (ECellView *ecell_view, - GtkStyle *previous_style); - -void e_cell_focus (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - gint x1, - gint y1, - gint x2, - gint y2); -void e_cell_unfocus (ECellView *ecell_view); -gint e_cell_height (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -void *e_cell_enter_edit (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row); -void e_cell_leave_edit (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context); -void *e_cell_save_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context); -void e_cell_load_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *edit_context, - void *state); -void e_cell_free_state (ECellView *ecell_view, - gint model_col, - gint view_col, - gint row, - void *state); + gint model_col, + gint view_col, + gint row, + gdouble width); +gint e_cell_max_width (ECellView *ecell_view, + gint model_col, + gint view_col); +gint e_cell_max_width_by_row (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +gboolean e_cell_max_width_by_row_implemented + (ECellView *ecell_view); +gchar * e_cell_get_bg_color (ECellView *ecell_view, + gint row); +void e_cell_style_set (ECellView *ecell_view, + GtkStyle *previous_style); + +void e_cell_focus (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gint x1, + gint y1, + gint x2, + gint y2); +void e_cell_unfocus (ECellView *ecell_view); +gint e_cell_height (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +gpointer e_cell_enter_edit (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row); +void e_cell_leave_edit (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context); +gpointer e_cell_save_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context); +void e_cell_load_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer edit_context, + gpointer state); +void e_cell_free_state (ECellView *ecell_view, + gint model_col, + gint view_col, + gint row, + gpointer state); G_END_DECLS diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index b3294ff293..d983c1b935 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -492,13 +492,13 @@ etcta_reflow (GnomeCanvasItem *item, gint flags) } static void -etcta_class_init (ETableClickToAddClass *klass) +etcta_class_init (ETableClickToAddClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); - klass->cursor_change = NULL; - klass->style_set = etcta_style_set; + class->cursor_change = NULL; + class->style_set = etcta_style_set; object_class->dispose = etcta_dispose; object_class->set_property = etcta_set_property; @@ -512,14 +512,14 @@ etcta_class_init (ETableClickToAddClass *klass) g_param_spec_object ("header", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_MODEL, g_param_spec_object ("model", "Model", NULL, - E_TABLE_MODEL_TYPE, + E_TYPE_TABLE_MODEL, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_MESSAGE, diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index 782cc6285a..49f8df334c 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -30,15 +30,31 @@ #include <table/e-table-item.h> #include <table/e-table-selection-model.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_CLICK_TO_ADD \ + (e_table_click_to_add_get_type ()) +#define E_TABLE_CLICK_TO_ADD(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_CLICK_TO_ADD, ETableClickToAdd)) +#define E_TABLE_CLICK_TO_ADD_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_CLICK_TO_ADD, ETableClickToAddClass)) +#define E_IS_TABLE_CLICK_TO_ADD(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_CLICK_TO_ADD)) +#define E_IS_TABLE_CLICK_TO_ADD_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_CLICK_TO_ADD)) +#define E_TABLE_CLICK_TO_ADD_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_CLICK_TO_ADD, ETableClickToAddClass)) + G_BEGIN_DECLS -#define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ()) -#define E_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) -#define E_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass)) -#define E_IS_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE)) -#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_CLICK_TO_ADD_TYPE)) +typedef struct _ETableClickToAdd ETableClickToAdd; +typedef struct _ETableClickToAddClass ETableClickToAddClass; -typedef struct { +struct _ETableClickToAdd { GnomeCanvasGroup parent; ETableModel *one; /* The ETableOne. */ @@ -56,21 +72,21 @@ typedef struct { gdouble height; ETableSelectionModel *selection; -} ETableClickToAdd; +}; -typedef struct { +struct _ETableClickToAddClass { GnomeCanvasGroupClass parent_class; - /* - * signals - */ - void (*cursor_change) (ETableClickToAdd *etcta, gint row, gint col); - void (*style_set) (ETableClickToAdd *etcta, GtkStyle *previous_style); -} ETableClickToAddClass; - -GType e_table_click_to_add_get_type (void); + /* Signals */ + void (*cursor_change) (ETableClickToAdd *etcta, + gint row, + gint col); + void (*style_set) (ETableClickToAdd *etcta, + GtkStyle *previous_style); +}; -void e_table_click_to_add_commit (ETableClickToAdd *etcta); +GType e_table_click_to_add_get_type (void) G_GNUC_CONST; +void e_table_click_to_add_commit (ETableClickToAdd *etcta); G_END_DECLS diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c index e4881ff755..1238d5c017 100644 --- a/widgets/table/e-table-col.c +++ b/widgets/table/e-table-col.c @@ -114,9 +114,9 @@ etc_get_property (GObject *object, } static void -e_table_col_class_init (ETableColClass *klass) +e_table_col_class_init (ETableColClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etc_dispose; object_class->set_property = etc_set_property; diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h index cbe3dc3a80..b82886a5ca 100644 --- a/widgets/table/e-table-col.h +++ b/widgets/table/e-table-col.h @@ -92,7 +92,7 @@ struct _ETableColClass { GObjectClass parent_class; }; -GType e_table_col_get_type (void); +GType e_table_col_get_type (void) G_GNUC_CONST; ETableCol * e_table_col_new (gint col_idx, const gchar *text, const gchar *icon_name, diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index e4e642db4f..9f7ea53ebe 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -66,9 +66,9 @@ etcs_finalize (GObject *object) } static void -etcs_class_init (ETableColumnSpecificationClass *klass) +etcs_class_init (ETableColumnSpecificationClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = etcs_finalize; } @@ -95,9 +95,7 @@ etcs_init (ETableColumnSpecification *specification) ETableColumnSpecification * e_table_column_specification_new (void) { - ETableColumnSpecification *etcs = g_object_new (E_TABLE_COLUMN_SPECIFICATION_TYPE, NULL); - - return (ETableColumnSpecification *) etcs; + return g_object_new (E_TYPE_TABLE_COLUMN_SPECIFICATION, NULL); } void diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h index 048decdf54..e20d7de6b5 100644 --- a/widgets/table/e-table-column-specification.h +++ b/widgets/table/e-table-column-specification.h @@ -23,21 +23,36 @@ #ifndef _E_TABLE_COLUMN_SPECIFICATION_H_ #define _E_TABLE_COLUMN_SPECIFICATION_H_ -#include <glib.h> #include <glib-object.h> #include <libxml/tree.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_COLUMN_SPECIFICATION \ + (e_table_column_specification_get_type ()) +#define E_TABLE_COLUMN_SPECIFICATION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_COLUMN_SPECIFICATION, ETableColumnSpecification)) +#define E_TABLE_COLUMN_SPECIFICATION_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_COLUMN_SPECIFICATION, ETableColumnSpecificationClass)) +#define E_IS_TABLE_COLUMN_SPECIFICATION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_COLUMN_SPECIFICATION)) +#define E_IS_TABLE_COLUMN_SPECIFICATION_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_COLUMN_SPECIFICATION)) +#define E_TABLE_COLUMN_SPECIFICATION_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_COLUMN_SPECIFICATION, ETableColumnSpecificationClass)) + G_BEGIN_DECLS -#define E_TABLE_COLUMN_SPECIFICATION_TYPE (e_table_column_specification_get_type ()) -#define E_TABLE_COLUMN_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecification)) -#define E_TABLE_COLUMN_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass)) -#define E_IS_TABLE_COLUMN_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE)) -#define E_IS_TABLE_COLUMN_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_COLUMN_SPECIFICATION_TYPE)) -#define E_TABLE_COLUMN_SPECIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass)) +typedef struct _ETableColumnSpecification ETableColumnSpecification; +typedef struct _ETableColumnSpecificationClass ETableColumnSpecificationClass; + +struct _ETableColumnSpecification { + GObject parent; -typedef struct { - GObject base; gint model_col; gint compare_col; gchar *title; @@ -53,20 +68,21 @@ typedef struct { gchar *search; gchar *sortable; gint priority; -} ETableColumnSpecification; +}; -typedef struct { +struct _ETableColumnSpecificationClass { GObjectClass parent_class; -} ETableColumnSpecificationClass; - -GType e_table_column_specification_get_type (void); - -ETableColumnSpecification *e_table_column_specification_new (void); +}; -void e_table_column_specification_load_from_node (ETableColumnSpecification *state, - const xmlNode *node); -xmlNode *e_table_column_specification_save_to_node (ETableColumnSpecification *state, - xmlNode *parent); +GType e_table_column_specification_get_type (void) G_GNUC_CONST; +ETableColumnSpecification * + e_table_column_specification_new (void); +void e_table_column_specification_load_from_node + (ETableColumnSpecification *state, + const xmlNode *node); +xmlNode * e_table_column_specification_save_to_node + (ETableColumnSpecification *state, + xmlNode *parent); G_END_DECLS diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index cce43dc3c8..62db1d32b1 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -127,11 +127,11 @@ config_get_property (GObject *object, } static void -e_table_config_class_init (ETableConfigClass *klass) +e_table_config_class_init (ETableConfigClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); - klass->changed = NULL; + class->changed = NULL; object_class->finalize = config_finalize; object_class->get_property = config_get_property; @@ -149,7 +149,7 @@ e_table_config_class_init (ETableConfigClass *klass) g_param_spec_object ("state", "State", NULL, - E_TABLE_STATE_TYPE, + E_TYPE_TABLE_STATE, G_PARAM_READABLE)); } @@ -1383,7 +1383,7 @@ e_table_config_new (const gchar *header, ETableState *state, GtkWindow *parent_window) { - ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL); + ETableConfig *config = g_object_new (E_TYPE_TABLE_CONFIG, NULL); GtkDialog *dialog; GtkWidget *widget; diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h index 4f690c97cc..083160772f 100644 --- a/widgets/table/e-table-config.h +++ b/widgets/table/e-table-config.h @@ -31,16 +31,33 @@ #include <table/e-table.h> #include <gtk/gtk.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_CONFIG \ + (e_table_config_get_type ()) +#define E_TABLE_CONFIG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_CONFIG, ETableConfig)) +#define E_TABLE_CONFIG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_CONFIG, ETableConfigClass)) +#define E_IS_TABLE_CONFIG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_CONFIG)) +#define E_IS_TABLE_CONFIG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_CONFIG)) +#define E_TABLE_CONFIG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_CONFIG, ETableConfigClass)) + G_BEGIN_DECLS -#define E_TABLE_CONFIG_TYPE (e_table_config_get_type ()) -#define E_TABLE_CONFIG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig)) -#define E_TABLE_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_TYPE, ETableConfigClass)) -#define E_IS_TABLE_CONFIG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CONFIG_TYPE)) -#define E_IS_TABLE_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_TYPE)) -#define E_TABLE_CONFIG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_CONFIG_TYPE, ETableConfigClass)) +typedef struct _ETableConfigSortWidgets ETableConfigSortWidgets; + +typedef struct _ETableConfig ETableConfig; +typedef struct _ETableConfigClass ETableConfigClass; -typedef struct { +struct _ETableConfigSortWidgets { GtkWidget *combo; GtkWidget *frames; GtkWidget *radio_ascending; @@ -48,9 +65,9 @@ typedef struct { GtkWidget *view_check; /* Only for group dialog */ guint changed_id, toggled_id; gpointer e_table_config; -} ETableConfigSortWidgets; +}; -typedef struct { +struct _ETableConfig { GObject parent; gchar *header; @@ -86,26 +103,26 @@ typedef struct { * List of valid column names */ GSList *column_names; -} ETableConfig; +}; -typedef struct { +struct _ETableConfigClass { GObjectClass parent_class; /* Signals */ - void (*changed) (ETableConfig *config); -} ETableConfigClass; - -GType e_table_config_get_type (void); -ETableConfig *e_table_config_new (const gchar *header, - ETableSpecification *spec, - ETableState *state, - GtkWindow *parent_window); -ETableConfig *e_table_config_construct (ETableConfig *etco, - const gchar *header, - ETableSpecification *spec, - ETableState *state, - GtkWindow *parent_window); -void e_table_config_raise (ETableConfig *config); + void (*changed) (ETableConfig *config); +}; + +GType e_table_config_get_type (void) G_GNUC_CONST; +ETableConfig * e_table_config_new (const gchar *header, + ETableSpecification *spec, + ETableState *state, + GtkWindow *parent_window); +ETableConfig *e_table_config_construct (ETableConfig *etco, + const gchar *header, + ETableSpecification *spec, + ETableState *state, + GtkWindow *parent_window); +void e_table_config_raise (ETableConfig *config); G_END_DECLS diff --git a/widgets/table/e-table-extras.h b/widgets/table/e-table-extras.h index 55af6a14d0..6b1ed4200f 100644 --- a/widgets/table/e-table-extras.h +++ b/widgets/table/e-table-extras.h @@ -27,6 +27,7 @@ #include <table/e-cell.h> #include <gdk-pixbuf/gdk-pixbuf.h> +/* Standard GObject macros */ #define E_TYPE_TABLE_EXTRAS \ (e_table_extras_get_type ()) #define E_TABLE_EXTRAS(obj) \ @@ -60,7 +61,7 @@ struct _ETableExtrasClass { GObjectClass parent_class; }; -GType e_table_extras_get_type (void); +GType e_table_extras_get_type (void) G_GNUC_CONST; ETableExtras * e_table_extras_new (void); void e_table_extras_add_cell (ETableExtras *extras, const gchar *id, diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c index a4e96ec99c..9c24a64496 100644 --- a/widgets/table/e-table-field-chooser-dialog.c +++ b/widgets/table/e-table-field-chooser-dialog.c @@ -46,13 +46,13 @@ enum { G_DEFINE_TYPE (ETableFieldChooserDialog, e_table_field_chooser_dialog, GTK_TYPE_DIALOG) static void -e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass) +e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *class) { GObjectClass *object_class; GtkDialogClass *dialog_class; - object_class = (GObjectClass*) klass; - dialog_class = GTK_DIALOG_CLASS (klass); + object_class = (GObjectClass*) class; + dialog_class = GTK_DIALOG_CLASS (class); object_class->dispose = e_table_field_chooser_dialog_dispose; object_class->set_property = e_table_field_chooser_dialog_set_property; @@ -71,14 +71,14 @@ e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass) g_param_spec_object ("full_header", "Full Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_HEADER, g_param_spec_object ("header", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); } @@ -120,8 +120,7 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos GtkWidget* e_table_field_chooser_dialog_new (void) { - GtkWidget *widget = g_object_new (E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, NULL); - return widget; + return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, NULL); } static void diff --git a/widgets/table/e-table-field-chooser-dialog.h b/widgets/table/e-table-field-chooser-dialog.h index 01129ffa09..bd378bc89d 100644 --- a/widgets/table/e-table-field-chooser-dialog.h +++ b/widgets/table/e-table-field-chooser-dialog.h @@ -27,27 +27,30 @@ #include <table/e-table-field-chooser.h> #include <table/e-table-header.h> -G_BEGIN_DECLS - -/* ETableFieldChooserDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ +#define E_TYPE_TABLE_FIELD_CHOOSER_DIALOG \ + (e_table_field_chooser_dialog_get_type ()) +#define E_TABLE_FIELD_CHOOSER_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, ETableFieldChooserDialog)) +#define E_TABLE_FIELD_CHOOSER_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, ETableFieldChooserDialogClass)) +#define E_IS_TABLE_FIELD_CHOOSER_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_DIALOG)) +#define E_IS_TABLE_FIELD_CHOOSER_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER_DIALOG)) +#define E_TABLE_FIELD_CHOOSER_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, ETableFieldChooserDialogClass)) -#define E_TABLE_FIELD_CHOOSER_DIALOG_TYPE (e_table_field_chooser_dialog_get_type ()) -#define E_TABLE_FIELD_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialog)) -#define E_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialogClass)) -#define E_IS_TABLE_FIELD_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE)) +G_BEGIN_DECLS -typedef struct _ETableFieldChooserDialog ETableFieldChooserDialog; -typedef struct _ETableFieldChooserDialogClass ETableFieldChooserDialogClass; +typedef struct _ETableFieldChooserDialog ETableFieldChooserDialog; +typedef struct _ETableFieldChooserDialogClass ETableFieldChooserDialogClass; -struct _ETableFieldChooserDialog -{ +struct _ETableFieldChooserDialog { GtkDialog parent; /* item specific fields */ @@ -57,13 +60,12 @@ struct _ETableFieldChooserDialog ETableHeader *header; }; -struct _ETableFieldChooserDialogClass -{ +struct _ETableFieldChooserDialogClass { GtkDialogClass parent_class; }; -GtkWidget *e_table_field_chooser_dialog_new (void); -GType e_table_field_chooser_dialog_get_type (void); +GType e_table_field_chooser_dialog_get_type (void) G_GNUC_CONST; +GtkWidget * e_table_field_chooser_dialog_new (void); G_END_DECLS diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 880731e5be..7a87db4302 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -639,10 +639,10 @@ etfci_event (GnomeCanvasItem *item, GdkEvent *e) } static void -etfci_class_init (ETableFieldChooserItemClass *klass) +etfci_class_init (ETableFieldChooserItemClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etfci_dispose; object_class->set_property = etfci_set_property; @@ -666,14 +666,14 @@ etfci_class_init (ETableFieldChooserItemClass *klass) g_param_spec_object ("full_header", "Full Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_HEADER, g_param_spec_object ("header", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_WIDTH, diff --git a/widgets/table/e-table-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h index 5e38ba7037..066dd52ffb 100644 --- a/widgets/table/e-table-field-chooser-item.h +++ b/widgets/table/e-table-field-chooser-item.h @@ -28,16 +28,33 @@ #include <libxml/tree.h> #include <table/e-table-header.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_FIELD_CHOOSER_ITEM \ + (e_table_field_chooser_item_get_type ()) +#define E_TABLE_FIELD_CHOOSER_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_ITEM, ETableFieldChooserItem)) +#define E_TABLE_FIELD_CHOOSER_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER_ITEM, ETableFieldChooserItemClass)) +#define E_IS_TABLE_FIELD_CHOOSER_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_ITEM)) +#define E_IS_TABLE_FIELD_CHOOSER_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER_ITEM)) +#define E_TABLE_FIELD_CHOOSER_ITEM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER_ITEM, ETableFieldChooserItemClass)) + G_BEGIN_DECLS -#define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ()) -#define E_TABLE_FIELD_CHOOSER_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem)) -#define E_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItemClass)) -#define E_IS_TABLE_FIELD_CHOOSER_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE)) +typedef struct _ETableFieldChooserItem ETableFieldChooserItem; +typedef struct _ETableFieldChooserItemClass ETableFieldChooserItemClass; -typedef struct { +struct _ETableFieldChooserItem { GnomeCanvasItem parent; + ETableHeader *full_header; ETableHeader *header; ETableHeader *combined_header; @@ -62,13 +79,13 @@ typedef struct { gint drag_col; guint drag_data_get_id; guint drag_end_id; -} ETableFieldChooserItem; +}; -typedef struct { +struct _ETableFieldChooserItemClass { GnomeCanvasItemClass parent_class; -} ETableFieldChooserItemClass; +}; -GType e_table_field_chooser_item_get_type (void); +GType e_table_field_chooser_item_get_type (void) G_GNUC_CONST; G_END_DECLS diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 374507e1ee..557785df0c 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -52,11 +52,11 @@ enum { G_DEFINE_TYPE (ETableFieldChooser, e_table_field_chooser, GTK_TYPE_VBOX) static void -e_table_field_chooser_class_init (ETableFieldChooserClass *klass) +e_table_field_chooser_class_init (ETableFieldChooserClass *class) { GObjectClass *object_class; - object_class = (GObjectClass*) klass; + object_class = (GObjectClass*) class; object_class->set_property = e_table_field_chooser_set_property; object_class->get_property = e_table_field_chooser_get_property; @@ -73,14 +73,14 @@ e_table_field_chooser_class_init (ETableFieldChooserClass *klass) g_param_spec_object ("full_header", "Full Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_HEADER, g_param_spec_object ("header", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); } @@ -242,8 +242,7 @@ e_table_field_chooser_dispose (GObject *object) GtkWidget* e_table_field_chooser_new (void) { - GtkWidget *widget = GTK_WIDGET (g_object_new (E_TABLE_FIELD_CHOOSER_TYPE, NULL)); - return widget; + return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER, NULL); } static void diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h index 01cbc39c64..743bf9eabe 100644 --- a/widgets/table/e-table-field-chooser.h +++ b/widgets/table/e-table-field-chooser.h @@ -28,27 +28,31 @@ #include <table/e-table-header.h> #include <libgnomecanvas/libgnomecanvas.h> -G_BEGIN_DECLS - -/* ETableFieldChooser - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ +/* Standard GObject macros */ +#define E_TYPE_TABLE_FIELD_CHOOSER \ + (e_table_field_chooser_get_type ()) +#define E_TABLE_FIELD_CHOOSER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER, ETableFieldChooser)) +#define E_TABLE_FIELD_CHOOSER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER, ETableFieldChooserClass)) +#define E_IS_TABLE_FIELD_CHOOSER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER)) +#define E_IS_TABLE_FIELD_CHOOSER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_FIELD_CHOOSER)) +#define E_TABLE_FIELD_CHOOSER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_FIELD_CHOOSER, ETableFieldChooserClass)) -#define E_TABLE_FIELD_CHOOSER_TYPE (e_table_field_chooser_get_type ()) -#define E_TABLE_FIELD_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooser)) -#define E_TABLE_FIELD_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooserClass)) -#define E_IS_TABLE_FIELD_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE)) -#define E_IS_TABLE_FIELD_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE)) +G_BEGIN_DECLS -typedef struct _ETableFieldChooser ETableFieldChooser; -typedef struct _ETableFieldChooserClass ETableFieldChooserClass; +typedef struct _ETableFieldChooser ETableFieldChooser; +typedef struct _ETableFieldChooserClass ETableFieldChooserClass; -struct _ETableFieldChooser -{ +struct _ETableFieldChooser { GtkVBox parent; /* item specific fields */ @@ -63,13 +67,12 @@ struct _ETableFieldChooser ETableHeader *header; }; -struct _ETableFieldChooserClass -{ +struct _ETableFieldChooserClass { GtkVBoxClass parent_class; }; -GtkWidget *e_table_field_chooser_new (void); -GType e_table_field_chooser_get_type (void); +GType e_table_field_chooser_get_type (void) G_GNUC_CONST; +GtkWidget * e_table_field_chooser_new (void); G_END_DECLS diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 12788ad6c4..6e8bbf4e61 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -46,7 +46,7 @@ /* workaround for avoiding API breakage */ #define etgc_get_type e_table_group_container_get_type -G_DEFINE_TYPE (ETableGroupContainer, etgc, E_TABLE_GROUP_TYPE) +G_DEFINE_TYPE (ETableGroupContainer, etgc, E_TYPE_TABLE_GROUP) /* The arguments we take */ enum { @@ -195,7 +195,7 @@ e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header g_return_val_if_fail (parent != NULL, NULL); - etgc = g_object_new (E_TABLE_GROUP_CONTAINER_TYPE, NULL); + etgc = g_object_new (E_TYPE_TABLE_GROUP_CONTAINER, NULL); e_table_group_container_construct (parent, etgc, full_header, header, model, sort_info, n); @@ -916,11 +916,11 @@ etgc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps } static void -etgc_class_init (ETableGroupContainerClass *klass) +etgc_class_init (ETableGroupContainerClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (class); object_class->dispose = etgc_dispose; object_class->set_property = etgc_set_property; diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index b0d819be2b..5ea0910ef0 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -30,15 +30,33 @@ #include <table/e-table-group.h> #include <table/e-table-item.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_GROUP_CONTAINER \ + (e_table_group_container_get_type ()) +#define E_TABLE_GROUP_CONTAINER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_GROUP_CONTAINER, ETableGroupContainer)) +#define E_TABLE_GROUP_CONTAINER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_GROUP_CONTAINER, ETableGroupContainerClass)) +#define E_IS_TABLE_GROUP_CONTAINER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_GROUP_CONTAINER)) +#define E_IS_TABLE_GROUP_CONTAINER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_GROUP_CONTAINER)) +#define E_TABLE_GROUP_CONTAINER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_GROUP_CONTAINER, ETableGroupContainerClass)) + G_BEGIN_DECLS -#define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) -#define E_TABLE_GROUP_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) -#define E_TABLE_GROUP_CONTAINER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainerClass)) -#define E_IS_TABLE_GROUP_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_CONTAINER_TYPE)) -#define E_IS_TABLE_GROUP_CONTAINER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_CONTAINER_TYPE)) +typedef struct _ETableGroupContainer ETableGroupContainer; +typedef struct _ETableGroupContainerClass ETableGroupContainerClass; + +typedef struct _ETableGroupContainerChildNode ETableGroupContainerChildNode; -typedef struct { +struct _ETableGroupContainer { ETableGroup group; /* @@ -78,29 +96,37 @@ typedef struct { * State: the ETableGroup is open or closed */ guint open:1; -} ETableGroupContainer; +}; -typedef struct { +struct _ETableGroupContainerClass { ETableGroupClass parent_class; -} ETableGroupContainerClass; - -typedef struct { - ETableGroup *child; - gpointer key; - gchar *string; - GnomeCanvasItem *text; - GnomeCanvasItem *rect; - gint count; -} ETableGroupContainerChildNode; - -ETableGroup *e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, gint n); -void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableSortInfo *sort_info, gint n); - -GType e_table_group_container_get_type (void); +}; + +struct _ETableGroupContainerChildNode { + ETableGroup *child; + gpointer key; + gchar *string; + GnomeCanvasItem *text; + GnomeCanvasItem *rect; + gint count; +}; + +GType e_table_group_container_get_type + (void) G_GNUC_CONST; +ETableGroup * e_table_group_container_new (GnomeCanvasGroup *parent, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model, + ETableSortInfo *sort_info, + gint n); +void e_table_group_container_construct + (GnomeCanvasGroup *parent, + ETableGroupContainer *etgc, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model, + ETableSortInfo *sort_info, + gint n); G_END_DECLS diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index a874e44601..2f287c2abf 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -37,7 +37,7 @@ /* workaround for avoiding APi breakage */ #define etgl_get_type e_table_group_leaf_get_type -G_DEFINE_TYPE (ETableGroupLeaf, etgl, E_TABLE_GROUP_TYPE) +G_DEFINE_TYPE (ETableGroupLeaf, etgl, E_TYPE_TABLE_GROUP) /* The arguments we take */ enum { @@ -158,7 +158,7 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent, g_return_val_if_fail (parent != NULL, NULL); - etgl = g_object_new (E_TABLE_GROUP_LEAF_TYPE, NULL); + etgl = g_object_new (E_TYPE_TABLE_GROUP_LEAF, NULL); e_table_group_leaf_construct (parent, etgl, full_header, header, model, sort_info); @@ -584,11 +584,11 @@ etgl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps } static void -etgl_class_init (ETableGroupLeafClass *klass) +etgl_class_init (ETableGroupLeafClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etgl_dispose; object_class->set_property = etgl_set_property; diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h index 55efc2d655..beed62e7d1 100644 --- a/widgets/table/e-table-group-leaf.h +++ b/widgets/table/e-table-group-leaf.h @@ -29,15 +29,31 @@ #include <table/e-table-subset.h> #include <table/e-table-item.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_GROUP_LEAF \ + (e_table_group_leaf_get_type ()) +#define E_TABLE_GROUP_LEAF(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_GROUP_LEAF, ETableGroupLeaf)) +#define E_TABLE_GROUP_LEAF_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_GROUP_LEAF, ETableGroupLeafClass)) +#define E_IS_TABLE_GROUP_LEAF(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_GROUP_LEAF)) +#define E_IS_TABLE_GROUP_LEAF_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_GROUP_LEAF)) +#define E_TABLE_GROUP_LEAF_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_GROUP_LEAF, ETableGroupLeafClass)) + G_BEGIN_DECLS -#define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) -#define E_TABLE_GROUP_LEAF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) -#define E_TABLE_GROUP_LEAF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeafClass)) -#define E_IS_TABLE_GROUP_LEAF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_LEAF_TYPE)) -#define E_IS_TABLE_GROUP_LEAF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_LEAF_TYPE)) +typedef struct _ETableGroupLeaf ETableGroupLeaf; +typedef struct _ETableGroupLeafClass ETableGroupLeafClass; -typedef struct { +struct _ETableGroupLeaf { ETableGroup group; /* @@ -70,18 +86,18 @@ typedef struct { gint etgl_start_drag_id; ESelectionModel *selection_model; -} ETableGroupLeaf; +}; -typedef struct { +struct _ETableGroupLeafClass { ETableGroupClass parent_class; -} ETableGroupLeafClass; - -ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info); -GType e_table_group_leaf_get_type (void); +}; + +GType e_table_group_leaf_get_type (void) G_GNUC_CONST; +ETableGroup * e_table_group_leaf_new (GnomeCanvasGroup *parent, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model, + ETableSortInfo *sort_info); G_END_DECLS diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index c69b23d4d5..2b6f3e971a 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -642,36 +642,36 @@ etg_get_focus (ETableGroup *etg) } static void -etg_class_init (ETableGroupClass *klass) +etg_class_init (ETableGroupClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etg_dispose; item_class->event = etg_event; - klass->cursor_change = NULL; - klass->cursor_activated = NULL; - klass->double_click = NULL; - klass->right_click = NULL; - klass->click = NULL; - klass->key_press = NULL; - klass->start_drag = NULL; - - klass->add = NULL; - klass->add_array = NULL; - klass->add_all = NULL; - klass->remove = NULL; - klass->row_count = NULL; - klass->increment = NULL; - klass->decrement = NULL; - klass->set_focus = NULL; - klass->get_focus = etg_get_focus; - klass->get_printable = NULL; - klass->compute_location = NULL; - klass->get_mouse_over = NULL; - klass->get_cell_geometry = NULL; + class->cursor_change = NULL; + class->cursor_activated = NULL; + class->double_click = NULL; + class->right_click = NULL; + class->click = NULL; + class->key_press = NULL; + class->start_drag = NULL; + + class->add = NULL; + class->add_array = NULL; + class->add_all = NULL; + class->remove = NULL; + class->row_count = NULL; + class->increment = NULL; + class->decrement = NULL; + class->set_focus = NULL; + class->get_focus = etg_get_focus; + class->get_printable = NULL; + class->compute_location = NULL; + class->get_mouse_over = NULL; + class->get_cell_geometry = NULL; etg_signals[CURSOR_CHANGE] = g_signal_new ("cursor_change", diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 157c70756a..5731dfdeaf 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -7,7 +7,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public @@ -32,15 +32,31 @@ #include <e-util/e-util.h> #include <misc/e-printable.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_GROUP \ + (e_table_group_get_type ()) +#define E_TABLE_GROUP(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_GROUP, ETableGroup)) +#define E_TABLE_GROUP_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_GROUP, ETableGroupClass)) +#define E_IS_TABLE_GROUP(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_GROUP)) +#define E_IS_TABLE_GROUP_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_GROUP)) +#define E_TABLE_GROUP_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_GROUP, ETableGroupClass)) + G_BEGIN_DECLS -#define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) -#define E_TABLE_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) -#define E_TABLE_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass)) -#define E_IS_TABLE_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_TYPE)) -#define E_IS_TABLE_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE)) +typedef struct _ETableGroup ETableGroup; +typedef struct _ETableGroupClass ETableGroupClass; -typedef struct { +struct _ETableGroup { GnomeCanvasGroup group; /* @@ -63,119 +79,158 @@ typedef struct { guint has_focus : 1; guint frozen : 1; -} ETableGroup; +}; -typedef struct { +struct _ETableGroupClass { GnomeCanvasGroupClass parent_class; /* Signals */ - void (*cursor_change) (ETableGroup *etg, gint row); - void (*cursor_activated) (ETableGroup *etg, gint row); - void (*double_click) (ETableGroup *etg, gint row, gint col, GdkEvent *event); - gboolean (*right_click) (ETableGroup *etg, gint row, gint col, GdkEvent *event); - gboolean (*click) (ETableGroup *etg, gint row, gint col, GdkEvent *event); - gboolean (*key_press) (ETableGroup *etg, gint row, gint col, GdkEvent *event); - gint (*start_drag) (ETableGroup *etg, gint row, gint col, GdkEvent *event); + void (*cursor_change) (ETableGroup *etg, + gint row); + void (*cursor_activated) (ETableGroup *etg, + gint row); + void (*double_click) (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); + gboolean (*right_click) (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); + gboolean (*click) (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); + gboolean (*key_press) (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); + gint (*start_drag) (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); /* Virtual functions. */ - void (*add) (ETableGroup *etg, gint row); - void (*add_array) (ETableGroup *etg, const gint *array, gint count); - void (*add_all) (ETableGroup *etg); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*row_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*decrement) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - EPrintable *(*get_printable) (ETableGroup *etg); - void (*compute_location) (ETableGroup *etg, gint *x, gint *y, gint *row, gint *col); - void (*get_mouse_over) (ETableGroup *etg, gint *row, gint *col); - void (*get_cell_geometry) (ETableGroup *etg, gint *row, gint *col, gint *x, gint *y, gint *width, gint *height); - -} ETableGroupClass; + void (*add) (ETableGroup *etg, + gint row); + void (*add_array) (ETableGroup *etg, + const gint *array, + gint count); + void (*add_all) (ETableGroup *etg); + gboolean (*remove) (ETableGroup *etg, + gint row); + gint (*row_count) (ETableGroup *etg); + void (*increment) (ETableGroup *etg, + gint position, + gint amount); + void (*decrement) (ETableGroup *etg, + gint position, + gint amount); + void (*set_focus) (ETableGroup *etg, + EFocus direction, + gint view_col); + gboolean (*get_focus) (ETableGroup *etg); + gint (*get_focus_column) (ETableGroup *etg); + EPrintable * (*get_printable) (ETableGroup *etg); + void (*compute_location) (ETableGroup *etg, + gint *x, + gint *y, + gint *row, + gint *col); + void (*get_mouse_over) (ETableGroup *etg, + gint *row, + gint *col); + void (*get_cell_geometry) (ETableGroup *etg, + gint *row, + gint *col, + gint *x, + gint *y, + gint *width, + gint *height); +}; + +GType e_table_group_get_type (void) G_GNUC_CONST; +ETableGroup * e_table_group_new (GnomeCanvasGroup *parent, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model, + ETableSortInfo *sort_info, + gint n); +void e_table_group_construct (GnomeCanvasGroup *parent, + ETableGroup *etg, + ETableHeader *full_header, + ETableHeader *header, + ETableModel *model); /* Virtual functions */ -void e_table_group_add (ETableGroup *etg, - gint row); -void e_table_group_add_array (ETableGroup *etg, - const gint *array, - gint count); -void e_table_group_add_all (ETableGroup *etg); -gboolean e_table_group_remove (ETableGroup *etg, - gint row); -void e_table_group_increment (ETableGroup *etg, - gint position, - gint amount); -void e_table_group_decrement (ETableGroup *etg, - gint position, - gint amount); -gint e_table_group_row_count (ETableGroup *etg); -void e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint view_col); -gboolean e_table_group_get_focus (ETableGroup *etg); -gint e_table_group_get_focus_column (ETableGroup *etg); -ETableHeader *e_table_group_get_header (ETableGroup *etg); -EPrintable *e_table_group_get_printable (ETableGroup *etg); -void e_table_group_compute_location (ETableGroup *etg, - gint *x, - gint *y, - gint *row, - gint *col); -void e_table_group_get_mouse_over (ETableGroup *etg, - gint *row, - gint *col); -void e_table_group_get_cell_geometry (ETableGroup *etg, - gint *row, - gint *col, - gint *x, - gint *y, - gint *width, - gint *height); -ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - ETableSortInfo *sort_info, - gint n); -void e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model); +void e_table_group_add (ETableGroup *etg, + gint row); +void e_table_group_add_array (ETableGroup *etg, + const gint *array, + gint count); +void e_table_group_add_all (ETableGroup *etg); +gboolean e_table_group_remove (ETableGroup *etg, + gint row); +void e_table_group_increment (ETableGroup *etg, + gint position, + gint amount); +void e_table_group_decrement (ETableGroup *etg, + gint position, + gint amount); +gint e_table_group_row_count (ETableGroup *etg); +void e_table_group_set_focus (ETableGroup *etg, + EFocus direction, + gint view_col); +gboolean e_table_group_get_focus (ETableGroup *etg); +gint e_table_group_get_focus_column (ETableGroup *etg); +ETableHeader * e_table_group_get_header (ETableGroup *etg); +EPrintable * e_table_group_get_printable (ETableGroup *etg); +void e_table_group_compute_location (ETableGroup *etg, + gint *x, + gint *y, + gint *row, + gint *col); +void e_table_group_get_mouse_over (ETableGroup *etg, + gint *row, + gint *col); +void e_table_group_get_cell_geometry (ETableGroup *etg, + gint *row, + gint *col, + gint *x, + gint *y, + gint *width, + gint *height); /* For emitting the signals */ -void e_table_group_cursor_change (ETableGroup *etg, - gint row); -void e_table_group_cursor_activated (ETableGroup *etg, - gint row); -void e_table_group_double_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gboolean e_table_group_right_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gboolean e_table_group_click (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gboolean e_table_group_key_press (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -gint e_table_group_start_drag (ETableGroup *etg, - gint row, - gint col, - GdkEvent *event); -GType e_table_group_get_type (void); +void e_table_group_cursor_change (ETableGroup *etg, + gint row); +void e_table_group_cursor_activated (ETableGroup *etg, + gint row); +void e_table_group_double_click (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); +gboolean e_table_group_right_click (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); +gboolean e_table_group_click (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); +gboolean e_table_group_key_press (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); +gint e_table_group_start_drag (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); typedef void (*ETableGroupLeafFn) (gpointer e_table_item, gpointer closure); -void e_table_group_apply_to_leafs (ETableGroup *etg, - ETableGroupLeafFn fn, - void *closure); +void e_table_group_apply_to_leafs (ETableGroup *etg, + ETableGroupLeafFn fn, + gpointer closure); G_END_DECLS diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 1c97826ef2..2e7b4704ec 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1961,10 +1961,10 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) } static void -ethi_class_init (ETableHeaderItemClass *klass) +ethi_class_init (ETableHeaderItemClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = ethi_dispose; object_class->set_property = ethi_set_property; @@ -1995,35 +1995,35 @@ ethi_class_init (ETableHeaderItemClass *klass) g_param_spec_object ("full_header", "Full Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_TABLE_HEADER, g_param_spec_object ("ETableHeader", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_SORT_INFO, g_param_spec_object ("sort_info", "Sort Info", NULL, - E_TABLE_SORT_INFO_TYPE, + E_TYPE_TABLE_SORT_INFO, G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_TABLE, g_param_spec_object ("table", "Table", NULL, - E_TABLE_TYPE, + E_TYPE_TABLE, G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_TREE, g_param_spec_object ("tree", "Tree", NULL, - E_TREE_TYPE, + E_TYPE_TREE, G_PARAM_WRITABLE)); ethi_signals[BUTTON_PRESSED] = diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 49755dcff0..4ab483a4ce 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -31,15 +31,31 @@ #include <table/e-table-header.h> #include <table/e-table-sort-info.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_HEADER_ITEM \ + (e_table_header_item_get_type ()) +#define E_TABLE_HEADER_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_HEADER_ITEM, ETableHeaderItem)) +#define E_TABLE_HEADER_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_HEADER_ITEM, ETableHeaderItemClass)) +#define E_IS_TABLE_HEADER_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_HEADER_ITEM)) +#define E_IS_TABLE_HEADER_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_HEADER_ITEM)) +#define E_TABLE_HEADER_ITEM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_HEADER_ITEM, ETableHeaderItemClass)) + G_BEGIN_DECLS -#define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ()) -#define E_TABLE_HEADER_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem)) -#define E_TABLE_HEADER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItemClass)) -#define E_IS_TABLE_HEADER_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_HEADER_ITEM_TYPE)) -#define E_IS_TABLE_HEADER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_ITEM_TYPE)) +typedef struct _ETableHeaderItem ETableHeaderItem; +typedef struct _ETableHeaderItemClass ETableHeaderItemClass; -typedef struct { +struct _ETableHeaderItem { GnomeCanvasItem parent; ETableHeader *eth; @@ -103,22 +119,19 @@ typedef struct { /* For keyboard navigation*/ gint selected_col; +}; -} ETableHeaderItem; - -typedef struct { +struct _ETableHeaderItemClass { GnomeCanvasItemClass parent_class; - /* - * signals - */ - void (*button_pressed) (ETableHeaderItem *ethi, GdkEventButton *button); -} ETableHeaderItemClass; - -void -ethi_change_sort_state (ETableHeaderItem *ethi, ETableCol *col); + /* Signals */ + void (*button_pressed) (ETableHeaderItem *ethi, + GdkEventButton *button); +}; -GType e_table_header_item_get_type (void); +GType e_table_header_item_get_type (void) G_GNUC_CONST; +void ethi_change_sort_state (ETableHeaderItem *ethi, + ETableCol *col); G_END_DECLS diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h index 16cc867f8c..3ae11a4eca 100644 --- a/widgets/table/e-table-header-utils.h +++ b/widgets/table/e-table-header-utils.h @@ -30,22 +30,22 @@ G_BEGIN_DECLS -gdouble e_table_header_compute_height (ETableCol *ecol, - GtkWidget *widget); -gdouble e_table_header_width_extras (GtkStyle *style); -void e_table_header_draw_button (GdkDrawable *drawable, - ETableCol *ecol, - GtkStyle *style, - GtkStateType state, - GtkWidget *widget, - gint x, - gint y, - gint width, - gint height, - gint button_width, - gint button_height, - ETableColArrow arrow); +gdouble e_table_header_compute_height (ETableCol *ecol, + GtkWidget *widget); +gdouble e_table_header_width_extras (GtkStyle *style); +void e_table_header_draw_button (GdkDrawable *drawable, + ETableCol*ecol, + GtkStyle *style, + GtkStateType state, + GtkWidget *widget, + gint x, + gint y, + gint width, + gint height, + gint button_width, + gint button_height, + ETableColArrow arrow); G_END_DECLS -#endif +#endif /* E_TABLE_HEADER_UTILS_H */ diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 1a3efafa85..df772a3c80 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -249,9 +249,9 @@ eth_get_property (GObject *object, guint prop_id, GValue *val, GParamSpec *pspec } static void -e_table_header_class_init (ETableHeaderClass *klass) +e_table_header_class_init (ETableHeaderClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = eth_finalize; object_class->set_property = eth_set_property; @@ -274,7 +274,7 @@ e_table_header_class_init (ETableHeaderClass *klass) g_object_class_install_property ( object_class, PROP_SORT_INFO, g_param_spec_object ("sort_info", "Sort Info", "Sort Info", - E_TABLE_SORT_INFO_TYPE, + E_TYPE_TABLE_SORT_INFO, G_PARAM_READWRITE)); eth_signals[STRUCTURE_CHANGE] = @@ -310,10 +310,10 @@ e_table_header_class_init (ETableHeaderClass *klass) e_marshal_INT__INT, G_TYPE_INT, 1, G_TYPE_INT); - klass->structure_change = NULL; - klass->dimension_change = NULL; - klass->expansion_change = NULL; - klass->request_width = NULL; + class->structure_change = NULL; + class->dimension_change = NULL; + class->expansion_change = NULL; + class->request_width = NULL; } static void @@ -342,7 +342,7 @@ ETableHeader * e_table_header_new (void) { - return (ETableHeader *) g_object_new (E_TABLE_HEADER_TYPE, NULL); + return g_object_new (E_TYPE_TABLE_HEADER, NULL); } static void diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index d724c2710f..1ac3016c8f 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -25,29 +25,41 @@ #ifndef _E_TABLE_COLUMN_H_ #define _E_TABLE_COLUMN_H_ -#include <glib-object.h> #include <gdk/gdk.h> #include <table/e-table-sort-info.h> #include <table/e-table-col.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_HEADER \ + (e_table_header_get_type ()) +#define E_TABLE_HEADER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_HEADER, ETableHeader)) +#define E_TABLE_HEADER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_HEADER, ETableHeaderClass)) +#define E_IS_TABLE_HEADER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_HEADER)) +#define E_IS_TABLE_HEADER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_HEADER)) +#define E_TABLE_HEADER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_HEADER, ETableHeaderClass)) + G_BEGIN_DECLS typedef struct _ETableHeader ETableHeader; - -#define E_TABLE_HEADER_TYPE (e_table_header_get_type ()) -#define E_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader)) -#define E_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass)) -#define E_IS_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_HEADER_TYPE)) -#define E_IS_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE)) -#define E_TABLE_HEADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_HEADER_TYPE, ETableHeaderClass)) +typedef struct _ETableHeaderClass ETableHeaderClass; typedef gboolean (*ETableColCheckFunc) (ETableCol *col, gpointer user_data); /* - * A Columnar header. + * A Column header. */ struct _ETableHeader { - GObject base; + GObject parent; gint col_count; gint width; @@ -63,56 +75,63 @@ struct _ETableHeader { gint idle; }; -typedef struct { +struct _ETableHeaderClass { GObjectClass parent_class; - void (*structure_change) (ETableHeader *eth); - void (*dimension_change) (ETableHeader *eth, gint width); - void (*expansion_change) (ETableHeader *eth); - gint (*request_width) (ETableHeader *eth, gint col); -} ETableHeaderClass; - -GType e_table_header_get_type (void); -ETableHeader *e_table_header_new (void); - -void e_table_header_add_column (ETableHeader *eth, - ETableCol *tc, - gint pos); -ETableCol *e_table_header_get_column (ETableHeader *eth, - gint column); -ETableCol *e_table_header_get_column_by_col_idx (ETableHeader *eth, - gint col_idx); -gint e_table_header_count (ETableHeader *eth); -gint e_table_header_index (ETableHeader *eth, - gint col); -gint e_table_header_get_index_at (ETableHeader *eth, - gint x_offset); -ETableCol **e_table_header_get_columns (ETableHeader *eth); -gint e_table_header_get_selected (ETableHeader *eth); - -gint e_table_header_total_width (ETableHeader *eth); -gint e_table_header_min_width (ETableHeader *eth); -void e_table_header_move (ETableHeader *eth, - gint source_index, - gint target_index); -void e_table_header_remove (ETableHeader *eth, - gint idx); -void e_table_header_set_size (ETableHeader *eth, - gint idx, - gint size); -void e_table_header_set_selection (ETableHeader *eth, - gboolean allow_selection); -gint e_table_header_col_diff (ETableHeader *eth, - gint start_col, - gint end_col); - -void e_table_header_calc_widths (ETableHeader *eth); -GList *e_table_header_get_selected_indexes (ETableHeader *eth); -void e_table_header_update_horizontal (ETableHeader *eth); -gint e_table_header_prioritized_column (ETableHeader *eth); -ETableCol *e_table_header_prioritized_column_selected (ETableHeader *eth, - ETableColCheckFunc check_func, - gpointer user_data); + void (*structure_change) (ETableHeader *eth); + void (*dimension_change) (ETableHeader *eth, + gint width); + void (*expansion_change) (ETableHeader *eth); + gint (*request_width) (ETableHeader *eth, + gint col); +}; + +GType e_table_header_get_type (void) G_GNUC_CONST; +ETableHeader * e_table_header_new (void); + +void e_table_header_add_column (ETableHeader *eth, + ETableCol *tc, + gint pos); +ETableCol * e_table_header_get_column (ETableHeader *eth, + gint column); +ETableCol * e_table_header_get_column_by_col_idx + (ETableHeader *eth, + gint col_idx); +gint e_table_header_count (ETableHeader *eth); +gint e_table_header_index (ETableHeader *eth, + gint col); +gint e_table_header_get_index_at (ETableHeader *eth, + gint x_offset); +ETableCol ** e_table_header_get_columns (ETableHeader *eth); +gint e_table_header_get_selected (ETableHeader *eth); + +gint e_table_header_total_width (ETableHeader *eth); +gint e_table_header_min_width (ETableHeader *eth); +void e_table_header_move (ETableHeader *eth, + gint source_index, + gint target_index); +void e_table_header_remove (ETableHeader *eth, + gint idx); +void e_table_header_set_size (ETableHeader *eth, + gint idx, + gint size); +void e_table_header_set_selection (ETableHeader *eth, + gboolean allow_selection); +gint e_table_header_col_diff (ETableHeader *eth, + gint start_col, + gint end_col); + +void e_table_header_calc_widths (ETableHeader *eth); +GList * e_table_header_get_selected_indexes + (ETableHeader *eth); +void e_table_header_update_horizontal + (ETableHeader *eth); +gint e_table_header_prioritized_column + (ETableHeader *eth); +ETableCol * e_table_header_prioritized_column_selected + (ETableHeader *eth, + ETableColCheckFunc check_func, + gpointer user_data); G_END_DECLS diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 7c45bbe656..b6421bb439 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -2792,10 +2792,10 @@ eti_style_set (ETableItem *eti, GtkStyle *previous_style) } static void -eti_class_init (ETableItemClass *klass) +eti_class_init (ETableItemClass *class) { - GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = eti_dispose; object_class->set_property = eti_set_property; @@ -2808,29 +2808,29 @@ eti_class_init (ETableItemClass *klass) item_class->point = eti_point; item_class->event = eti_event; - klass->cursor_change = NULL; - klass->cursor_activated = NULL; - klass->double_click = NULL; - klass->right_click = NULL; - klass->click = NULL; - klass->key_press = NULL; - klass->start_drag = NULL; - klass->style_set = eti_style_set; - klass->selection_model_removed = NULL; - klass->selection_model_added = NULL; + class->cursor_change = NULL; + class->cursor_activated = NULL; + class->double_click = NULL; + class->right_click = NULL; + class->click = NULL; + class->key_press = NULL; + class->start_drag = NULL; + class->style_set = eti_style_set; + class->selection_model_removed = NULL; + class->selection_model_added = NULL; g_object_class_install_property (object_class, PROP_TABLE_HEADER, g_param_spec_object ("ETableHeader", "Table header", "Table header", - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_TABLE_MODEL, g_param_spec_object ("ETableModel", "Table model", "Table model", - E_TABLE_MODEL_TYPE, + E_TYPE_TABLE_MODEL, G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_SELECTION_MODEL, diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 6322bcd395..d2fd2c56d6 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -32,15 +32,31 @@ #include <misc/e-selection-model.h> #include <misc/e-printable.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_ITEM \ + (e_table_item_get_type ()) +#define E_TABLE_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_ITEM, ETableItem)) +#define E_TABLE_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_ITEM, ETableItemClass)) +#define E_IS_TABLE_ITEM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_ITEM)) +#define E_IS_TABLE_ITEM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_ITEM)) +#define E_TABLE_ITEM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_ITEM, ETableItemClass)) + G_BEGIN_DECLS -#define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) -#define E_TABLE_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) -#define E_TABLE_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass)) -#define E_IS_TABLE_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_ITEM_TYPE)) -#define E_IS_TABLE_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE)) +typedef struct _ETableItem ETableItem; +typedef struct _ETableItemClass ETableItemClass; -typedef struct { +struct _ETableItem { GnomeCanvasItem parent; ETableModel *table_model; ETableHeader *header; @@ -151,67 +167,89 @@ typedef struct { gint grabbed_col, grabbed_row; gint grabbed_count; +}; -} ETableItem; - -typedef struct { +struct _ETableItemClass { GnomeCanvasItemClass parent_class; - void (*cursor_change) (ETableItem *eti, gint row); - void (*cursor_activated) (ETableItem *eti, gint row); - void (*double_click) (ETableItem *eti, gint row, gint col, GdkEvent *event); - gboolean (*right_click) (ETableItem *eti, gint row, gint col, GdkEvent *event); - gboolean (*click) (ETableItem *eti, gint row, gint col, GdkEvent *event); - gboolean (*key_press) (ETableItem *eti, gint row, gint col, GdkEvent *event); - gboolean (*start_drag) (ETableItem *eti, gint row, gint col, GdkEvent *event); - void (*style_set) (ETableItem *eti, GtkStyle *previous_style); - void (*selection_model_removed) (ETableItem *eti, ESelectionModel *selection); - void (*selection_model_added) (ETableItem *eti, ESelectionModel *selection); -} ETableItemClass; -GType e_table_item_get_type (void); + void (*cursor_change) (ETableItem *eti, + gint row); + void (*cursor_activated) (ETableItem *eti, + gint row); + void (*double_click) (ETableItem *eti, + gint row, + gint col, + GdkEvent *event); + gboolean (*right_click) (ETableItem *eti, + gint row, + gint col, + GdkEvent *event); + gboolean (*click) (ETableItem *eti, + gint row, + gint col, + GdkEvent *event); + gboolean (*key_press) (ETableItem *eti, + gint row, + gint col, + GdkEvent *event); + gboolean (*start_drag) (ETableItem *eti, + gint row, + gint col, + GdkEvent *event); + void (*style_set) (ETableItem *eti, + GtkStyle *previous_style); + void (*selection_model_removed) + (ETableItem *eti, + ESelectionModel *selection); + void (*selection_model_added) + (ETableItem *eti, + ESelectionModel *selection); +}; + +GType e_table_item_get_type (void) G_GNUC_CONST; /* * Focus */ -void e_table_item_set_cursor (ETableItem *eti, - gint col, - gint row); - -gint e_table_item_get_focused_column (ETableItem *eti); - -void e_table_item_leave_edit (ETableItem *eti); -void e_table_item_enter_edit (ETableItem *eti, - gint col, - gint row); - -void e_table_item_redraw_range (ETableItem *eti, - gint start_col, - gint start_row, - gint end_col, - gint end_row); - -EPrintable *e_table_item_get_printable (ETableItem *eti); -void e_table_item_compute_location (ETableItem *eti, - gint *x, - gint *y, - gint *row, - gint *col); -void e_table_item_compute_mouse_over (ETableItem *eti, - gint x, - gint y, - gint *row, - gint *col); -void e_table_item_get_cell_geometry (ETableItem *eti, - gint *row, - gint *col, - gint *x, - gint *y, - gint *width, - gint *height); - -gint e_table_item_row_diff (ETableItem *eti, - gint start_row, - gint end_row); +void e_table_item_set_cursor (ETableItem *eti, + gint col, + gint row); + +gint e_table_item_get_focused_column (ETableItem *eti); + +void e_table_item_leave_edit (ETableItem *eti); +void e_table_item_enter_edit (ETableItem *eti, + gint col, + gint row); + +void e_table_item_redraw_range (ETableItem *eti, + gint start_col, + gint start_row, + gint end_col, + gint end_row); + +EPrintable * e_table_item_get_printable (ETableItem *eti); +void e_table_item_compute_location (ETableItem *eti, + gint *x, + gint *y, + gint *row, + gint *col); +void e_table_item_compute_mouse_over (ETableItem *eti, + gint x, + gint y, + gint *row, + gint *col); +void e_table_item_get_cell_geometry (ETableItem *eti, + gint *row, + gint *col, + gint *x, + gint *y, + gint *width, + gint *height); + +gint e_table_item_row_diff (ETableItem *eti, + gint start_row, + gint end_row); G_END_DECLS diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c index 8bdfc585df..5101e9ec73 100644 --- a/widgets/table/e-table-memory-callbacks.c +++ b/widgets/table/e-table-memory-callbacks.c @@ -27,12 +27,12 @@ #include "e-table-memory-callbacks.h" -G_DEFINE_TYPE (ETableMemoryCalbacks, e_table_memory_callbacks, E_TABLE_MEMORY_TYPE) +G_DEFINE_TYPE (ETableMemoryCallbacks, e_table_memory_callbacks, E_TYPE_TABLE_MEMORY) static gint etmc_column_count (ETableModel *etm) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->col_count) return etmc->col_count (etm, etmc->data); @@ -43,7 +43,7 @@ etmc_column_count (ETableModel *etm) static gpointer etmc_value_at (ETableModel *etm, gint col, gint row) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->value_at) return etmc->value_at (etm, col, row, etmc->data); @@ -54,7 +54,7 @@ etmc_value_at (ETableModel *etm, gint col, gint row) static void etmc_set_value_at (ETableModel *etm, gint col, gint row, gconstpointer val) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->set_value_at) etmc->set_value_at (etm, col, row, val, etmc->data); @@ -63,7 +63,7 @@ etmc_set_value_at (ETableModel *etm, gint col, gint row, gconstpointer val) static gboolean etmc_is_cell_editable (ETableModel *etm, gint col, gint row) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->is_cell_editable) return etmc->is_cell_editable (etm, col, row, etmc->data); @@ -75,7 +75,7 @@ etmc_is_cell_editable (ETableModel *etm, gint col, gint row) static gpointer etmc_duplicate_value (ETableModel *etm, gint col, gconstpointer value) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->duplicate_value) return etmc->duplicate_value (etm, col, value, etmc->data); @@ -86,7 +86,7 @@ etmc_duplicate_value (ETableModel *etm, gint col, gconstpointer value) static void etmc_free_value (ETableModel *etm, gint col, gpointer value) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->free_value) etmc->free_value (etm, col, value, etmc->data); @@ -95,7 +95,7 @@ etmc_free_value (ETableModel *etm, gint col, gpointer value) static gpointer etmc_initialize_value (ETableModel *etm, gint col) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->initialize_value) return etmc->initialize_value (etm, col, etmc->data); @@ -106,7 +106,7 @@ etmc_initialize_value (ETableModel *etm, gint col) static gboolean etmc_value_is_empty (ETableModel *etm, gint col, gconstpointer value) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->value_is_empty) return etmc->value_is_empty (etm, col, value, etmc->data); @@ -117,7 +117,7 @@ etmc_value_is_empty (ETableModel *etm, gint col, gconstpointer value) static gchar * etmc_value_to_string (ETableModel *etm, gint col, gconstpointer value) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->value_to_string) return etmc->value_to_string (etm, col, value, etmc->data); @@ -128,16 +128,16 @@ etmc_value_to_string (ETableModel *etm, gint col, gconstpointer value) static void etmc_append_row (ETableModel *etm, ETableModel *source, gint row) { - ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); + ETableMemoryCallbacks *etmc = E_TABLE_MEMORY_CALLBACKS (etm); if (etmc->append_row) etmc->append_row (etm, source, row, etmc->data); } static void -e_table_memory_callbacks_class_init (ETableMemoryCalbacksClass *klass) +e_table_memory_callbacks_class_init (ETableMemoryCallbacksClass *class) { - ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (class); model_class->column_count = etmc_column_count; model_class->value_at = etmc_value_at; @@ -153,7 +153,7 @@ e_table_memory_callbacks_class_init (ETableMemoryCalbacksClass *klass) } static void -e_table_memory_callbacks_init (ETableMemoryCalbacks *etmc) +e_table_memory_callbacks_init (ETableMemoryCallbacks *etmc) { /* nothing to do */ } @@ -171,35 +171,35 @@ e_table_memory_callbacks_init (ETableMemoryCalbacks *etmc) * @value_to_string: * @data: closure pointer. * - * This initializes a new ETableMemoryCalbacksModel object. - * ETableMemoryCalbacksModel is an implementaiton of the abstract class - * ETableModel. The ETableMemoryCalbacksModel is designed to allow people + * This initializes a new ETableMemoryCallbacksModel object. + * ETableMemoryCallbacksModel is an implementaiton of the abstract class + * ETableModel. The ETableMemoryCallbacksModel is designed to allow people * to easily create ETableModels without having to create a new GType * derived from ETableModel every time they need one. * - * Instead, ETableMemoryCalbacksModel uses a setup based in callback + * Instead, ETableMemoryCallbacksModel uses a setup based in callback * functions, every callback function signature mimics the signature of * each ETableModel method and passes the extra @data pointer to each one * of the method to provide them with any context they might want to use. * - * Returns: An ETableMemoryCalbacksModel object (which is also an ETableModel + * Returns: An ETableMemoryCallbacksModel object (which is also an ETableModel * object). */ ETableModel * -e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count, - ETableMemoryCalbacksValueAtFn value_at, - ETableMemoryCalbacksSetValueAtFn set_value_at, - ETableMemoryCalbacksIsCellEditableFn is_cell_editable, - ETableMemoryCalbacksDuplicateValueFn duplicate_value, - ETableMemoryCalbacksFreeValueFn free_value, - ETableMemoryCalbacksInitializeValueFn initialize_value, - ETableMemoryCalbacksValueIsEmptyFn value_is_empty, - ETableMemoryCalbacksValueToStringFn value_to_string, +e_table_memory_callbacks_new (ETableMemoryCallbacksColumnCountFn col_count, + ETableMemoryCallbacksValueAtFn value_at, + ETableMemoryCallbacksSetValueAtFn set_value_at, + ETableMemoryCallbacksIsCellEditableFn is_cell_editable, + ETableMemoryCallbacksDuplicateValueFn duplicate_value, + ETableMemoryCallbacksFreeValueFn free_value, + ETableMemoryCallbacksInitializeValueFn initialize_value, + ETableMemoryCallbacksValueIsEmptyFn value_is_empty, + ETableMemoryCallbacksValueToStringFn value_to_string, gpointer data) { - ETableMemoryCalbacks *et; + ETableMemoryCallbacks *et; - et = g_object_new (E_TABLE_MEMORY_CALLBACKS_TYPE, NULL); + et = g_object_new (E_TYPE_TABLE_MEMORY_CALLBACKS, NULL); et->col_count = col_count; et->value_at = value_at; diff --git a/widgets/table/e-table-memory-callbacks.h b/widgets/table/e-table-memory-callbacks.h index 97e2e53421..8feb6e9884 100644 --- a/widgets/table/e-table-memory-callbacks.h +++ b/widgets/table/e-table-memory-callbacks.h @@ -25,64 +25,118 @@ #include <table/e-table-memory.h> -G_BEGIN_DECLS - -#define E_TABLE_MEMORY_CALLBACKS_TYPE (e_table_memory_callbacks_get_type ()) -#define E_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacks)) -#define E_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass)) -#define E_IS_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_CALLBACKS_TYPE)) -#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_CALLBACKS_TYPE)) -#define E_TABLE_MEMORY_CALLBACKS_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass)) - -typedef gint (*ETableMemoryCalbacksColumnCountFn) (ETableModel *etm, gpointer data); -typedef void (*ETableMemoryCalbacksAppendRowFn) (ETableModel *etm, ETableModel *model, gint row, gpointer data); +/* Standard GObject macros */ +#define E_TYPE_TABLE_MEMORY_CALLBACKS \ + (e_table_memory_callbacks_get_type ()) +#define E_TABLE_MEMORY_CALLBACKS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_MEMORY_CALLBACKS, ETableMemoryCallbacks)) +#define E_TABLE_MEMORY_CALLBACKS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_MEMORY_CALLBACKS, ETableMemoryCallbacksClass)) +#define E_IS_TABLE_MEMORY_CALLBACKS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_MEMORY_CALLBACKS)) +#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_MEMORY_CALLBACKS)) +#define E_TABLE_MEMORY_CALLBACKS_GET_CLASS(cls) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((cls), E_TYPE_TABLE_MEMORY_CALLBACKS, ETableMemoryCallbacksClass)) -typedef void *(*ETableMemoryCalbacksValueAtFn) (ETableModel *etm, gint col, gint row, gpointer data); -typedef void (*ETableMemoryCalbacksSetValueAtFn) (ETableModel *etm, gint col, gint row, gconstpointer val, gpointer data); -typedef gboolean (*ETableMemoryCalbacksIsCellEditableFn) (ETableModel *etm, gint col, gint row, gpointer data); - -typedef void *(*ETableMemoryCalbacksDuplicateValueFn) (ETableModel *etm, gint col, gconstpointer val, gpointer data); -typedef void (*ETableMemoryCalbacksFreeValueFn) (ETableModel *etm, gint col, gpointer val, gpointer data); -typedef void *(*ETableMemoryCalbacksInitializeValueFn) (ETableModel *etm, gint col, gpointer data); -typedef gboolean (*ETableMemoryCalbacksValueIsEmptyFn) (ETableModel *etm, gint col, gconstpointer val, gpointer data); -typedef gchar *(*ETableMemoryCalbacksValueToStringFn) (ETableModel *etm, gint col, gconstpointer val, gpointer data); +G_BEGIN_DECLS -typedef struct { +typedef struct _ETableMemoryCallbacks ETableMemoryCallbacks; +typedef struct _ETableMemoryCallbacksClass ETableMemoryCallbacksClass; + +typedef gint (*ETableMemoryCallbacksColumnCountFn) + (ETableModel *etm, + gpointer data); +typedef void (*ETableMemoryCallbacksAppendRowFn) + (ETableModel *etm, + ETableModel *model, + gint row, + gpointer data); + +typedef gpointer (*ETableMemoryCallbacksValueAtFn) + (ETableModel *etm, + gint col, + gint row, + gpointer data); +typedef void (*ETableMemoryCallbacksSetValueAtFn) + (ETableModel *etm, + gint col, + gint row, + gconstpointer val, + gpointer data); +typedef gboolean (*ETableMemoryCallbacksIsCellEditableFn) + (ETableModel *etm, + gint col, + gint row, + gpointer data); + +typedef gpointer (*ETableMemoryCallbacksDuplicateValueFn) + (ETableModel *etm, + gint col, + gconstpointer val, + gpointer data); +typedef void (*ETableMemoryCallbacksFreeValueFn) + (ETableModel *etm, + gint col, + gpointer val, + gpointer data); +typedef gpointer (*ETableMemoryCallbacksInitializeValueFn) + (ETableModel *etm, + gint col, + gpointer data); +typedef gboolean (*ETableMemoryCallbacksValueIsEmptyFn) + (ETableModel *etm, + gint col, + gconstpointer val, + gpointer data); +typedef gchar * (*ETableMemoryCallbacksValueToStringFn) + (ETableModel *etm, + gint col, + gconstpointer val, + gpointer data); + +struct _ETableMemoryCallbacks { ETableMemory parent; - ETableMemoryCalbacksColumnCountFn col_count; - ETableMemoryCalbacksAppendRowFn append_row; + ETableMemoryCallbacksColumnCountFn col_count; + ETableMemoryCallbacksAppendRowFn append_row; - ETableMemoryCalbacksValueAtFn value_at; - ETableMemoryCalbacksSetValueAtFn set_value_at; - ETableMemoryCalbacksIsCellEditableFn is_cell_editable; + ETableMemoryCallbacksValueAtFn value_at; + ETableMemoryCallbacksSetValueAtFn set_value_at; + ETableMemoryCallbacksIsCellEditableFn is_cell_editable; - ETableMemoryCalbacksDuplicateValueFn duplicate_value; - ETableMemoryCalbacksFreeValueFn free_value; - ETableMemoryCalbacksInitializeValueFn initialize_value; - ETableMemoryCalbacksValueIsEmptyFn value_is_empty; - ETableMemoryCalbacksValueToStringFn value_to_string; + ETableMemoryCallbacksDuplicateValueFn duplicate_value; + ETableMemoryCallbacksFreeValueFn free_value; + ETableMemoryCallbacksInitializeValueFn initialize_value; + ETableMemoryCallbacksValueIsEmptyFn value_is_empty; + ETableMemoryCallbacksValueToStringFn value_to_string; gpointer data; -} ETableMemoryCalbacks; +}; -typedef struct { +struct _ETableMemoryCallbacksClass { ETableMemoryClass parent_class; -} ETableMemoryCalbacksClass; - -GType e_table_memory_callbacks_get_type (void); - -ETableModel *e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count, - - ETableMemoryCalbacksValueAtFn value_at, - ETableMemoryCalbacksSetValueAtFn set_value_at, - ETableMemoryCalbacksIsCellEditableFn is_cell_editable, - - ETableMemoryCalbacksDuplicateValueFn duplicate_value, - ETableMemoryCalbacksFreeValueFn free_value, - ETableMemoryCalbacksInitializeValueFn initialize_value, - ETableMemoryCalbacksValueIsEmptyFn value_is_empty, - ETableMemoryCalbacksValueToStringFn value_to_string, - gpointer data); +}; + +GType e_table_memory_callbacks_get_type + (void) G_GNUC_CONST; +ETableModel * e_table_memory_callbacks_new + (ETableMemoryCallbacksColumnCountFn col_count, + + ETableMemoryCallbacksValueAtFn value_at, + ETableMemoryCallbacksSetValueAtFn set_value_at, + ETableMemoryCallbacksIsCellEditableFn is_cell_editable, + + ETableMemoryCallbacksDuplicateValueFn duplicate_value, + ETableMemoryCallbacksFreeValueFn free_value, + ETableMemoryCallbacksInitializeValueFn initialize_value, + ETableMemoryCallbacksValueIsEmptyFn value_is_empty, + ETableMemoryCallbacksValueToStringFn value_to_string, + gpointer data); G_END_DECLS diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c index 05aad76d35..5a0263b308 100644 --- a/widgets/table/e-table-memory-store.c +++ b/widgets/table/e-table-memory-store.c @@ -28,6 +28,10 @@ #include "e-table-memory-store.h" +#define E_TABLE_MEMORY_STORE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStorePrivate)) + #define STORE_LOCATOR(etms, col, row) (*((etms)->priv->store + (row) * (etms)->priv->col_count + (col))) struct _ETableMemoryStorePrivate { @@ -36,7 +40,7 @@ struct _ETableMemoryStorePrivate { gpointer *store; }; -G_DEFINE_TYPE (ETableMemoryStore, e_table_memory_store, E_TABLE_MEMORY_TYPE) +G_DEFINE_TYPE (ETableMemoryStore, e_table_memory_store, E_TYPE_TABLE_MEMORY) static gpointer duplicate_value (ETableMemoryStore *etms, gint col, gconstpointer val) @@ -222,50 +226,49 @@ etms_append_row (ETableModel *etm, ETableModel *source, gint row) } static void -etms_finalize (GObject *obj) +etms_finalize (GObject *object) { - ETableMemoryStore *etms = (ETableMemoryStore *) obj; + ETableMemoryStorePrivate *priv; - if (etms->priv) { - e_table_memory_store_clear (etms); + priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (object); - g_free (etms->priv->columns); - g_free (etms->priv->store); - g_free (etms->priv); - } + e_table_memory_store_clear (E_TABLE_MEMORY_STORE (object)); + + g_free (priv->columns); + g_free (priv->store); - if (G_OBJECT_CLASS (e_table_memory_store_parent_class)->finalize) - G_OBJECT_CLASS (e_table_memory_store_parent_class)->finalize (obj); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_table_memory_store_parent_class)->finalize (object); } static void e_table_memory_store_init (ETableMemoryStore *etms) { - etms->priv = g_new (ETableMemoryStorePrivate, 1); - - etms->priv->col_count = 0; - etms->priv->columns = NULL; - etms->priv->store = NULL; + etms->priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (etms); } static void -e_table_memory_store_class_init (ETableMemoryStoreClass *klass) +e_table_memory_store_class_init (ETableMemoryStoreClass *class) { - ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; + ETableModelClass *model_class; + + g_type_class_add_private (class, sizeof (ETableMemoryStorePrivate)); - object_class->finalize = etms_finalize; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = etms_finalize; - model_class->column_count = etms_column_count; - model_class->value_at = etms_value_at; - model_class->set_value_at = etms_set_value_at; + model_class = E_TABLE_MODEL_CLASS (class); + model_class->column_count = etms_column_count; + model_class->value_at = etms_value_at; + model_class->set_value_at = etms_set_value_at; model_class->is_cell_editable = etms_is_cell_editable; - model_class->duplicate_value = etms_duplicate_value; - model_class->free_value = etms_free_value; + model_class->duplicate_value = etms_duplicate_value; + model_class->free_value = etms_free_value; model_class->initialize_value = etms_initialize_value; - model_class->value_is_empty = etms_value_is_empty; - model_class->value_to_string = etms_value_to_string; - model_class->append_row = etms_append_row; + model_class->value_is_empty = etms_value_is_empty; + model_class->value_to_string = etms_value_to_string; + model_class->append_row = etms_append_row; } /** @@ -297,7 +300,7 @@ e_table_memory_store_class_init (ETableMemoryStoreClass *klass) ETableModel * e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns) { - ETableMemoryStore *et = g_object_new (E_TABLE_MEMORY_STORE_TYPE, NULL); + ETableMemoryStore *et = g_object_new (E_TYPE_TABLE_MEMORY_STORE, NULL); if (e_table_memory_store_construct (et, columns)) { return (ETableModel *) et; diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h index 96da50f71c..9d3d638e18 100644 --- a/widgets/table/e-table-memory-store.h +++ b/widgets/table/e-table-memory-store.h @@ -27,14 +27,26 @@ #include <table/e-table-memory.h> #include <table/e-table-memory-callbacks.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TABLE_MEMORY_STORE \ + (e_table_memory_store_get_type ()) +#define E_TABLE_MEMORY_STORE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStore)) +#define E_TABLE_MEMORY_STORE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStoreClass)) +#define E_IS_TABLE_MEMORY_STORE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_MEMORY_STORE)) +#define E_IS_TABLE_MEMORY_STORE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_MEMORY_STORE)) +#define E_TABLE_MEMORY_STORE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStoreClass)) -#define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ()) -#define E_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore)) -#define E_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass)) -#define E_IS_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_STORE_TYPE)) -#define E_IS_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_STORE_TYPE)) -#define E_TABLE_MEMORY_STORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass)) +G_BEGIN_DECLS typedef enum { E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR, @@ -46,11 +58,11 @@ typedef enum { } ETableMemoryStoreColumnType; typedef struct { - ETableMemoryCalbacksDuplicateValueFn duplicate_value; - ETableMemoryCalbacksFreeValueFn free_value; - ETableMemoryCalbacksInitializeValueFn initialize_value; - ETableMemoryCalbacksValueIsEmptyFn value_is_empty; - ETableMemoryCalbacksValueToStringFn value_to_string; + ETableMemoryCallbacksDuplicateValueFn duplicate_value; + ETableMemoryCallbacksFreeValueFn free_value; + ETableMemoryCallbacksInitializeValueFn initialize_value; + ETableMemoryCallbacksValueIsEmptyFn value_is_empty; + ETableMemoryCallbacksValueToStringFn value_to_string; } ETableMemoryStoreCustomColumn; typedef struct { @@ -59,79 +71,80 @@ typedef struct { guint editable : 1; } ETableMemoryStoreColumnInfo; -#define E_TABLE_MEMORY_STORE_TERMINATOR { E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR, { NULL }, FALSE } -#define E_TABLE_MEMORY_STORE_INTEGER { E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER, { NULL }, FALSE } -#define E_TABLE_MEMORY_STORE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, FALSE } -#define E_TABLE_MEMORY_STORE_PIXBUF { E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF, { NULL }, FALSE } -#define E_TABLE_MEMORY_STORE_EDITABLE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, TRUE } -#define E_TABLE_MEMORY_STORE_CUSTOM(editable, duplicate, free, initialize, empty, string) \ - { E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \ - { (duplicate), (free), (initialize), (empty), (string) }, editable } -#define E_TABLE_MEMORY_STORE_OBJECT(editable, initialize, empty, string) \ - { E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \ - { NULL, NULL, (initialize), (empty), (string) }, editable } +#define E_TABLE_MEMORY_STORE_TERMINATOR \ + { E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR, { NULL }, FALSE } +#define E_TABLE_MEMORY_STORE_INTEGER \ + { E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER, { NULL }, FALSE } +#define E_TABLE_MEMORY_STORE_STRING \ + { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, FALSE } +typedef struct _ETableMemoryStore ETableMemoryStore; +typedef struct _ETableMemoryStoreClass ETableMemoryStoreClass; typedef struct _ETableMemoryStorePrivate ETableMemoryStorePrivate; -typedef struct { +struct _ETableMemoryStore { ETableMemory parent; - ETableMemoryStorePrivate *priv; -} ETableMemoryStore; +}; -typedef struct { +struct _ETableMemoryStoreClass { ETableMemoryClass parent_class; -} ETableMemoryStoreClass; - -GType e_table_memory_store_get_type (void); +}; -/* Object Creation */ -ETableModel *e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns); -ETableModel *e_table_memory_store_construct (ETableMemoryStore *store, - ETableMemoryStoreColumnInfo *columns); +GType e_table_memory_store_get_type (void) G_GNUC_CONST; +ETableModel * e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns); +ETableModel * e_table_memory_store_construct (ETableMemoryStore *store, + ETableMemoryStoreColumnInfo *columns); /* Adopt a value instead of copying it. */ -void e_table_memory_store_adopt_value_at (ETableMemoryStore *etms, - gint col, - gint row, - void *value); +void e_table_memory_store_adopt_value_at + (ETableMemoryStore *etms, + gint col, + gint row, + gpointer value); /* The size of these arrays is the number of columns. */ -void e_table_memory_store_insert_array (ETableMemoryStore *etms, - gint row, - void **store, - gpointer data); -void e_table_memory_store_insert (ETableMemoryStore *etms, - gint row, - gpointer data, - ...); -void e_table_memory_store_insert_adopt (ETableMemoryStore *etms, - gint row, - gpointer data, - ...); -void e_table_memory_store_insert_adopt_array (ETableMemoryStore *etms, - gint row, - void **store, - gpointer data); -void e_table_memory_store_change_array (ETableMemoryStore *etms, - gint row, - void **store, - gpointer data); -void e_table_memory_store_change (ETableMemoryStore *etms, - gint row, - gpointer data, - ...); -void e_table_memory_store_change_adopt (ETableMemoryStore *etms, - gint row, - gpointer data, - ...); -void e_table_memory_store_change_adopt_array (ETableMemoryStore *etms, - gint row, - void **store, - gpointer data); -void e_table_memory_store_remove (ETableMemoryStore *etms, - gint row); -void e_table_memory_store_clear (ETableMemoryStore *etms); +void e_table_memory_store_insert_array + (ETableMemoryStore *etms, + gint row, + gpointer *store, + gpointer data); +void e_table_memory_store_insert (ETableMemoryStore *etms, + gint row, + gpointer data, + ...); +void e_table_memory_store_insert_adopt + (ETableMemoryStore *etms, + gint row, + gpointer data, + ...); +void e_table_memory_store_insert_adopt_array + (ETableMemoryStore *etms, + gint row, + gpointer *store, + gpointer data); +void e_table_memory_store_change_array + (ETableMemoryStore *etms, + gint row, + gpointer *store, + gpointer data); +void e_table_memory_store_change (ETableMemoryStore *etms, + gint row, + gpointer data, + ...); +void e_table_memory_store_change_adopt + (ETableMemoryStore *etms, + gint row, + gpointer data, + ...); +void e_table_memory_store_change_adopt_array + (ETableMemoryStore *etms, + gint row, + gpointer *store, + gpointer data); +void e_table_memory_store_remove (ETableMemoryStore *etms, + gint row); +void e_table_memory_store_clear (ETableMemoryStore *etms); G_END_DECLS diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index ca338ab1ca..0c0237531b 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -37,30 +37,28 @@ #include "e-table-memory.h" -G_DEFINE_TYPE (ETableMemory, e_table_memory, E_TABLE_MODEL_TYPE) +#define E_TABLE_MEMORY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_MEMORY, ETableMemoryPrivate)) -struct ETableMemoryPriv { +G_DEFINE_TYPE (ETableMemory, e_table_memory, E_TYPE_TABLE_MODEL) + +struct _ETableMemoryPrivate { gpointer *data; gint num_rows; gint frozen; }; - -/* virtual methods */ - static void etmm_finalize (GObject *object) { - ETableMemory *etmm = E_TABLE_MEMORY (object); - ETableMemoryPriv *priv = etmm->priv; + ETableMemoryPrivate *priv; - /* XXX lots of stuff to free here */ - if (priv) { - g_free (priv->data); - g_free (priv); - } - etmm->priv = NULL; + priv = E_TABLE_MEMORY_GET_PRIVATE (object); + + g_free (priv->data); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_table_memory_parent_class)->finalize (object); } @@ -72,29 +70,25 @@ etmm_row_count (ETableModel *etm) return etmm->priv->num_rows; } - static void -e_table_memory_class_init (ETableMemoryClass *klass) +e_table_memory_class_init (ETableMemoryClass *class) { - ETableModelClass *table_class = E_TABLE_MODEL_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; + ETableModelClass *table_model_class; + + g_type_class_add_private (class, sizeof (ETableMemoryPrivate)); - object_class->finalize = etmm_finalize; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = etmm_finalize; - table_class->row_count = etmm_row_count; + table_model_class = E_TABLE_MODEL_CLASS (class); + table_model_class->row_count = etmm_row_count; } static void e_table_memory_init (ETableMemory *etmm) { - ETableMemoryPriv *priv; - - priv = g_new0 (ETableMemoryPriv, 1); - etmm->priv = priv; - - priv->data = NULL; - priv->num_rows = 0; - priv->frozen = 0; + etmm->priv = E_TABLE_MEMORY_GET_PRIVATE (etmm); } /** @@ -107,7 +101,7 @@ e_table_memory_init (ETableMemory *etmm) ETableMemory * e_table_memory_new (void) { - return g_object_new (E_TABLE_MEMORY_TYPE, NULL); + return g_object_new (E_TYPE_TABLE_MEMORY, NULL); } /** @@ -245,7 +239,7 @@ e_table_memory_clear (ETableMemory *etmm) void e_table_memory_freeze (ETableMemory *etmm) { - ETableMemoryPriv *priv = etmm->priv; + ETableMemoryPrivate *priv = etmm->priv; if (priv->frozen == 0) e_table_model_pre_change (E_TABLE_MODEL (etmm)); @@ -265,7 +259,7 @@ e_table_memory_freeze (ETableMemory *etmm) void e_table_memory_thaw (ETableMemory *etmm) { - ETableMemoryPriv *priv = etmm->priv; + ETableMemoryPrivate *priv = etmm->priv; if (priv->frozen > 0) priv->frozen--; diff --git a/widgets/table/e-table-memory.h b/widgets/table/e-table-memory.h index 8de51b7c5e..853f378c9e 100644 --- a/widgets/table/e-table-memory.h +++ b/widgets/table/e-table-memory.h @@ -26,48 +26,60 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <table/e-table-model.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TABLE_MEMORY \ + (e_table_memory_get_type ()) +#define E_TABLE_MEMORY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_MEMORY, ETableMemory)) +#define E_TABLE_MEMORY_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_MEMORY, ETableMemoryClass)) +#define E_IS_TABLE_MEMORY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_MEMORY)) +#define E_IS_TABLE_MEMORY_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_MEMORY)) +#define E_TABLE_MEMORY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_MEMORY, ETableMemoryClass)) -#define E_TABLE_MEMORY_TYPE (e_table_memory_get_type ()) -#define E_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_TYPE, ETableMemory)) -#define E_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_TYPE, ETableMemoryClass)) -#define E_IS_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_TYPE)) -#define E_IS_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_TYPE)) -#define E_TABLE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MEMORY_TYPE, ETableMemoryClass)) +G_BEGIN_DECLS -typedef struct ETableMemory ETableMemory; -typedef struct ETableMemoryPriv ETableMemoryPriv; -typedef struct ETableMemoryClass ETableMemoryClass; +typedef struct _ETableMemory ETableMemory; +typedef struct _ETableMemoryClass ETableMemoryClass; +typedef struct _ETableMemoryPrivate ETableMemoryPrivate; -struct ETableMemory { - ETableModel base; - ETableMemoryPriv *priv; +struct _ETableMemory { + ETableModel parent; + ETableMemoryPrivate *priv; }; -struct ETableMemoryClass { +struct _ETableMemoryClass { ETableModelClass parent_class; }; -GType e_table_memory_get_type (void); -void e_table_memory_construct (ETableMemory *etable); -ETableMemory *e_table_memory_new (void); +GType e_table_memory_get_type (void) G_GNUC_CONST; +ETableMemory * e_table_memory_new (void); +void e_table_memory_construct (ETableMemory *etable); /* row operations */ -void e_table_memory_insert (ETableMemory *etable, - gint row, - gpointer data); -gpointer e_table_memory_remove (ETableMemory *etable, - gint row); -void e_table_memory_clear (ETableMemory *etable); +void e_table_memory_insert (ETableMemory *etable, + gint row, + gpointer data); +gpointer e_table_memory_remove (ETableMemory *etable, + gint row); +void e_table_memory_clear (ETableMemory *etable); /* Freeze and thaw */ -void e_table_memory_freeze (ETableMemory *etable); -void e_table_memory_thaw (ETableMemory *etable); -gpointer e_table_memory_get_data (ETableMemory *etm, - gint row); -void e_table_memory_set_data (ETableMemory *etm, - gint row, - gpointer data); +void e_table_memory_freeze (ETableMemory *etable); +void e_table_memory_thaw (ETableMemory *etable); +gpointer e_table_memory_get_data (ETableMemory *etm, + gint row); +void e_table_memory_set_data (ETableMemory *etm, + gint row, + gpointer data); G_END_DECLS diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index dbe01a345c..308cdb0c58 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -271,9 +271,9 @@ e_table_model_finalize (GObject *object) } static void -e_table_model_class_init (ETableModelClass *klass) +e_table_model_class_init (ETableModelClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = e_table_model_finalize; @@ -340,31 +340,31 @@ e_table_model_class_init (ETableModelClass *klass) e_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - klass->column_count = NULL; - klass->row_count = NULL; - klass->append_row = NULL; + class->column_count = NULL; + class->row_count = NULL; + class->append_row = NULL; - klass->value_at = NULL; - klass->set_value_at = NULL; - klass->is_cell_editable = NULL; + class->value_at = NULL; + class->set_value_at = NULL; + class->is_cell_editable = NULL; - klass->has_save_id = NULL; - klass->get_save_id = NULL; + class->has_save_id = NULL; + class->get_save_id = NULL; - klass->has_change_pending = NULL; + class->has_change_pending = NULL; - klass->duplicate_value = NULL; - klass->free_value = NULL; - klass->initialize_value = NULL; - klass->value_is_empty = NULL; - klass->value_to_string = NULL; + class->duplicate_value = NULL; + class->free_value = NULL; + class->initialize_value = NULL; + class->value_is_empty = NULL; + class->value_to_string = NULL; - klass->model_no_change = NULL; - klass->model_changed = NULL; - klass->model_row_changed = NULL; - klass->model_cell_changed = NULL; - klass->model_rows_inserted = NULL; - klass->model_rows_deleted = NULL; + class->model_no_change = NULL; + class->model_changed = NULL; + class->model_row_changed = NULL; + class->model_cell_changed = NULL; + class->model_rows_inserted = NULL; + class->model_rows_deleted = NULL; } static void @@ -393,7 +393,7 @@ e_table_model_pre_change (ETableModel *e_table_model) return; d (print_tabs ()); - d(g_print("Emitting pre_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type))); + d(g_print("Emitting pre_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_PRE_CHANGE], 0); @@ -423,7 +423,7 @@ e_table_model_no_change (ETableModel *e_table_model) return; d (print_tabs ()); - d(g_print("Emitting model_no_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type))); + d(g_print("Emitting model_no_change on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_NO_CHANGE], 0); @@ -453,7 +453,7 @@ e_table_model_changed (ETableModel *e_table_model) return; d (print_tabs ()); - d(g_print("Emitting model_changed on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type))); + d(g_print("Emitting model_changed on model 0x%p, a %s.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_CHANGED], 0); @@ -480,7 +480,7 @@ e_table_model_row_changed (ETableModel *e_table_model, gint row) return; d (print_tabs ()); - d(g_print("Emitting row_changed on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type), row)); + d(g_print("Emitting row_changed on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_ROW_CHANGED], 0, row); @@ -508,7 +508,7 @@ e_table_model_cell_changed (ETableModel *e_table_model, gint col, gint row) return; d (print_tabs ()); - d(g_print("Emitting cell_changed on model 0x%p, a %s, row %d, col %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type), row, col)); + d(g_print("Emitting cell_changed on model 0x%p, a %s, row %d, col %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row, col)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_CELL_CHANGED], 0, col, row); @@ -536,7 +536,7 @@ e_table_model_rows_inserted (ETableModel *e_table_model, gint row, gint count) return; d (print_tabs ()); - d(g_print("Emitting row_inserted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type), row)); + d(g_print("Emitting row_inserted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_ROWS_INSERTED], 0, row, count); @@ -579,7 +579,7 @@ e_table_model_rows_deleted (ETableModel *e_table_model, gint row, gint count) return; d (print_tabs ()); - d(g_print("Emitting row_deleted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->klass->type), row)); + d(g_print("Emitting row_deleted on model 0x%p, a %s, row %d.\n", e_table_model, g_type_name (G_OBJECT(e_table_model)->class->type), row)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), e_table_model_signals[MODEL_ROWS_DELETED], 0, row, count); diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h index e319b1ff42..2ff4eacebd 100644 --- a/widgets/table/e-table-model.h +++ b/widgets/table/e-table-model.h @@ -26,48 +26,82 @@ #include <glib-object.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_MODEL \ + (e_table_model_get_type ()) +#define E_TABLE_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_MODEL, ETableModel)) +#define E_TABLE_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_MODEL, ETableModelClass)) +#define E_IS_TABLE_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_MODEL)) +#define E_IS_TABLE_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_MODEL)) +#define E_TABLE_MODEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_MODEL, ETableModelClass)) + G_BEGIN_DECLS -#define E_TABLE_MODEL_TYPE (e_table_model_get_type ()) -#define E_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel)) -#define E_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass)) -#define E_IS_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MODEL_TYPE)) -#define E_IS_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE)) -#define E_TABLE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MODEL_TYPE, ETableModelClass)) +typedef struct _ETableModel ETableModel; +typedef struct _ETableModelClass ETableModelClass; -typedef struct { - GObject base; -} ETableModel; +struct _ETableModel { + GObject parent; +}; -typedef struct { +struct _ETableModelClass { GObjectClass parent_class; /* * Virtual methods */ - gint (*column_count) (ETableModel *etm); - gint (*row_count) (ETableModel *etm); - void (*append_row) (ETableModel *etm, ETableModel *source, gint row); - - void *(*value_at) (ETableModel *etm, gint col, gint row); - void (*set_value_at) (ETableModel *etm, gint col, gint row, gconstpointer value); - gboolean (*is_cell_editable) (ETableModel *etm, gint col, gint row); - - gboolean (*has_save_id) (ETableModel *etm); - gchar *(*get_save_id) (ETableModel *etm, gint row); - - gboolean (*has_change_pending) (ETableModel *etm); + gint (*column_count) (ETableModel *etm); + gint (*row_count) (ETableModel *etm); + void (*append_row) (ETableModel *etm, + ETableModel *source, + gint row); + + gpointer (*value_at) (ETableModel *etm, + gint col, + gint row); + void (*set_value_at) (ETableModel *etm, + gint col, + gint row, + gconstpointer value); + gboolean (*is_cell_editable) (ETableModel *etm, + gint col, + gint row); + + gboolean (*has_save_id) (ETableModel *etm); + gchar * (*get_save_id) (ETableModel *etm, + gint row); + + gboolean (*has_change_pending) (ETableModel *etm); /* Allocate a copy of the given value. */ - void *(*duplicate_value) (ETableModel *etm, gint col, gconstpointer value); + gpointer (*duplicate_value) (ETableModel *etm, + gint col, + gconstpointer value); /* Free an allocated value. */ - void (*free_value) (ETableModel *etm, gint col, gpointer value); + void (*free_value) (ETableModel *etm, + gint col, + gpointer value); /* Return an allocated empty value. */ - void *(*initialize_value) (ETableModel *etm, gint col); + gpointer (*initialize_value) (ETableModel *etm, + gint col); /* Return TRUE if value is equivalent to an empty cell. */ - gboolean (*value_is_empty) (ETableModel *etm, gint col, gconstpointer value); + gboolean (*value_is_empty) (ETableModel *etm, + gint col, + gconstpointer value); /* Return an allocated string. */ - gchar *(*value_to_string) (ETableModel *etm, gint col, gconstpointer value); + gchar * (*value_to_string) (ETableModel *etm, + gint col, + gconstpointer value); /* * Signals @@ -82,89 +116,97 @@ typedef struct { * A row inserted: row_inserted * A row deleted: row_deleted */ - void (*model_pre_change) (ETableModel *etm); - - void (*model_no_change) (ETableModel *etm); - void (*model_changed) (ETableModel *etm); - void (*model_row_changed) (ETableModel *etm, gint row); - void (*model_cell_changed) (ETableModel *etm, gint col, gint row); - void (*model_rows_inserted) (ETableModel *etm, gint row, gint count); - void (*model_rows_deleted) (ETableModel *etm, gint row, gint count); -} ETableModelClass; - -GType e_table_model_get_type (void); + void (*model_pre_change) (ETableModel *etm); + + void (*model_no_change) (ETableModel *etm); + void (*model_changed) (ETableModel *etm); + void (*model_row_changed) (ETableModel *etm, + gint row); + void (*model_cell_changed) (ETableModel *etm, + gint col, + gint row); + void (*model_rows_inserted) (ETableModel *etm, + gint row, + gint count); + void (*model_rows_deleted) (ETableModel *etm, + gint row, + gint count); +}; + +GType e_table_model_get_type (void) G_GNUC_CONST; /**/ -gint e_table_model_column_count (ETableModel *e_table_model); -const gchar *e_table_model_column_name (ETableModel *e_table_model, - gint col); -gint e_table_model_row_count (ETableModel *e_table_model); -void e_table_model_append_row (ETableModel *e_table_model, - ETableModel *source, - gint row); +gint e_table_model_column_count (ETableModel *e_table_model); +const gchar * e_table_model_column_name (ETableModel *e_table_model, + gint col); +gint e_table_model_row_count (ETableModel *e_table_model); +void e_table_model_append_row (ETableModel *e_table_model, + ETableModel *source, + gint row); /**/ -void *e_table_model_value_at (ETableModel *e_table_model, - gint col, - gint row); -void e_table_model_set_value_at (ETableModel *e_table_model, - gint col, - gint row, - const void *value); -gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, - gint col, - gint row); +gpointer e_table_model_value_at (ETableModel *e_table_model, + gint col, + gint row); +void e_table_model_set_value_at (ETableModel *e_table_model, + gint col, + gint row, + gconstpointer value); +gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, + gint col, + gint row); /**/ -gboolean e_table_model_has_save_id (ETableModel *etm); -gchar *e_table_model_get_save_id (ETableModel *etm, - gint row); +gboolean e_table_model_has_save_id (ETableModel *etm); +gchar * e_table_model_get_save_id (ETableModel *etm, + gint row); /**/ -gboolean e_table_model_has_change_pending (ETableModel *etm); +gboolean e_table_model_has_change_pending + (ETableModel *etm); /**/ -void *e_table_model_duplicate_value (ETableModel *e_table_model, - gint col, - const void *value); -void e_table_model_free_value (ETableModel *e_table_model, - gint col, - void *value); -void *e_table_model_initialize_value (ETableModel *e_table_model, - gint col); -gboolean e_table_model_value_is_empty (ETableModel *e_table_model, - gint col, - const void *value); -gchar *e_table_model_value_to_string (ETableModel *e_table_model, - gint col, - const void *value); +gpointer e_table_model_duplicate_value (ETableModel *e_table_model, + gint col, + gconstpointer value); +void e_table_model_free_value (ETableModel *e_table_model, + gint col, + gpointer value); +gpointer e_table_model_initialize_value (ETableModel *e_table_model, + gint col); +gboolean e_table_model_value_is_empty (ETableModel *e_table_model, + gint col, + gconstpointer value); +gchar * e_table_model_value_to_string (ETableModel *e_table_model, + gint col, + gconstpointer value); /* * Routines for emitting signals on the e_table */ -void e_table_model_pre_change (ETableModel *e_table_model); -void e_table_model_no_change (ETableModel *e_table_model); -void e_table_model_changed (ETableModel *e_table_model); -void e_table_model_row_changed (ETableModel *e_table_model, - gint row); -void e_table_model_cell_changed (ETableModel *e_table_model, - gint col, - gint row); -void e_table_model_rows_inserted (ETableModel *e_table_model, -gint row, -gint count); -void e_table_model_rows_deleted (ETableModel *e_table_model, -gint row, -gint count); +void e_table_model_pre_change (ETableModel *e_table_model); +void e_table_model_no_change (ETableModel *e_table_model); +void e_table_model_changed (ETableModel *e_table_model); +void e_table_model_row_changed (ETableModel *e_table_model, + gint row); +void e_table_model_cell_changed (ETableModel *e_table_model, + gint col, + gint row); +void e_table_model_rows_inserted (ETableModel *e_table_model, + gint row, + gint count); +void e_table_model_rows_deleted (ETableModel *e_table_model, + gint row, + gint count); /**/ -void e_table_model_row_inserted (ETableModel *e_table_model, -gint row); -void e_table_model_row_deleted (ETableModel *e_table_model, -gint row); +void e_table_model_row_inserted (ETableModel *e_table_model, + gint row); +void e_table_model_row_deleted (ETableModel *e_table_model, + gint row); -void e_table_model_freeze (ETableModel *e_table_model); -void e_table_model_thaw (ETableModel *e_table_model); +void e_table_model_freeze (ETableModel *e_table_model); +void e_table_model_thaw (ETableModel *e_table_model); G_END_DECLS diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c index b58b0b8631..ed8a481104 100644 --- a/widgets/table/e-table-one.c +++ b/widgets/table/e-table-one.c @@ -27,7 +27,7 @@ #include "e-table-one.h" -G_DEFINE_TYPE (ETableOne, e_table_one, E_TABLE_MODEL_TYPE) +G_DEFINE_TYPE (ETableOne, e_table_one, E_TYPE_TABLE_MODEL) static gint one_column_count (ETableModel *etm) @@ -167,10 +167,10 @@ one_dispose (GObject *object) } static void -e_table_one_class_init (ETableOneClass *klass) +e_table_one_class_init (ETableOneClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ETableModelClass *model_class = E_TABLE_MODEL_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ETableModelClass *model_class = E_TABLE_MODEL_CLASS (class); model_class->column_count = one_column_count; model_class->row_count = one_row_count; @@ -201,7 +201,7 @@ e_table_one_new (ETableModel *source) gint col_count; gint i; - eto = g_object_new (E_TABLE_ONE_TYPE, NULL); + eto = g_object_new (E_TYPE_TABLE_ONE, NULL); eto->source = source; col_count = e_table_model_column_count (source); diff --git a/widgets/table/e-table-one.h b/widgets/table/e-table-one.h index 2984aeaa76..a0d5c7bf88 100644 --- a/widgets/table/e-table-one.h +++ b/widgets/table/e-table-one.h @@ -25,30 +25,45 @@ #include <table/e-table-model.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_ONE \ + (e_table_one_get_type ()) +#define E_TABLE_ONE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_ONE, ETableOne)) +#define E_TABLE_ONE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_ONE, ETableOneClass)) +#define E_IS_TABLE_ONE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_ONE)) +#define E_IS_TABLE_ONE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_ONE)) +#define E_TABLE_ONE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_ONE, ETableOneClass)) + G_BEGIN_DECLS -#define E_TABLE_ONE_TYPE (e_table_one_get_type ()) -#define E_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_ONE_TYPE, ETableOne)) -#define E_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass)) -#define E_IS_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_ONE_TYPE)) -#define E_IS_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE)) -#define E_TABLE_ONE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_ONE_TYPE, ETableOneClass)) +typedef struct _ETableOne ETableOne; +typedef struct _ETableOneClass ETableOneClass; -typedef struct { - ETableModel parent; +struct _ETableOne { + ETableModel parent; ETableModel *source; - void **data; -} ETableOne; + gpointer *data; +}; -typedef struct { +struct _ETableOneClass { ETableModelClass parent_class; -} ETableOneClass; +}; -GType e_table_one_get_type (void); +GType e_table_one_get_type (void) G_GNUC_CONST; -ETableModel *e_table_one_new (ETableModel *source); -void e_table_one_commit (ETableOne *one); +ETableModel * e_table_one_new (ETableModel *source); +void e_table_one_commit (ETableOne *one); G_END_DECLS diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 1f2f5b1a0b..10ed919571 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -30,6 +30,10 @@ #define d(x) +#define E_TABLE_SEARCH_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_SEARCH, ETableSearchPrivate)) + d (static gint depth = 0) struct _ETableSearchPrivate { @@ -106,21 +110,26 @@ add_timeout (ETableSearch *ets) static void e_table_search_finalize (GObject *object) { - ETableSearch *ets = (ETableSearch *) object; + ETableSearchPrivate *priv; - drop_timeout (ets); - g_free (ets->priv->search_string); - g_free (ets->priv); + priv = E_TABLE_SEARCH_GET_PRIVATE (object); + + drop_timeout (E_TABLE_SEARCH (object)); + + g_free (priv->search_string); - if (G_OBJECT_CLASS (e_table_search_parent_class)->finalize) - (*G_OBJECT_CLASS (e_table_search_parent_class)->finalize)(object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_table_search_parent_class)->finalize (object); } static void -e_table_search_class_init (ETableSearchClass *klass) +e_table_search_class_init (ETableSearchClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; + g_type_class_add_private (class, sizeof (ETableSearchPrivate)); + + object_class = G_OBJECT_CLASS (class); object_class->finalize = e_table_search_finalize; e_table_search_signals[SEARCH_SEARCH] = @@ -141,26 +150,22 @@ e_table_search_class_init (ETableSearchClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - klass->search = NULL; - klass->accept = NULL; + class->search = NULL; + class->accept = NULL; } static void e_table_search_init (ETableSearch *ets) { - ets->priv = g_new (ETableSearchPrivate, 1); + ets->priv = E_TABLE_SEARCH_GET_PRIVATE (ets); - ets->priv->timeout_id = 0; ets->priv->search_string = g_strdup (""); - ets->priv->last_character = 0; } ETableSearch * e_table_search_new (void) { - ETableSearch *ets = g_object_new (E_TABLE_SEARCH_TYPE, NULL); - - return ets; + return g_object_new (E_TYPE_TABLE_SEARCH, NULL); } /** diff --git a/widgets/table/e-table-search.h b/widgets/table/e-table-search.h index 798d81bd2d..ecd56a5d72 100644 --- a/widgets/table/e-table-search.h +++ b/widgets/table/e-table-search.h @@ -26,45 +26,56 @@ #include <glib-object.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TABLE_SEARCH \ + (e_table_search_get_type ()) +#define E_TABLE_SEARCH(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SEARCH, ETableSearch)) +#define E_TABLE_SEARCH_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SEARCH, ETableSearchClass)) +#define E_IS_TABLE_SEARCH(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SEARCH)) +#define E_IS_TABLE_SEARCH_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SEARCH)) +#define E_TABLE_SEARCH_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SEARCH, ETableSearchClass)) -#define E_TABLE_SEARCH_TYPE (e_table_search_get_type ()) -#define E_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch)) -#define E_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SEARCH_TYPE, ETableSearchClass)) -#define E_IS_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SEARCH_TYPE)) -#define E_IS_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SEARCH_TYPE)) -#define E_TABLE_SEARCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SEARCH_TYPE, ETableSearchClass)) +G_BEGIN_DECLS +typedef struct _ETableSearch ETableSearch; +typedef struct _ETableSearchClass ETableSearchClass; typedef struct _ETableSearchPrivate ETableSearchPrivate; typedef enum { E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST = 1 << 0 } ETableSearchFlags; -typedef struct { - GObject base; - +struct _ETableSearch { + GObject parent; ETableSearchPrivate *priv; -} ETableSearch; +}; -typedef struct { +struct _ETableSearchClass { GObjectClass parent_class; - /* - * Signals - */ - gboolean (*search) (ETableSearch *ets, gchar *string /* utf8 */, ETableSearchFlags flags); - void (*accept) (ETableSearch *ets); -} ETableSearchClass; - -GType e_table_search_get_type (void); -ETableSearch *e_table_search_new (void); + /* Signals */ + gboolean (*search) (ETableSearch *ets, + gchar *string /* utf8 */, + ETableSearchFlags flags); + void (*accept) (ETableSearch *ets); +}; -/**/ -void e_table_search_input_character (ETableSearch *e_table_search, - gunichar character); -gboolean e_table_search_backspace (ETableSearch *e_table_search); -void e_table_search_cancel (ETableSearch *e_table_search); +GType e_table_search_get_type (void) G_GNUC_CONST; +ETableSearch * e_table_search_new (void); +void e_table_search_input_character (ETableSearch *e_table_search, + gunichar character); +gboolean e_table_search_backspace (ETableSearch *e_table_search); +void e_table_search_cancel (ETableSearch *e_table_search); G_END_DECLS diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index b459dd1da1..7c11d1bd4a 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -283,13 +283,13 @@ e_table_selection_model_init (ETableSelectionModel *selection) } static void -e_table_selection_model_class_init (ETableSelectionModelClass *klass) +e_table_selection_model_class_init (ETableSelectionModelClass *class) { GObjectClass *object_class; ESelectionModelArrayClass *esma_class; - object_class = G_OBJECT_CLASS (klass); - esma_class = E_SELECTION_MODEL_ARRAY_CLASS (klass); + object_class = G_OBJECT_CLASS (class); + esma_class = E_SELECTION_MODEL_ARRAY_CLASS (class); object_class->dispose = etsm_dispose; object_class->get_property = etsm_get_property; @@ -301,14 +301,14 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) g_param_spec_object ("model", "Model", NULL, - E_TABLE_MODEL_TYPE, + E_TYPE_TABLE_MODEL, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_HEADER, g_param_spec_object ("header", "Header", NULL, - E_TABLE_HEADER_TYPE, + E_TYPE_TABLE_HEADER, G_PARAM_READWRITE)); } @@ -322,7 +322,7 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass) ETableSelectionModel * e_table_selection_model_new (void) { - return g_object_new (E_TABLE_SELECTION_MODEL_TYPE, NULL); + return g_object_new (E_TYPE_TABLE_SELECTION_MODEL, NULL); } static gint diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h index ab504ac711..f144980f03 100644 --- a/widgets/table/e-table-selection-model.h +++ b/widgets/table/e-table-selection-model.h @@ -24,21 +24,36 @@ #ifndef _E_TABLE_SELECTION_MODEL_H_ #define _E_TABLE_SELECTION_MODEL_H_ -#include <glib-object.h> #include <misc/e-selection-model-array.h> #include <table/e-table-model.h> #include <table/e-table-header.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SELECTION_MODEL \ + (e_table_selection_model_get_type ()) +#define E_TABLE_SELECTION_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SELECTION_MODEL, ETableSelectionModel)) +#define E_TABLE_SELECTION_MODEL_CLASS(cls) \ + (G_TYPE-CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SELECTION_MODEL, ETableSelectionModelClass)) +#define E_IS_TABLE_SELECTION_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SELECTION_MODEL)) +#define E_IS_TABLE_SELECTION_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SELECTION_MODEL)) +#define E_TABLE_SELECTION_MODEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SELECTION_MODEL, ETableSelectionModelClass)) + G_BEGIN_DECLS -#define E_TABLE_SELECTION_MODEL_TYPE (e_table_selection_model_get_type ()) -#define E_TABLE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel)) -#define E_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE-CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass)) -#define E_IS_TABLE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE)) -#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SELECTION_MODEL_TYPE)) +typedef struct _ETableSelectionModel ETableSelectionModel; +typedef struct _ETableSelectionModelClass ETableSelectionModelClass; -typedef struct { - ESelectionModelArray base; +struct _ETableSelectionModel { + ESelectionModelArray parent; ETableModel *model; ETableHeader *eth; @@ -57,14 +72,15 @@ typedef struct { GHashTable *hash; gchar *cursor_id; -} ETableSelectionModel; +}; -typedef struct { +struct _ETableSelectionModelClass { ESelectionModelArrayClass parent_class; -} ETableSelectionModelClass; +}; -GType e_table_selection_model_get_type (void); -ETableSelectionModel *e_table_selection_model_new (void); +GType e_table_selection_model_get_type (void) G_GNUC_CONST; +ETableSelectionModel * + e_table_selection_model_new (void); G_END_DECLS diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c index f7a6d89ad5..b238e6b444 100644 --- a/widgets/table/e-table-sort-info.c +++ b/widgets/table/e-table-sort-info.c @@ -71,11 +71,11 @@ e_table_sort_info_init (ETableSortInfo *info) } static void -e_table_sort_info_class_init (ETableSortInfoClass *klass) +e_table_sort_info_class_init (ETableSortInfoClass *class) { - GObjectClass * object_class = G_OBJECT_CLASS (klass); + GObjectClass * object_class = G_OBJECT_CLASS (class); - e_table_sort_info_parent_class = g_type_class_peek_parent (klass); + e_table_sort_info_parent_class = g_type_class_peek_parent (class); object_class->finalize = etsi_finalize; @@ -97,8 +97,8 @@ e_table_sort_info_class_init (ETableSortInfoClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - klass->sort_info_changed = NULL; - klass->group_info_changed = NULL; + class->sort_info_changed = NULL; + class->group_info_changed = NULL; } static void @@ -340,7 +340,7 @@ e_table_sort_info_sorting_set_nth (ETableSortInfo *info, gint n, ETableSortCol ETableSortInfo * e_table_sort_info_new (void) { - return g_object_new (E_TABLE_SORT_INFO_TYPE, NULL); + return g_object_new (E_TYPE_TABLE_SORT_INFO, NULL); } /** diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h index d9ffec9be2..a577481150 100644 --- a/widgets/table/e-table-sort-info.h +++ b/widgets/table/e-table-sort-info.h @@ -6,7 +6,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public @@ -26,24 +26,38 @@ #include <glib-object.h> #include <libxml/tree.h> -G_BEGIN_DECLS +#define E_TYPE_TABLE_SORT_INFO \ + (e_table_sort_info_get_type ()) +#define E_TABLE_SORT_INFO(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SORT_INFO, ETableSortInfo)) +#define E_TABLE_SORT_INFO_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SORT_INFO, ETableSortInfoClass)) +#define E_IS_TABLE_SORT_INFO(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SORT_INFO)) +#define E_IS_TABLE_SORT_INFO_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SORT_INFO)) +#define E_TABLE_SORT_INFO_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SORT_INFO, ETableSortInfoClass)) -#define E_TABLE_SORT_INFO_TYPE (e_table_sort_info_get_type ()) -#define E_TABLE_SORT_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfo)) -#define E_TABLE_SORT_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass)) -#define E_IS_TABLE_SORT_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORT_INFO_TYPE)) -#define E_IS_TABLE_SORT_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORT_INFO_TYPE)) -#define E_TABLE_SORT_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass)) +G_BEGIN_DECLS typedef struct _ETableSortColumn ETableSortColumn; +typedef struct _ETableSortInfo ETableSortInfo; +typedef struct _ETableSortInfoClass ETableSortInfoClass; + struct _ETableSortColumn { guint column : 31; guint ascending : 1; }; -typedef struct { - GObject base; +struct _ETableSortInfo { + GObject parent; gint group_count; ETableSortColumn *groupings; @@ -55,51 +69,60 @@ typedef struct { guint group_info_changed : 1; guint can_group : 1; -} ETableSortInfo; +}; -typedef struct { +struct _ETableSortInfoClass { GObjectClass parent_class; - /* - * Signals - */ - void (*sort_info_changed) (ETableSortInfo *info); - void (*group_info_changed) (ETableSortInfo *info); -} ETableSortInfoClass; - -GType e_table_sort_info_get_type (void); - -void e_table_sort_info_freeze (ETableSortInfo *info); -void e_table_sort_info_thaw (ETableSortInfo *info); - -guint e_table_sort_info_grouping_get_count (ETableSortInfo *info); -void e_table_sort_info_grouping_truncate (ETableSortInfo *info, - gint length); -ETableSortColumn e_table_sort_info_grouping_get_nth (ETableSortInfo *info, - gint n); -void e_table_sort_info_grouping_set_nth (ETableSortInfo *info, - gint n, - ETableSortColumn column); - -guint e_table_sort_info_sorting_get_count (ETableSortInfo *info); -void e_table_sort_info_sorting_truncate (ETableSortInfo *info, - gint length); -ETableSortColumn e_table_sort_info_sorting_get_nth (ETableSortInfo *info, - gint n); -void e_table_sort_info_sorting_set_nth (ETableSortInfo *info, - gint n, - ETableSortColumn column); - -ETableSortInfo *e_table_sort_info_new (void); -void e_table_sort_info_load_from_node (ETableSortInfo *info, - xmlNode *node, - gdouble state_version); -xmlNode *e_table_sort_info_save_to_node (ETableSortInfo *info, - xmlNode *parent); -ETableSortInfo *e_table_sort_info_duplicate (ETableSortInfo *info); -void e_table_sort_info_set_can_group (ETableSortInfo *info, - gboolean can_group); -gboolean e_table_sort_info_get_can_group (ETableSortInfo *info); + /* Signals */ + void (*sort_info_changed) (ETableSortInfo *info); + void (*group_info_changed) (ETableSortInfo *info); +}; + +GType e_table_sort_info_get_type (void) G_GNUC_CONST; + +void e_table_sort_info_freeze (ETableSortInfo *info); +void e_table_sort_info_thaw (ETableSortInfo *info); + +guint e_table_sort_info_grouping_get_count + (ETableSortInfo *info); +void e_table_sort_info_grouping_truncate + (ETableSortInfo *info, + gint length); +ETableSortColumn + e_table_sort_info_grouping_get_nth + (ETableSortInfo *info, + gint n); +void e_table_sort_info_grouping_set_nth + (ETableSortInfo *info, + gint n, + ETableSortColumn column); + +guint e_table_sort_info_sorting_get_count + (ETableSortInfo *info); +void e_table_sort_info_sorting_truncate + (ETableSortInfo *info, + gint length); +ETableSortColumn + e_table_sort_info_sorting_get_nth + (ETableSortInfo *info, + gint n); +void e_table_sort_info_sorting_set_nth + (ETableSortInfo *info, + gint n, + ETableSortColumn column); + +ETableSortInfo *e_table_sort_info_new (void); +void e_table_sort_info_load_from_node + (ETableSortInfo *info, + xmlNode *node, + gdouble state_version); +xmlNode * e_table_sort_info_save_to_node (ETableSortInfo *info, + xmlNode *parent); +ETableSortInfo *e_table_sort_info_duplicate (ETableSortInfo *info); +void e_table_sort_info_set_can_group (ETableSortInfo *info, + gboolean can_group); +gboolean e_table_sort_info_get_can_group (ETableSortInfo *info); G_END_DECLS diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index b9185994c1..f2970209bf 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -39,7 +39,7 @@ /* workaround for avoiding API breakage */ #define etsv_get_type e_table_sorted_variable_get_type -G_DEFINE_TYPE (ETableSortedVariable, etsv, E_TABLE_SUBSET_VARIABLE_TYPE) +G_DEFINE_TYPE (ETableSortedVariable, etsv, E_TYPE_TABLE_SUBSET_VARIABLE) static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv); static void etsv_sort (ETableSortedVariable *etsv); @@ -77,10 +77,10 @@ etsv_dispose (GObject *object) } static void -etsv_class_init (ETableSortedVariableClass *klass) +etsv_class_init (ETableSortedVariableClass *class) { - ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etsv_dispose; @@ -187,7 +187,7 @@ etsv_add_all (ETableSubsetVariable *etssv) ETableModel * e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { - ETableSortedVariable *etsv = g_object_new (E_TABLE_SORTED_VARIABLE_TYPE, NULL); + ETableSortedVariable *etsv = g_object_new (E_TYPE_TABLE_SORTED_VARIABLE, NULL); ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv); if (e_table_subset_variable_construct (etssv, source) == NULL) { diff --git a/widgets/table/e-table-sorted-variable.h b/widgets/table/e-table-sorted-variable.h index c778af3c1f..917338ae4d 100644 --- a/widgets/table/e-table-sorted-variable.h +++ b/widgets/table/e-table-sorted-variable.h @@ -24,41 +24,57 @@ #ifndef _E_TABLE_SORTED_VARIABLE_H_ #define _E_TABLE_SORTED_VARIABLE_H_ -#include <glib-object.h> #include <table/e-table-model.h> #include <table/e-table-subset-variable.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SORTED_VARIABLE \ + (e_table_sorted_variable_get_type ()) +#define E_TABLE_SORTED_VARIABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SORTED_VARIABLE, ETableSortedVariable)) +#define E_TABLE_SORTED_VARIABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SORTED_VARIABLE, ETableSortedVariableClass)) +#define E_IS_TABLE_SORTED_VARIABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SORTED_VARIABLE)) +#define E_IS_TABLE_SORTED_VARIABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SORTED_VARIABLE)) +#define E_TABLE_SORTED_VARIABLE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SORTED_VARIABLE, ETableSortedVariableClass)) + G_BEGIN_DECLS -#define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ()) -#define E_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) -#define E_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) -#define E_IS_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_TABLE_SORTED_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) +typedef struct _ETableSortedVariable ETableSortedVariable; +typedef struct _ETableSortedVariableClass ETableSortedVariableClass; -typedef struct { - ETableSubsetVariable base; +struct _ETableSortedVariable { + ETableSubsetVariable parent; ETableSortInfo *sort_info; ETableHeader *full_header; - gint sort_info_changed_id; - gint sort_idle_id; - gint insert_idle_id; - gint insert_count; - -} ETableSortedVariable; + gint sort_info_changed_id; + gint sort_idle_id; + gint insert_idle_id; + gint insert_count; +}; -typedef struct { +struct _ETableSortedVariableClass { ETableSubsetVariableClass parent_class; -} ETableSortedVariableClass; +}; -GType e_table_sorted_variable_get_type (void); -ETableModel *e_table_sorted_variable_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info); +GType e_table_sorted_variable_get_type + (void) G_GNUC_CONST; +ETableModel * e_table_sorted_variable_new (ETableModel *etm, + ETableHeader *header, + ETableSortInfo *sort_info); G_END_DECLS diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index c1ff7740d5..73dbac102e 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -36,7 +36,7 @@ /* workaround for avoding API breakage */ #define ets_get_type e_table_sorted_get_type -G_DEFINE_TYPE (ETableSorted, ets, E_TABLE_SUBSET_TYPE) +G_DEFINE_TYPE (ETableSorted, ets, E_TYPE_TABLE_SUBSET) /* maximum insertions between an idle event that we will do without scheduling an idle sort */ #define ETS_INSERT_MAX (4) @@ -77,10 +77,10 @@ ets_dispose (GObject *object) } static void -ets_class_init (ETableSortedClass *klass) +ets_class_init (ETableSortedClass *class) { - ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); etss_class->proxy_model_changed = ets_proxy_model_changed; etss_class->proxy_model_row_changed = ets_proxy_model_row_changed; @@ -125,7 +125,7 @@ ets_insert_idle (ETableSorted *ets) ETableModel * e_table_sorted_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { - ETableSorted *ets = g_object_new (E_TABLE_SORTED_TYPE, NULL); + ETableSorted *ets = g_object_new (E_TYPE_TABLE_SORTED, NULL); ETableSubset *etss = E_TABLE_SUBSET (ets); if (E_TABLE_SUBSET_CLASS (ets_parent_class)->proxy_model_pre_change) diff --git a/widgets/table/e-table-sorted.h b/widgets/table/e-table-sorted.h index a9e815ef3a..feff6e2ad5 100644 --- a/widgets/table/e-table-sorted.h +++ b/widgets/table/e-table-sorted.h @@ -24,41 +24,56 @@ #ifndef _E_TABLE_SORTED_H_ #define _E_TABLE_SORTED_H_ -#include <glib-object.h> #include <table/e-table-model.h> #include <table/e-table-subset.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SORTED \ + (e_table_sorted_get_type ()) +#define E_TABLE_SORTED(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SORTED, ETableSorted)) +#define E_TABLE_SORTED_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SORTED, ETableSortedClass)) +#define E_IS_TABLE_SORTED(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SORTED)) +#define E_IS_TABLE_SORTED_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SORTED)) +#define E_TABLE_SORTED_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SORTED, ETableSortedClass)) + G_BEGIN_DECLS -#define E_TABLE_SORTED_TYPE (e_table_sorted_get_type ()) -#define E_TABLE_SORTED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTED_TYPE, ETableSorted)) -#define E_TABLE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTED_TYPE, ETableSortedClass)) -#define E_IS_TABLE_SORTED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTED_TYPE)) -#define E_IS_TABLE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_TYPE)) -#define E_TABLE_SORTED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_SORTED_TYPE, ETableSortedClass)) +typedef struct _ETableSorted ETableSorted; +typedef struct _ETableSortedClass ETableSortedClass; -typedef struct { - ETableSubset base; +struct _ETableSorted { + ETableSubset parent; ETableSortInfo *sort_info; ETableHeader *full_header; - gint sort_info_changed_id; - gint sort_idle_id; - gint insert_idle_id; - gint insert_count; - -} ETableSorted; + gint sort_info_changed_id; + gint sort_idle_id; + gint insert_idle_id; + gint insert_count; +}; -typedef struct { +struct _ETableSortedClass { ETableSubsetClass parent_class; -} ETableSortedClass; +}; -GType e_table_sorted_get_type (void); -ETableModel *e_table_sorted_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info); +GType e_table_sorted_get_type (void) G_GNUC_CONST; +ETableModel * e_table_sorted_new (ETableModel *etm, + ETableHeader *header, + ETableSortInfo *sort_info); G_END_DECLS diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 2a52fbb8d5..491fe7fc6f 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -153,10 +153,10 @@ ets_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *psp } static void -ets_class_init (ETableSorterClass *klass) +ets_class_init (ETableSorterClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - ESorterClass *sorter_class = E_SORTER_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + ESorterClass *sorter_class = E_SORTER_CLASS (class); object_class->dispose = ets_dispose; object_class->set_property = ets_set_property; @@ -172,7 +172,7 @@ ets_class_init (ETableSorterClass *klass) g_param_spec_object ("sort_info", "Sort Info", NULL, - E_TABLE_SORT_INFO_TYPE, + E_TYPE_TABLE_SORT_INFO, G_PARAM_READWRITE)); } @@ -197,7 +197,7 @@ ets_init (ETableSorter *ets) ETableSorter * e_table_sorter_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { - ETableSorter *ets = g_object_new (E_TABLE_SORTER_TYPE, NULL); + ETableSorter *ets = g_object_new (E_TYPE_TABLE_SORTER, NULL); ets->sort_info = sort_info; g_object_ref (ets->sort_info); diff --git a/widgets/table/e-table-sorter.h b/widgets/table/e-table-sorter.h index 067da103f9..0f36f441f6 100644 --- a/widgets/table/e-table-sorter.h +++ b/widgets/table/e-table-sorter.h @@ -23,51 +23,68 @@ #ifndef _E_TABLE_SORTER_H_ #define _E_TABLE_SORTER_H_ -#include <glib-object.h> #include <e-util/e-sorter.h> #include <table/e-table-model.h> #include <table/e-table-subset-variable.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SORTER \ + (e_table_sorter_get_type ()) +#define E_TABLE_SORTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SORTER, ETableSorter)) +#define E_TABLE_SORTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SORTER, ETableSorterClass)) +#define E_IS_TABLE_SORTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SORTER)) +#define E_IS_TABLE_SORTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SORTER)) +#define E_TABLE_SORTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SORTER, ETableSorterClass)) + G_BEGIN_DECLS -#define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ()) -#define E_TABLE_SORTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter)) -#define E_TABLE_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTER_TYPE, ETableSorterClass)) -#define E_IS_TABLE_SORTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTER_TYPE)) -#define E_IS_TABLE_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTER_TYPE)) +typedef struct _ETableSorter ETableSorter; +typedef struct _ETableSorterClass ETableSorterClass; -typedef struct { - ESorter base; +struct _ETableSorter { + ESorter parent; - ETableModel *source; - ETableHeader *full_header; + ETableModel *source; + ETableHeader *full_header; ETableSortInfo *sort_info; - /* If needs_sorting is 0, then model_to_sorted and sorted_to_model are no-ops. */ - gint needs_sorting; + /* If needs_sorting is 0, then model_to_sorted + * and sorted_to_model are no-ops. */ + gint needs_sorting; - gint *sorted; - gint *backsorted; + gint *sorted; + gint *backsorted; - gint table_model_changed_id; - gint table_model_row_changed_id; - gint table_model_cell_changed_id; - gint table_model_rows_inserted_id; - gint table_model_rows_deleted_id; - gint sort_info_changed_id; - gint group_info_changed_id; -} ETableSorter; + gint table_model_changed_id; + gint table_model_row_changed_id; + gint table_model_cell_changed_id; + gint table_model_rows_inserted_id; + gint table_model_rows_deleted_id; + gint sort_info_changed_id; + gint group_info_changed_id; +}; -typedef struct { +struct _ETableSorterClass { ESorterClass parent_class; -} ETableSorterClass; +}; + +GType e_table_sorter_get_type (void) G_GNUC_CONST; +ETableSorter * e_table_sorter_new (ETableModel *etm, + ETableHeader *full_header, + ETableSortInfo *sort_info); -GType e_table_sorter_get_type (void); -ETableSorter *e_table_sorter_new (ETableModel *etm, - ETableHeader *full_header, - ETableSortInfo *sort_info); G_END_DECLS #endif /* _E_TABLE_SORTER_H_ */ diff --git a/widgets/table/e-table-sorting-utils.h b/widgets/table/e-table-sorting-utils.h index 3c60df1838..5a0a3cd3d7 100644 --- a/widgets/table/e-table-sorting-utils.h +++ b/widgets/table/e-table-sorting-utils.h @@ -6,7 +6,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public @@ -29,50 +29,62 @@ G_BEGIN_DECLS #include <table/e-tree-model.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> -gboolean e_table_sorting_utils_affects_sort (ETableSortInfo *sort_info, - ETableHeader *full_header, - gint col); -void e_table_sorting_utils_sort (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - gint *map_table, - gint rows); -gint e_table_sorting_utils_insert (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - gint *map_table, - gint rows, - gint row); -gint e_table_sorting_utils_check_position (ETableModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - gint *map_table, - gint rows, - gint view_row); +gboolean e_table_sorting_utils_affects_sort + (ETableSortInfo *sort_info, + ETableHeader *full_header, + gint col); -void e_table_sorting_utils_tree_sort (ETreeModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - ETreePath *map_table, - gint count); -gint e_table_sorting_utils_tree_check_position (ETreeModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - ETreePath *map_table, - gint count, - gint old_index); -gint e_table_sorting_utils_tree_insert (ETreeModel *source, - ETableSortInfo *sort_info, - ETableHeader *full_header, - ETreePath *map_table, - gint count, - ETreePath path); +void e_table_sorting_utils_sort (ETableModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + gint *map_table, + gint rows); +gint e_table_sorting_utils_insert (ETableModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + gint *map_table, + gint rows, + gint row); +gint e_table_sorting_utils_check_position + (ETableModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + gint *map_table, + gint rows, + gint view_row); -gpointer e_table_sorting_utils_create_cmp_cache (void); -void e_table_sorting_utils_free_cmp_cache (gpointer cmp_cache); -void e_table_sorting_utils_add_to_cmp_cache (gpointer cmp_cache, const gchar *key, gchar *value); -const gchar *e_table_sorting_utils_lookup_cmp_cache (gpointer cmp_cache, const gchar *key); +void e_table_sorting_utils_tree_sort (ETreeModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + ETreePath *map_table, + gint count); +gint e_table_sorting_utils_tree_check_position + (ETreeModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + ETreePath *map_table, + gint count, + gint old_index); +gint e_table_sorting_utils_tree_insert + (ETreeModel *source, + ETableSortInfo *sort_info, + ETableHeader *full_header, + ETreePath *map_table, + gint count, + ETreePath path); + +gpointer e_table_sorting_utils_create_cmp_cache + (void); +void e_table_sorting_utils_free_cmp_cache + (gpointer cmp_cache); +void e_table_sorting_utils_add_to_cmp_cache + (gpointer cmp_cache, + const gchar *key, + gchar *value); +const gchar * e_table_sorting_utils_lookup_cmp_cache + (gpointer cmp_cache, + const gchar *key); G_END_DECLS diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 2325aea633..99213ad501 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -69,9 +69,9 @@ etsp_finalize (GObject *object) } static void -etsp_class_init (ETableSpecificationClass *klass) +etsp_class_init (ETableSpecificationClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = etsp_finalize; } diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index e6f6707ae5..021c0524c5 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -24,24 +24,38 @@ #ifndef _E_TABLE_SPECIFICATION_H_ #define _E_TABLE_SPECIFICATION_H_ -#include <glib-object.h> #include <libxml/tree.h> #include <misc/e-selection-model.h> #include <table/e-table-state.h> #include <table/e-table-column-specification.h> #include <table/e-table-defines.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SPECIFICATION \ + (e_table_specification_get_type ()) +#define E_TABLE_SPECIFICATION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SPECIFICATION, ETableSpecification)) +#define E_TABLE_SPECIFICATION_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SPECIFICATION, ETableSpecificationClass)) +#define E_IS_TABLE_SPECIFICATION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SPECIFICATION)) +#define E_IS_TABLE_SPECIFICATION_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SPECIFICATION)) +#define E_TABLE_SPECIFICATION_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SPECIFICATION, ETableSpecificationClass)) + G_BEGIN_DECLS -#define E_TYPE_TABLE_SPECIFICATION (e_table_specification_get_type ()) -#define E_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_TABLE_SPECIFICATION, ETableSpecification)) -#define E_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_TABLE_SPECIFICATION, ETableSpecificationClass)) -#define E_IS_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_TABLE_SPECIFICATION)) -#define E_IS_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_TABLE_SPECIFICATION)) -#define E_TABLE_SPECIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TYPE_TABLE_SPECIFICATION, ETableSpecificationClass)) +typedef struct _ETableSpecification ETableSpecification; +typedef struct _ETableSpecificationClass ETableSpecificationClass; -typedef struct { - GObject base; +struct _ETableSpecification { + GObject parent; ETableColumnSpecification **columns; ETableState *state; @@ -61,28 +75,36 @@ typedef struct { gchar *click_to_add_message; gchar *domain; -} ETableSpecification; +}; -typedef struct { +struct _ETableSpecificationClass { GObjectClass parent_class; -} ETableSpecificationClass; +}; -GType e_table_specification_get_type (void); -ETableSpecification *e_table_specification_new (void); +GType e_table_specification_get_type (void) G_GNUC_CONST; +ETableSpecification * + e_table_specification_new (void); -gboolean e_table_specification_load_from_file (ETableSpecification *specification, - const gchar *filename); -gboolean e_table_specification_load_from_string (ETableSpecification *specification, - const gchar *xml); -void e_table_specification_load_from_node (ETableSpecification *specification, - const xmlNode *node); +gboolean e_table_specification_load_from_file + (ETableSpecification *specification, + const gchar *filename); +gboolean e_table_specification_load_from_string + (ETableSpecification *specification, + const gchar *xml); +void e_table_specification_load_from_node + (ETableSpecification *specification, + const xmlNode *node); -gint e_table_specification_save_to_file (ETableSpecification *specification, - const gchar *filename); -gchar *e_table_specification_save_to_string (ETableSpecification *specification); -xmlNode *e_table_specification_save_to_node (ETableSpecification *specification, - xmlDoc *doc); -ETableSpecification *e_table_specification_duplicate (ETableSpecification *spec); +gint e_table_specification_save_to_file + (ETableSpecification *specification, + const gchar *filename); +gchar * e_table_specification_save_to_string + (ETableSpecification *specification); +xmlNode * e_table_specification_save_to_node + (ETableSpecification *specification, + xmlDoc *doc); +ETableSpecification * + e_table_specification_duplicate (ETableSpecification *specification); G_END_DECLS diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index 9844849818..536bf3c5c8 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -71,9 +71,9 @@ etst_finalize (GObject *object) } static void -e_table_state_class_init (ETableStateClass *klass) +e_table_state_class_init (ETableStateClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etst_dispose; object_class->finalize = etst_finalize; @@ -90,7 +90,7 @@ e_table_state_init (ETableState *state) ETableState * e_table_state_new (void) { - return (ETableState *) g_object_new (E_TABLE_STATE_TYPE, NULL); + return g_object_new (E_TYPE_TABLE_STATE, NULL); } ETableState * diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h index 082bb17ad7..23fc5b2fb2 100644 --- a/widgets/table/e-table-state.h +++ b/widgets/table/e-table-state.h @@ -23,50 +23,61 @@ #ifndef _E_TABLE_STATE_H_ #define _E_TABLE_STATE_H_ -#include <glib-object.h> #include <libxml/tree.h> #include <table/e-table-sort-info.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_STATE \ + (e_table_state_get_type ()) +#define E_TABLE_STATE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_STATE, ETableState)) +#define E_TABLE_STATE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_STATE, ETableStateClass)) +#define E_IS_TABLE_STATE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_STATE)) +#define E_IS_TABLE_STATE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_STATE)) +#define E_TABLE_STATE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_STATE, ETableStateClass)) + G_BEGIN_DECLS -#define E_TABLE_STATE_TYPE (e_table_state_get_type ()) -#define E_TABLE_STATE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_STATE_TYPE, ETableState)) -#define E_TABLE_STATE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_STATE_TYPE, ETableStateClass)) -#define E_IS_TABLE_STATE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_STATE_TYPE)) -#define E_IS_TABLE_STATE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_STATE_TYPE)) -#define E_TABLE_STATE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_STATE_TYPE, ETableStateClass)) +typedef struct _ETableState ETableState; +typedef struct _ETableStateClass ETableStateClass; -typedef struct { - GObject base; +struct _ETableState { + GObject parent; ETableSortInfo *sort_info; - gint col_count; - gint *columns; - gdouble *expansions; -} ETableState; + gint col_count; + gint *columns; + gdouble *expansions; +}; -typedef struct { +struct _ETableStateClass { GObjectClass parent_class; -} ETableStateClass; - -GType e_table_state_get_type (void); -ETableState *e_table_state_new (void); - -ETableState *e_table_state_vanilla (gint col_count); - -gboolean e_table_state_load_from_file (ETableState *state, - const gchar *filename); -void e_table_state_load_from_string (ETableState *state, - const gchar *xml); -void e_table_state_load_from_node (ETableState *state, - const xmlNode *node); +}; -void e_table_state_save_to_file (ETableState *state, - const gchar *filename); -gchar *e_table_state_save_to_string (ETableState *state); -xmlNode *e_table_state_save_to_node (ETableState *state, - xmlNode *parent); -ETableState *e_table_state_duplicate (ETableState *state); +GType e_table_state_get_type (void) G_GNUC_CONST; +ETableState * e_table_state_new (void); +ETableState * e_table_state_vanilla (gint col_count); +gboolean e_table_state_load_from_file (ETableState *state, + const gchar *filename); +void e_table_state_load_from_string (ETableState *state, + const gchar *xml); +void e_table_state_load_from_node (ETableState *state, + const xmlNode *node); +void e_table_state_save_to_file (ETableState *state, + const gchar *filename); +gchar * e_table_state_save_to_string (ETableState *state); +xmlNode * e_table_state_save_to_node (ETableState *state, + xmlNode *parent); +ETableState * e_table_state_duplicate (ETableState *state); G_END_DECLS diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index 07aaa18e10..0f9a58db31 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -33,7 +33,7 @@ /* workaround for avoiding API breakage */ #define etssv_get_type e_table_subset_variable_get_type -G_DEFINE_TYPE (ETableSubsetVariable, etssv, E_TABLE_SUBSET_TYPE) +G_DEFINE_TYPE (ETableSubsetVariable, etssv, E_TYPE_TABLE_SUBSET) #define INCREMENT_AMOUNT 10 @@ -120,12 +120,12 @@ etssv_remove (ETableSubsetVariable *etssv, } static void -etssv_class_init (ETableSubsetVariableClass *klass) +etssv_class_init (ETableSubsetVariableClass *class) { - klass->add = etssv_add; - klass->add_array = etssv_add_array; - klass->add_all = etssv_add_all; - klass->remove = etssv_remove; + class->add = etssv_add; + class->add_array = etssv_add_array; + class->add_all = etssv_add_all; + class->remove = etssv_remove; } static void @@ -148,7 +148,7 @@ e_table_subset_variable_construct (ETableSubsetVariable *etssv, ETableModel * e_table_subset_variable_new (ETableModel *source) { - ETableSubsetVariable *etssv = g_object_new (E_TABLE_SUBSET_VARIABLE_TYPE, NULL); + ETableSubsetVariable *etssv = g_object_new (E_TYPE_TABLE_SUBSET_VARIABLE, NULL); if (e_table_subset_variable_construct (etssv, source) == NULL) { g_object_unref (etssv); diff --git a/widgets/table/e-table-subset-variable.h b/widgets/table/e-table-subset-variable.h index 4654fb5d67..da8186a1df 100644 --- a/widgets/table/e-table-subset-variable.h +++ b/widgets/table/e-table-subset-variable.h @@ -23,58 +23,78 @@ #ifndef _E_TABLE_SUBSET_VARIABLE_H_ #define _E_TABLE_SUBSET_VARIABLE_H_ -#include <glib-object.h> #include <table/e-table-subset.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TABLE_SUBSET_VARIABLE \ + (e_table_subset_variable_get_type ()) +#define E_TABLE_SUBSET_VARIABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SUBSET_VARIABLE, ETableSubsetVariable)) +#define E_TABLE_SUBSET_VARIABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SUBSET_VARIABLE, ETableSubsetVariableClass)) +#define E_IS_TABLE_SUBSET_VARIABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SUBSET_VARIABLE)) +#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SUBSET_VARIABLE)) +#define E_TABLE_SUBSET_VARIABLE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SUBSET_VARIABLE, ETableSubsetVariableClass)) -#define E_TABLE_SUBSET_VARIABLE_TYPE (e_table_subset_variable_get_type ()) -#define E_TABLE_SUBSET_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariable)) -#define E_TABLE_SUBSET_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass)) -#define E_IS_TABLE_SUBSET_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SUBSET_VARIABLE_TYPE)) -#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_VARIABLE_TYPE)) -#define E_TABLE_SUBSET_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass)) +G_BEGIN_DECLS -typedef struct { - ETableSubset base; +typedef struct _ETableSubsetVariable ETableSubsetVariable; +typedef struct _ETableSubsetVariableClass ETableSubsetVariableClass; +struct _ETableSubsetVariable { + ETableSubset parent; gint n_vals_allocated; -} ETableSubsetVariable; +}; -typedef struct { +struct _ETableSubsetVariableClass { ETableSubsetClass parent_class; - void (*add) (ETableSubsetVariable *ets, - gint row); - void (*add_array) (ETableSubsetVariable *ets, - const gint *array, - gint count); - void (*add_all) (ETableSubsetVariable *ets); - gboolean (*remove) (ETableSubsetVariable *ets, - gint row); -} ETableSubsetVariableClass; + void (*add) (ETableSubsetVariable *ets, + gint row); + void (*add_array) (ETableSubsetVariable *ets, + const gint *array, + gint count); + void (*add_all) (ETableSubsetVariable *ets); + gboolean (*remove) (ETableSubsetVariable *ets, + gint row); +}; + +GType e_table_subset_variable_get_type + (void) G_GNUC_CONST; +ETableModel * e_table_subset_variable_new (ETableModel *etm); +ETableModel * e_table_subset_variable_construct + (ETableSubsetVariable *etssv, + ETableModel *source); +void e_table_subset_variable_add (ETableSubsetVariable *ets, + gint row); +void e_table_subset_variable_add_array + (ETableSubsetVariable *ets, + const gint *array, + gint count); +void e_table_subset_variable_add_all (ETableSubsetVariable *ets); +gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets, + gint row); +void e_table_subset_variable_clear (ETableSubsetVariable *ets); +void e_table_subset_variable_increment + (ETableSubsetVariable *ets, + gint position, + gint amount); +void e_table_subset_variable_decrement + (ETableSubsetVariable *ets, + gint position, + gint amount); +void e_table_subset_variable_set_allocation + (ETableSubsetVariable *ets, + gint total); -GType e_table_subset_variable_get_type (void); -ETableModel *e_table_subset_variable_new (ETableModel *etm); -ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source); -void e_table_subset_variable_add (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_add_array (ETableSubsetVariable *ets, - const gint *array, - gint count); -void e_table_subset_variable_add_all (ETableSubsetVariable *ets); -gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_clear (ETableSubsetVariable *ets); -void e_table_subset_variable_increment (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_decrement (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets, - gint total); G_END_DECLS #endif /* _E_TABLE_SUBSET_VARIABLE_H_ */ diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index e9f048da06..7473099bf9 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -42,7 +42,7 @@ static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel /* workaround for avoding API breakage */ #define etss_get_type e_table_subset_get_type -G_DEFINE_TYPE (ETableSubset, etss, E_TABLE_MODEL_TYPE) +G_DEFINE_TYPE (ETableSubset, etss, E_TYPE_TABLE_MODEL) #define ETSS_CLASS(object) (E_TABLE_SUBSET_GET_CLASS(object)) @@ -248,10 +248,10 @@ etss_value_to_string (ETableModel *etm, gint col, gconstpointer value) } static void -etss_class_init (ETableSubsetClass *klass) +etss_class_init (ETableSubsetClass *class) { - ETableModelClass *table_class = E_TABLE_MODEL_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + ETableModelClass *table_class = E_TABLE_MODEL_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = etss_dispose; object_class->finalize = etss_finalize; @@ -273,13 +273,13 @@ etss_class_init (ETableSubsetClass *klass) table_class->value_is_empty = etss_value_is_empty; table_class->value_to_string = etss_value_to_string; - klass->proxy_model_pre_change = etss_proxy_model_pre_change_real; - klass->proxy_model_no_change = etss_proxy_model_no_change_real; - klass->proxy_model_changed = etss_proxy_model_changed_real; - klass->proxy_model_row_changed = etss_proxy_model_row_changed_real; - klass->proxy_model_cell_changed = etss_proxy_model_cell_changed_real; - klass->proxy_model_rows_inserted = etss_proxy_model_rows_inserted_real; - klass->proxy_model_rows_deleted = etss_proxy_model_rows_deleted_real; + class->proxy_model_pre_change = etss_proxy_model_pre_change_real; + class->proxy_model_no_change = etss_proxy_model_no_change_real; + class->proxy_model_changed = etss_proxy_model_changed_real; + class->proxy_model_row_changed = etss_proxy_model_row_changed_real; + class->proxy_model_cell_changed = etss_proxy_model_cell_changed_real; + class->proxy_model_rows_inserted = etss_proxy_model_rows_inserted_real; + class->proxy_model_rows_deleted = etss_proxy_model_rows_deleted_real; } static void @@ -429,7 +429,7 @@ e_table_subset_construct (ETableSubset *etss, ETableModel *source, gint nvals) ETableModel * e_table_subset_new (ETableModel *source, const gint nvals) { - ETableSubset *etss = g_object_new (E_TABLE_SUBSET_TYPE, NULL); + ETableSubset *etss = g_object_new (E_TYPE_TABLE_SUBSET, NULL); if (e_table_subset_construct (etss, source, nvals) == NULL) { g_object_unref (etss); diff --git a/widgets/table/e-table-subset.h b/widgets/table/e-table-subset.h index dd345732e2..9729bdd6b0 100644 --- a/widgets/table/e-table-subset.h +++ b/widgets/table/e-table-subset.h @@ -25,63 +25,90 @@ #ifndef _E_TABLE_SUBSET_H_ #define _E_TABLE_SUBSET_H_ -#include <glib-object.h> #include <table/e-table-model.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE_SUBSET \ + (e_table_subset_get_type ()) +#define E_TABLE_SUBSET(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_SUBSET, ETableSubset)) +#define E_TABLE_SUBSET_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_SUBSET, ETableSubsetClass)) +#define E_IS_TABLE_SUBSET(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_SUBSET)) +#define E_IS_TABLE_SUBSET_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_SUBSET)) +#define E_TABLE_SUBSET_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_SUBSET, ETableSubsetClass)) + G_BEGIN_DECLS -#define E_TABLE_SUBSET_TYPE (e_table_subset_get_type ()) -#define E_TABLE_SUBSET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SUBSET_TYPE, ETableSubset)) -#define E_TABLE_SUBSET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_TYPE, ETableSubsetClass)) -#define E_IS_TABLE_SUBSET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SUBSET_TYPE)) -#define E_IS_TABLE_SUBSET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_TYPE)) -#define E_TABLE_SUBSET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TABLE_SUBSET_TYPE, ETableSubsetClass)) +typedef struct _ETableSubset ETableSubset; +typedef struct _ETableSubsetClass ETableSubsetClass; -typedef struct { - ETableModel base; +struct _ETableSubset { + ETableModel parent; - ETableModel *source; - gint n_map; + ETableModel *source; + gint n_map; gint *map_table; gint last_access; - gint table_model_pre_change_id; - gint table_model_no_change_id; - gint table_model_changed_id; - gint table_model_row_changed_id; - gint table_model_cell_changed_id; - gint table_model_rows_inserted_id; - gint table_model_rows_deleted_id; -} ETableSubset; + gint table_model_pre_change_id; + gint table_model_no_change_id; + gint table_model_changed_id; + gint table_model_row_changed_id; + gint table_model_cell_changed_id; + gint table_model_rows_inserted_id; + gint table_model_rows_deleted_id; +}; -typedef struct { +struct _ETableSubsetClass { ETableModelClass parent_class; - void (*proxy_model_pre_change) (ETableSubset *etss, ETableModel *etm); - void (*proxy_model_no_change) (ETableSubset *etss, ETableModel *etm); - void (*proxy_model_changed) (ETableSubset *etss, ETableModel *etm); - void (*proxy_model_row_changed) (ETableSubset *etss, ETableModel *etm, gint row); - void (*proxy_model_cell_changed) (ETableSubset *etss, ETableModel *etm, gint col, gint row); - void (*proxy_model_rows_inserted) (ETableSubset *etss, ETableModel *etm, gint row, gint count); - void (*proxy_model_rows_deleted) (ETableSubset *etss, ETableModel *etm, gint row, gint count); -} ETableSubsetClass; - -GType e_table_subset_get_type (void); -ETableModel *e_table_subset_new (ETableModel *etm, - gint n_vals); -ETableModel *e_table_subset_construct (ETableSubset *ets, - ETableModel *source, - gint nvals); - -gint e_table_subset_model_to_view_row (ETableSubset *ets, - gint model_row); -gint e_table_subset_view_to_model_row (ETableSubset *ets, - gint view_row); - -ETableModel *e_table_subset_get_toplevel (ETableSubset *table_model); - -void e_table_subset_print_debugging (ETableSubset *table_model); + void (*proxy_model_pre_change) (ETableSubset *etss, + ETableModel *etm); + void (*proxy_model_no_change) (ETableSubset *etss, + ETableModel *etm); + void (*proxy_model_changed) (ETableSubset *etss, + ETableModel *etm); + void (*proxy_model_row_changed) (ETableSubset *etss, + ETableModel *etm, + gint row); + void (*proxy_model_cell_changed) (ETableSubset *etss, + ETableModel *etm, + gint col, + gint row); + void (*proxy_model_rows_inserted) (ETableSubset *etss, + ETableModel *etm, + gint row, + gint count); + void (*proxy_model_rows_deleted) (ETableSubset *etss, + ETableModel *etm, + gint row, + gint count); +}; + +GType e_table_subset_get_type (void) G_GNUC_CONST; +ETableModel * e_table_subset_new (ETableModel *etm, + gint n_vals); +ETableModel * e_table_subset_construct (ETableSubset *ets, + ETableModel *source, + gint nvals); +gint e_table_subset_model_to_view_row + (ETableSubset *ets, + gint model_row); +gint e_table_subset_view_to_model_row + (ETableSubset *ets, + gint view_row); +ETableModel * e_table_subset_get_toplevel (ETableSubset *table_model); +void e_table_subset_print_debugging (ETableSubset *table_model); G_END_DECLS diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h index 2c725f4bf9..a53e7e4060 100644 --- a/widgets/table/e-table-utils.h +++ b/widgets/table/e-table-utils.h @@ -31,17 +31,18 @@ G_BEGIN_DECLS -ETableHeader *e_table_state_to_header (GtkWidget *widget, - ETableHeader *full_header, - ETableState *state); - -ETableHeader *e_table_spec_to_full_header (ETableSpecification *spec, - ETableExtras *ete); - -ETableCol *e_table_util_calculate_current_search_col (ETableHeader *header, - ETableHeader *full_header, - ETableSortInfo *sort_info, - gboolean always_search); +ETableHeader * e_table_state_to_header (GtkWidget *widget, + ETableHeader *full_header, + ETableState *state); + +ETableHeader * e_table_spec_to_full_header (ETableSpecification *spec, + ETableExtras *ete); + +ETableCol * e_table_util_calculate_current_search_col + (ETableHeader *header, + ETableHeader *full_header, + ETableSortInfo *sort_info, + gboolean always_search); G_END_DECLS diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 5dacfb61cc..881c21bf16 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -30,9 +30,13 @@ #include "e-table-without.h" +#define E_TABLE_WITHOUT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_WITHOUT, ETableWithoutPrivate)) + /* workaround for avoiding API breakage */ #define etw_get_type e_table_without_get_type -G_DEFINE_TYPE (ETableWithout, etw, E_TABLE_SUBSET_TYPE) +G_DEFINE_TYPE (ETableWithout, etw, E_TYPE_TABLE_SUBSET) #define INCREMENT_AMOUNT 10 @@ -135,20 +139,18 @@ delete_hash_element (gpointer key, static void etw_dispose (GObject *object) { - ETableWithout *etw = E_TABLE_WITHOUT (object); + ETableWithoutPrivate *priv; - if (etw->priv) { - if (etw->priv->hash) { - g_hash_table_foreach (etw->priv->hash, delete_hash_element, etw); - g_hash_table_destroy (etw->priv->hash); - etw->priv->hash = NULL; - } - g_free (etw->priv); - etw->priv = NULL; + priv = E_TABLE_WITHOUT_GET_PRIVATE (object); + + if (priv->hash != NULL) { + g_hash_table_foreach (priv->hash, delete_hash_element, object); + g_hash_table_destroy (priv->hash); + priv->hash = NULL; } - if (G_OBJECT_CLASS (etw_parent_class)->dispose) - (* G_OBJECT_CLASS (etw_parent_class)->dispose) (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (etw_parent_class)->dispose (object); } static void @@ -231,28 +233,26 @@ etw_proxy_model_changed (ETableSubset *etss, ETableModel *etm) } static void -etw_class_init (ETableWithoutClass *klass) +etw_class_init (ETableWithoutClass *class) { - ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; + ETableSubsetClass *etss_class; + + g_type_class_add_private (class, sizeof (ETableWithoutPrivate)); - object_class->dispose = etw_dispose; + object_class = G_OBJECT_CLASS (class); + object_class->dispose = etw_dispose; + etss_class = E_TABLE_SUBSET_CLASS (class); etss_class->proxy_model_rows_inserted = etw_proxy_model_rows_inserted; etss_class->proxy_model_rows_deleted = etw_proxy_model_rows_deleted; - etss_class->proxy_model_changed = etw_proxy_model_changed; + etss_class->proxy_model_changed = etw_proxy_model_changed; } static void etw_init (ETableWithout *etw) { - etw->priv = g_new (ETableWithoutPrivate, 1); - etw->priv->hash_func = NULL; - etw->priv->compare_func = NULL; - etw->priv->get_key_func = NULL; - etw->priv->duplicate_key_func = NULL; - etw->priv->free_gotten_key_func = NULL; - etw->priv->free_duplicated_key_func = NULL; + etw->priv = E_TABLE_WITHOUT_GET_PRIVATE (etw); } ETableModel * @@ -293,7 +293,7 @@ e_table_without_new (ETableModel *source, ETableWithoutFreeKeyFunc free_duplicated_key_func, void *closure) { - ETableWithout *etw = g_object_new (E_TABLE_WITHOUT_TYPE, NULL); + ETableWithout *etw = g_object_new (E_TYPE_TABLE_WITHOUT, NULL); if (e_table_without_construct (etw, source, diff --git a/widgets/table/e-table-without.h b/widgets/table/e-table-without.h index ce4745cff9..03e1db6702 100644 --- a/widgets/table/e-table-without.h +++ b/widgets/table/e-table-without.h @@ -24,62 +24,76 @@ #ifndef _E_TABLE_WITHOUT_H_ #define _E_TABLE_WITHOUT_H_ -#include <glib-object.h> #include <table/e-table-subset.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TABLE_WITHOUT \ + (e_table_without_get_type ()) +#define E_TABLE_WITHOUT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE_WITHOUT, ETableWithout)) +#define E_TABLE_WITHOUT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE_WITHOUT, ETableWithoutClass)) +#define E_IS_TABLE_WITHOUT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE_WITHOUT)) +#define E_IS_TABLE_WITHOUT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE_WITHOUT)) +#define E_TABLE_WITHOUT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE_WITHOUT, ETableWithoutClass)) -#define E_TABLE_WITHOUT_TYPE (e_table_without_get_type ()) -#define E_TABLE_WITHOUT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_WITHOUT_TYPE, ETableWithout)) -#define E_TABLE_WITHOUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_WITHOUT_TYPE, ETableWithoutClass)) -#define E_IS_TABLE_WITHOUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_WITHOUT_TYPE)) -#define E_IS_TABLE_WITHOUT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_WITHOUT_TYPE)) +G_BEGIN_DECLS +typedef struct _ETableWithout ETableWithout; +typedef struct _ETableWithoutClass ETableWithoutClass; typedef struct _ETableWithoutPrivate ETableWithoutPrivate; -typedef gpointer (*ETableWithoutGetKeyFunc) (ETableModel *source, - gint row, - void *closure); -typedef gpointer (*ETableWithoutDuplicateKeyFunc) (const void *key, - void *closure); -typedef void (*ETableWithoutFreeKeyFunc) (void *key, - void *closure); -typedef struct { - ETableSubset base; +typedef gpointer (*ETableWithoutGetKeyFunc) (ETableModel *source, + gint row, + gpointer closure); +typedef gpointer (*ETableWithoutDuplicateKeyFunc)(gconstpointer key, + gpointer closure); +typedef void (*ETableWithoutFreeKeyFunc) (gpointer key, + gpointer closure); +struct _ETableWithout { + ETableSubset parent; ETableWithoutPrivate *priv; -} ETableWithout; +}; -typedef struct { +struct _ETableWithoutClass { ETableSubsetClass parent_class; +}; -} ETableWithoutClass; +GType e_table_without_get_type (void) G_GNUC_CONST; +ETableModel * e_table_without_new (ETableModel *source, + GHashFunc hash_func, + GCompareFunc compare_func, + ETableWithoutGetKeyFunc get_key_func, + ETableWithoutDuplicateKeyFunc duplicate_key_func, + ETableWithoutFreeKeyFunc free_gotten_key_func, + ETableWithoutFreeKeyFunc free_duplicated_key_func, + gpointer closure); +ETableModel * e_table_without_construct (ETableWithout *etw, + ETableModel *source, + GHashFunc hash_func, + GCompareFunc compare_func, + ETableWithoutGetKeyFunc get_key_func, + ETableWithoutDuplicateKeyFunc duplicate_key_func, + ETableWithoutFreeKeyFunc free_gotten_key_func, + ETableWithoutFreeKeyFunc free_duplicated_key_func, + gpointer closure); +void e_table_without_hide (ETableWithout *etw, + gpointer key); +void e_table_without_hide_adopt (ETableWithout *etw, + gpointer key); +void e_table_without_show (ETableWithout *etw, + gpointer key); +void e_table_without_show_all (ETableWithout *etw); -GType e_table_without_get_type (void); -ETableModel *e_table_without_new (ETableModel *source, - GHashFunc hash_func, - GCompareFunc compare_func, - ETableWithoutGetKeyFunc get_key_func, - ETableWithoutDuplicateKeyFunc duplicate_key_func, - ETableWithoutFreeKeyFunc free_gotten_key_func, - ETableWithoutFreeKeyFunc free_duplicated_key_func, - void *closure); -ETableModel *e_table_without_construct (ETableWithout *etw, - ETableModel *source, - GHashFunc hash_func, - GCompareFunc compare_func, - ETableWithoutGetKeyFunc get_key_func, - ETableWithoutDuplicateKeyFunc duplicate_key_func, - ETableWithoutFreeKeyFunc free_gotten_key_func, - ETableWithoutFreeKeyFunc free_duplicated_key_func, - void *closure); -void e_table_without_hide (ETableWithout *etw, - void *key); -void e_table_without_hide_adopt (ETableWithout *etw, - void *key); -void e_table_without_show (ETableWithout *etw, - void *key); -void e_table_without_show_all (ETableWithout *etw); G_END_DECLS #endif /* _E_TABLE_WITHOUT_H_ */ diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 952bf900b8..aad7c9f729 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1869,7 +1869,7 @@ e_table_new (ETableModel *etm, g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec != NULL, NULL); - e_table = g_object_new (E_TABLE_TYPE, NULL); + e_table = g_object_new (E_TYPE_TABLE, NULL); e_table = e_table_construct (e_table, etm, ete, spec, state); @@ -1909,7 +1909,7 @@ e_table_new_from_spec_file (ETableModel *etm, g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec_fn != NULL, NULL); - e_table = g_object_new (E_TABLE_TYPE, NULL); + e_table = g_object_new (E_TYPE_TABLE, NULL); e_table = e_table_construct_from_spec_file (e_table, etm, ete, spec_fn, state_fn); @@ -3510,7 +3510,7 @@ e_table_class_init (ETableClass *class) g_param_spec_object ("model", "Model", NULL, - E_TABLE_MODEL_TYPE, + E_TYPE_TABLE_MODEL, G_PARAM_READABLE)); gtk_widget_class_install_style_property ( diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 1da89f9e2f..b95444d118 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -6,7 +6,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public @@ -40,13 +40,29 @@ #include <table/e-table-sorter.h> #include <table/e-table-search.h> +/* Standard GObject macros */ +#define E_TYPE_TABLE \ + (e_table_get_type ()) +#define E_TABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TABLE, ETable)) +#define E_TABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TABLE, ETableClass)) +#define E_IS_TABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TABLE)) +#define E_IS_TABLE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TABLE)) +#define E_TABLE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TABLE, ETableClass)) + G_BEGIN_DECLS -#define E_TABLE_TYPE (e_table_get_type ()) -#define E_TABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_TYPE, ETable)) -#define E_TABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_TYPE, ETableClass)) -#define E_IS_TABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_TYPE)) -#define E_IS_TABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE)) +typedef struct _ETable ETable; +typedef struct _ETableClass ETableClass; typedef struct _ETableDragSourceSite ETableDragSourceSite; @@ -56,7 +72,7 @@ typedef enum { E_TABLE_CURSOR_LOC_TABLE = 1 << 1 } ETableCursorLoc; -typedef struct { +struct _ETable { GtkTable parent; ETableModel *model; @@ -64,21 +80,21 @@ typedef struct { ETableHeader *full_header, *header; GnomeCanvasItem *canvas_vbox; - ETableGroup *group; + ETableGroup *group; ETableSortInfo *sort_info; - ETableSorter *sorter; + ETableSorter *sorter; ETableSelectionModel *selection; ETableCursorLoc cursor_loc; ETableSpecification *spec; - ETableSearch *search; + ETableSearch *search; - ETableCol *current_search_col; + ETableCol *current_search_col; - guint search_search_id; - guint search_accept_id; + guint search_search_id; + guint search_accept_id; gint table_model_change_id; gint table_row_change_id; @@ -154,201 +170,226 @@ typedef struct { gint header_width; gchar *domain; -} ETable; +}; -typedef struct { +struct _ETableClass { GtkTableClass parent_class; - void (*cursor_change) (ETable *et, gint row); - void (*cursor_activated) (ETable *et, gint row); - void (*selection_change) (ETable *et); - void (*double_click) (ETable *et, gint row, gint col, GdkEvent *event); - gboolean (*right_click) (ETable *et, gint row, gint col, GdkEvent *event); - gboolean (*click) (ETable *et, gint row, gint col, GdkEvent *event); - gboolean (*key_press) (ETable *et, gint row, gint col, GdkEvent *event); - gboolean (*start_drag) (ETable *et, gint row, gint col, GdkEvent *event); - void (*state_change) (ETable *et); - gboolean (*white_space_event) (ETable *et, GdkEvent *event); - - void (*set_scroll_adjustments) (ETable *table, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment); + void (*cursor_change) (ETable *et, + gint row); + void (*cursor_activated) (ETable *et, + gint row); + void (*selection_change) (ETable *et); + void (*double_click) (ETable *et, + gint row, + gint col, + GdkEvent *event); + gboolean (*right_click) (ETable *et, + gint row, + gint col, + GdkEvent *event); + gboolean (*click) (ETable *et, + gint row, + gint col, + GdkEvent *event); + gboolean (*key_press) (ETable *et, + gint row, + gint col, + GdkEvent *event); + gboolean (*start_drag) (ETable *et, + gint row, + gint col, + GdkEvent *event); + void (*state_change) (ETable *et); + gboolean (*white_space_event) (ETable *et, + GdkEvent *event); + + void (*set_scroll_adjustments) + (ETable *table, + GtkAdjustment *hadjustment, + GtkAdjustment *vadjustment); /* Source side drag signals */ - void (* table_drag_begin) (ETable *table, - gint row, - gint col, - GdkDragContext *context); - void (* table_drag_end) (ETable *table, - gint row, - gint col, - GdkDragContext *context); - void (* table_drag_data_get) (ETable *table, - gint row, - gint col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time); - void (* table_drag_data_delete) (ETable *table, - gint row, - gint col, - GdkDragContext *context); + void (*table_drag_begin) (ETable *table, + gint row, + gint col, + GdkDragContext *context); + void (*table_drag_end) (ETable *table, + gint row, + gint col, + GdkDragContext *context); + void (*table_drag_data_get) (ETable *table, + gint row, + gint col, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint info, + guint time); + void (*table_drag_data_delete) + (ETable *table, + gint row, + gint col, + GdkDragContext *context); /* Target side drag signals */ - void (* table_drag_leave) (ETable *table, - gint row, - gint col, - GdkDragContext *context, - guint time); - gboolean (* table_drag_motion) (ETable *table, - gint row, - gint col, - GdkDragContext *context, - gint x, - gint y, - guint time); - gboolean (* table_drag_drop) (ETable *table, - gint row, - gint col, - GdkDragContext *context, - gint x, - gint y, - guint time); - void (* table_drag_data_received) (ETable *table, - gint row, - gint col, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time); -} ETableClass; -GType e_table_get_type (void); -ETable *e_table_construct (ETable *e_table, - ETableModel *etm, - ETableExtras *ete, - const gchar *spec, - const gchar *state); -GtkWidget *e_table_new (ETableModel *etm, - ETableExtras *ete, - const gchar *spec, - const gchar *state); + void (*table_drag_leave) (ETable *table, + gint row, + gint col, + GdkDragContext *context, + guint time); + gboolean (*table_drag_motion) (ETable *table, + gint row, + gint col, + GdkDragContext *context, + gint x, + gint y, + guint time); + gboolean (*table_drag_drop) (ETable *table, + gint row, + gint col, + GdkDragContext *context, + gint x, + gint y, + guint time); + void (*table_drag_data_received) + (ETable *table, + gint row, + gint col, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint time); +}; + +GType e_table_get_type (void) G_GNUC_CONST; +ETable * e_table_construct (ETable *e_table, + ETableModel *etm, + ETableExtras *ete, + const gchar *spec, + const gchar *state); +GtkWidget * e_table_new (ETableModel *etm, + ETableExtras *ete, + const gchar *spec, + const gchar *state); /* Create an ETable using files. */ -ETable *e_table_construct_from_spec_file (ETable *e_table, - ETableModel *etm, - ETableExtras *ete, - const gchar *spec_fn, - const gchar *state_fn); -GtkWidget *e_table_new_from_spec_file (ETableModel *etm, - ETableExtras *ete, - const gchar *spec_fn, - const gchar *state_fn); +ETable * e_table_construct_from_spec_file + (ETable *e_table, + ETableModel *etm, + ETableExtras *ete, + const gchar *spec_fn, + const gchar *state_fn); +GtkWidget * e_table_new_from_spec_file (ETableModel *etm, + ETableExtras *ete, + const gchar *spec_fn, + const gchar *state_fn); /* To save the state */ -gchar *e_table_get_state (ETable *e_table); -void e_table_save_state (ETable *e_table, - const gchar *filename); -ETableState *e_table_get_state_object (ETable *e_table); +gchar * e_table_get_state (ETable *e_table); +void e_table_save_state (ETable *e_table, + const gchar *filename); +ETableState *e_table_get_state_object (ETable *e_table); /* note that it is more efficient to provide the state at creation time */ -void e_table_set_state (ETable *e_table, - const gchar *state); -void e_table_set_state_object (ETable *e_table, - ETableState *state); -void e_table_load_state (ETable *e_table, - const gchar *filename); -void e_table_set_cursor_row (ETable *e_table, - gint row); - -/* -1 means we don't have the cursor. This is in model rows. */ -gint e_table_get_cursor_row (ETable *e_table); -void e_table_selected_row_foreach (ETable *e_table, - EForeachFunc callback, - gpointer closure); -gint e_table_selected_count (ETable *e_table); -EPrintable *e_table_get_printable (ETable *e_table); -gint e_table_get_next_row (ETable *e_table, - gint model_row); -gint e_table_get_prev_row (ETable *e_table, - gint model_row); -gint e_table_model_to_view_row (ETable *e_table, - gint model_row); -gint e_table_view_to_model_row (ETable *e_table, - gint view_row); -void e_table_get_cell_at (ETable *table, - gint x, - gint y, - gint *row_return, - gint *col_return); -void e_table_get_mouse_over_cell (ETable *table, gint *row, gint *col); -void e_table_get_cell_geometry (ETable *table, - gint row, - gint col, - gint *x_return, - gint *y_return, - gint *width_return, - gint *height_return); +void e_table_set_state (ETable *e_table, + const gchar *state); +void e_table_set_state_object (ETable *e_table, + ETableState *state); +void e_table_load_state (ETable *e_table, + const gchar *filename); +void e_table_set_cursor_row (ETable *e_table, + gint row); + +/* -1 means we don't have the cursor. This is in model rows. */ +gint e_table_get_cursor_row (ETable *e_table); +void e_table_selected_row_foreach (ETable *e_table, + EForeachFunc callback, + gpointer closure); +gint e_table_selected_count (ETable *e_table); +EPrintable * e_table_get_printable (ETable *e_table); +gint e_table_get_next_row (ETable *e_table, + gint model_row); +gint e_table_get_prev_row (ETable *e_table, + gint model_row); +gint e_table_model_to_view_row (ETable *e_table, + gint model_row); +gint e_table_view_to_model_row (ETable *e_table, + gint view_row); +void e_table_get_cell_at (ETable *table, + gint x, + gint y, + gint *row_return, + gint *col_return); +void e_table_get_mouse_over_cell (ETable *table, + gint *row, + gint *col); +void e_table_get_cell_geometry (ETable *table, + gint row, + gint col, + gint *x_return, + gint *y_return, + gint *width_return, + gint *height_return); /* Useful accessor functions. */ -ESelectionModel *e_table_get_selection_model (ETable *table); +ESelectionModel *e_table_get_selection_model (ETable *table); /* Drag & drop stuff. */ /* Target */ -void e_table_drag_get_data (ETable *table, - gint row, - gint col, - GdkDragContext *context, - GdkAtom target, - guint32 time); -void e_table_drag_highlight (ETable *table, - gint row, - gint col); /* col == -1 to highlight entire row. */ -void e_table_drag_unhighlight (ETable *table); -void e_table_drag_dest_set (ETable *table, - GtkDestDefaults flags, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_table_drag_dest_set_proxy (ETable *table, - GdkWindow *proxy_window, - GdkDragProtocol protocol, - gboolean use_coordinates); +void e_table_drag_get_data (ETable *table, + gint row, + gint col, + GdkDragContext *context, + GdkAtom target, + guint32 time); +void e_table_drag_highlight (ETable *table, + gint row, + gint col); /* col == -1 to highlight entire row. */ +void e_table_drag_unhighlight (ETable *table); +void e_table_drag_dest_set (ETable *table, + GtkDestDefaults flags, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions); +void e_table_drag_dest_set_proxy (ETable *table, + GdkWindow *proxy_window, + GdkDragProtocol protocol, + gboolean use_coordinates); /* There probably should be functions for setting the targets * as a GtkTargetList */ -void e_table_drag_dest_unset (GtkWidget *widget); +void e_table_drag_dest_unset (GtkWidget *widget); /* Source side */ -void e_table_drag_source_set (ETable *table, - GdkModifierType start_button_mask, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_table_drag_source_unset (ETable *table); +void e_table_drag_source_set (ETable *table, + GdkModifierType start_button_mask, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions); +void e_table_drag_source_unset (ETable *table); /* There probably should be functions for setting the targets * as a GtkTargetList */ -GdkDragContext *e_table_drag_begin (ETable *table, - gint row, - gint col, - GtkTargetList *targets, - GdkDragAction actions, - gint button, - GdkEvent *event); +GdkDragContext *e_table_drag_begin (ETable *table, + gint row, + gint col, + GtkTargetList *targets, + GdkDragAction actions, + gint button, + GdkEvent *event); /* selection stuff */ -void e_table_select_all (ETable *table); -void e_table_invert_selection (ETable *table); +void e_table_select_all (ETable *table); +void e_table_invert_selection (ETable *table); /* This function is only needed in single_selection_mode. */ -void e_table_right_click_up (ETable *table); +void e_table_right_click_up (ETable *table); -void e_table_commit_click_to_add (ETable *table); +void e_table_commit_click_to_add (ETable *table); G_END_DECLS diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c index daf3bc7c13..1edaa3e09d 100644 --- a/widgets/table/e-tree-memory-callbacks.c +++ b/widgets/table/e-tree-memory-callbacks.c @@ -29,7 +29,7 @@ #include "e-tree-memory-callbacks.h" -G_DEFINE_TYPE (ETreeMemoryCallbacks, e_tree_memory_callbacks, E_TREE_MEMORY_TYPE) +G_DEFINE_TYPE (ETreeMemoryCallbacks, e_tree_memory_callbacks, E_TYPE_TREE_MEMORY) static GdkPixbuf * etmc_icon_at (ETreeModel *etm, ETreePath node) @@ -184,9 +184,9 @@ etmc_value_to_string (ETreeModel *etm, gint col, gconstpointer value) } static void -e_tree_memory_callbacks_class_init (ETreeMemoryCallbacksClass *klass) +e_tree_memory_callbacks_class_init (ETreeMemoryCallbacksClass *class) { - ETreeModelClass *model_class = E_TREE_MODEL_CLASS (klass); + ETreeModelClass *model_class = E_TREE_MODEL_CLASS (class); model_class->icon_at = etmc_icon_at; @@ -263,7 +263,7 @@ e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at, { ETreeMemoryCallbacks *etmc; - etmc = g_object_new (E_TREE_MEMORY_CALLBACKS_TYPE, NULL); + etmc = g_object_new (E_TYPE_TREE_MEMORY_CALLBACKS, NULL); etmc->icon_at = icon_at; diff --git a/widgets/table/e-tree-memory-callbacks.h b/widgets/table/e-tree-memory-callbacks.h index e37ef30d6c..f2e202bec3 100644 --- a/widgets/table/e-tree-memory-callbacks.h +++ b/widgets/table/e-tree-memory-callbacks.h @@ -25,35 +25,98 @@ #include <table/e-tree-memory.h> -G_BEGIN_DECLS - -#define E_TREE_MEMORY_CALLBACKS_TYPE (e_tree_memory_callbacks_get_type ()) -#define E_TREE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacks)) -#define E_TREE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacksClass)) -#define E_IS_TREE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MEMORY_CALLBACKS_TYPE)) -#define E_IS_TREE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_CALLBACKS_TYPE)) - -typedef GdkPixbuf* (*ETreeMemoryCallbacksIconAtFn) (ETreeModel *etree, ETreePath path, gpointer model_data); - -typedef gint (*ETreeMemoryCallbacksColumnCountFn) (ETreeModel *etree, gpointer model_data); - -typedef gboolean (*ETreeMemoryCallbacksHasSaveIdFn) (ETreeModel *etree, gpointer model_data); -typedef gchar *(*ETreeMemoryCallbacksGetSaveIdFn) (ETreeModel *etree, ETreePath path, gpointer model_data); +/* Standard GObject macros */ +#define E_TYPE_TREE_MEMORY_CALLBACKS \ + (e_tree_memory_callbacks_get_type ()) +#define E_TREE_MEMORY_CALLBACKS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_MEMORY_CALLBACKS, ETreeMemoryCallbacks)) +#define E_TREE_MEMORY_CALLBACKS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_MEMORY_CALLBACKS, ETreeMemoryCallbacksClass)) +#define E_IS_TREE_MEMORY_CALLBACKS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_MEMORY_CALLBACKS)) +#define E_IS_TREE_MEMORY_CALLBACKS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_MEMORY_CALLBACKS)) +#define E_TREE_MEMORY_CALLBACKS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_MEMORY_CALLBACKS, ETreeMemoryCallbacksClass)) -typedef gboolean (*ETreeMemoryCallbacksHasGetNodeByIdFn) (ETreeModel *etree, gpointer model_data); -typedef ETreePath (*ETreeMemoryCallbacksGetNodeByIdFn) (ETreeModel *etree, const gchar *save_id, gpointer model_data); - -typedef gpointer (*ETreeMemoryCallbacksValueAtFn) (ETreeModel *etree, ETreePath path, gint col, gpointer model_data); -typedef void (*ETreeMemoryCallbacksSetValueAtFn) (ETreeModel *etree, ETreePath path, gint col, gconstpointer val, gpointer model_data); -typedef gboolean (*ETreeMemoryCallbacksIsEditableFn) (ETreeModel *etree, ETreePath path, gint col, gpointer model_data); - -typedef void *(*ETreeMemoryCallbacksDuplicateValueFn) (ETreeModel *etm, gint col, gconstpointer val, gpointer data); -typedef void (*ETreeMemoryCallbacksFreeValueFn) (ETreeModel *etm, gint col, gpointer val, gpointer data); -typedef void *(*ETreeMemoryCallbacksInitializeValueFn) (ETreeModel *etm, gint col, gpointer data); -typedef gboolean (*ETreeMemoryCallbacksValueIsEmptyFn) (ETreeModel *etm, gint col, gconstpointer val, gpointer data); -typedef gchar *(*ETreeMemoryCallbacksValueToStringFn) (ETreeModel *etm, gint col, gconstpointer val, gpointer data); +G_BEGIN_DECLS -typedef struct { +typedef struct _ETreeMemoryCallbacks ETreeMemoryCallbacks; +typedef struct _ETreeMemoryCallbacksClass ETreeMemoryCallbacksClass; + +typedef GdkPixbuf * (*ETreeMemoryCallbacksIconAtFn) + (ETreeModel *etree, + ETreePath path, + gpointer model_data); + +typedef gint (*ETreeMemoryCallbacksColumnCountFn) + (ETreeModel *etree, + gpointer model_data); + +typedef gboolean (*ETreeMemoryCallbacksHasSaveIdFn) + (ETreeModel *etree, + gpointer model_data); +typedef gchar * (*ETreeMemoryCallbacksGetSaveIdFn) + (ETreeModel *etree, + ETreePath path, + gpointer model_data); + +typedef gboolean (*ETreeMemoryCallbacksHasGetNodeByIdFn) + (ETreeModel *etree, + gpointer model_data); +typedef ETreePath (*ETreeMemoryCallbacksGetNodeByIdFn) + (ETreeModel *etree, + const gchar *save_id, + gpointer model_data); + +typedef gpointer (*ETreeMemoryCallbacksValueAtFn) + (ETreeModel *etree, + ETreePath path, + gint col, + gpointer model_data); +typedef void (*ETreeMemoryCallbacksSetValueAtFn) + (ETreeModel *etree, + ETreePath path, + gint col, + gconstpointer val, + gpointer model_data); +typedef gboolean (*ETreeMemoryCallbacksIsEditableFn) + (ETreeModel *etree, + ETreePath path, + gint col, + gpointer model_data); + +typedef gpointer (*ETreeMemoryCallbacksDuplicateValueFn) + (ETreeModel *etm, + gint col, + gconstpointer val, + gpointer data); +typedef void (*ETreeMemoryCallbacksFreeValueFn) + (ETreeModel *etm, + gint col, + gpointer val, + gpointer data); +typedef gpointer (*ETreeMemoryCallbacksInitializeValueFn) + (ETreeModel *etm, + gint col, + gpointer data); +typedef gboolean (*ETreeMemoryCallbacksValueIsEmptyFn) + (ETreeModel *etm, + gint col, + gconstpointer val, + gpointer data); +typedef gchar * (*ETreeMemoryCallbacksValueToStringFn) + (ETreeModel *etm, + gint col, + gconstpointer val, + gpointer data); + +struct _ETreeMemoryCallbacks { ETreeMemory parent; ETreeMemoryCallbacksIconAtFn icon_at; @@ -66,7 +129,7 @@ typedef struct { ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id; ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id; - ETreeMemoryCallbacksValueAtFn sort_value_at; + ETreeMemoryCallbacksValueAtFn sort_value_at; ETreeMemoryCallbacksValueAtFn value_at; ETreeMemoryCallbacksSetValueAtFn set_value_at; ETreeMemoryCallbacksIsEditableFn is_editable; @@ -78,36 +141,37 @@ typedef struct { ETreeMemoryCallbacksValueToStringFn value_to_string; gpointer model_data; -} ETreeMemoryCallbacks; +}; -typedef struct { +struct _ETreeMemoryCallbacksClass { ETreeMemoryClass parent_class; -} ETreeMemoryCallbacksClass; - -GType e_tree_memory_callbacks_get_type (void); +}; -ETreeModel *e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at, +GType e_tree_memory_callbacks_get_type + (void) G_GNUC_CONST; +ETreeModel * e_tree_memory_callbacks_new + (ETreeMemoryCallbacksIconAtFn icon_at, - ETreeMemoryCallbacksColumnCountFn column_count, + ETreeMemoryCallbacksColumnCountFn column_count, - ETreeMemoryCallbacksHasSaveIdFn has_save_id, - ETreeMemoryCallbacksGetSaveIdFn get_save_id, + ETreeMemoryCallbacksHasSaveIdFn has_save_id, + ETreeMemoryCallbacksGetSaveIdFn get_save_id, - ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id, - ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id, + ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id, + ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id, - ETreeMemoryCallbacksValueAtFn sort_value_at, - ETreeMemoryCallbacksValueAtFn value_at, - ETreeMemoryCallbacksSetValueAtFn set_value_at, - ETreeMemoryCallbacksIsEditableFn is_editable, + ETreeMemoryCallbacksValueAtFn sort_value_at, + ETreeMemoryCallbacksValueAtFn value_at, + ETreeMemoryCallbacksSetValueAtFn set_value_at, + ETreeMemoryCallbacksIsEditableFn is_editable, - ETreeMemoryCallbacksDuplicateValueFn duplicate_value, - ETreeMemoryCallbacksFreeValueFn free_value, - ETreeMemoryCallbacksInitializeValueFn initialize_value, - ETreeMemoryCallbacksValueIsEmptyFn value_is_empty, - ETreeMemoryCallbacksValueToStringFn value_to_string, + ETreeMemoryCallbacksDuplicateValueFn duplicate_value, + ETreeMemoryCallbacksFreeValueFn free_value, + ETreeMemoryCallbacksInitializeValueFn initialize_value, + ETreeMemoryCallbacksValueIsEmptyFn value_is_empty, + ETreeMemoryCallbacksValueToStringFn value_to_string, - gpointer model_data); + gpointer model_data); G_END_DECLS diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index 71dc0cbae0..bb26fa773f 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -37,7 +37,11 @@ #include "e-tree-memory.h" -G_DEFINE_TYPE (ETreeMemory, e_tree_memory, E_TREE_MODEL_TYPE) +#define E_TREE_MEMORY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TREE_MEMORY, ETreeMemoryPrivate)) + +G_DEFINE_TYPE (ETreeMemory, e_tree_memory, E_TYPE_TREE_MODEL) enum { FILL_IN_CHILDREN, @@ -63,7 +67,7 @@ struct ETreeMemoryPath { gint num_children; }; -struct ETreeMemoryPriv { +struct _ETreeMemoryPrivate { ETreeMemoryPath *root; /* whether nodes are created expanded @@ -180,7 +184,7 @@ e_tree_path_unlink (ETreeMemoryPath *path) void e_tree_memory_freeze (ETreeMemory *etmm) { - ETreeMemoryPriv *priv = etmm->priv; + ETreeMemoryPrivate *priv = etmm->priv; if (priv->frozen == 0) e_tree_model_pre_change (E_TREE_MODEL (etmm)); @@ -200,7 +204,7 @@ e_tree_memory_freeze (ETreeMemory *etmm) void e_tree_memory_thaw (ETreeMemory *etmm) { - ETreeMemoryPriv *priv = etmm->priv; + ETreeMemoryPrivate *priv = etmm->priv; if (priv->frozen > 0) priv->frozen--; @@ -215,18 +219,13 @@ e_tree_memory_thaw (ETreeMemory *etmm) static void etmm_dispose (GObject *object) { - ETreeMemory *etmm = E_TREE_MEMORY (object); - ETreeMemoryPriv *priv = etmm->priv; - - if (priv) { - /* XXX lots of stuff to free here */ + ETreeMemoryPrivate *priv; - if (priv->root) - e_tree_memory_node_remove (etmm, priv->root); + priv = E_TREE_MEMORY_GET_PRIVATE (object); - g_free (priv); - } - etmm->priv = NULL; + if (priv->root) + e_tree_memory_node_remove ( + E_TREE_MEMORY (object), priv->root); G_OBJECT_CLASS (e_tree_memory_parent_class)->dispose (object); } @@ -234,7 +233,7 @@ etmm_dispose (GObject *object) static ETreePath etmm_get_root (ETreeModel *etm) { - ETreeMemoryPriv *priv = E_TREE_MEMORY (etm)->priv; + ETreeMemoryPrivate *priv = E_TREE_MEMORY (etm)->priv; return priv->root; } @@ -326,7 +325,7 @@ static gboolean etmm_get_expanded_default (ETreeModel *etm) { ETreeMemory *etmm = E_TREE_MEMORY (etm); - ETreeMemoryPriv *priv = etmm->priv; + ETreeMemoryPrivate *priv = etmm->priv; return priv->expanded_default; } @@ -353,10 +352,33 @@ etmm_node_request_collapse (ETreeModel *etm, ETreePath node) static void -e_tree_memory_class_init (ETreeMemoryClass *klass) +e_tree_memory_class_init (ETreeMemoryClass *class) { - ETreeModelClass *tree_class = (ETreeModelClass *) klass; - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class; + ETreeModelClass *tree_model_class; + + g_type_class_add_private (class, sizeof (ETreeMemoryPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = etmm_dispose; + + tree_model_class = E_TREE_MODEL_CLASS (class); + tree_model_class->get_root = etmm_get_root; + tree_model_class->get_prev = etmm_get_prev; + tree_model_class->get_next = etmm_get_next; + tree_model_class->get_first_child = etmm_get_first_child; + tree_model_class->get_last_child = etmm_get_last_child; + tree_model_class->get_parent = etmm_get_parent; + + tree_model_class->is_root = etmm_is_root; + tree_model_class->is_expandable = etmm_is_expandable; + tree_model_class->get_children = etmm_get_children; + tree_model_class->depth = etmm_depth; + tree_model_class->get_expanded_default = etmm_get_expanded_default; + + tree_model_class->node_request_collapse = etmm_node_request_collapse; + + class->fill_in_children = NULL; signals[FILL_IN_CHILDREN] = g_signal_new ("fill_in_children", @@ -366,40 +388,12 @@ e_tree_memory_class_init (ETreeMemoryClass *klass) (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - - object_class->dispose = etmm_dispose; - - tree_class->get_root = etmm_get_root; - tree_class->get_prev = etmm_get_prev; - tree_class->get_next = etmm_get_next; - tree_class->get_first_child = etmm_get_first_child; - tree_class->get_last_child = etmm_get_last_child; - tree_class->get_parent = etmm_get_parent; - - tree_class->is_root = etmm_is_root; - tree_class->is_expandable = etmm_is_expandable; - tree_class->get_children = etmm_get_children; - tree_class->depth = etmm_depth; - tree_class->get_expanded_default = etmm_get_expanded_default; - - tree_class->node_request_collapse = etmm_node_request_collapse; - - klass->fill_in_children = NULL; } static void e_tree_memory_init (ETreeMemory *etmm) { - ETreeMemoryPriv *priv; - - priv = g_new0 (ETreeMemoryPriv, 1); - etmm->priv = priv; - - priv->root = NULL; - priv->frozen = 0; - priv->expanded_default = 0; - priv->destroy_func = NULL; - priv->destroy_user_data = NULL; + etmm->priv = E_TREE_MEMORY_GET_PRIVATE (etmm); } /** @@ -423,7 +417,7 @@ e_tree_memory_construct (ETreeMemory *etmm) ETreeMemory * e_tree_memory_new (void) { - return (ETreeMemory *) g_object_new (E_TREE_MEMORY_TYPE, NULL); + return g_object_new (E_TYPE_TREE_MEMORY, NULL); } /** @@ -495,7 +489,7 @@ e_tree_memory_node_insert (ETreeMemory *tree_model, gint position, gpointer node_data) { - ETreeMemoryPriv *priv; + ETreeMemoryPrivate *priv; ETreeMemoryPath *new_path; ETreeMemoryPath *parent_path = parent_node; diff --git a/widgets/table/e-tree-memory.h b/widgets/table/e-tree-memory.h index 824f0b1399..cff4811256 100644 --- a/widgets/table/e-tree-memory.h +++ b/widgets/table/e-tree-memory.h @@ -28,71 +28,90 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <table/e-tree-model.h> -G_BEGIN_DECLS +/* Standard GObject macros */ +#define E_TYPE_TREE_MEMORY \ + (e_tree_memory_get_type ()) +#define E_TREE_MEMORY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_MEMORY, ETreeMemory)) +#define E_TREE_MEMORY_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_MEMORY, ETreeMemoryClass)) +#define E_IS_TREE_MEMORY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_MEMORY)) +#define E_IS_TREE_MEMORY_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_MEMORY)) +#define E_TREE_MEMORY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_MEMORY, ETreeMemoryClass)) -#define E_TREE_MEMORY_TYPE (e_tree_memory_get_type ()) -#define E_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MEMORY_TYPE, ETreeMemory)) -#define E_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MEMORY_TYPE, ETreeMemoryClass)) -#define E_IS_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MEMORY_TYPE)) -#define E_IS_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_TYPE)) -#define E_TREE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MEMORY_TYPE, ETreeMemoryClass)) +G_BEGIN_DECLS -typedef struct ETreeMemory ETreeMemory; -typedef struct ETreeMemoryPriv ETreeMemoryPriv; -typedef struct ETreeMemoryClass ETreeMemoryClass; +typedef struct _ETreeMemory ETreeMemory; +typedef struct _ETreeMemoryClass ETreeMemoryClass; +typedef struct _ETreeMemoryPrivate ETreeMemoryPrivate; -typedef gint (*ETreeMemorySortCallback) (ETreeMemory *etmm, ETreePath path1, ETreePath path2, gpointer closure); +typedef gint (*ETreeMemorySortCallback) (ETreeMemory *etmm, + ETreePath path1, + ETreePath path2, + gpointer closure); -struct ETreeMemory { - ETreeModel base; - ETreeMemoryPriv *priv; +struct _ETreeMemory { + ETreeModel parent; + ETreeMemoryPrivate *priv; }; -struct ETreeMemoryClass { +struct _ETreeMemoryClass { ETreeModelClass parent_class; - /* signals */ - void (*fill_in_children) (ETreeMemory *model, ETreePath node); + /* Signals */ + void (*fill_in_children) (ETreeMemory *model, + ETreePath node); }; -GType e_tree_memory_get_type (void); -void e_tree_memory_construct (ETreeMemory *etree); -ETreeMemory *e_tree_memory_new (void); +GType e_tree_memory_get_type (void) G_GNUC_CONST; +void e_tree_memory_construct (ETreeMemory *etree); +ETreeMemory * e_tree_memory_new (void); /* node operations */ -ETreePath e_tree_memory_node_insert (ETreeMemory *etree, - ETreePath parent, - gint position, - gpointer node_data); -ETreePath e_tree_memory_node_insert_id (ETreeMemory *etree, - ETreePath parent, - gint position, - gpointer node_data, - gchar *id); -ETreePath e_tree_memory_node_insert_before (ETreeMemory *etree, - ETreePath parent, - ETreePath sibling, - gpointer node_data); -gpointer e_tree_memory_node_remove (ETreeMemory *etree, - ETreePath path); +ETreePath e_tree_memory_node_insert (ETreeMemory *etree, + ETreePath parent, + gint position, + gpointer node_data); +ETreePath e_tree_memory_node_insert_id (ETreeMemory *etree, + ETreePath parent, + gint position, + gpointer node_data, + gchar *id); +ETreePath e_tree_memory_node_insert_before + (ETreeMemory *etree, + ETreePath parent, + ETreePath sibling, + gpointer node_data); +gpointer e_tree_memory_node_remove (ETreeMemory *etree, + ETreePath path); /* Freeze and thaw */ -void e_tree_memory_freeze (ETreeMemory *etree); -void e_tree_memory_thaw (ETreeMemory *etree); -void e_tree_memory_set_expanded_default (ETreeMemory *etree, - gboolean expanded); -gpointer e_tree_memory_node_get_data (ETreeMemory *etm, - ETreePath node); -void e_tree_memory_node_set_data (ETreeMemory *etm, - ETreePath node, - gpointer node_data); -void e_tree_memory_sort_node (ETreeMemory *etm, - ETreePath node, - ETreeMemorySortCallback callback, - gpointer user_data); -void e_tree_memory_set_node_destroy_func (ETreeMemory *etmm, - GFunc destroy_func, - gpointer user_data); +void e_tree_memory_freeze (ETreeMemory *etree); +void e_tree_memory_thaw (ETreeMemory *etree); +void e_tree_memory_set_expanded_default + (ETreeMemory *etree, + gboolean expanded); +gpointer e_tree_memory_node_get_data (ETreeMemory *etm, + ETreePath node); +void e_tree_memory_node_set_data (ETreeMemory *etm, + ETreePath node, + gpointer node_data); +void e_tree_memory_sort_node (ETreeMemory *etm, + ETreePath node, + ETreeMemorySortCallback callback, + gpointer user_data); +void e_tree_memory_set_node_destroy_func + (ETreeMemory *etmm, + GFunc destroy_func, + gpointer user_data); G_END_DECLS diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 2c90c6ae72..79197aade0 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -61,9 +61,9 @@ static guint e_tree_model_signals[LAST_SIGNAL] = {0, }; static void -e_tree_model_class_init (ETreeModelClass *klass) +e_tree_model_class_init (ETreeModelClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); e_tree_model_signals[PRE_CHANGE] = g_signal_new ("pre_change", @@ -155,52 +155,52 @@ e_tree_model_class_init (ETreeModelClass *klass) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - klass->get_root = NULL; - - klass->get_parent = NULL; - klass->get_first_child = NULL; - klass->get_last_child = NULL; - klass->get_next = NULL; - klass->get_prev = NULL; - - klass->is_root = NULL; - klass->is_expandable = NULL; - klass->get_children = NULL; - klass->depth = NULL; - - klass->icon_at = NULL; - - klass->get_expanded_default = NULL; - klass->column_count = NULL; - - klass->has_save_id = NULL; - klass->get_save_id = NULL; - klass->has_get_node_by_id = NULL; - klass->get_node_by_id = NULL; - - klass->has_change_pending = NULL; - - klass->sort_value_at = NULL; - klass->value_at = NULL; - klass->set_value_at = NULL; - klass->is_editable = NULL; - - klass->duplicate_value = NULL; - klass->free_value = NULL; - klass->initialize_value = NULL; - klass->value_is_empty = NULL; - klass->value_to_string = NULL; - - klass->pre_change = NULL; - klass->no_change = NULL; - klass->rebuilt = NULL; - klass->node_changed = NULL; - klass->node_data_changed = NULL; - klass->node_col_changed = NULL; - klass->node_inserted = NULL; - klass->node_removed = NULL; - klass->node_deleted = NULL; - klass->node_request_collapse = NULL; + class->get_root = NULL; + + class->get_parent = NULL; + class->get_first_child = NULL; + class->get_last_child = NULL; + class->get_next = NULL; + class->get_prev = NULL; + + class->is_root = NULL; + class->is_expandable = NULL; + class->get_children = NULL; + class->depth = NULL; + + class->icon_at = NULL; + + class->get_expanded_default = NULL; + class->column_count = NULL; + + class->has_save_id = NULL; + class->get_save_id = NULL; + class->has_get_node_by_id = NULL; + class->get_node_by_id = NULL; + + class->has_change_pending = NULL; + + class->sort_value_at = NULL; + class->value_at = NULL; + class->set_value_at = NULL; + class->is_editable = NULL; + + class->duplicate_value = NULL; + class->free_value = NULL; + class->initialize_value = NULL; + class->value_is_empty = NULL; + class->value_to_string = NULL; + + class->pre_change = NULL; + class->no_change = NULL; + class->rebuilt = NULL; + class->node_changed = NULL; + class->node_data_changed = NULL; + class->node_col_changed = NULL; + class->node_inserted = NULL; + class->node_removed = NULL; + class->node_deleted = NULL; + class->node_request_collapse = NULL; } static void @@ -226,7 +226,7 @@ e_tree_model_pre_change (ETreeModel *tree_model) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting pre_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting pre_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[PRE_CHANGE], 0); } @@ -246,7 +246,7 @@ e_tree_model_no_change (ETreeModel *tree_model) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting no_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting no_change on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NO_CHANGE], 0); } @@ -266,7 +266,7 @@ e_tree_model_rebuilt (ETreeModel *tree_model) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting rebuilt on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting rebuilt on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[REBUILT], 0); } @@ -285,7 +285,7 @@ e_tree_model_node_changed (ETreeModel *tree_model, ETreePath node) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_CHANGED], 0, node); } @@ -305,7 +305,7 @@ e_tree_model_node_data_changed (ETreeModel *tree_model, ETreePath node) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_data_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_data_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DATA_CHANGED], 0, node); } @@ -325,7 +325,7 @@ e_tree_model_node_col_changed (ETreeModel *tree_model, ETreePath node, gint col g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_col_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_col_changed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_COL_CHANGED], 0, node, col); } @@ -346,7 +346,7 @@ e_tree_model_node_inserted (ETreeModel *tree_model, g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_inserted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_inserted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_INSERTED], 0, parent_node, inserted_node); @@ -366,7 +366,7 @@ e_tree_model_node_removed (ETreeModel *tree_model, ETreePath parent_node, ETree g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_removed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_removed on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REMOVED], 0, parent_node, removed_node, old_position); @@ -385,7 +385,7 @@ e_tree_model_node_deleted (ETreeModel *tree_model, ETreePath deleted_node) g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_deleted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_deleted on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DELETED], 0, deleted_node); } @@ -403,7 +403,7 @@ e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed g_return_if_fail (tree_model != NULL); g_return_if_fail (E_IS_TREE_MODEL (tree_model)); - d(g_print("Emitting node_request_collapse on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->klass->type))); + d(g_print("Emitting node_request_collapse on model 0x%p, a %s.\n", tree_model, g_type_name (G_OBJECT(tree_model)->class->type))); g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REQUEST_COLLAPSE], 0, collapsed_node); } @@ -420,7 +420,7 @@ e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed ETreeModel * e_tree_model_new (void) { - return (ETreeModel *) g_object_new (E_TREE_MODEL_TYPE, NULL); + return g_object_new (E_TYPE_TREE_MODEL, NULL); } /** diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index c6600ddf83..01c4bf4180 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -26,72 +26,120 @@ #define _E_TREE_MODEL_H_ #include <gdk-pixbuf/gdk-pixbuf.h> -#include <glib-object.h> + +/* Standard GObject macros */ +#define E_TYPE_TREE_MODEL \ + (e_tree_model_get_type ()) +#define E_TREE_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_MODEL, ETreeModel)) +#define E_TREE_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_MODEL, ETreeModelClass)) +#define E_IS_TREE_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_MODEL)) +#define E_IS_TREE_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_MODEL)) +#define E_TREE_MODEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_MODEL, ETreeModelClass)) G_BEGIN_DECLS -#define E_TREE_MODEL_TYPE (e_tree_model_get_type ()) -#define E_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel)) -#define E_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass)) -#define E_IS_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MODEL_TYPE)) -#define E_IS_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE)) -#define E_TREE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MODEL_TYPE, ETreeModelClass)) - -typedef gpointer ETreePath; -typedef struct ETreeModel ETreeModel; -typedef struct ETreeModelClass ETreeModelClass; -typedef gint (*ETreePathCompareFunc)(ETreeModel *model, ETreePath path1, ETreePath path2); -typedef gboolean (*ETreePathFunc)(ETreeModel *model, ETreePath path, gpointer data); - -struct ETreeModel { - GObject base; +typedef gpointer ETreePath; + +typedef struct _ETreeModel ETreeModel; +typedef struct _ETreeModelClass ETreeModelClass; + +typedef gint (*ETreePathCompareFunc) (ETreeModel *model, + ETreePath path1, + ETreePath path2); +typedef gboolean (*ETreePathFunc) (ETreeModel *model, + ETreePath path, + gpointer data); + +struct _ETreeModel { + GObject parent; }; -struct ETreeModelClass { +struct _ETreeModelClass { GObjectClass parent_class; /* * Virtual methods */ - ETreePath (*get_root) (ETreeModel *etm); + ETreePath (*get_root) (ETreeModel *etm); - ETreePath (*get_parent) (ETreeModel *etm, ETreePath node); - ETreePath (*get_first_child) (ETreeModel *etm, ETreePath node); - ETreePath (*get_last_child) (ETreeModel *etm, ETreePath node); - ETreePath (*get_next) (ETreeModel *etm, ETreePath node); - ETreePath (*get_prev) (ETreeModel *etm, ETreePath node); + ETreePath (*get_parent) (ETreeModel *etm, + ETreePath node); + ETreePath (*get_first_child) (ETreeModel *etm, + ETreePath node); + ETreePath (*get_last_child) (ETreeModel *etm, + ETreePath node); + ETreePath (*get_next) (ETreeModel *etm, + ETreePath node); + ETreePath (*get_prev) (ETreeModel *etm, + ETreePath node); - gboolean (*is_root) (ETreeModel *etm, ETreePath node); - gboolean (*is_expandable) (ETreeModel *etm, ETreePath node); - guint (*get_children) (ETreeModel *etm, ETreePath node, ETreePath **paths); - guint (*depth) (ETreeModel *etm, ETreePath node); + gboolean (*is_root) (ETreeModel *etm, + ETreePath node); + gboolean (*is_expandable) (ETreeModel *etm, + ETreePath node); + guint (*get_children) (ETreeModel *etm, + ETreePath node, + ETreePath **paths); + guint (*depth) (ETreeModel *etm, + ETreePath node); - GdkPixbuf *(*icon_at) (ETreeModel *etm, ETreePath node); + GdkPixbuf * (*icon_at) (ETreeModel *etm, + ETreePath node); - gboolean (*get_expanded_default) (ETreeModel *etm); - gint (*column_count) (ETreeModel *etm); + gboolean (*get_expanded_default) (ETreeModel *etm); + gint (*column_count) (ETreeModel *etm); - gboolean (*has_save_id) (ETreeModel *etm); - gchar *(*get_save_id) (ETreeModel *etm, ETreePath node); + gboolean (*has_save_id) (ETreeModel *etm); + gchar * (*get_save_id) (ETreeModel *etm, + ETreePath node); - gboolean (*has_get_node_by_id) (ETreeModel *etm); - ETreePath (*get_node_by_id) (ETreeModel *etm, const gchar *save_id); + gboolean (*has_get_node_by_id) (ETreeModel *etm); + ETreePath (*get_node_by_id) (ETreeModel *etm, + const gchar *save_id); - gboolean (*has_change_pending) (ETreeModel *etm); + gboolean (*has_change_pending) (ETreeModel *etm); /* * ETable analogs */ - void *(*sort_value_at) (ETreeModel *etm, ETreePath node, gint col); - void *(*value_at) (ETreeModel *etm, ETreePath node, gint col); - void (*set_value_at) (ETreeModel *etm, ETreePath node, gint col, gconstpointer val); - gboolean (*is_editable) (ETreeModel *etm, ETreePath node, gint col); + gpointer (*sort_value_at) (ETreeModel *etm, + ETreePath node, + gint col); + gpointer (*value_at) (ETreeModel *etm, + ETreePath node, + gint col); + void (*set_value_at) (ETreeModel *etm, + ETreePath node, + gint col, + gconstpointer val); + gboolean (*is_editable) (ETreeModel *etm, + ETreePath node, + gint col); - void *(*duplicate_value) (ETreeModel *etm, gint col, gconstpointer value); - void (*free_value) (ETreeModel *etm, gint col, gpointer value); - void *(*initialize_value) (ETreeModel *etm, gint col); - gboolean (*value_is_empty) (ETreeModel *etm, gint col, gconstpointer value); - gchar *(*value_to_string) (ETreeModel *etm, gint col, gconstpointer value); + gpointer (*duplicate_value) (ETreeModel *etm, + gint col, + gconstpointer value); + void (*free_value) (ETreeModel *etm, + gint col, + gpointer value); + gpointer (*initialize_value) (ETreeModel *etm, + gint col); + gboolean (*value_is_empty) (ETreeModel *etm, + gint col, + gconstpointer value); + gchar * (*value_to_string) (ETreeModel *etm, + gint col, + gconstpointer value); /* * Signals @@ -102,127 +150,144 @@ struct ETreeModelClass { * node_deleted, the ETreePath is no longer valid. */ - void (*pre_change) (ETreeModel *etm); - void (*no_change) (ETreeModel *etm); - void (*node_changed) (ETreeModel *etm, ETreePath node); - void (*node_data_changed) (ETreeModel *etm, ETreePath node); - void (*node_col_changed) (ETreeModel *etm, ETreePath node, gint col); - void (*node_inserted) (ETreeModel *etm, ETreePath parent, ETreePath inserted_node); - void (*node_removed) (ETreeModel *etm, ETreePath parent, ETreePath removed_node, gint old_position); - void (*node_deleted) (ETreeModel *etm, ETreePath deleted_node); - void (*rebuilt) (ETreeModel *etm); + void (*pre_change) (ETreeModel *etm); + void (*no_change) (ETreeModel *etm); + void (*node_changed) (ETreeModel *etm, + ETreePath node); + void (*node_data_changed) (ETreeModel *etm, + ETreePath node); + void (*node_col_changed) (ETreeModel *etm, + ETreePath node, + gint col); + void (*node_inserted) (ETreeModel *etm, + ETreePath parent, + ETreePath inserted_node); + void (*node_removed) (ETreeModel *etm, + ETreePath parent, + ETreePath removed_node, + gint old_position); + void (*node_deleted) (ETreeModel *etm, + ETreePath deleted_node); + void (*rebuilt) (ETreeModel *etm); /* This signal requests that any viewers of the tree that * collapse and expand nodes collapse this node. */ - void (*node_request_collapse) (ETreeModel *etm, ETreePath node); + void (*node_request_collapse) + (ETreeModel *etm, + ETreePath node); }; -GType e_tree_model_get_type (void); -ETreeModel *e_tree_model_new (void); +GType e_tree_model_get_type (void) G_GNUC_CONST; +ETreeModel * e_tree_model_new (void); /* tree traversal operations */ -ETreePath e_tree_model_get_root (ETreeModel *etree); -ETreePath e_tree_model_node_get_parent (ETreeModel *etree, - ETreePath path); -ETreePath e_tree_model_node_get_first_child (ETreeModel *etree, - ETreePath path); -ETreePath e_tree_model_node_get_last_child (ETreeModel *etree, - ETreePath path); -ETreePath e_tree_model_node_get_next (ETreeModel *etree, - ETreePath path); -ETreePath e_tree_model_node_get_prev (ETreeModel *etree, - ETreePath path); +ETreePath e_tree_model_get_root (ETreeModel *etree); +ETreePath e_tree_model_node_get_parent (ETreeModel *etree, + ETreePath path); +ETreePath e_tree_model_node_get_first_child + (ETreeModel *etree, + ETreePath path); +ETreePath e_tree_model_node_get_last_child + (ETreeModel *etree, + ETreePath path); +ETreePath e_tree_model_node_get_next (ETreeModel *etree, + ETreePath path); +ETreePath e_tree_model_node_get_prev (ETreeModel *etree, + ETreePath path); /* node accessors */ -gboolean e_tree_model_node_is_root (ETreeModel *etree, - ETreePath path); -gboolean e_tree_model_node_is_expandable (ETreeModel *etree, - ETreePath path); -guint e_tree_model_node_get_children (ETreeModel *etree, - ETreePath path, - ETreePath **paths); -guint e_tree_model_node_depth (ETreeModel *etree, - ETreePath path); -GdkPixbuf *e_tree_model_icon_at (ETreeModel *etree, - ETreePath path); -gboolean e_tree_model_get_expanded_default (ETreeModel *model); -gint e_tree_model_column_count (ETreeModel *model); -gboolean e_tree_model_has_save_id (ETreeModel *model); -gchar *e_tree_model_get_save_id (ETreeModel *model, - ETreePath node); -gboolean e_tree_model_has_get_node_by_id (ETreeModel *model); -ETreePath e_tree_model_get_node_by_id (ETreeModel *model, - const gchar *save_id); -gboolean e_tree_model_has_change_pending (ETreeModel *model); -void *e_tree_model_sort_value_at (ETreeModel *etree, - ETreePath node, - gint col); -void *e_tree_model_value_at (ETreeModel *etree, - ETreePath node, - gint col); -void e_tree_model_set_value_at (ETreeModel *etree, - ETreePath node, - gint col, - const void *val); -gboolean e_tree_model_node_is_editable (ETreeModel *etree, - ETreePath node, - gint col); -void *e_tree_model_duplicate_value (ETreeModel *etree, - gint col, - const void *value); -void e_tree_model_free_value (ETreeModel *etree, - gint col, - void *value); -void *e_tree_model_initialize_value (ETreeModel *etree, - gint col); -gboolean e_tree_model_value_is_empty (ETreeModel *etree, - gint col, - const void *value); -gchar *e_tree_model_value_to_string (ETreeModel *etree, - gint col, - const void *value); +gboolean e_tree_model_node_is_root (ETreeModel *etree, + ETreePath path); +gboolean e_tree_model_node_is_expandable (ETreeModel *etree, + ETreePath path); +guint e_tree_model_node_get_children (ETreeModel *etree, + ETreePath path, + ETreePath **paths); +guint e_tree_model_node_depth (ETreeModel *etree, + ETreePath path); +GdkPixbuf * e_tree_model_icon_at (ETreeModel *etree, + ETreePath path); +gboolean e_tree_model_get_expanded_default + (ETreeModel *model); +gint e_tree_model_column_count (ETreeModel *model); +gboolean e_tree_model_has_save_id (ETreeModel *model); +gchar * e_tree_model_get_save_id (ETreeModel *model, + ETreePath node); +gboolean e_tree_model_has_get_node_by_id (ETreeModel *model); +ETreePath e_tree_model_get_node_by_id (ETreeModel *model, + const gchar *save_id); +gboolean e_tree_model_has_change_pending (ETreeModel *model); +void *e_tree_model_sort_value_at (ETreeModel *etree, + ETreePath node, + gint col); +void *e_tree_model_value_at (ETreeModel *etree, + ETreePath node, + gint col); +void e_tree_model_set_value_at (ETreeModel *etree, + ETreePath node, + gint col, + const void *val); +gboolean e_tree_model_node_is_editable (ETreeModel *etree, + ETreePath node, + gint col); +void *e_tree_model_duplicate_value (ETreeModel *etree, + gint col, + const void *value); +void e_tree_model_free_value (ETreeModel *etree, + gint col, + void *value); +void *e_tree_model_initialize_value (ETreeModel *etree, + gint col); +gboolean e_tree_model_value_is_empty (ETreeModel *etree, + gint col, + const void *value); +gchar * e_tree_model_value_to_string (ETreeModel *etree, + gint col, + const void *value); /* depth first traversal of path's descendents, calling func on each one */ -void e_tree_model_node_traverse (ETreeModel *model, - ETreePath path, - ETreePathFunc func, - gpointer data); -void e_tree_model_node_traverse_preorder (ETreeModel *model, - ETreePath path, - ETreePathFunc func, - gpointer data); -ETreePath e_tree_model_node_find (ETreeModel *model, - ETreePath path, - ETreePath end_path, - gboolean forward_direction, - ETreePathFunc func, - gpointer data); +void e_tree_model_node_traverse (ETreeModel *model, + ETreePath path, + ETreePathFunc func, + gpointer data); +void e_tree_model_node_traverse_preorder + (ETreeModel *model, + ETreePath path, + ETreePathFunc func, + gpointer data); +ETreePath e_tree_model_node_find (ETreeModel *model, + ETreePath path, + ETreePath end_path, + gboolean forward_direction, + ETreePathFunc func, + gpointer data); /* ** Routines for emitting signals on the ETreeModel */ -void e_tree_model_pre_change (ETreeModel *tree_model); -void e_tree_model_no_change (ETreeModel *tree_model); -void e_tree_model_rebuilt (ETreeModel *tree_model); -void e_tree_model_node_changed (ETreeModel *tree_model, - ETreePath node); -void e_tree_model_node_data_changed (ETreeModel *tree_model, - ETreePath node); -void e_tree_model_node_col_changed (ETreeModel *tree_model, - ETreePath node, - gint col); -void e_tree_model_node_inserted (ETreeModel *tree_model, - ETreePath parent_node, - ETreePath inserted_node); -void e_tree_model_node_removed (ETreeModel *tree_model, - ETreePath parent_node, - ETreePath removed_node, - gint old_position); -void e_tree_model_node_deleted (ETreeModel *tree_model, - ETreePath deleted_node); -void e_tree_model_node_request_collapse (ETreeModel *tree_model, - ETreePath deleted_node); +void e_tree_model_pre_change (ETreeModel *tree_model); +void e_tree_model_no_change (ETreeModel *tree_model); +void e_tree_model_rebuilt (ETreeModel *tree_model); +void e_tree_model_node_changed (ETreeModel *tree_model, + ETreePath node); +void e_tree_model_node_data_changed (ETreeModel *tree_model, + ETreePath node); +void e_tree_model_node_col_changed (ETreeModel *tree_model, + ETreePath node, + gint col); +void e_tree_model_node_inserted (ETreeModel *tree_model, + ETreePath parent_node, + ETreePath inserted_node); +void e_tree_model_node_removed (ETreeModel *tree_model, + ETreePath parent_node, + ETreePath removed_node, + gint old_position); +void e_tree_model_node_deleted (ETreeModel *tree_model, + ETreePath deleted_node); +void e_tree_model_node_request_collapse + (ETreeModel *tree_model, + ETreePath deleted_node); G_END_DECLS diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index e734114f00..cc8a1fcd6a 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -29,6 +29,10 @@ #include "e-tree-selection-model.h" +#define E_TREE_SELECTION_MODEL_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelPrivate)) + G_DEFINE_TYPE ( ETreeSelectionModel, e_tree_selection_model, E_TYPE_SELECTION_MODEL) @@ -40,7 +44,7 @@ enum { PROP_ETTA }; -struct ETreeSelectionModelPriv { +struct _ETreeSelectionModelPrivate { ETreeTableAdapter *etta; ETreeModel *model; @@ -206,7 +210,7 @@ etsm_node_deleted (ETreeModel *etm, ETreePath child, ETreeSelectionModel *etsm) static void add_model (ETreeSelectionModel *etsm, ETreeModel *model) { - ETreeSelectionModelPriv *priv = etsm->priv; + ETreeSelectionModelPrivate *priv = etsm->priv; priv->model = model; @@ -235,7 +239,7 @@ add_model (ETreeSelectionModel *etsm, ETreeModel *model) static void drop_model (ETreeSelectionModel *etsm) { - ETreeSelectionModelPriv *priv = etsm->priv; + ETreeSelectionModelPrivate *priv = etsm->priv; if (!priv->model) return; @@ -277,24 +281,22 @@ etsm_dispose (GObject *object) drop_model (etsm); - if (G_OBJECT_CLASS (e_tree_selection_model_parent_class)->dispose) - (* G_OBJECT_CLASS (e_tree_selection_model_parent_class)->dispose) (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_tree_selection_model_parent_class)->dispose (object); } static void etsm_finalize (GObject *object) { - ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object); + ETreeSelectionModelPrivate *priv; - if (etsm->priv) { - clear_selection (etsm); - g_hash_table_destroy (etsm->priv->paths); - g_free (etsm->priv); - etsm->priv = NULL; - } + priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (object); - if (G_OBJECT_CLASS (e_tree_selection_model_parent_class)->finalize) - (* G_OBJECT_CLASS (e_tree_selection_model_parent_class)->finalize) (object); + clear_selection (E_TREE_SELECTION_MODEL (object)); + g_hash_table_destroy (priv->paths); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_tree_selection_model_parent_class)->finalize (object); } static void @@ -743,61 +745,44 @@ e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm) static void e_tree_selection_model_init (ETreeSelectionModel *etsm) { - ETreeSelectionModelPriv *priv; - priv = g_new (ETreeSelectionModelPriv, 1); - etsm->priv = priv; - - priv->etta = NULL; - priv->model = NULL; + etsm->priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (etsm); - priv->paths = g_hash_table_new (NULL, NULL); - - priv->cursor_path = NULL; - priv->start_path = NULL; - priv->cursor_col = -1; - priv->cursor_save_id = NULL; - - priv->tree_model_pre_change_id = 0; - priv->tree_model_no_change_id = 0; - priv->tree_model_node_changed_id = 0; - priv->tree_model_node_data_changed_id = 0; - priv->tree_model_node_col_changed_id = 0; - priv->tree_model_node_inserted_id = 0; - priv->tree_model_node_removed_id = 0; - priv->tree_model_node_deleted_id = 0; + etsm->priv->paths = g_hash_table_new (NULL, NULL); + etsm->priv->cursor_col = -1; } static void -e_tree_selection_model_class_init (ETreeSelectionModelClass *klass) +e_tree_selection_model_class_init (ETreeSelectionModelClass *class) { GObjectClass *object_class; ESelectionModelClass *esm_class; - object_class = G_OBJECT_CLASS (klass); - esm_class = E_SELECTION_MODEL_CLASS (klass); + g_type_class_add_private (class, sizeof (ETreeSelectionModelPrivate)); + object_class = G_OBJECT_CLASS (class); object_class->dispose = etsm_dispose; object_class->finalize = etsm_finalize; object_class->get_property = etsm_get_property; object_class->set_property = etsm_set_property; - esm_class->is_row_selected = etsm_is_row_selected; - esm_class->foreach = etsm_foreach; - esm_class->clear = etsm_clear; - esm_class->selected_count = etsm_selected_count; - esm_class->select_all = etsm_select_all; - esm_class->invert_selection = etsm_invert_selection; - esm_class->row_count = etsm_row_count; - - esm_class->change_one_row = etsm_change_one_row; - esm_class->change_cursor = etsm_change_cursor; - esm_class->cursor_row = etsm_cursor_row; - esm_class->cursor_col = etsm_cursor_col; - - esm_class->select_single_row = etsm_select_single_row; - esm_class->toggle_single_row = etsm_toggle_single_row; + esm_class = E_SELECTION_MODEL_CLASS (class); + esm_class->is_row_selected = etsm_is_row_selected; + esm_class->foreach = etsm_foreach; + esm_class->clear = etsm_clear; + esm_class->selected_count = etsm_selected_count; + esm_class->select_all = etsm_select_all; + esm_class->invert_selection = etsm_invert_selection; + esm_class->row_count = etsm_row_count; + + esm_class->change_one_row = etsm_change_one_row; + esm_class->change_cursor = etsm_change_cursor; + esm_class->cursor_row = etsm_cursor_row; + esm_class->cursor_col = etsm_cursor_col; + + esm_class->select_single_row = etsm_select_single_row; + esm_class->toggle_single_row = etsm_toggle_single_row; esm_class->move_selection_end = etsm_move_selection_end; - esm_class->set_selection_end = etsm_set_selection_end; + esm_class->set_selection_end = etsm_set_selection_end; g_object_class_install_property (object_class, PROP_CURSOR_ROW, g_param_spec_int ("cursor_row", @@ -817,14 +802,14 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *klass) g_param_spec_object ("model", "Model", NULL, - E_TREE_MODEL_TYPE, + E_TYPE_TREE_MODEL, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_ETTA, g_param_spec_object ("etta", "ETTA", NULL, - E_TREE_TABLE_ADAPTER_TYPE, + E_TYPE_TREE_TABLE_ADAPTER, G_PARAM_READWRITE)); } @@ -832,6 +817,6 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *klass) ESelectionModel * e_tree_selection_model_new (void) { - return g_object_new (E_TREE_SELECTION_MODEL_TYPE, NULL); + return g_object_new (E_TYPE_TREE_SELECTION_MODEL, NULL); } diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h index e66abf3454..1541fcb95a 100644 --- a/widgets/table/e-tree-selection-model.h +++ b/widgets/table/e-tree-selection-model.h @@ -23,48 +23,68 @@ #ifndef _E_TREE_SELECTION_MODEL_H_ #define _E_TREE_SELECTION_MODEL_H_ -#include <glib-object.h> #include <e-util/e-sorter.h> #include <misc/e-selection-model.h> #include <table/e-tree-model.h> -G_BEGIN_DECLS - -typedef void (*ETreeForeachFunc) (ETreePath path, - gpointer closure); +/* Standard GObject macros */ +#define E_TYPE_TREE_SELECTION_MODEL \ + (e_tree_selection_model_get_type ()) +#define E_TREE_SELECTION_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModel)) +#define E_TREE_SELECTION_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelClass)) +#define E_IS_TREE_SELECTION_MODEL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_SELECTION_MODEL)) +#define E_IS_TREE_SELECTION_MODEL_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_SELECTION_MODEL)) +#define E_TREE_SELECTION_MODEL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelClass)) -typedef struct ETreeSelectionModelPriv ETreeSelectionModelPriv; +G_BEGIN_DECLS -#define E_TREE_SELECTION_MODEL_TYPE (e_tree_selection_model_get_type ()) -#define E_TREE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel)) -#define E_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModelClass)) -#define E_IS_TREE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SELECTION_MODEL_TYPE)) -#define E_IS_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SELECTION_MODEL_TYPE)) +typedef void (*ETreeForeachFunc) (ETreePath path, + gpointer closure); -typedef struct { - ESelectionModel base; +typedef struct _ETreeSelectionModel ETreeSelectionModel; +typedef struct _ETreeSelectionModelClass ETreeSelectionModelClass; +typedef struct _ETreeSelectionModelPrivate ETreeSelectionModelPrivate; - ETreeSelectionModelPriv *priv; -} ETreeSelectionModel; +struct _ETreeSelectionModel { + ESelectionModel parent; + ETreeSelectionModelPrivate *priv; +}; -typedef struct { +struct _ETreeSelectionModelClass { ESelectionModelClass parent_class; -} ETreeSelectionModelClass; +}; -GType e_tree_selection_model_get_type (void); -ESelectionModel *e_tree_selection_model_new (void); -void e_tree_selection_model_foreach (ETreeSelectionModel *etsm, - ETreeForeachFunc callback, - gpointer closure); -void e_tree_selection_model_select_single_path (ETreeSelectionModel *etsm, - ETreePath path); -void e_tree_selection_model_select_paths (ETreeSelectionModel *etsm, GPtrArray *paths); +GType e_tree_selection_model_get_type (void) G_GNUC_CONST; +ESelectionModel * + e_tree_selection_model_new (void); +void e_tree_selection_model_foreach (ETreeSelectionModel *etsm, + ETreeForeachFunc callback, + gpointer closure); +void e_tree_selection_model_select_single_path + (ETreeSelectionModel *etsm, + ETreePath path); +void e_tree_selection_model_select_paths + (ETreeSelectionModel *etsm, + GPtrArray *paths); -void e_tree_selection_model_add_to_selection (ETreeSelectionModel *etsm, - ETreePath path); -void e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, - ETreePath path); -ETreePath e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm); +void e_tree_selection_model_add_to_selection + (ETreeSelectionModel *etsm, + ETreePath path); +void e_tree_selection_model_change_cursor + (ETreeSelectionModel *etsm, + ETreePath path); +ETreePath e_tree_selection_model_get_cursor + (ETreeSelectionModel *etsm); G_END_DECLS diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index e62ed66ffe..40b10c0dec 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -48,7 +48,11 @@ #define d(x) -G_DEFINE_TYPE (ETreeSorted, e_tree_sorted, E_TREE_MODEL_TYPE) +#define E_TREE_SORTED_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TREE_SORTED, ETreeSortedPrivate)) + +G_DEFINE_TYPE (ETreeSorted, e_tree_sorted, E_TYPE_TREE_MODEL) enum { NODE_RESORTED, @@ -75,7 +79,7 @@ struct ETreeSortedPath { guint needs_regen_to_sort : 1; }; -struct ETreeSortedPriv { +struct _ETreeSortedPrivate { ETreeModel *source; ETreeSortedPath *root; @@ -582,34 +586,29 @@ schedule_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_regen, static void ets_dispose (GObject *object) { - ETreeSorted *ets = E_TREE_SORTED (object); - ETreeSortedPriv *priv = ets->priv; + ETreeSortedPrivate *priv; - /* FIXME lots of stuff to free here */ - if (!priv) { - G_OBJECT_CLASS (e_tree_sorted_parent_class)->dispose (object); - return; - } + priv = E_TREE_SORTED_GET_PRIVATE (object); if (priv->source) { - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_pre_change_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_no_change_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_data_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_col_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_inserted_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_removed_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_deleted_id); - g_signal_handler_disconnect (G_OBJECT (priv->source), - priv->tree_model_node_request_collapse_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_pre_change_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_no_change_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_data_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_col_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_inserted_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_removed_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_deleted_id); + g_signal_handler_disconnect ( + priv->source, priv->tree_model_node_request_collapse_id); g_object_unref (priv->source); priv->source = NULL; @@ -626,43 +625,48 @@ ets_dispose (GObject *object) } if (priv->sort_info) { - g_signal_handler_disconnect (G_OBJECT (priv->sort_info), - priv->sort_info_changed_id); + g_signal_handler_disconnect ( + priv->sort_info, priv->sort_info_changed_id); priv->sort_info_changed_id = 0; g_object_unref (priv->sort_info); priv->sort_info = NULL; } - ets_stop_sort_idle (ets); - if (ets->priv->insert_idle_id) { - g_source_remove (ets->priv->insert_idle_id); - ets->priv->insert_idle_id = 0; + ets_stop_sort_idle (E_TREE_SORTED (object)); + + if (priv->insert_idle_id) { + g_source_remove (priv->insert_idle_id); + priv->insert_idle_id = 0; } - if (priv->full_header) + if (priv->full_header) { g_object_unref (priv->full_header); + priv->full_header = NULL; + } + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_tree_sorted_parent_class)->dispose (object); } static void ets_finalize (GObject *object) { - ETreeSorted *ets = (ETreeSorted *) object; + ETreeSortedPrivate *priv; - if (ets->priv->root) - free_path (ets->priv->root); + priv = E_TREE_SORTED_GET_PRIVATE (object); - g_free (ets->priv); - ets->priv = NULL; + if (priv->root) + free_path (priv->root); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (e_tree_sorted_parent_class)->finalize (object); } static ETreePath ets_get_root (ETreeModel *etm) { - ETreeSortedPriv *priv = E_TREE_SORTED (etm)->priv; + ETreeSortedPrivate *priv = E_TREE_SORTED (etm)->priv; if (priv->root == NULL) { ETreeSorted *ets = E_TREE_SORTED (etm); ETreePath corresponding = e_tree_model_get_root (ets->priv->source); @@ -1143,50 +1147,52 @@ ets_sort_info_changed (ETableSortInfo *sort_info, ETreeSorted *ets) /* Initialization and creation */ static void -e_tree_sorted_class_init (ETreeSortedClass *klass) +e_tree_sorted_class_init (ETreeSortedClass *class) { - ETreeModelClass *tree_class = E_TREE_MODEL_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class; + ETreeModelClass *tree_model_class; - klass->node_resorted = NULL; + g_type_class_add_private (class, sizeof (ETreeSortedPrivate)); - object_class->dispose = ets_dispose; - object_class->finalize = ets_finalize; + object_class = G_OBJECT_CLASS (class); + object_class->dispose = ets_dispose; + object_class->finalize = ets_finalize; - tree_class->get_root = ets_get_root; - tree_class->get_parent = ets_get_parent; - tree_class->get_first_child = ets_get_first_child; - tree_class->get_last_child = ets_get_last_child; - tree_class->get_prev = ets_get_prev; - tree_class->get_next = ets_get_next; + tree_model_class = E_TREE_MODEL_CLASS (class); + tree_model_class->get_root = ets_get_root; + tree_model_class->get_parent = ets_get_parent; + tree_model_class->get_first_child = ets_get_first_child; + tree_model_class->get_last_child = ets_get_last_child; + tree_model_class->get_prev = ets_get_prev; + tree_model_class->get_next = ets_get_next; - tree_class->is_root = ets_is_root; - tree_class->is_expandable = ets_is_expandable; - tree_class->get_children = ets_get_children; - tree_class->depth = ets_depth; + tree_model_class->is_root = ets_is_root; + tree_model_class->is_expandable = ets_is_expandable; + tree_model_class->get_children = ets_get_children; + tree_model_class->depth = ets_depth; - tree_class->icon_at = ets_icon_at; + tree_model_class->icon_at = ets_icon_at; - tree_class->get_expanded_default = ets_get_expanded_default; - tree_class->column_count = ets_column_count; + tree_model_class->get_expanded_default = ets_get_expanded_default; + tree_model_class->column_count = ets_column_count; - tree_class->has_save_id = ets_has_save_id; - tree_class->get_save_id = ets_get_save_id; + tree_model_class->has_save_id = ets_has_save_id; + tree_model_class->get_save_id = ets_get_save_id; - tree_class->has_get_node_by_id = ets_has_get_node_by_id; - tree_class->get_node_by_id = ets_get_node_by_id; + tree_model_class->has_get_node_by_id = ets_has_get_node_by_id; + tree_model_class->get_node_by_id = ets_get_node_by_id; - tree_class->has_change_pending = ets_has_change_pending; + tree_model_class->has_change_pending = ets_has_change_pending; - tree_class->value_at = ets_value_at; - tree_class->set_value_at = ets_set_value_at; - tree_class->is_editable = ets_is_editable; + tree_model_class->value_at = ets_value_at; + tree_model_class->set_value_at = ets_set_value_at; + tree_model_class->is_editable = ets_is_editable; - tree_class->duplicate_value = ets_duplicate_value; - tree_class->free_value = ets_free_value; - tree_class->initialize_value = ets_initialize_value; - tree_class->value_is_empty = ets_value_is_empty; - tree_class->value_to_string = ets_value_to_string; + tree_model_class->duplicate_value = ets_duplicate_value; + tree_model_class->free_value = ets_free_value; + tree_model_class->initialize_value = ets_initialize_value; + tree_model_class->value_is_empty = ets_value_is_empty; + tree_model_class->value_to_string = ets_value_to_string; signals[NODE_RESORTED] = g_signal_new ("node_resorted", @@ -1201,36 +1207,7 @@ e_tree_sorted_class_init (ETreeSortedClass *klass) static void e_tree_sorted_init (ETreeSorted *ets) { - ETreeSortedPriv *priv; - - priv = g_new0 (ETreeSortedPriv, 1); - ets->priv = priv; - - priv->root = NULL; - priv->source = NULL; - - priv->sort_info = NULL; - priv->full_header = NULL; - - priv->last_access = NULL; - - priv->tree_model_pre_change_id = 0; - priv->tree_model_no_change_id = 0; - priv->tree_model_node_changed_id = 0; - priv->tree_model_node_data_changed_id = 0; - priv->tree_model_node_col_changed_id = 0; - priv->tree_model_node_inserted_id = 0; - priv->tree_model_node_removed_id = 0; - priv->tree_model_node_deleted_id = 0; - priv->tree_model_node_request_collapse_id = 0; - - priv->sort_info_changed_id = 0; - priv->sort_idle_id = 0; - priv->insert_idle_id = 0; - priv->insert_count = 0; - - priv->in_resort_idle = 0; - priv->nested_resort_idle = 0; + ets->priv = E_TREE_SORTED_GET_PRIVATE (ets); } /** @@ -1283,7 +1260,7 @@ e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *ful ETreeSorted * e_tree_sorted_new (ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { - ETreeSorted *ets = g_object_new (E_TREE_SORTED_TYPE, NULL); + ETreeSorted *ets = g_object_new (E_TYPE_TREE_SORTED, NULL); e_tree_sorted_construct (ets, source, full_header, sort_info); diff --git a/widgets/table/e-tree-sorted.h b/widgets/table/e-tree-sorted.h index 74d9a70a32..456ee15d14 100644 --- a/widgets/table/e-tree-sorted.h +++ b/widgets/table/e-tree-sorted.h @@ -29,56 +29,70 @@ #include <table/e-table-sort-info.h> #include <table/e-table-header.h> -G_BEGIN_DECLS - -#define E_TREE_SORTED_TYPE (e_tree_sorted_get_type ()) -#define E_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SORTED_TYPE, ETreeSorted)) -#define E_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SORTED_TYPE, ETreeSortedClass)) -#define E_IS_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SORTED_TYPE)) -#define E_IS_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_TYPE)) -#define E_TREE_SORTED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_SORTED_TYPE, ETreeSortedClass)) +/* Standard GObject macros */ +#define E_TYPE_TREE_SORTED \ + (e_tree_sorted_get_type ()) +#define E_TREE_SORTED(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_SORTED, ETreeSorted)) +#define E_TREE_SORTED_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_SORTED, ETreeSortedClass)) +#define E_IS_TREE_SORTED(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_SORTED)) +#define E_IS_TREE_SORTED_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_SORTED)) +#define E_TREE_SORTED_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_SORTED, ETreeSortedClass)) -typedef struct ETreeSorted ETreeSorted; -typedef struct ETreeSortedPriv ETreeSortedPriv; -typedef struct ETreeSortedClass ETreeSortedClass; +G_BEGIN_DECLS -struct ETreeSorted { - ETreeModel base; +typedef struct _ETreeSorted ETreeSorted; +typedef struct _ETreeSortedClass ETreeSortedClass; +typedef struct _ETreeSortedPrivate ETreeSortedPrivate; - ETreeSortedPriv *priv; +struct _ETreeSorted { + ETreeModel parent; + ETreeSortedPrivate *priv; }; -struct ETreeSortedClass { +struct _ETreeSortedClass { ETreeModelClass parent_class; /* Signals */ - void (*node_resorted) (ETreeSorted *etm, ETreePath node); + void (*node_resorted) (ETreeSorted *etm, + ETreePath node); }; -GType e_tree_sorted_get_type (void); -void e_tree_sorted_construct (ETreeSorted *etree, - ETreeModel *source, - ETableHeader *full_header, - ETableSortInfo *sort_info); -ETreeSorted *e_tree_sorted_new (ETreeModel *source, - ETableHeader *full_header, - ETableSortInfo *sort_info); +GType e_tree_sorted_get_type (void) G_GNUC_CONST; +void e_tree_sorted_construct (ETreeSorted *etree, + ETreeModel *source, + ETableHeader *full_header, + ETableSortInfo *sort_info); +ETreeSorted * e_tree_sorted_new (ETreeModel *source, + ETableHeader *full_header, + ETableSortInfo *sort_info); -ETreePath e_tree_sorted_view_to_model_path (ETreeSorted *ets, - ETreePath view_path); -ETreePath e_tree_sorted_model_to_view_path (ETreeSorted *ets, - ETreePath model_path); -gint e_tree_sorted_orig_position (ETreeSorted *ets, - ETreePath path); -gint e_tree_sorted_node_num_children (ETreeSorted *ets, - ETreePath path); +ETreePath e_tree_sorted_view_to_model_path + (ETreeSorted *ets, + ETreePath view_path); +ETreePath e_tree_sorted_model_to_view_path + (ETreeSorted *ets, + ETreePath model_path); +gint e_tree_sorted_orig_position (ETreeSorted *ets, + ETreePath path); +gint e_tree_sorted_node_num_children (ETreeSorted *ets, + ETreePath path); -void e_tree_sorted_node_resorted (ETreeSorted *tree_model, - ETreePath node); +void e_tree_sorted_node_resorted (ETreeSorted *tree_model, + ETreePath node); -ETableSortInfo* e_tree_sorted_get_sort_info (ETreeSorted *tree_model); -void e_tree_sorted_set_sort_info (ETreeSorted *tree_model, - ETableSortInfo *sort_info); +ETableSortInfo *e_tree_sorted_get_sort_info (ETreeSorted *tree_model); +void e_tree_sorted_set_sort_info (ETreeSorted *tree_model, + ETableSortInfo *sort_info); G_END_DECLS diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 63bd640a3c..d529a6e045 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -38,9 +38,13 @@ #include "e-table-sorting-utils.h" #include "e-tree-table-adapter.h" +#define E_TREE_TABLE_ADAPTER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterPrivate)) + /* workaround for avoiding API breakage */ #define etta_get_type e_tree_table_adapter_get_type -G_DEFINE_TYPE (ETreeTableAdapter, etta, E_TABLE_MODEL_TYPE) +G_DEFINE_TYPE (ETreeTableAdapter, etta, E_TYPE_TABLE_MODEL) #define d(x) #define INCREMENT_AMOUNT 100 @@ -62,7 +66,7 @@ typedef struct { guint expandable_set : 1; } node_t; -struct ETreeTableAdapterPriv { +struct _ETreeTableAdapterPrivate { ETreeModel *source; ETableSortInfo *sort_info; ETableHeader *header; @@ -508,68 +512,72 @@ update_node (ETreeTableAdapter *etta, ETreePath path) static void etta_finalize (GObject *object) { - ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object); + ETreeTableAdapterPrivate *priv; - if (etta->priv->resort_idle_id) { - g_source_remove (etta->priv->resort_idle_id); - etta->priv->resort_idle_id = 0; - } + priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object); - if (etta->priv->root) { - kill_gnode (etta->priv->root, etta); - etta->priv->root = NULL; + if (priv->resort_idle_id) { + g_source_remove (priv->resort_idle_id); + priv->resort_idle_id = 0; } - g_hash_table_destroy (etta->priv->nodes); + if (priv->root) { + kill_gnode (priv->root, E_TREE_TABLE_ADAPTER (object)); + priv->root = NULL; + } - g_free (etta->priv->map_table); + g_hash_table_destroy (priv->nodes); - g_free (etta->priv); + g_free (priv->map_table); + /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (etta_parent_class)->finalize (object); } static void etta_dispose (GObject *object) { - ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object); + ETreeTableAdapterPrivate *priv; - if (etta->priv->sort_info) { - g_signal_handler_disconnect (G_OBJECT (etta->priv->sort_info), - etta->priv->sort_info_changed_id); - g_object_unref (etta->priv->sort_info); - etta->priv->sort_info = NULL; + priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object); + + if (priv->sort_info) { + g_signal_handler_disconnect ( + priv->sort_info, priv->sort_info_changed_id); + g_object_unref (priv->sort_info); + priv->sort_info = NULL; } - if (etta->priv->header) { - g_object_unref (etta->priv->header); - etta->priv->header = NULL; + if (priv->header) { + g_object_unref (priv->header); + priv->header = NULL; } - if (etta->priv->source) { - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->pre_change_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->no_change_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->rebuilt_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_changed_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_data_changed_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_col_changed_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_inserted_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_removed_id); - g_signal_handler_disconnect (G_OBJECT (etta->priv->source), - etta->priv->node_request_collapse_id); - - g_object_unref (etta->priv->source); - etta->priv->source = NULL; + if (priv->source) { + g_signal_handler_disconnect ( + priv->source, priv->pre_change_id); + g_signal_handler_disconnect ( + priv->source, priv->no_change_id); + g_signal_handler_disconnect ( + priv->source, priv->rebuilt_id); + g_signal_handler_disconnect ( + priv->source, priv->node_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->node_data_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->node_col_changed_id); + g_signal_handler_disconnect ( + priv->source, priv->node_inserted_id); + g_signal_handler_disconnect ( + priv->source, priv->node_removed_id); + g_signal_handler_disconnect ( + priv->source, priv->node_request_collapse_id); + + g_object_unref (priv->source); + priv->source = NULL; } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (etta_parent_class)->dispose (object); } @@ -694,33 +702,37 @@ etta_value_to_string (ETableModel *etm, gint col, gconstpointer value) } static void -etta_class_init (ETreeTableAdapterClass *klass) +etta_class_init (ETreeTableAdapterClass *class) { - ETableModelClass *table_class = (ETableModelClass *) klass; - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class; + ETableModelClass *table_model_class; - object_class->dispose = etta_dispose; - object_class->finalize = etta_finalize; + g_type_class_add_private (class, sizeof (ETreeTableAdapterPrivate)); - table_class->column_count = etta_column_count; - table_class->row_count = etta_row_count; - table_class->append_row = etta_append_row; + object_class = G_OBJECT_CLASS (class); + object_class->dispose = etta_dispose; + object_class->finalize = etta_finalize; - table_class->value_at = etta_value_at; - table_class->set_value_at = etta_set_value_at; - table_class->is_cell_editable = etta_is_cell_editable; + table_model_class = E_TABLE_MODEL_CLASS (class); + table_model_class->column_count = etta_column_count; + table_model_class->row_count = etta_row_count; + table_model_class->append_row = etta_append_row; - table_class->has_save_id = etta_has_save_id; - table_class->get_save_id = etta_get_save_id; + table_model_class->value_at = etta_value_at; + table_model_class->set_value_at = etta_set_value_at; + table_model_class->is_cell_editable = etta_is_cell_editable; - table_class->has_change_pending = etta_has_change_pending; - table_class->duplicate_value = etta_duplicate_value; - table_class->free_value = etta_free_value; - table_class->initialize_value = etta_initialize_value; - table_class->value_is_empty = etta_value_is_empty; - table_class->value_to_string = etta_value_to_string; + table_model_class->has_save_id = etta_has_save_id; + table_model_class->get_save_id = etta_get_save_id; - klass->sorting_changed = NULL; + table_model_class->has_change_pending = etta_has_change_pending; + table_model_class->duplicate_value = etta_duplicate_value; + table_model_class->free_value = etta_free_value; + table_model_class->initialize_value = etta_initialize_value; + table_model_class->value_is_empty = etta_value_is_empty; + table_model_class->value_to_string = etta_value_to_string; + + class->sorting_changed = NULL; signals[SORTING_CHANGED] = g_signal_new ("sorting_changed", @@ -735,32 +747,10 @@ etta_class_init (ETreeTableAdapterClass *klass) static void etta_init (ETreeTableAdapter *etta) { - etta->priv = g_new (ETreeTableAdapterPriv, 1); - - etta->priv->source = NULL; - etta->priv->sort_info = NULL; + etta->priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (etta); - etta->priv->n_map = 0; - etta->priv->n_vals_allocated = 0; - etta->priv->map_table = NULL; - etta->priv->nodes = NULL; - etta->priv->root = NULL; - - etta->priv->root_visible = TRUE; - etta->priv->remap_needed = TRUE; - - etta->priv->pre_change_id = 0; - etta->priv->no_change_id = 0; - etta->priv->rebuilt_id = 0; - etta->priv->node_changed_id = 0; - etta->priv->node_data_changed_id = 0; - etta->priv->node_col_changed_id = 0; - etta->priv->node_inserted_id = 0; - etta->priv->node_removed_id = 0; - etta->priv->node_request_collapse_id = 0; - - etta->priv->resort_idle_id = 0; - etta->priv->force_expanded_state = 0; + etta->priv->root_visible = TRUE; + etta->priv->remap_needed = TRUE; } static void @@ -931,7 +921,7 @@ e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source, ETa ETableModel * e_tree_table_adapter_new (ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *header) { - ETreeTableAdapter *etta = g_object_new (E_TREE_TABLE_ADAPTER_TYPE, NULL); + ETreeTableAdapter *etta = g_object_new (E_TYPE_TREE_TABLE_ADAPTER, NULL); e_tree_table_adapter_construct (etta, source, sort_info, header); diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h index b5fc2c0422..ea7b86b21d 100644 --- a/widgets/table/e-tree-table-adapter.h +++ b/widgets/table/e-tree-table-adapter.h @@ -24,81 +24,109 @@ #ifndef _E_TREE_TABLE_ADAPTER_H_ #define _E_TREE_TABLE_ADAPTER_H_ -#include <glib-object.h> #include <table/e-table-model.h> #include <table/e-tree-model.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> #include <libxml/tree.h> -G_BEGIN_DECLS - -#define E_TREE_TABLE_ADAPTER_TYPE (e_tree_table_adapter_get_type ()) -#define E_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapter)) -#define E_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass)) -#define E_IS_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_TABLE_ADAPTER_TYPE)) -#define E_IS_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_TABLE_ADAPTER_TYPE)) -#define E_TREE_TABLE_ADAPTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass)) +/* Standard GObject macros */ +#define E_TYPE_TREE_TABLE_ADAPTER \ + (e_tree_table_adapter_get_type ()) +#define E_TREE_TABLE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapter)) +#define E_TREE_TABLE_ADAPTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterClass)) +#define E_IS_TREE_TABLE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE_TABLE_ADAPTER)) +#define E_IS_TREE_TABLE_ADAPTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE_TABLE_ADAPTER)) +#define E_TREE_TABLE_ADAPTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterClass)) -typedef struct ETreeTableAdapterPriv ETreeTableAdapterPriv; +G_BEGIN_DECLS -typedef struct { - ETableModel base; +typedef struct _ETreeTableAdapter ETreeTableAdapter; +typedef struct _ETreeTableAdapterClass ETreeTableAdapterClass; +typedef struct _ETreeTableAdapterPrivate ETreeTableAdapterPrivate; - ETreeTableAdapterPriv *priv; -} ETreeTableAdapter; +struct _ETreeTableAdapter { + ETableModel parent; + ETreeTableAdapterPrivate *priv; +}; -typedef struct { +struct _ETreeTableAdapterClass { ETableModelClass parent_class; /* Signals */ - gboolean (*sorting_changed) (ETreeTableAdapter *etta); -} ETreeTableAdapterClass; - -GType e_tree_table_adapter_get_type (void); -ETableModel *e_tree_table_adapter_new (ETreeModel *source, - ETableSortInfo *sort_info, - ETableHeader *header); -ETableModel *e_tree_table_adapter_construct (ETreeTableAdapter *ets, - ETreeModel *source, - ETableSortInfo *sort_info, - ETableHeader *header); - -ETreePath e_tree_table_adapter_node_get_next (ETreeTableAdapter *etta, - ETreePath path); -gboolean e_tree_table_adapter_node_is_expanded (ETreeTableAdapter *etta, - ETreePath path); -void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, - ETreePath path, - gboolean expanded); -void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta, - ETreePath path, - gboolean expanded); -void e_tree_table_adapter_force_expanded_state (ETreeTableAdapter *etta, - gint state); -void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta, - gboolean visible); -ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta, - gint row); -gint e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta, - ETreePath path); -gboolean e_tree_table_adapter_root_node_is_visible (ETreeTableAdapter *etta); - -void e_tree_table_adapter_show_node (ETreeTableAdapter *etta, - ETreePath path); - -void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, - const gchar *filename); -void e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, - const gchar *filename); - -xmlDoc *e_tree_table_adapter_save_expanded_state_xml (ETreeTableAdapter *etta); -void e_tree_table_adapter_load_expanded_state_xml (ETreeTableAdapter *etta, xmlDoc *doc); - -void e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta, - ETableSortInfo *sort_info); -ETableSortInfo *e_tree_table_adapter_get_sort_info (ETreeTableAdapter *etta); -ETableHeader *e_tree_table_adapter_get_header (ETreeTableAdapter *etta); + gboolean (*sorting_changed) (ETreeTableAdapter *etta); +}; + +GType e_tree_table_adapter_get_type (void) G_GNUC_CONST; +ETableModel * e_tree_table_adapter_new (ETreeModel *source, + ETableSortInfo *sort_info, + ETableHeader *header); +ETableModel * e_tree_table_adapter_construct (ETreeTableAdapter *ets, + ETreeModel *source, + ETableSortInfo *sort_info, + ETableHeader *header); + +ETreePath e_tree_table_adapter_node_get_next + (ETreeTableAdapter *etta, + ETreePath path); +gboolean e_tree_table_adapter_node_is_expanded + (ETreeTableAdapter *etta, + ETreePath path); +void e_tree_table_adapter_node_set_expanded + (ETreeTableAdapter *etta, + ETreePath path, + gboolean expanded); +void e_tree_table_adapter_node_set_expanded_recurse + (ETreeTableAdapter *etta, + ETreePath path, + gboolean expanded); +void e_tree_table_adapter_force_expanded_state + (ETreeTableAdapter *etta, + gint state); +void e_tree_table_adapter_root_node_set_visible + (ETreeTableAdapter *etta, + gboolean visible); +ETreePath e_tree_table_adapter_node_at_row + (ETreeTableAdapter *etta, + gint row); +gint e_tree_table_adapter_row_of_node + (ETreeTableAdapter *etta, + ETreePath path); +gboolean e_tree_table_adapter_root_node_is_visible + (ETreeTableAdapter *etta); + +void e_tree_table_adapter_show_node (ETreeTableAdapter *etta, + ETreePath path); + +void e_tree_table_adapter_save_expanded_state + (ETreeTableAdapter *etta, + const gchar *filename); +void e_tree_table_adapter_load_expanded_state + (ETreeTableAdapter *etta, + const gchar *filename); + +xmlDoc * e_tree_table_adapter_save_expanded_state_xml + (ETreeTableAdapter *etta); +void e_tree_table_adapter_load_expanded_state_xml + (ETreeTableAdapter *etta, + xmlDoc *doc); + +void e_tree_table_adapter_set_sort_info + (ETreeTableAdapter *etta, + ETableSortInfo *sort_info); +ETableSortInfo *e_tree_table_adapter_get_sort_info + (ETreeTableAdapter *etta); +ETableHeader * e_tree_table_adapter_get_header (ETreeTableAdapter *etta); G_END_DECLS diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index f19a9a7cfc..bcad41a797 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -59,6 +59,10 @@ #define d(x) +#define E_TREE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TREE, ETreePrivate)) + enum { CURSOR_CHANGE, CURSOR_ACTIVATED, @@ -107,7 +111,7 @@ enum { ET_SCROLL_RIGHT = 1 << 3 }; -struct ETreePriv { +struct _ETreePrivate { ETreeModel *model; ETreeTableAdapter *etta; @@ -379,70 +383,94 @@ connect_header (ETree *e_tree, ETableState *state) static void et_dispose (GObject *object) { - ETree *et = E_TREE (object); + ETreePrivate *priv; - if (et->priv) { + priv = E_TREE_GET_PRIVATE (object); - if (et->priv->search) { - if (et->priv->search_search_id) - g_signal_handler_disconnect (et->priv->search, - et->priv->search_search_id); - if (et->priv->search_accept_id) - g_signal_handler_disconnect (et->priv->search, - et->priv->search_accept_id); - g_object_unref (et->priv->search); - } + if (priv->search != NULL) { + g_signal_handler_disconnect ( + priv->search, priv->search_search_id); + g_signal_handler_disconnect ( + priv->search, priv->search_accept_id); + g_object_unref (priv->search); + priv->search = NULL; + } - if (et->priv->reflow_idle_id) - g_source_remove (et->priv->reflow_idle_id); - et->priv->reflow_idle_id = 0; + if (priv->reflow_idle_id > 0) { + g_source_remove (priv->reflow_idle_id); + priv->reflow_idle_id = 0; + } - scroll_off (et); - hover_off (et); - g_list_foreach ( - et->priv->expanded_list, - (GFunc) g_free, NULL); - g_list_free (et->priv->expanded_list); - - et_disconnect_from_etta (et); - - g_object_unref (et->priv->etta); - g_object_unref (et->priv->model); - g_object_unref (et->priv->full_header); - disconnect_header (et); - g_object_unref (et->priv->selection); - if (et->priv->spec) - g_object_unref (et->priv->spec); - et->priv->spec = NULL; - - if (et->priv->sorter) - g_object_unref (et->priv->sorter); - et->priv->sorter = NULL; - - if (et->priv->header_canvas) - gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); - et->priv->header_canvas = NULL; - - if (et->priv->site) - e_tree_drag_source_unset (et); - - if (et->priv->last_drop_context) - g_object_weak_unref (G_OBJECT (et->priv->last_drop_context), context_destroyed, et); - et->priv->last_drop_context = NULL; + scroll_off (E_TREE (object)); + hover_off (E_TREE (object)); + g_list_foreach ( + priv->expanded_list, + (GFunc) g_free, NULL); + g_list_free (priv->expanded_list); + priv->expanded_list = NULL; + + et_disconnect_from_etta (E_TREE (object)); - if (et->priv->info_text) - g_object_run_dispose (G_OBJECT (et->priv->info_text)); - et->priv->info_text = NULL; - et->priv->info_text_resize_id = 0; + if (priv->etta != NULL) { + g_object_unref (priv->etta); + priv->etta = NULL; + } + + if (priv->model != NULL) { + g_object_unref (priv->model); + priv->model = NULL; + } + + if (priv->full_header != NULL) { + g_object_unref (priv->full_header); + priv->full_header = NULL; + } + + disconnect_header (E_TREE (object)); + + if (priv->selection != NULL) { + g_object_unref (priv->selection); + priv->selection = NULL; + } + + if (priv->spec != NULL) { + g_object_unref (priv->spec); + priv->spec = NULL; + } + + if (priv->sorter != NULL) { + g_object_unref (priv->sorter); + priv->sorter = NULL; + } + + if (priv->header_canvas != NULL) { + gtk_widget_destroy (GTK_WIDGET (priv->header_canvas)); + priv->header_canvas = NULL; + } - gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas)); + if (priv->site) + e_tree_drag_source_unset (E_TREE (object)); - g_free (et->priv); - et->priv = NULL; + if (priv->last_drop_context != NULL) { + g_object_weak_unref ( + G_OBJECT (priv->last_drop_context), + context_destroyed, object); + priv->last_drop_context = NULL; } - if (G_OBJECT_CLASS (e_tree_parent_class)->dispose) - G_OBJECT_CLASS (e_tree_parent_class)->dispose (object); + if (priv->info_text != NULL) { + g_object_run_dispose (G_OBJECT (priv->info_text)); + priv->info_text = NULL; + } + priv->info_text_resize_id = 0; + + if (priv->table_canvas != NULL) { + gtk_widget_destroy (GTK_WIDGET (priv->table_canvas)); + priv->table_canvas = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_tree_parent_class)->dispose (object); } static void @@ -555,65 +583,20 @@ e_tree_init (ETree *e_tree) gtk_table_set_homogeneous (GTK_TABLE (e_tree), FALSE); - e_tree->priv = g_new (ETreePriv, 1); - - e_tree->priv->model = NULL; - e_tree->priv->etta = NULL; - - e_tree->priv->full_header = NULL; - e_tree->priv->header = NULL; - - e_tree->priv->structure_change_id = 0; - e_tree->priv->expansion_change_id = 0; - e_tree->priv->sort_info_change_id = 0; - e_tree->priv->group_info_change_id = 0; - - e_tree->priv->sort_info = NULL; - e_tree->priv->sorter = NULL; - e_tree->priv->reflow_idle_id = 0; - e_tree->priv->scroll_idle_id = 0; - e_tree->priv->hover_idle_id = 0; - - e_tree->priv->show_cursor_after_reflow = FALSE; - - e_tree->priv->table_model_change_id = 0; - e_tree->priv->table_row_change_id = 0; - e_tree->priv->table_cell_change_id = 0; - e_tree->priv->table_rows_delete_id = 0; + e_tree->priv = E_TREE_GET_PRIVATE (e_tree); e_tree->priv->alternating_row_colors = 1; - e_tree->priv->horizontal_draw_grid = 1; - e_tree->priv->vertical_draw_grid = 1; - e_tree->priv->draw_focus = 1; - e_tree->priv->cursor_mode = E_CURSOR_SIMPLE; - e_tree->priv->length_threshold = 200; - e_tree->priv->uniform_row_height = FALSE; - - e_tree->priv->row_selection_active = FALSE; - e_tree->priv->horizontal_scrolling = FALSE; - e_tree->priv->scroll_direction = 0; + e_tree->priv->horizontal_draw_grid = 1; + e_tree->priv->vertical_draw_grid = 1; + e_tree->priv->draw_focus = 1; + e_tree->priv->cursor_mode = E_CURSOR_SIMPLE; + e_tree->priv->length_threshold = 200; - e_tree->priv->drop_row = -1; - e_tree->priv->drop_path = NULL; - e_tree->priv->drop_col = -1; - e_tree->priv->drop_highlight = NULL; + e_tree->priv->drop_row = -1; + e_tree->priv->drop_col = -1; - e_tree->priv->last_drop_x = 0; - e_tree->priv->last_drop_y = 0; - e_tree->priv->last_drop_time = 0; - e_tree->priv->last_drop_context = NULL; - - e_tree->priv->hover_x = 0; - e_tree->priv->hover_y = 0; - - e_tree->priv->drag_row = -1; - e_tree->priv->drag_path = NULL; - e_tree->priv->drag_col = -1; - - e_tree->priv->expanded_list = NULL; - - e_tree->priv->site = NULL; - e_tree->priv->do_drag = FALSE; + e_tree->priv->drag_row = -1; + e_tree->priv->drag_col = -1; #ifdef E_TREE_USE_TREE_SELECTION e_tree->priv->selection = @@ -622,32 +605,17 @@ e_tree_init (ETree *e_tree) e_tree->priv->selection = E_SELECTION_MODEL (e_table_selection_model_new ()); #endif - e_tree->priv->spec = NULL; - - e_tree->priv->info_text = NULL; - e_tree->priv->info_text_resize_id = 0; - - e_tree->priv->header_canvas = NULL; - e_tree->priv->table_canvas = NULL; - e_tree->priv->header_item = NULL; - e_tree->priv->root = NULL; + e_tree->priv->search = e_table_search_new (); - e_tree->priv->white_item = NULL; - e_tree->priv->item = NULL; - - e_tree->priv->search = e_table_search_new (); - - e_tree->priv->search_search_id = + e_tree->priv->search_search_id = g_signal_connect (G_OBJECT (e_tree->priv->search), "search", - G_CALLBACK (et_search_search), e_tree); - e_tree->priv->search_accept_id = + G_CALLBACK (et_search_search), e_tree); + e_tree->priv->search_accept_id = g_signal_connect (G_OBJECT (e_tree->priv->search), "accept", - G_CALLBACK (et_search_accept), e_tree); + G_CALLBACK (et_search_accept), e_tree); - e_tree->priv->current_search_col = NULL; - e_tree->priv->search_col_set = FALSE; - e_tree->priv->always_search = g_getenv ("GAL_ALWAYS_SEARCH") ? TRUE : FALSE; + e_tree->priv->always_search = g_getenv ("GAL_ALWAYS_SEARCH") ? TRUE : FALSE; } /* Grab_focus handler for the ETree */ @@ -1747,7 +1715,7 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const gchar *spec, const gchar * g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec != NULL, NULL); - e_tree = g_object_new (E_TREE_TYPE, NULL); + e_tree = g_object_new (E_TYPE_TREE, NULL); if (!e_tree_construct (e_tree, etm, ete, spec, state)) { g_object_unref (e_tree); @@ -1790,7 +1758,7 @@ e_tree_new_from_spec_file (ETreeModel *etm, g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec_fn != NULL, NULL); - e_tree = g_object_new (E_TREE_TYPE, NULL); + e_tree = g_object_new (E_TYPE_TREE, NULL); if (!e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn)) { g_object_unref (e_tree); @@ -2035,7 +2003,8 @@ set_scroll_adjustments (ETree *tree, if (hadjustment != NULL) gtk_adjustment_set_step_increment (hadjustment, 20); - if (tree->priv) { + /* XXX This can be called after our dispose() method has run. */ + if (tree->priv->table_canvas != NULL) { GtkScrollable *scrollable; scrollable = GTK_SCROLLABLE (tree->priv->table_canvas); @@ -3275,38 +3244,20 @@ e_tree_class_init (ETreeClass *class) GObjectClass *object_class; GtkWidgetClass *widget_class; - object_class = (GObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - object_class->dispose = et_dispose; - object_class->set_property = et_set_property; - object_class->get_property = et_get_property; - - widget_class->grab_focus = et_grab_focus; - widget_class->unrealize = et_unrealize; - widget_class->style_set = et_canvas_style_set; - widget_class->focus = et_focus; - - class->cursor_change = NULL; - class->cursor_activated = NULL; - class->selection_change = NULL; - class->double_click = NULL; - class->right_click = NULL; - class->click = NULL; - class->key_press = NULL; - class->start_drag = et_real_start_drag; - class->state_change = NULL; - class->white_space_event = NULL; - - class->tree_drag_begin = NULL; - class->tree_drag_end = NULL; - class->tree_drag_data_get = NULL; - class->tree_drag_data_delete = NULL; - - class->tree_drag_leave = NULL; - class->tree_drag_motion = NULL; - class->tree_drag_drop = NULL; - class->tree_drag_data_received = NULL; + g_type_class_add_private (class, sizeof (ETreePrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = et_dispose; + object_class->set_property = et_set_property; + object_class->get_property = et_get_property; + + widget_class = GTK_WIDGET_CLASS (class); + widget_class->grab_focus = et_grab_focus; + widget_class->unrealize = et_unrealize; + widget_class->style_set = et_canvas_style_set; + widget_class->focus = et_focus; + + class->start_drag = et_real_start_drag; et_signals[CURSOR_CHANGE] = g_signal_new ("cursor_change", @@ -3557,7 +3508,7 @@ e_tree_class_init (ETreeClass *class) g_param_spec_object ("ETreeTableAdapter", "ETree table adapter", "ETree table adapter", - E_TREE_TABLE_ADAPTER_TYPE, + E_TYPE_TREE_TABLE_ADAPTER, G_PARAM_READABLE)); g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT, diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 345aa34336..533ab588f5 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -41,279 +41,331 @@ #include <table/e-tree-selection-model.h> #endif +/* Standard GObject macros */ +#define E_TYPE_TREE \ + (e_tree_get_type ()) +#define E_TREE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_TREE, ETree)) +#define E_TREE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_TREE, ETreeClass)) +#define E_IS_TREE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_TREE)) +#define E_IS_TREE_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_TREE)) +#define E_TREE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_TREE)) + G_BEGIN_DECLS -#define E_TREE_TYPE (e_tree_get_type ()) -#define E_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_TYPE, ETree)) -#define E_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_TYPE, ETreeClass)) -#define E_IS_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_TYPE)) -#define E_IS_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_TYPE)) typedef struct _ETreeDragSourceSite ETreeDragSourceSite; -typedef struct ETreePriv ETreePriv; -typedef struct { - GtkTable parent; +typedef struct _ETree ETree; +typedef struct _ETreeClass ETreeClass; +typedef struct _ETreePrivate ETreePrivate; - ETreePriv *priv; -} ETree; +struct _ETree { + GtkTable parent; + ETreePrivate *priv; +}; -typedef struct { +struct _ETreeClass { GtkTableClass parent_class; - void (*cursor_change) (ETree *et, gint row, ETreePath path); - void (*cursor_activated) (ETree *et, gint row, ETreePath path); - void (*selection_change) (ETree *et); - void (*double_click) (ETree *et, gint row, ETreePath path, gint col, GdkEvent *event); - gboolean (*right_click) (ETree *et, gint row, ETreePath path, gint col, GdkEvent *event); - gboolean (*click) (ETree *et, gint row, ETreePath path, gint col, GdkEvent *event); - gboolean (*key_press) (ETree *et, gint row, ETreePath path, gint col, GdkEvent *event); - gboolean (*start_drag) (ETree *et, gint row, ETreePath path, gint col, GdkEvent *event); - void (*state_change) (ETree *et); - gboolean (*white_space_event) (ETree *et, GdkEvent *event); - - void (*set_scroll_adjustments) (ETree *tree, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment); + void (*cursor_change) (ETree *et, + gint row, + ETreePath path); + void (*cursor_activated) (ETree *et, + gint row, + ETreePath path); + void (*selection_change) (ETree *et); + void (*double_click) (ETree *et, + gint row, + ETreePath path, + gint col, + GdkEvent *event); + gboolean (*right_click) (ETree *et, + gint row, + ETreePath path, + gint col, + GdkEvent *event); + gboolean (*click) (ETree *et, + gint row, + ETreePath path, + gint col, + GdkEvent *event); + gboolean (*key_press) (ETree *et, + gint row, + ETreePath path, + gint col, + GdkEvent *event); + gboolean (*start_drag) (ETree *et, + gint row, + ETreePath path, + gint col, + GdkEvent *event); + void (*state_change) (ETree *et); + gboolean (*white_space_event) (ETree *et, + GdkEvent *event); + + void (*set_scroll_adjustments) + (ETree *tree, + GtkAdjustment *hadjustment, + GtkAdjustment *vadjustment); /* Source side drag signals */ - void (* tree_drag_begin) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context); - void (* tree_drag_end) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context); - void (* tree_drag_data_get) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time); - void (* tree_drag_data_delete) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context); + void (*tree_drag_begin) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context); + void (*tree_drag_end) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context); + void (*tree_drag_data_get) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + GtkSelectionData *selection_data, + guint info, + guint time); + void (*tree_drag_data_delete) + (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context); /* Target side drag signals */ - void (* tree_drag_leave) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context, - guint time); - gboolean (* tree_drag_motion) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context, - gint x, - gint y, - guint time); - gboolean (* tree_drag_drop) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context, - gint x, - gint y, - guint time); - void (* tree_drag_data_received) (ETree *tree, - gint row, - ETreePath path, - gint col, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time); -} ETreeClass; - -GType e_tree_get_type (void); -gboolean e_tree_construct (ETree *e_tree, - ETreeModel *etm, - ETableExtras *ete, - const gchar *spec, - const gchar *state); -GtkWidget *e_tree_new (ETreeModel *etm, - ETableExtras *ete, - const gchar *spec, - const gchar *state); + void (*tree_drag_leave) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + guint time); + gboolean (*tree_drag_motion) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + gint x, + gint y, + guint time); + gboolean (*tree_drag_drop) (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + gint x, + gint y, + guint time); + void (*tree_drag_data_received) + (ETree *tree, + gint row, + ETreePath path, + gint col, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint time); +}; + +GType e_tree_get_type (void) G_GNUC_CONST; +gboolean e_tree_construct (ETree *e_tree, + ETreeModel *etm, + ETableExtras *ete, + const gchar *spec, + const gchar *state); +GtkWidget * e_tree_new (ETreeModel *etm, + ETableExtras *ete, + const gchar *spec, + const gchar *state); /* Create an ETree using files. */ -gboolean e_tree_construct_from_spec_file (ETree *e_tree, - ETreeModel *etm, - ETableExtras *ete, - const gchar *spec_fn, - const gchar *state_fn); -GtkWidget *e_tree_new_from_spec_file (ETreeModel *etm, - ETableExtras *ete, - const gchar *spec_fn, - const gchar *state_fn); +gboolean e_tree_construct_from_spec_file (ETree *e_tree, + ETreeModel *etm, + ETableExtras *ete, + const gchar *spec_fn, + const gchar *state_fn); +GtkWidget * e_tree_new_from_spec_file (ETreeModel *etm, + ETableExtras *ete, + const gchar *spec_fn, + const gchar *state_fn); /* To save the state */ -gchar *e_tree_get_state (ETree *e_tree); -void e_tree_save_state (ETree *e_tree, - const gchar *filename); -ETableState *e_tree_get_state_object (ETree *e_tree); -ETableSpecification *e_tree_get_spec (ETree *e_tree); +gchar * e_tree_get_state (ETree *e_tree); +void e_tree_save_state (ETree *e_tree, + const gchar *filename); +ETableState * e_tree_get_state_object (ETree *e_tree); +ETableSpecification * + e_tree_get_spec (ETree *e_tree); /* note that it is more efficient to provide the state at creation time */ -void e_tree_set_search_column (ETree *e_tree, - gint col); -void e_tree_set_state (ETree *e_tree, - const gchar *state); -void e_tree_set_state_object (ETree *e_tree, - ETableState *state); -void e_tree_load_state (ETree *e_tree, - const gchar *filename); -void e_tree_show_cursor_after_reflow (ETree *e_tree); - -void e_tree_set_cursor (ETree *e_tree, - ETreePath path); +void e_tree_set_search_column (ETree *e_tree, + gint col); +void e_tree_set_state (ETree *e_tree, + const gchar *state); +void e_tree_set_state_object (ETree *e_tree, + ETableState *state); +void e_tree_load_state (ETree *e_tree, + const gchar *filename); +void e_tree_show_cursor_after_reflow (ETree *e_tree); + +void e_tree_set_cursor (ETree *e_tree, + ETreePath path); /* NULL means we don't have the cursor. */ -ETreePath e_tree_get_cursor (ETree *e_tree); -void e_tree_selected_row_foreach (ETree *e_tree, - EForeachFunc callback, - gpointer closure); +ETreePath e_tree_get_cursor (ETree *e_tree); +void e_tree_selected_row_foreach (ETree *e_tree, + EForeachFunc callback, + gpointer closure); #ifdef E_TREE_USE_TREE_SELECTION -void e_tree_selected_path_foreach (ETree *e_tree, - ETreeForeachFunc callback, - gpointer closure); -void e_tree_path_foreach (ETree *e_tree, - ETreeForeachFunc callback, - gpointer closure); +void e_tree_selected_path_foreach (ETree *e_tree, + ETreeForeachFunc callback, + gpointer closure); +void e_tree_path_foreach (ETree *e_tree, + ETreeForeachFunc callback, + gpointer closure); #endif -gint e_tree_selected_count (ETree *e_tree); -EPrintable *e_tree_get_printable (ETree *e_tree); -gint e_tree_get_next_row (ETree *e_tree, - gint model_row); -gint e_tree_get_prev_row (ETree *e_tree, - gint model_row); -gint e_tree_model_to_view_row (ETree *e_tree, - gint model_row); -gint e_tree_view_to_model_row (ETree *e_tree, - gint view_row); -void e_tree_get_cell_at (ETree *tree, - gint x, - gint y, - gint *row_return, - gint *col_return); -void e_tree_get_cell_geometry (ETree *tree, - gint row, - gint col, - gint *x_return, - gint *y_return, - gint *width_return, - gint *height_return); +gint e_tree_selected_count (ETree *e_tree); +EPrintable *e_tree_get_printable (ETree *e_tree); +gint e_tree_get_next_row (ETree *e_tree, + gint model_row); +gint e_tree_get_prev_row (ETree *e_tree, + gint model_row); +gint e_tree_model_to_view_row (ETree *e_tree, + gint model_row); +gint e_tree_view_to_model_row (ETree *e_tree, + gint view_row); +void e_tree_get_cell_at (ETree *tree, + gint x, + gint y, + gint *row_return, + gint *col_return); +void e_tree_get_cell_geometry (ETree *tree, + gint row, + gint col, + gint *x_return, + gint *y_return, + gint *width_return, + gint *height_return); /* Useful accessors */ -ETreeModel * e_tree_get_model (ETree *et); -ESelectionModel *e_tree_get_selection_model (ETree *et); -ETreeTableAdapter *e_tree_get_table_adapter (ETree *et); +ETreeModel * e_tree_get_model (ETree *et); +ESelectionModel * + e_tree_get_selection_model (ETree *et); +ETreeTableAdapter * + e_tree_get_table_adapter (ETree *et); /* Drag & drop stuff. */ /* Target */ -void e_tree_drag_get_data (ETree *tree, - gint row, - gint col, - GdkDragContext *context, - GdkAtom target, - guint32 time); -void e_tree_drag_highlight (ETree *tree, - gint row, - gint col); /* col == -1 to highlight entire row. */ -void e_tree_drag_unhighlight (ETree *tree); -void e_tree_drag_dest_set (ETree *tree, - GtkDestDefaults flags, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_tree_drag_dest_set_proxy (ETree *tree, - GdkWindow *proxy_window, - GdkDragProtocol protocol, - gboolean use_coordinates); +void e_tree_drag_get_data (ETree *tree, + gint row, + gint col, + GdkDragContext *context, + GdkAtom target, + guint32 time); +void e_tree_drag_highlight (ETree *tree, + gint row, + gint col); /* col == -1 to highlight entire row. */ +void e_tree_drag_unhighlight (ETree *tree); +void e_tree_drag_dest_set (ETree *tree, + GtkDestDefaults flags, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions); +void e_tree_drag_dest_set_proxy (ETree *tree, + GdkWindow *proxy_window, + GdkDragProtocol protocol, + gboolean use_coordinates); /* There probably should be functions for setting the targets * as a GtkTargetList */ -void e_tree_drag_dest_unset (GtkWidget *widget); +void e_tree_drag_dest_unset (GtkWidget *widget); /* Source side */ -void e_tree_drag_source_set (ETree *tree, - GdkModifierType start_button_mask, - const GtkTargetEntry *targets, - gint n_targets, - GdkDragAction actions); -void e_tree_drag_source_unset (ETree *tree); +void e_tree_drag_source_set (ETree *tree, + GdkModifierType start_button_mask, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions); +void e_tree_drag_source_unset (ETree *tree); /* There probably should be functions for setting the targets * as a GtkTargetList */ -GdkDragContext *e_tree_drag_begin (ETree *tree, - gint row, - gint col, - GtkTargetList *targets, - GdkDragAction actions, - gint button, - GdkEvent *event); +GdkDragContext *e_tree_drag_begin (ETree *tree, + gint row, + gint col, + GtkTargetList *targets, + GdkDragAction actions, + gint button, + GdkEvent *event); /* Adapter functions */ -gboolean e_tree_node_is_expanded (ETree *et, - ETreePath path); -void e_tree_node_set_expanded (ETree *et, - ETreePath path, - gboolean expanded); -void e_tree_node_set_expanded_recurse (ETree *et, - ETreePath path, - gboolean expanded); -void e_tree_root_node_set_visible (ETree *et, - gboolean visible); -ETreePath e_tree_node_at_row (ETree *et, - gint row); -gint e_tree_row_of_node (ETree *et, - ETreePath path); -gboolean e_tree_root_node_is_visible (ETree *et); -void e_tree_show_node (ETree *et, - ETreePath path); -void e_tree_save_expanded_state (ETree *et, - gchar *filename); -void e_tree_load_expanded_state (ETree *et, - gchar *filename); - -xmlDoc *e_tree_save_expanded_state_xml (ETree *et); -void e_tree_load_expanded_state_xml (ETree *et, xmlDoc *doc); - -gint e_tree_row_count (ETree *et); -GtkWidget *e_tree_get_tooltip (ETree *et); -void e_tree_force_expanded_state (ETree *et, gint state); +gboolean e_tree_node_is_expanded (ETree *et, + ETreePath path); +void e_tree_node_set_expanded (ETree *et, + ETreePath path, + gboolean expanded); +void e_tree_node_set_expanded_recurse + (ETree *et, + ETreePath path, + gboolean expanded); +void e_tree_root_node_set_visible (ETree *et, + gboolean visible); +ETreePath e_tree_node_at_row (ETree *et, + gint row); +gint e_tree_row_of_node (ETree *et, + ETreePath path); +gboolean e_tree_root_node_is_visible (ETree *et); +void e_tree_show_node (ETree *et, + ETreePath path); +void e_tree_save_expanded_state (ETree *et, + gchar *filename); +void e_tree_load_expanded_state (ETree *et, + gchar *filename); + +xmlDoc * e_tree_save_expanded_state_xml (ETree *et); +void e_tree_load_expanded_state_xml (ETree *et, + xmlDoc *doc); + +gint e_tree_row_count (ETree *et); +GtkWidget * e_tree_get_tooltip (ETree *et); +void e_tree_force_expanded_state (ETree *et, + gint state); typedef enum { E_TREE_FIND_NEXT_BACKWARD = 0, - E_TREE_FIND_NEXT_FORWARD = 1 << 0, - E_TREE_FIND_NEXT_WRAP = 1 << 1 + E_TREE_FIND_NEXT_FORWARD = 1 << 0, + E_TREE_FIND_NEXT_WRAP = 1 << 1 } ETreeFindNextParams; -gboolean e_tree_find_next (ETree *et, - ETreeFindNextParams params, - ETreePathFunc func, - gpointer data); +gboolean e_tree_find_next (ETree *et, + ETreeFindNextParams params, + ETreePathFunc func, + gpointer data); /* This function is only needed in single_selection_mode. */ -void e_tree_right_click_up (ETree *et); +void e_tree_right_click_up (ETree *et); -ETableItem * e_tree_get_item (ETree * et); +ETableItem * e_tree_get_item (ETree *et); -GnomeCanvasItem * e_tree_get_header_item (ETree * et); +GnomeCanvasItem * + e_tree_get_header_item (ETree *et); -void e_tree_set_info_message (ETree *tree, const gchar *info_message); +void e_tree_set_info_message (ETree *tree, + const gchar *info_message); G_END_DECLS diff --git a/widgets/table/gal-a11y-e-cell-popup.c b/widgets/table/gal-a11y-e-cell-popup.c index 92ee3a8322..a282f862e3 100644 --- a/widgets/table/gal-a11y-e-cell-popup.c +++ b/widgets/table/gal-a11y-e-cell-popup.c @@ -38,7 +38,7 @@ static AtkObjectClass *parent_class = NULL; #define PARENT_TYPE (gal_a11y_e_cell_get_type ()) -static void gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *klass); +static void gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *class); static void popup_cell_action (GalA11yECell *cell); /** @@ -77,7 +77,7 @@ gal_a11y_e_cell_popup_get_type (void) } static void -gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *klass) +gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *class) { parent_class = g_type_class_ref (PARENT_TYPE); } diff --git a/widgets/table/gal-a11y-e-cell-popup.h b/widgets/table/gal-a11y-e-cell-popup.h index b96aa9392c..fdf20802a1 100644 --- a/widgets/table/gal-a11y-e-cell-popup.h +++ b/widgets/table/gal-a11y-e-cell-popup.h @@ -24,7 +24,6 @@ #ifndef __GAL_A11Y_E_CELL_POPUP_H__ #define __GAL_A11Y_E_CELL_POPUP_H__ -#include <glib-object.h> #include <table/e-table-item.h> #include <table/gal-a11y-e-cell.h> #include <atk/atkgobjectaccessible.h> diff --git a/widgets/table/gal-a11y-e-cell-registry.c b/widgets/table/gal-a11y-e-cell-registry.c index c1c3b441e7..863813348d 100644 --- a/widgets/table/gal-a11y-e-cell-registry.c +++ b/widgets/table/gal-a11y-e-cell-registry.c @@ -47,9 +47,9 @@ gal_a11y_e_cell_registry_finalize (GObject *obj) } static void -gal_a11y_e_cell_registry_class_init (GalA11yECellRegistryClass *klass) +gal_a11y_e_cell_registry_class_init (GalA11yECellRegistryClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-cell-registry.h b/widgets/table/gal-a11y-e-cell-registry.h index 189da02b02..de8b21b701 100644 --- a/widgets/table/gal-a11y-e-cell-registry.h +++ b/widgets/table/gal-a11y-e-cell-registry.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_CELL_REGISTRY_H__ #define __GAL_A11Y_E_CELL_REGISTRY_H__ -#include <glib-object.h> #include <atk/atkobject.h> #include <table/e-table-item.h> #include <table/e-cell.h> diff --git a/widgets/table/gal-a11y-e-cell-toggle.c b/widgets/table/gal-a11y-e-cell-toggle.c index fcea3ec2a1..660a0ebd9a 100644 --- a/widgets/table/gal-a11y-e-cell-toggle.c +++ b/widgets/table/gal-a11y-e-cell-toggle.c @@ -30,7 +30,7 @@ #define PARENT_TYPE (gal_a11y_e_cell_get_type ()) static GObjectClass *parent_class; -static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass); +static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *class); static void gal_a11y_e_cell_toggle_dispose (GObject *object) @@ -78,9 +78,9 @@ gal_a11y_e_cell_toggle_get_type (void) } static void -gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass) +gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->dispose = gal_a11y_e_cell_toggle_dispose; parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-cell-tree.c b/widgets/table/gal-a11y-e-cell-tree.c index 776fc692c6..1a95c46a90 100644 --- a/widgets/table/gal-a11y-e-cell-tree.c +++ b/widgets/table/gal-a11y-e-cell-tree.c @@ -144,7 +144,7 @@ ectr_do_action_collapse (AtkAction *action) } static void -ectr_class_init (GalA11yECellTreeClass *klass) +ectr_class_init (GalA11yECellTreeClass *class) { a11y_parent_class = g_type_class_ref (A11Y_PARENT_TYPE); } diff --git a/widgets/table/gal-a11y-e-cell-tree.h b/widgets/table/gal-a11y-e-cell-tree.h index fedd9e5fbd..18ccf9c7bc 100644 --- a/widgets/table/gal-a11y-e-cell-tree.h +++ b/widgets/table/gal-a11y-e-cell-tree.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_CELL_TREE_H__ #define __GAL_A11Y_E_CELL_TREE_H__ -#include <glib-object.h> #include <table/e-table-item.h> #include <table/e-cell-tree.h> #include "gal-a11y-e-cell.h" diff --git a/widgets/table/gal-a11y-e-cell-vbox.c b/widgets/table/gal-a11y-e-cell-vbox.c index df3e00bff4..1fa24f821a 100644 --- a/widgets/table/gal-a11y-e-cell-vbox.c +++ b/widgets/table/gal-a11y-e-cell-vbox.c @@ -147,10 +147,10 @@ ecv_ref_accessible_at_point (AtkComponent *component, } static void -ecv_class_init (GalA11yECellVboxClass *klass) +ecv_class_init (GalA11yECellVboxClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - AtkObjectClass *a11y_class = ATK_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + AtkObjectClass *a11y_class = ATK_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); object_class->dispose = ecv_dispose; diff --git a/widgets/table/gal-a11y-e-cell.c b/widgets/table/gal-a11y-e-cell.c index b2962ba96c..65a1fe9759 100644 --- a/widgets/table/gal-a11y-e-cell.c +++ b/widgets/table/gal-a11y-e-cell.c @@ -228,10 +228,10 @@ gal_a11y_e_cell_atk_component_iface_init (AtkComponentIface *iface) } static void -gal_a11y_e_cell_class_init (GalA11yECellClass *klass) +gal_a11y_e_cell_class_init (GalA11yECellClass *class) { - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-cell.h b/widgets/table/gal-a11y-e-cell.h index aa02aff79c..48c7d2bec8 100644 --- a/widgets/table/gal-a11y-e-cell.h +++ b/widgets/table/gal-a11y-e-cell.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_CELL_H__ #define __GAL_A11Y_E_CELL_H__ -#include <glib-object.h> #include <table/e-table-item.h> #include <table/e-cell.h> diff --git a/widgets/table/gal-a11y-e-table-click-to-add-factory.c b/widgets/table/gal-a11y-e-table-click-to-add-factory.c index 1208241179..e13e6599b4 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add-factory.c +++ b/widgets/table/gal-a11y-e-table-click-to-add-factory.c @@ -56,9 +56,9 @@ gal_a11y_e_table_click_to_add_factory_create_accessible (GObject *obj) } static void -gal_a11y_e_table_click_to_add_factory_class_init (GalA11yETableClickToAddFactoryClass *klass) +gal_a11y_e_table_click_to_add_factory_class_init (GalA11yETableClickToAddFactoryClass *class) { - AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass); + AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-table-click-to-add-factory.h b/widgets/table/gal-a11y-e-table-click-to-add-factory.h index 5321ccd241..c8f9782a7e 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add-factory.h +++ b/widgets/table/gal-a11y-e-table-click-to-add-factory.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY_H__ #define __GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY_H__ -#include <glib-object.h> #include <atk/atkobjectfactory.h> #define GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY (gal_a11y_e_table_item_factory_get_type ()) diff --git a/widgets/table/gal-a11y-e-table-click-to-add.c b/widgets/table/gal-a11y-e-table-click-to-add.c index 32bee99f07..05f145f6ed 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add.c +++ b/widgets/table/gal-a11y-e-table-click-to-add.c @@ -181,9 +181,9 @@ etcta_ref_state_set (AtkObject *accessible) } static void -etcta_class_init (GalA11yETableClickToAddClass *klass) +etcta_class_init (GalA11yETableClickToAddClass *class) { - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); @@ -335,7 +335,7 @@ gal_a11y_e_table_click_to_add_init (void) { if (atk_get_root ()) atk_registry_set_factory_type (atk_get_default_registry (), - E_TABLE_CLICK_TO_ADD_TYPE, + E_TYPE_TABLE_CLICK_TO_ADD, gal_a11y_e_table_click_to_add_factory_get_type ()); } diff --git a/widgets/table/gal-a11y-e-table-click-to-add.h b/widgets/table/gal-a11y-e-table-click-to-add.h index 0d1507f79d..8d95a00baa 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add.h +++ b/widgets/table/gal-a11y-e-table-click-to-add.h @@ -22,7 +22,6 @@ #ifndef __GAL_A11Y_E_TABLE_CLICK_TO_ADD_H__ #define __GAL_A11Y_E_TABLE_CLICK_TO_ADD_H__ -#include <glib-object.h> #include <table/e-table-item.h> #include <atk/atkgobjectaccessible.h> diff --git a/widgets/table/gal-a11y-e-table-column-header.c b/widgets/table/gal-a11y-e-table-column-header.c index c2f3abe91a..6eec994eb2 100644 --- a/widgets/table/gal-a11y-e-table-column-header.c +++ b/widgets/table/gal-a11y-e-table-column-header.c @@ -86,17 +86,17 @@ gal_a11y_e_table_column_header_dispose (GObject *object) } static void -etch_class_init (GalA11yETableColumnHeaderClass *klass) +etch_class_init (GalA11yETableColumnHeaderClass *class) { - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); object_class->dispose = gal_a11y_e_table_column_header_dispose; - class->ref_state_set = gal_a11y_e_table_column_header_ref_state_set; - class->initialize = gal_a11y_e_table_column_header_real_initialize; + atk_object_class->ref_state_set = gal_a11y_e_table_column_header_ref_state_set; + atk_object_class->initialize = gal_a11y_e_table_column_header_real_initialize; } inline static GObject * diff --git a/widgets/table/gal-a11y-e-table-column-header.h b/widgets/table/gal-a11y-e-table-column-header.h index ec9a74b868..20d41004f2 100644 --- a/widgets/table/gal-a11y-e-table-column-header.h +++ b/widgets/table/gal-a11y-e-table-column-header.h @@ -24,7 +24,6 @@ #ifndef __GAL_A11Y_E_TABLE_COLUMN_HEADER_H__ #define __GAL_A11Y_E_TABLE_COLUMN_HEADER_H__ -#include <glib-object.h> #include <atk/atkgobjectaccessible.h> #define GAL_A11Y_TYPE_E_TABLE_COLUMN_HEADER (gal_a11y_e_table_column_header_get_type ()) diff --git a/widgets/table/gal-a11y-e-table-factory.c b/widgets/table/gal-a11y-e-table-factory.c index 5e99c13bb9..face3ad06b 100644 --- a/widgets/table/gal-a11y-e-table-factory.c +++ b/widgets/table/gal-a11y-e-table-factory.c @@ -48,9 +48,9 @@ gal_a11y_e_table_factory_create_accessible (GObject *obj) } static void -gal_a11y_e_table_factory_class_init (GalA11yETableFactoryClass *klass) +gal_a11y_e_table_factory_class_init (GalA11yETableFactoryClass *class) { - AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass); + AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-table-factory.h b/widgets/table/gal-a11y-e-table-factory.h index 6caf3d8beb..6f66e6b82a 100644 --- a/widgets/table/gal-a11y-e-table-factory.h +++ b/widgets/table/gal-a11y-e-table-factory.h @@ -24,7 +24,6 @@ #ifndef __GAL_A11Y_E_TABLE_FACTORY_H__ #define __GAL_A11Y_E_TABLE_FACTORY_H__ -#include <glib-object.h> #include <atk/atkobjectfactory.h> #define GAL_A11Y_TYPE_E_TABLE_FACTORY (gal_a11y_e_table_factory_get_type ()) diff --git a/widgets/table/gal-a11y-e-table-item-factory.c b/widgets/table/gal-a11y-e-table-item-factory.c index 0b58e29add..c987b0068a 100644 --- a/widgets/table/gal-a11y-e-table-item-factory.c +++ b/widgets/table/gal-a11y-e-table-item-factory.c @@ -55,9 +55,9 @@ gal_a11y_e_table_item_factory_create_accessible (GObject *obj) } static void -gal_a11y_e_table_item_factory_class_init (GalA11yETableItemFactoryClass *klass) +gal_a11y_e_table_item_factory_class_init (GalA11yETableItemFactoryClass *class) { - AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass); + AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-table-item-factory.h b/widgets/table/gal-a11y-e-table-item-factory.h index a08cfeb84b..c2995eaaf0 100644 --- a/widgets/table/gal-a11y-e-table-item-factory.h +++ b/widgets/table/gal-a11y-e-table-item-factory.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_TABLE_ITEM_FACTORY_H__ #define __GAL_A11Y_E_TABLE_ITEM_FACTORY_H__ -#include <glib-object.h> #include <atk/atkobjectfactory.h> #define GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY (gal_a11y_e_table_item_factory_get_type ()) diff --git a/widgets/table/gal-a11y-e-table-item.c b/widgets/table/gal-a11y-e-table-item.c index 3938bd02ec..218265ecdd 100644 --- a/widgets/table/gal-a11y-e-table-item.c +++ b/widgets/table/gal-a11y-e-table-item.c @@ -917,10 +917,10 @@ eti_real_initialize (AtkObject *obj, } static void -eti_class_init (GalA11yETableItemClass *klass) +eti_class_init (GalA11yETableItemClass *class) { - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); + GObjectClass *object_class = G_OBJECT_CLASS (class); quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object"); @@ -1341,7 +1341,7 @@ gal_a11y_e_table_item_init (void) { if (atk_get_root ()) atk_registry_set_factory_type (atk_get_default_registry (), - E_TABLE_ITEM_TYPE, + E_TYPE_TABLE_ITEM, gal_a11y_e_table_item_factory_get_type ()); } diff --git a/widgets/table/gal-a11y-e-table-item.h b/widgets/table/gal-a11y-e-table-item.h index 90861a14ec..b77c5c3e93 100644 --- a/widgets/table/gal-a11y-e-table-item.h +++ b/widgets/table/gal-a11y-e-table-item.h @@ -24,7 +24,6 @@ #ifndef __GAL_A11Y_E_TABLE_ITEM_H__ #define __GAL_A11Y_E_TABLE_ITEM_H__ -#include <glib-object.h> #include <table/e-table-item.h> #include <atk/atkgobjectaccessible.h> diff --git a/widgets/table/gal-a11y-e-table.c b/widgets/table/gal-a11y-e-table.c index 1bf522767b..7139b41fe3 100644 --- a/widgets/table/gal-a11y-e-table.c +++ b/widgets/table/gal-a11y-e-table.c @@ -200,9 +200,9 @@ et_get_layer (AtkComponent *component) } static void -et_class_init (GalA11yETableClass *klass) +et_class_init (GalA11yETableClass *class) { - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); @@ -305,7 +305,7 @@ gal_a11y_e_table_init (void) { if (atk_get_root ()) atk_registry_set_factory_type (atk_get_default_registry (), - E_TABLE_TYPE, + E_TYPE_TABLE, gal_a11y_e_table_factory_get_type ()); } diff --git a/widgets/table/gal-a11y-e-tree-factory.c b/widgets/table/gal-a11y-e-tree-factory.c index e3cf441974..cf864ca283 100644 --- a/widgets/table/gal-a11y-e-tree-factory.c +++ b/widgets/table/gal-a11y-e-tree-factory.c @@ -47,9 +47,9 @@ gal_a11y_e_tree_factory_create_accessible (GObject *obj) } static void -gal_a11y_e_tree_factory_class_init (GalA11yETreeFactoryClass *klass) +gal_a11y_e_tree_factory_class_init (GalA11yETreeFactoryClass *class) { - AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass); + AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/widgets/table/gal-a11y-e-tree-factory.h b/widgets/table/gal-a11y-e-tree-factory.h index 640261acf2..a2e44445a0 100644 --- a/widgets/table/gal-a11y-e-tree-factory.h +++ b/widgets/table/gal-a11y-e-tree-factory.h @@ -23,7 +23,6 @@ #ifndef __GAL_A11Y_E_TREE_FACTORY_H__ #define __GAL_A11Y_E_TREE_FACTORY_H__ -#include <glib-object.h> #include <atk/atkobjectfactory.h> #define GAL_A11Y_TYPE_E_TREE_FACTORY (gal_a11y_e_table_factory_get_type ()) diff --git a/widgets/table/gal-a11y-e-tree.c b/widgets/table/gal-a11y-e-tree.c index 87dc8f1618..193d3eb9d7 100644 --- a/widgets/table/gal-a11y-e-tree.c +++ b/widgets/table/gal-a11y-e-tree.c @@ -98,9 +98,9 @@ et_get_layer (AtkComponent *component) } static void -et_class_init (GalA11yETreeClass *klass) +et_class_init (GalA11yETreeClass *class) { - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); + AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (class); parent_class = g_type_class_ref (PARENT_TYPE); @@ -190,7 +190,7 @@ gal_a11y_e_tree_init (void) { if (atk_get_root ()) atk_registry_set_factory_type (atk_get_default_registry (), - E_TREE_TYPE, + E_TYPE_TREE, gal_a11y_e_tree_factory_get_type ()); } |