From 23f5773903d64a554d977ae7d0ebbaca73528f1f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 30 Nov 2011 20:53:20 -0600 Subject: Coding style and whitespace cleanup. --- widgets/table/e-cell-combo.c | 53 +- widgets/table/e-cell-date-edit.c | 59 +- widgets/table/e-cell-text.c | 27 +- widgets/table/e-cell-toggle.c | 23 +- widgets/table/e-cell.c | 176 +++-- widgets/table/e-popup-menu.c | 7 +- widgets/table/e-table-click-to-add.c | 15 +- widgets/table/e-table-config.c | 15 +- widgets/table/e-table-extras.c | 9 +- widgets/table/e-table-field-chooser-dialog.c | 216 +++--- widgets/table/e-table-field-chooser-item.c | 6 +- widgets/table/e-table-field-chooser.c | 18 +- widgets/table/e-table-group-container.c | 82 ++- widgets/table/e-table-group-leaf.c | 260 ++++--- widgets/table/e-table-header-item.c | 119 ++-- widgets/table/e-table-header-utils.c | 8 +- widgets/table/e-table-header.c | 3 +- widgets/table/e-table-item.c | 46 +- widgets/table/e-table-memory-store.c | 9 +- widgets/table/e-table-memory.c | 9 +- widgets/table/e-table-model.c | 318 +++++---- widgets/table/e-table-search.c | 9 +- widgets/table/e-table-sorter.c | 51 +- widgets/table/e-table-subset.c | 33 +- widgets/table/e-table-utils.c | 10 +- widgets/table/e-table-without.c | 15 +- widgets/table/e-table.c | 901 +++++++++++-------------- widgets/table/e-tree-memory.c | 9 +- widgets/table/e-tree-model.c | 118 ++-- widgets/table/e-tree-selection-model.c | 240 ++++--- widgets/table/e-tree-sorted.c | 11 +- widgets/table/e-tree-table-adapter.c | 11 +- widgets/table/e-tree.c | 169 +++-- widgets/table/gal-a11y-e-cell-registry.c | 11 +- widgets/table/gal-a11y-e-cell-toggle.c | 7 +- widgets/table/gal-a11y-e-cell-tree.c | 7 +- widgets/table/gal-a11y-e-table-click-to-add.c | 18 +- widgets/table/gal-a11y-e-table-column-header.c | 9 +- widgets/table/gal-a11y-e-table-factory.c | 3 +- 39 files changed, 1691 insertions(+), 1419 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 2617cfafdf..20a19165be 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -259,34 +259,44 @@ e_cell_combo_do_popup (ECellPopup *ecp, gint view_col) { ECellCombo *ecc = E_CELL_COMBO (ecp); + GtkTreeSelection *selection; + GdkWindow *window; guint32 time; gint error_code; - GtkTreeSelection *selection; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view)); + selection = gtk_tree_view_get_selection ( + GTK_TREE_VIEW (ecc->popup_tree_view)); + + g_signal_handlers_block_by_func ( + selection, e_cell_combo_selection_changed, ecc); - g_signal_handlers_block_by_func (selection, e_cell_combo_selection_changed, ecc); e_cell_combo_show_popup (ecc, row, view_col); e_cell_combo_select_matching_item (ecc); - g_signal_handlers_unblock_by_func (selection, e_cell_combo_selection_changed, ecc); - if (event->type == GDK_BUTTON_PRESS) { + g_signal_handlers_unblock_by_func ( + selection, e_cell_combo_selection_changed, ecc); + + if (event->type == GDK_BUTTON_PRESS) time = event->button.time; - } else { + else time = event->key.time; - } - error_code = gdk_pointer_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE, - GDK_ENTER_NOTIFY_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON1_MOTION_MASK, - NULL, NULL, time); + window = gtk_widget_get_window (ecc->popup_tree_view); + + error_code = gdk_pointer_grab ( + window, TRUE, + GDK_ENTER_NOTIFY_MASK | + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_HINT_MASK | + GDK_BUTTON1_MOTION_MASK, + NULL, NULL, time); + if (error_code != 0) g_warning ("Failed to get pointer grab (%i)", error_code); + gtk_grab_add (ecc->popup_window); - gdk_keyboard_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE, time); + gdk_keyboard_grab (window, TRUE, time); return TRUE; } @@ -297,7 +307,7 @@ e_cell_combo_select_matching_item (ECellCombo *ecc) ECellPopup *ecp = E_CELL_POPUP (ecc); ECellView *ecv = (ECellView *) ecp->popup_cell_view; ECellText *ecell_text = E_CELL_TEXT (ecp->child); - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + ETableItem *eti; ETableCol *ecol; gboolean found = FALSE; gchar *cell_text; @@ -306,6 +316,8 @@ e_cell_combo_select_matching_item (ECellCombo *ecc) GtkTreeIter iter; GtkTreeModel *model; + eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + ecol = e_table_header_get_column (eti->header, ecp->popup_view_col); cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model, ecol->col_idx, ecp->popup_row); @@ -390,8 +402,8 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, gint *width) { ECellPopup *ecp = E_CELL_POPUP (ecc); - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); + ETableItem *eti; + GtkWidget *canvas; GtkWidget *widget; GtkWidget *popwin_child; GtkWidget *popup_child; @@ -408,6 +420,9 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, gdouble x1, y1; gdouble wx, wy; + eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); + /* This code is practically copied from GtkCombo. */ popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window); popwin = GTK_BIN (ecc->popup_window); @@ -503,7 +518,7 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, if (show_hscroll) work_height += requisition.height + - GTK_SCROLLED_WINDOW_CLASS (G_OBJECT_GET_CLASS (popup))->scrollbar_spacing; + GTK_SCROLLED_WINDOW_GET_CLASS (popup)->scrollbar_spacing; /* Check if it fits in the available height. */ if (work_height + list_requisition.height > avail_height) { diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c index 3035652116..bee042cb2a 100644 --- a/widgets/table/e-cell-date-edit.c +++ b/widgets/table/e-cell-date-edit.c @@ -299,43 +299,42 @@ e_cell_date_edit_init (ECellDateEdit *ecde) now_button = gtk_button_new_with_label (_("Now")); gtk_container_add (GTK_CONTAINER (bbox), now_button); gtk_widget_show (now_button); - g_signal_connect ((now_button), "clicked", - G_CALLBACK (e_cell_date_edit_on_now_clicked), - ecde); + g_signal_connect ( + now_button, "clicked", + G_CALLBACK (e_cell_date_edit_on_now_clicked), ecde); ecde->now_button = now_button; today_button = gtk_button_new_with_label (_("Today")); gtk_container_add (GTK_CONTAINER (bbox), today_button); gtk_widget_show (today_button); - g_signal_connect ((today_button), "clicked", - G_CALLBACK (e_cell_date_edit_on_today_clicked), - ecde); + g_signal_connect ( + today_button, "clicked", + G_CALLBACK (e_cell_date_edit_on_today_clicked), ecde); ecde->today_button = today_button; - /* Translators: "None" as a label of a button to unset date in a date table cell */ + /* Translators: "None" as a label of a button to unset date in a + * date table cell. */ none_button = gtk_button_new_with_label (C_("table-date", "None")); gtk_container_add (GTK_CONTAINER (bbox), none_button); gtk_widget_show (none_button); - g_signal_connect ((none_button), "clicked", - G_CALLBACK (e_cell_date_edit_on_none_clicked), - ecde); + g_signal_connect ( + none_button, "clicked", + G_CALLBACK (e_cell_date_edit_on_none_clicked), ecde); ecde->none_button = none_button; ok_button = gtk_button_new_with_label (_("OK")); gtk_container_add (GTK_CONTAINER (bbox), ok_button); gtk_widget_show (ok_button); - g_signal_connect ((ok_button), "clicked", - G_CALLBACK (e_cell_date_edit_on_ok_clicked), - ecde); - - g_signal_connect ((ecde->popup_window), - "key_press_event", - G_CALLBACK (e_cell_date_edit_key_press), - ecde); - g_signal_connect ((ecde->popup_window), - "button_press_event", - G_CALLBACK (e_cell_date_edit_button_press), - ecde); + g_signal_connect ( + ok_button, "clicked", + G_CALLBACK (e_cell_date_edit_on_ok_clicked), ecde); + + g_signal_connect ( + ecde->popup_window, "key_press_event", + G_CALLBACK (e_cell_date_edit_key_press), ecde); + g_signal_connect ( + ecde->popup_window, "button_press_event", + G_CALLBACK (e_cell_date_edit_button_press), ecde); } /** @@ -504,7 +503,7 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde) ECellPopup *ecp = E_CELL_POPUP (ecde); ECellText *ecell_text = E_CELL_TEXT (ecp->child); ECellView *ecv = (ECellView *) ecp->popup_cell_view; - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + ETableItem *eti; ETableCol *ecol; gchar *cell_text; ETimeParseStatus status; @@ -514,9 +513,12 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde) gchar buffer[64]; gboolean is_date = TRUE; + eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); ecol = e_table_header_get_column (eti->header, ecp->popup_view_col); - cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model, - ecol->col_idx, ecp->popup_row); + + cell_text = e_cell_text_get_text ( + ecell_text, ecv->e_table_model, + ecol->col_idx, ecp->popup_row); /* Try to parse just a date first. If the value is only a date, we * use a DATE value. */ @@ -640,8 +642,8 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde, gint *width) { ECellPopup *ecp = E_CELL_POPUP (ecde); - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); + ETableItem *eti; + GtkWidget *canvas; GtkRequisition popup_requisition; GtkAdjustment *adjustment; GtkScrollable *scrollable; @@ -650,6 +652,9 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde, gdouble x1, y1, wx, wy; gint value; + eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); + window = gtk_widget_get_window (canvas); gdk_window_get_origin (window, x, y); diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 7e391c3ba9..54998bc8b9 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1148,10 +1148,22 @@ ect_enter_edit (ECellView *ecell_view, if (edit->im_context) { gtk_im_context_reset (edit->im_context); if (!edit->im_context_signals_registered) { - g_signal_connect (edit->im_context, "preedit_changed", G_CALLBACK (e_cell_text_preedit_changed_cb), text_view); - g_signal_connect (edit->im_context, "commit", G_CALLBACK (e_cell_text_commit_cb), text_view); - g_signal_connect (edit->im_context, "retrieve_surrounding", G_CALLBACK (e_cell_text_retrieve_surrounding_cb), text_view); - g_signal_connect (edit->im_context, "delete_surrounding", G_CALLBACK (e_cell_text_delete_surrounding_cb), text_view); + g_signal_connect ( + edit->im_context, "preedit_changed", + G_CALLBACK (e_cell_text_preedit_changed_cb), + text_view); + g_signal_connect ( + edit->im_context, "commit", + G_CALLBACK (e_cell_text_commit_cb), + text_view); + g_signal_connect ( + edit->im_context, "retrieve_surrounding", + G_CALLBACK (e_cell_text_retrieve_surrounding_cb), + text_view); + g_signal_connect ( + edit->im_context, "delete_surrounding", + G_CALLBACK (e_cell_text_delete_surrounding_cb), + text_view); edit->im_context_signals_registered = TRUE; } @@ -2519,10 +2531,9 @@ _get_tep (CellEdit *edit) { if (!edit->tep) { edit->tep = e_text_event_processor_emacs_like_new (); - g_signal_connect (edit->tep, - "command", - G_CALLBACK (e_cell_text_view_command), - (gpointer) edit); + g_signal_connect ( + edit->tep, "command", + G_CALLBACK (e_cell_text_view_command), edit); } } diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index bec9f5d005..cf5db5858a 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -39,6 +39,10 @@ #include "e-cell-toggle.h" #include "e-table-item.h" +#define E_CELL_TOGGLE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CELL_TOGGLE, ECellTogglePrivate)) + struct _ECellTogglePrivate { gchar **icon_names; guint n_icon_names; @@ -97,7 +101,7 @@ cell_toggle_dispose (GObject *object) { ECellTogglePrivate *priv; - priv = E_CELL_TOGGLE (object)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (object); if (priv->empty != NULL) { g_object_unref (priv->empty); @@ -117,7 +121,7 @@ cell_toggle_finalize (GObject *object) ECellTogglePrivate *priv; guint ii; - priv = E_CELL_TOGGLE (object)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (object); /* The array is not NULL-terminated, * so g_strfreev() will not work. */ @@ -184,7 +188,7 @@ cell_toggle_draw (ECellView *ecell_view, const gint value = GPOINTER_TO_INT ( e_table_model_value_at (ecell_view->e_table_model, model_col, row)); - priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell); if (value < 0 || value >= priv->pixbufs->len) return; @@ -216,7 +220,7 @@ etog_set_value (ECellToggleView *toggle_view, { ECellTogglePrivate *priv; - priv = E_CELL_TOGGLE (toggle_view->cell_view.ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (toggle_view->cell_view.ecell); if (value >= priv->pixbufs->len) value = 0; @@ -268,7 +272,7 @@ cell_toggle_height (ECellView *ecell_view, { ECellTogglePrivate *priv; - priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell); return priv->height; } @@ -290,7 +294,7 @@ cell_toggle_print (ECellView *ecell_view, cairo_t *cr; - priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell); if (value >= priv->pixbufs->len) return; @@ -323,7 +327,7 @@ cell_toggle_print_height (ECellView *ecell_view, { ECellTogglePrivate *priv; - priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell); return priv->height; } @@ -338,7 +342,7 @@ cell_toggle_max_width (ECellView *ecell_view, gint number_of_rows; gint row; - priv = E_CELL_TOGGLE (ecell_view->ecell)->priv; + priv = E_CELL_TOGGLE_GET_PRIVATE (ecell_view->ecell); number_of_rows = e_table_model_row_count (ecell_view->e_table_model); for (row = 0; row < number_of_rows; row++) { @@ -385,8 +389,7 @@ e_cell_toggle_class_init (ECellToggleClass *class) static void e_cell_toggle_init (ECellToggle *cell_toggle) { - cell_toggle->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - cell_toggle, E_TYPE_CELL_TOGGLE, ECellTogglePrivate); + cell_toggle->priv = E_CELL_TOGGLE_GET_PRIVATE (cell_toggle); cell_toggle->priv->empty = gdk_pixbuf_new_from_xpm_data (empty_xpm); diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index 88762f6a7a..b9b96eecb0 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -33,8 +33,6 @@ G_DEFINE_TYPE (ECell, e_cell, G_TYPE_OBJECT) -#define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell)) - static ECellView * ec_new_view (ECell *ecell, ETableModel *table_model, @@ -210,7 +208,8 @@ e_cell_init (ECell *cell) * @view_col: the column in the view * @row: the row * @flags: flags about the current state - * @actions: A second return value in case the cell wants to take some action (specifically grabbing & ungrabbing) + * @actions: a second return value in case the cell wants to take some action + * (specifically grabbing & ungrabbing) * * Dispatches the event @event to the @ecell_view for. * @@ -225,24 +224,31 @@ e_cell_event (ECellView *ecell_view, ECellFlags flags, ECellActions *actions) { - return ECVIEW_EC_CLASS (ecell_view)->event ( - ecell_view, event, model_col, view_col, row, flags, actions); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + return class->event ( + ecell_view, event, model_col, + view_col, row, flags, actions); } /** * e_cell_new_view: * @ecell: the Ecell that will create the new view * @table_model: the table model the ecell is bound to - * @e_table_item_view: An ETableItem object (the CanvasItem that reprensents the view of the table) + * @e_table_item_view: an ETableItem object (the CanvasItem that + * reprensents the view of the table) * * ECell renderers new to be bound to a table_model and to the actual view * during their life time to actually render the data. This method is invoked * by the ETableItem canvas item to instatiate a new view of the ECell. * - * This is invoked when the ETableModel is attached to the ETableItem (a CanvasItem - * that can render ETableModels in the screen). + * This is invoked when the ETableModel is attached to the ETableItem + * (a CanvasItem that can render ETableModels in the screen). * - * Returns: a new ECellView for this @ecell on the @table_model displayed on the @e_table_item_view. + * Returns: a new ECellView for this @ecell on the @table_model displayed + * on the @e_table_item_view. */ ECellView * e_cell_new_view (ECell *ecell, @@ -264,7 +270,12 @@ e_cell_new_view (ECell *ecell, void e_cell_realize (ECellView *ecell_view) { - ECVIEW_EC_CLASS (ecell_view)->realize (ecell_view); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_if_fail (class->realize != NULL); + + class->realize (ecell_view); } /** @@ -276,7 +287,12 @@ e_cell_realize (ECellView *ecell_view) void e_cell_kill_view (ECellView *ecell_view) { - ECVIEW_EC_CLASS (ecell_view)->kill_view (ecell_view); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_if_fail (class->kill_view != NULL); + + class->kill_view (ecell_view); } /** @@ -290,7 +306,12 @@ e_cell_kill_view (ECellView *ecell_view) void e_cell_unrealize (ECellView *ecell_view) { - ECVIEW_EC_CLASS (ecell_view)->unrealize (ecell_view); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_if_fail (class->unrealize != NULL); + + class->unrealize (ecell_view); } /** @@ -324,13 +345,21 @@ e_cell_draw (ECellView *ecell_view, gint x2, gint y2) { + ECellClass *class; + g_return_if_fail (ecell_view != NULL); g_return_if_fail (row >= 0); g_return_if_fail (row < e_table_model_row_count (ecell_view->e_table_model)); + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_if_fail (class->draw != NULL); + cairo_save (cr); - ECVIEW_EC_CLASS (ecell_view)->draw (ecell_view, cr, model_col, view_col, row, flags, x1, y1, x2, y2); + class->draw ( + ecell_view, cr, + model_col, view_col, + row, flags, x1, y1, x2, y2); cairo_restore (cr); } @@ -356,8 +385,15 @@ e_cell_print (ECellView *ecell_view, gdouble width, gdouble height) { - if (ECVIEW_EC_CLASS (ecell_view)->print) - ECVIEW_EC_CLASS (ecell_view)->print (ecell_view, context, model_col, view_col, row, width, height); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->print != NULL) + class->print ( + ecell_view, context, + model_col, view_col, + row, width, height); } /** @@ -373,11 +409,17 @@ e_cell_print_height (ECellView *ecell_view, gint row, gdouble width) { - if (ECVIEW_EC_CLASS (ecell_view)->print_height) - return ECVIEW_EC_CLASS (ecell_view)->print_height - (ecell_view, context, model_col, view_col, row, width); - else + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->print_height == NULL) return 0.0; + + return class->print_height ( + ecell_view, context, + model_col, view_col, + row, width); } /** @@ -396,7 +438,12 @@ e_cell_height (ECellView *ecell_view, gint view_col, gint row) { - return ECVIEW_EC_CLASS (ecell_view)->height (ecell_view, model_col, view_col, row); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_val_if_fail (class->height != NULL, 0); + + return class->height (ecell_view, model_col, view_col, row); } /** @@ -415,7 +462,12 @@ e_cell_enter_edit (ECellView *ecell_view, gint view_col, gint row) { - return ECVIEW_EC_CLASS (ecell_view)->enter_edit (ecell_view, model_col, view_col, row); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_val_if_fail (class->enter_edit != NULL, NULL); + + return class->enter_edit (ecell_view, model_col, view_col, row); } /** @@ -436,7 +488,12 @@ e_cell_leave_edit (ECellView *ecell_view, gint row, gpointer edit_context) { - ECVIEW_EC_CLASS (ecell_view)->leave_edit (ecell_view, model_col, view_col, row, edit_context); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_if_fail (class->leave_edit != NULL); + + class->leave_edit (ecell_view, model_col, view_col, row, edit_context); } /** @@ -460,10 +517,15 @@ e_cell_save_state (ECellView *ecell_view, gint row, gpointer edit_context) { - if (ECVIEW_EC_CLASS (ecell_view)->save_state) - return ECVIEW_EC_CLASS (ecell_view)->save_state (ecell_view, model_col, view_col, row, edit_context); - else + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->save_state == NULL) return NULL; + + return class->save_state ( + ecell_view, model_col, view_col, row, edit_context); } /** @@ -485,12 +547,18 @@ e_cell_load_state (ECellView *ecell_view, gpointer edit_context, gpointer save_state) { - if (ECVIEW_EC_CLASS (ecell_view)->load_state) - ECVIEW_EC_CLASS (ecell_view)->load_state (ecell_view, model_col, view_col, row, edit_context, save_state); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->load_state != NULL) + class->load_state ( + ecell_view, model_col, view_col, + row, edit_context, save_state); } /** - * e_cell_load_state: + * e_cell_free_state: * @ecell_view: the ECellView * @model_col: the column in the model * @view_col: the column in the view @@ -507,8 +575,13 @@ e_cell_free_state (ECellView *ecell_view, gint row, gpointer save_state) { - if (ECVIEW_EC_CLASS (ecell_view)->free_state) - ECVIEW_EC_CLASS (ecell_view)->free_state (ecell_view, model_col, view_col, row, save_state); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->free_state != NULL) + class->free_state ( + ecell_view, model_col, view_col, row, save_state); } /** @@ -525,8 +598,12 @@ e_cell_max_width (ECellView *ecell_view, gint model_col, gint view_col) { - return ECVIEW_EC_CLASS (ecell_view)->max_width - (ecell_view, model_col, view_col); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + g_return_val_if_fail (class->max_width != NULL, 0); + + return class->max_width (ecell_view, model_col, view_col); } /** @@ -545,11 +622,14 @@ e_cell_max_width_by_row (ECellView *ecell_view, gint view_col, gint row) { - if (ECVIEW_EC_CLASS (ecell_view)->max_width_by_row) - return ECVIEW_EC_CLASS (ecell_view)->max_width_by_row - (ecell_view, model_col, view_col, row); - else + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->max_width_by_row == NULL) return e_cell_max_width (ecell_view, model_col, view_col); + + return class->max_width_by_row (ecell_view, model_col, view_col, row); } /** @@ -565,24 +645,36 @@ e_cell_max_width_by_row (ECellView *ecell_view, gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view) { - return (ECVIEW_EC_CLASS (ecell_view)->max_width_by_row != NULL); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + return (class->max_width_by_row != NULL); } gchar * e_cell_get_bg_color (ECellView *ecell_view, gint row) { - if (ECVIEW_EC_CLASS (ecell_view)->get_bg_color) - return ECVIEW_EC_CLASS (ecell_view)->get_bg_color (ecell_view, row); - else + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->get_bg_color == NULL) return NULL; + + return class->get_bg_color (ecell_view, row); } void e_cell_style_set (ECellView *ecell_view, GtkStyle *previous_style) { - if (ECVIEW_EC_CLASS (ecell_view)->style_set) - ECVIEW_EC_CLASS (ecell_view)->style_set (ecell_view, previous_style); + ECellClass *class; + + class = E_CELL_GET_CLASS (ecell_view->ecell); + + if (class->style_set != NULL) + class->style_set (ecell_view, previous_style); } diff --git a/widgets/table/e-popup-menu.c b/widgets/table/e-popup-menu.c index a4cfec07e9..faffd9d1a0 100644 --- a/widgets/table/e-popup-menu.c +++ b/widgets/table/e-popup-menu.c @@ -94,9 +94,10 @@ e_popup_menu_create_with_domain (EPopupMenu *menu_list, gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); if (menu_list[i].fn) - g_signal_connect (item, "activate", - G_CALLBACK (menu_list[i].fn), - default_closure); + g_signal_connect ( + item, "activate", + G_CALLBACK (menu_list[i].fn), + default_closure); if (menu_list[i].disable_mask & disable_mask) gtk_widget_set_sensitive (item, FALSE); diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 8defc2c479..8cb7d060a9 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -387,8 +387,9 @@ finish_editing (ETableClickToAdd *etcta) "cursor_mode", E_CURSOR_SPREADSHEET, NULL); - g_signal_connect (etcta->row, "key_press", - G_CALLBACK (item_key_press), etcta); + g_signal_connect ( + etcta->row, "key_press", + G_CALLBACK (item_key_press), etcta); set_initial_selection (etcta); } @@ -436,8 +437,9 @@ etcta_event (GnomeCanvasItem *item, "cursor_mode", E_CURSOR_SPREADSHEET, NULL); - g_signal_connect (etcta->row, "key_press", - G_CALLBACK (item_key_press), etcta); + g_signal_connect ( + etcta->row, "key_press", + G_CALLBACK (item_key_press), etcta); e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etcta->row), TRUE); @@ -596,8 +598,9 @@ etcta_init (ETableClickToAdd *etcta) etcta->height = 6; etcta->selection = e_table_selection_model_new (); - g_signal_connect (etcta->selection, "cursor_changed", - G_CALLBACK (etcta_cursor_change), etcta); + g_signal_connect ( + etcta->selection, "cursor_changed", + G_CALLBACK (etcta_cursor_change), etcta); e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (etcta), etcta_reflow); diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 4e9fe81117..728616db3b 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -1197,13 +1197,15 @@ config_button_down (GtkWidget *widget, if (columns == NULL) return; - new_shown = g_new (int, config->temp_state->col_count); - new_expansions = g_new (double, config->temp_state->col_count); + new_shown = g_new (gint, config->temp_state->col_count); + new_expansions = g_new (gdouble, config->temp_state->col_count); column = columns; - next_col = config->temp_state->columns[config->temp_state->col_count - 1]; - next_expansion = config->temp_state->expansions[config->temp_state->col_count - 1]; + next_col = + config->temp_state->columns[config->temp_state->col_count - 1]; + next_expansion = + config->temp_state->expansions[config->temp_state->col_count - 1]; for (i = config->temp_state->col_count - 1; i > 0; i--) { if (column && (GPOINTER_TO_INT (column->data) == i - 1)) { @@ -1352,8 +1354,9 @@ setup_gui (ETableConfig *config) g_object_weak_ref (G_OBJECT (config->dialog_toplevel), dialog_destroyed, config); - g_signal_connect (config->dialog_toplevel, "response", - G_CALLBACK (dialog_response), config); + g_signal_connect ( + config->dialog_toplevel, "response", + G_CALLBACK (dialog_response), config); g_object_unref (builder); } diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index f3e55cf8cf..d39677bbc8 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -43,6 +43,10 @@ #include "e-table-extras.h" #include "e-table-sorting-utils.h" +#define E_TABLE_EXTRAS_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_EXTRAS, ETableExtrasPrivate)) + struct _ETableExtrasPrivate { GHashTable *cells; GHashTable *compares; @@ -59,7 +63,7 @@ ete_finalize (GObject *object) { ETableExtrasPrivate *priv; - priv = E_TABLE_EXTRAS (object)->priv; + priv = E_TABLE_EXTRAS_GET_PRIVATE (object); if (priv->cells) { g_hash_table_destroy (priv->cells); @@ -237,8 +241,7 @@ ete_init (ETableExtras *extras) { ECell *cell, *sub_cell; - extras->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - extras, E_TYPE_TABLE_EXTRAS, ETableExtrasPrivate); + extras->priv = E_TABLE_EXTRAS_GET_PRIVATE (extras); extras->priv->cells = g_hash_table_new_full ( g_str_hash, g_str_equal, diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c index 354095b0c8..5b99c3a79f 100644 --- a/widgets/table/e-table-field-chooser-dialog.c +++ b/widgets/table/e-table-field-chooser-dialog.c @@ -32,12 +32,6 @@ #include "e-table-field-chooser-dialog.h" -static void e_table_field_chooser_dialog_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void e_table_field_chooser_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void e_table_field_chooser_dialog_dispose (GObject *object); -static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id); - -/* The arguments we take */ enum { PROP_0, PROP_DND_CODE, @@ -45,105 +39,10 @@ enum { PROP_HEADER }; -G_DEFINE_TYPE (ETableFieldChooserDialog, e_table_field_chooser_dialog, GTK_TYPE_DIALOG) - -static void -e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *class) -{ - GObjectClass *object_class; - GtkDialogClass *dialog_class; - - 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; - object_class->get_property = e_table_field_chooser_dialog_get_property; - - dialog_class->response = e_table_field_chooser_dialog_response; - - g_object_class_install_property (object_class, PROP_DND_CODE, - g_param_spec_string ("dnd_code", - "DnD code", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FULL_HEADER, - g_param_spec_object ("full_header", - "Full Header", - NULL, - E_TYPE_TABLE_HEADER, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEADER, - g_param_spec_object ("header", - "Header", - NULL, - E_TYPE_TABLE_HEADER, - G_PARAM_READWRITE)); -} - -static void -e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog) -{ - GtkDialog *dialog; - GtkWidget *content_area; - GtkWidget *widget; - - dialog = GTK_DIALOG (e_table_field_chooser_dialog); - - e_table_field_chooser_dialog->etfc = NULL; - e_table_field_chooser_dialog->dnd_code = g_strdup(""); - e_table_field_chooser_dialog->full_header = NULL; - e_table_field_chooser_dialog->header = NULL; - - gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK); - - gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); - - widget = e_table_field_chooser_new (); - e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER (widget); - - g_object_set (widget, - "dnd_code", e_table_field_chooser_dialog->dnd_code, - "full_header", e_table_field_chooser_dialog->full_header, - "header", e_table_field_chooser_dialog->header, - NULL); - - content_area = gtk_dialog_get_content_area (dialog); - gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0); - - gtk_widget_show (GTK_WIDGET (widget)); - - gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column")); -} - -GtkWidget * -e_table_field_chooser_dialog_new (void) -{ - return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, NULL); -} - -static void -e_table_field_chooser_dialog_dispose (GObject *object) -{ - ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object); - - if (etfcd->dnd_code) - g_free (etfcd->dnd_code); - etfcd->dnd_code = NULL; - - if (etfcd->full_header) - g_object_unref (etfcd->full_header); - etfcd->full_header = NULL; - - if (etfcd->header) - g_object_unref (etfcd->header); - etfcd->header = NULL; - - G_OBJECT_CLASS (e_table_field_chooser_dialog_parent_class)->dispose (object); -} +G_DEFINE_TYPE ( + ETableFieldChooserDialog, + e_table_field_chooser_dialog, + GTK_TYPE_DIALOG) static void e_table_field_chooser_dialog_set_property (GObject *object, @@ -217,6 +116,26 @@ e_table_field_chooser_dialog_get_property (GObject *object, } } +static void +e_table_field_chooser_dialog_dispose (GObject *object) +{ + ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object); + + if (etfcd->dnd_code) + g_free (etfcd->dnd_code); + etfcd->dnd_code = NULL; + + if (etfcd->full_header) + g_object_unref (etfcd->full_header); + etfcd->full_header = NULL; + + if (etfcd->header) + g_object_unref (etfcd->header); + etfcd->header = NULL; + + G_OBJECT_CLASS (e_table_field_chooser_dialog_parent_class)->dispose (object); +} + static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id) @@ -224,3 +143,90 @@ e_table_field_chooser_dialog_response (GtkDialog *dialog, if (id == GTK_RESPONSE_OK) gtk_widget_destroy (GTK_WIDGET (dialog)); } + +static void +e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *class) +{ + GObjectClass *object_class; + GtkDialogClass *dialog_class; + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = e_table_field_chooser_dialog_set_property; + object_class->get_property = e_table_field_chooser_dialog_get_property; + object_class->dispose = e_table_field_chooser_dialog_dispose; + + dialog_class = GTK_DIALOG_CLASS (class); + dialog_class->response = e_table_field_chooser_dialog_response; + + g_object_class_install_property ( + object_class, + PROP_DND_CODE, + g_param_spec_string ( + "dnd_code", + "DnD code", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FULL_HEADER, + g_param_spec_object ( + "full_header", + "Full Header", + NULL, + E_TYPE_TABLE_HEADER, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HEADER, + g_param_spec_object ( + "header", + "Header", + NULL, + E_TYPE_TABLE_HEADER, + G_PARAM_READWRITE)); +} + +static void +e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog) +{ + GtkDialog *dialog; + GtkWidget *content_area; + GtkWidget *widget; + + dialog = GTK_DIALOG (e_table_field_chooser_dialog); + + e_table_field_chooser_dialog->etfc = NULL; + e_table_field_chooser_dialog->dnd_code = g_strdup(""); + e_table_field_chooser_dialog->full_header = NULL; + e_table_field_chooser_dialog->header = NULL; + + gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_OK); + + gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); + + widget = e_table_field_chooser_new (); + e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER (widget); + + g_object_set (widget, + "dnd_code", e_table_field_chooser_dialog->dnd_code, + "full_header", e_table_field_chooser_dialog->full_header, + "header", e_table_field_chooser_dialog->header, + NULL); + + content_area = gtk_dialog_get_content_area (dialog); + gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0); + + gtk_widget_show (GTK_WIDGET (widget)); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Add a Column")); +} + +GtkWidget * +e_table_field_chooser_dialog_new (void) +{ + return g_object_new (E_TYPE_TABLE_FIELD_CHOOSER_DIALOG, NULL); +} + diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 4dd1caab07..45881d4c03 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -301,9 +301,11 @@ etfci_drop_table_header (ETableFieldChooserItem *etfci) header = G_OBJECT (etfci->header); if (etfci->table_header_structure_change_id) - g_signal_handler_disconnect (header, etfci->table_header_structure_change_id); + g_signal_handler_disconnect ( + header, etfci->table_header_structure_change_id); if (etfci->table_header_dimension_change_id) - g_signal_handler_disconnect (header, etfci->table_header_dimension_change_id); + g_signal_handler_disconnect ( + header, etfci->table_header_dimension_change_id); etfci->table_header_structure_change_id = 0; etfci->table_header_dimension_change_id = 0; diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 5e2cb13880..6c1a9ab365 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -202,18 +202,18 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) "dnd_code", etfc->dnd_code, NULL ); - g_signal_connect ( etfc->canvas, "reflow", - G_CALLBACK ( resize ), - etfc); + g_signal_connect ( + etfc->canvas, "reflow", + G_CALLBACK (resize), etfc); - gnome_canvas_set_scroll_region ( GNOME_CANVAS ( etfc->canvas ), - 0, 0, - 100, 100 ); + gnome_canvas_set_scroll_region ( + GNOME_CANVAS (etfc->canvas), + 0, 0, 100, 100 ); /* Connect the signals */ - g_signal_connect (etfc->canvas, "size_allocate", - G_CALLBACK (allocate_callback), - etfc); + g_signal_connect ( + etfc->canvas, "size_allocate", + G_CALLBACK (allocate_callback), etfc); gtk_widget_show_all (widget); } diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 7d04eda9d9..2649f9bf79 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -481,20 +481,27 @@ create_child_node (ETableGroupContainer *etgc, "minimum_width", etgc->minimum_width - GROUP_INDENT, NULL); - g_signal_connect (child, "cursor_change", - G_CALLBACK (child_cursor_change), etgc); - g_signal_connect (child, "cursor_activated", - G_CALLBACK (child_cursor_activated), etgc); - g_signal_connect (child, "double_click", - G_CALLBACK (child_double_click), etgc); - g_signal_connect (child, "right_click", - G_CALLBACK (child_right_click), etgc); - g_signal_connect (child, "click", - G_CALLBACK (child_click), etgc); - g_signal_connect (child, "key_press", - G_CALLBACK (child_key_press), etgc); - g_signal_connect (child, "start_drag", - G_CALLBACK (child_start_drag), etgc); + g_signal_connect ( + child, "cursor_change", + G_CALLBACK (child_cursor_change), etgc); + g_signal_connect ( + child, "cursor_activated", + G_CALLBACK (child_cursor_activated), etgc); + g_signal_connect ( + child, "double_click", + G_CALLBACK (child_double_click), etgc); + g_signal_connect ( + child, "right_click", + G_CALLBACK (child_right_click), etgc); + g_signal_connect ( + child, "click", + G_CALLBACK (child_click), etgc); + g_signal_connect ( + child, "key_press", + G_CALLBACK (child_key_press), etgc); + g_signal_connect ( + child, "start_drag", + G_CALLBACK (child_start_drag), etgc); child_node->child = child; child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val); child_node->string = e_table_model_value_to_string (etg->model, etgc->ecol->col_idx, val); @@ -1560,29 +1567,30 @@ etgc_get_printable (ETableGroup *etg) groupcontext->child = etgc->children; groupcontext->child_printable = NULL; - g_signal_connect (printable, - "print_page", - G_CALLBACK (e_table_group_container_print_page), - groupcontext); - g_signal_connect (printable, - "data_left", - G_CALLBACK (e_table_group_container_data_left), - groupcontext); - g_signal_connect (printable, - "reset", - G_CALLBACK (e_table_group_container_reset), - groupcontext); - g_signal_connect (printable, - "height", - G_CALLBACK (e_table_group_container_height), - groupcontext); - g_signal_connect (printable, - "will_fit", - G_CALLBACK (e_table_group_container_will_fit), - groupcontext); - g_object_weak_ref (G_OBJECT (printable), - e_table_group_container_printable_destroy, - groupcontext); + g_signal_connect ( + printable, "print_page", + G_CALLBACK (e_table_group_container_print_page), + groupcontext); + g_signal_connect ( + printable, "data_left", + G_CALLBACK (e_table_group_container_data_left), + groupcontext); + g_signal_connect ( + printable, "reset", + G_CALLBACK (e_table_group_container_reset), + groupcontext); + g_signal_connect ( + printable, "height", + G_CALLBACK (e_table_group_container_height), + groupcontext); + g_signal_connect ( + printable, "will_fit", + G_CALLBACK (e_table_group_container_will_fit), + groupcontext); + g_object_weak_ref ( + G_OBJECT (printable), + e_table_group_container_printable_destroy, + groupcontext); return printable; } diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 27a62bbb16..aface8e697 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -297,35 +297,33 @@ etgl_realize (GnomeCanvasItem *item) "uniform_row_height", etgl->uniform_row_height, NULL)); - etgl->etgl_cursor_change_id = g_signal_connect (etgl->item, - "cursor_change", - G_CALLBACK (etgl_cursor_change), - etgl); - etgl->etgl_cursor_activated_id = g_signal_connect (etgl->item, - "cursor_activated", - G_CALLBACK (etgl_cursor_activated), - etgl); - etgl->etgl_double_click_id = g_signal_connect (etgl->item, - "double_click", - G_CALLBACK (etgl_double_click), - etgl); - - etgl->etgl_right_click_id = g_signal_connect (etgl->item, - "right_click", - G_CALLBACK (etgl_right_click), - etgl); - etgl->etgl_click_id = g_signal_connect (etgl->item, - "click", - G_CALLBACK (etgl_click), - etgl); - etgl->etgl_key_press_id = g_signal_connect (etgl->item, - "key_press", - G_CALLBACK (etgl_key_press), - etgl); - etgl->etgl_start_drag_id = g_signal_connect (etgl->item, - "start_drag", - G_CALLBACK (etgl_start_drag), - etgl); + etgl->etgl_cursor_change_id = g_signal_connect ( + etgl->item, "cursor_change", + G_CALLBACK (etgl_cursor_change), etgl); + + etgl->etgl_cursor_activated_id = g_signal_connect ( + etgl->item, "cursor_activated", + G_CALLBACK (etgl_cursor_activated), etgl); + + etgl->etgl_double_click_id = g_signal_connect ( + etgl->item, "double_click", + G_CALLBACK (etgl_double_click), etgl); + + etgl->etgl_right_click_id = g_signal_connect ( + etgl->item, "right_click", + G_CALLBACK (etgl_right_click), etgl); + + etgl->etgl_click_id = g_signal_connect ( + etgl->item, "click", + G_CALLBACK (etgl_click), etgl); + + etgl->etgl_key_press_id = g_signal_connect ( + etgl->item, "key_press", + G_CALLBACK (etgl_key_press), etgl); + + etgl->etgl_start_drag_id = g_signal_connect ( + etgl->item, "start_drag", + G_CALLBACK (etgl_start_drag), etgl); e_canvas_item_request_reflow (item); } @@ -647,89 +645,127 @@ etgl_class_init (ETableGroupLeafClass *class) e_group_class->get_mouse_over = etgl_get_mouse_over; e_group_class->get_cell_geometry = etgl_get_cell_geometry; - g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS, - g_param_spec_boolean ("alternating_row_colors", - "Alternating Row Colors", - "Alternating Row Colors", - FALSE, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_TABLE_HORIZONTAL_DRAW_GRID, - g_param_spec_boolean ("horizontal_draw_grid", - "Horizontal Draw Grid", - "Horizontal Draw Grid", - FALSE, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_TABLE_VERTICAL_DRAW_GRID, - g_param_spec_boolean ("vertical_draw_grid", - "Vertical Draw Grid", - "Vertical Draw Grid", - FALSE, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_TABLE_DRAW_FOCUS, - g_param_spec_boolean ("drawfocus", - "Draw focus", - "Draw focus", - FALSE, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_CURSOR_MODE, - g_param_spec_int ("cursor_mode", - "Cursor mode", - "Cursor mode", - E_CURSOR_LINE, E_CURSOR_SPREADSHEET, E_CURSOR_LINE, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD, - g_param_spec_int ("length_threshold", - "Length Threshold", - "Length Threshold", - -1, G_MAXINT, 0, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_SELECTION_MODEL, - g_param_spec_object ("selection_model", - "Selection model", - "Selection model", - E_TYPE_SELECTION_MODEL, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - "Height", - "Height", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - "Width", - "Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH, - g_param_spec_double ("minimum_width", - "Minimum width", - "Minimum Width", - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FROZEN, - g_param_spec_boolean ("frozen", - "Frozen", - "Frozen", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT, - g_param_spec_boolean ("uniform_row_height", - "Uniform row height", - "Uniform row height", - FALSE, - G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_TABLE_ALTERNATING_ROW_COLORS, + g_param_spec_boolean ( + "alternating_row_colors", + "Alternating Row Colors", + "Alternating Row Colors", + FALSE, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_TABLE_HORIZONTAL_DRAW_GRID, + g_param_spec_boolean ( + "horizontal_draw_grid", + "Horizontal Draw Grid", + "Horizontal Draw Grid", + FALSE, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_TABLE_VERTICAL_DRAW_GRID, + g_param_spec_boolean ( + "vertical_draw_grid", + "Vertical Draw Grid", + "Vertical Draw Grid", + FALSE, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_TABLE_DRAW_FOCUS, + g_param_spec_boolean ( + "drawfocus", + "Draw focus", + "Draw focus", + FALSE, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_CURSOR_MODE, + g_param_spec_int ( + "cursor_mode", + "Cursor mode", + "Cursor mode", + E_CURSOR_LINE, + E_CURSOR_SPREADSHEET, + E_CURSOR_LINE, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_LENGTH_THRESHOLD, + g_param_spec_int ( + "length_threshold", + "Length Threshold", + "Length Threshold", + -1, G_MAXINT, 0, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_SELECTION_MODEL, + g_param_spec_object ( + "selection_model", + "Selection model", + "Selection model", + E_TYPE_SELECTION_MODEL, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_HEIGHT, + g_param_spec_double ( + "height", + "Height", + "Height", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + object_class, + PROP_WIDTH, + g_param_spec_double ( + "width", + "Width", + "Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MINIMUM_WIDTH, + g_param_spec_double ( + "minimum_width", + "Minimum width", + "Minimum Width", + 0.0, G_MAXDOUBLE, 0.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FROZEN, + g_param_spec_boolean ( + "frozen", + "Frozen", + "Frozen", + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_UNIFORM_ROW_HEIGHT, + g_param_spec_boolean ( + "uniform_row_height", + "Uniform row height", + "Uniform row height", + FALSE, + G_PARAM_READWRITE)); } static void diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 43871a278a..780720e1aa 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -121,9 +121,11 @@ ethi_dispose (GObject *object) if (ethi->sort_info) { if (ethi->sort_info_changed_id) - g_signal_handler_disconnect (ethi->sort_info, ethi->sort_info_changed_id); + g_signal_handler_disconnect ( + ethi->sort_info, ethi->sort_info_changed_id); if (ethi->group_info_changed_id) - g_signal_handler_disconnect (ethi->sort_info, ethi->group_info_changed_id); + g_signal_handler_disconnect ( + ethi->sort_info, ethi->group_info_changed_id); g_object_unref (ethi->sort_info); ethi->sort_info = NULL; } @@ -205,22 +207,18 @@ ethi_update (GnomeCanvasItem *item, if (item->x1 != x1 || item->y1 != y1 || item->x2 != x2 || - item->y2 != y2) - { - gnome_canvas_request_redraw ( - item->canvas, - item->x1, item->y1, - item->x2, item->y2); - item->x1 = x1; - item->y1 = y1; - item->x2 = x2; - item->y2 = y2; -/* FIXME: Group Child bounds !? (FOO BAA) */ -#if 0 - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); -#endif - } - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); + item->y2 != y2) { + gnome_canvas_request_redraw ( + item->canvas, + item->x1, item->y1, + item->x2, item->y2); + item->x1 = x1; + item->y1 = y1; + item->x2 = x2; + item->y2 = y2; + } + gnome_canvas_request_redraw ( + item->canvas, item->x1, item->y1, item->x2, item->y2); } static void @@ -835,9 +833,15 @@ ethi_drag_data_received (GtkWidget *canvas, if (!found) { count = e_table_header_count (ethi->full_header); for (i = 0; i < count; i++) { - ETableCol *ecol = e_table_header_get_column (ethi->full_header, i); + ETableCol *ecol; + + ecol = e_table_header_get_column ( + ethi->full_header, i); + if (ecol->col_idx == column) { - e_table_header_add_column (ethi->eth, ecol, drop_col); + e_table_header_add_column ( + ethi->eth, ecol, + drop_col); break; } } @@ -893,7 +897,10 @@ ethi_drag_drop (GtkWidget *canvas, gchar *target = g_strdup_printf ( "%s-%s", TARGET_ETABLE_COL_TYPE, ethi->dnd_code); d(g_print ("ethi - %s\n", target)); - gtk_drag_get_data (canvas, context, gdk_atom_intern (target, FALSE), time); + gtk_drag_get_data ( + canvas, context, + gdk_atom_intern (target, FALSE), + time); g_free (target); } } @@ -941,20 +948,26 @@ ethi_realize (GnomeCanvasItem *item) g_free ((gpointer) ethi_drop_types[0].target); /* Drop signals */ - ethi->drag_motion_id = g_signal_connect (item->canvas, "drag_motion", - G_CALLBACK (ethi_drag_motion), ethi); - ethi->drag_leave_id = g_signal_connect (item->canvas, "drag_leave", - G_CALLBACK (ethi_drag_leave), ethi); - ethi->drag_drop_id = g_signal_connect (item->canvas, "drag_drop", - G_CALLBACK (ethi_drag_drop), ethi); - ethi->drag_data_received_id = g_signal_connect (item->canvas, "drag_data_received", - G_CALLBACK (ethi_drag_data_received), ethi); + ethi->drag_motion_id = g_signal_connect ( + item->canvas, "drag_motion", + G_CALLBACK (ethi_drag_motion), ethi); + ethi->drag_leave_id = g_signal_connect ( + item->canvas, "drag_leave", + G_CALLBACK (ethi_drag_leave), ethi); + ethi->drag_drop_id = g_signal_connect ( + item->canvas, "drag_drop", + G_CALLBACK (ethi_drag_drop), ethi); + ethi->drag_data_received_id = g_signal_connect ( + item->canvas, "drag_data_received", + G_CALLBACK (ethi_drag_data_received), ethi); /* Drag signals */ - ethi->drag_end_id = g_signal_connect (item->canvas, "drag_end", - G_CALLBACK (ethi_drag_end), ethi); - ethi->drag_data_get_id = g_signal_connect (item->canvas, "drag_data_get", - G_CALLBACK (ethi_drag_data_get), ethi); + ethi->drag_end_id = g_signal_connect ( + item->canvas, "drag_end", + G_CALLBACK (ethi_drag_end), ethi); + ethi->drag_data_get_id = g_signal_connect ( + item->canvas, "drag_data_get", + G_CALLBACK (ethi_drag_data_get), ethi); } @@ -1699,7 +1712,9 @@ ethi_header_context_menu (ETableHeaderItem *ethi, if (sort_col == -1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_item), TRUE); - g_signal_connect (menu_item, "activate", G_CALLBACK (popup_custom), info); + g_signal_connect ( + menu_item, "activate", + G_CALLBACK (popup_custom), info); /* Show a seperator */ menu_item = gtk_separator_menu_item_new (); @@ -1729,15 +1744,22 @@ ethi_header_context_menu (ETableHeaderItem *ethi, gtk_menu_shell_prepend (GTK_MENU_SHELL (sub_menu), menu_item); if (ncol == sort_col) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); - gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (menu_item), TRUE); - g_object_set_data (G_OBJECT (menu_item), "col-number", GINT_TO_POINTER (ncol)); - g_signal_connect (menu_item, "activate", G_CALLBACK (sort_by_id), ethi); + gtk_check_menu_item_set_active ( + GTK_CHECK_MENU_ITEM (menu_item), TRUE); + gtk_check_menu_item_set_draw_as_radio ( + GTK_CHECK_MENU_ITEM (menu_item), TRUE); + g_object_set_data ( + G_OBJECT (menu_item), "col-number", + GINT_TO_POINTER (ncol)); + g_signal_connect ( + menu_item, "activate", + G_CALLBACK (sort_by_id), ethi); } g_object_ref_sink (popup); - g_signal_connect (popup, "selection-done", - G_CALLBACK (free_popup_info), info); + g_signal_connect ( + popup, "selection-done", + G_CALLBACK (free_popup_info), info); gtk_menu_popup ( GTK_MENU (popup), @@ -1806,15 +1828,18 @@ ethi_change_sort_state (ETableHeaderItem *ethi, for (j = i + 1; j < length; j++) e_table_sort_info_sorting_set_nth ( ethi->sort_info, j - 1, - e_table_sort_info_sorting_get_nth (ethi->sort_info, j)); + e_table_sort_info_sorting_get_nth ( + ethi->sort_info, j)); - e_table_sort_info_sorting_truncate (ethi->sort_info, length - 1); + e_table_sort_info_sorting_truncate ( + ethi->sort_info, length - 1); length--; i--; } else { ascending = !ascending; column.ascending = ascending; - e_table_sort_info_sorting_set_nth (ethi->sort_info, i, column); + e_table_sort_info_sorting_set_nth ( + ethi->sort_info, i, column); } found = TRUE; if (model_col != -1) @@ -1891,7 +1916,8 @@ ethi_event (GnomeCanvasItem *item, convert (canvas, e->button.x, e->button.y, &x, &y); - if (is_pointer_on_division (ethi, x, &start, &col) && e->button.button == 1) { + if (is_pointer_on_division (ethi, x, &start, &col) && + e->button.button == 1) { ETableCol *ecol; /* @@ -1991,8 +2017,9 @@ ethi_event (GnomeCanvasItem *item, ethi->sort_info)) ? 0 : 16) + 128, info, GETTEXT_PACKAGE); g_object_ref_sink (popup); - g_signal_connect (popup, "selection-done", - G_CALLBACK (free_popup_info), info); + g_signal_connect ( + popup, "selection-done", + G_CALLBACK (free_popup_info), info); gtk_menu_popup ( GTK_MENU (popup), NULL, NULL, NULL, NULL, diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c index df5ee66b56..038a44a938 100644 --- a/widgets/table/e-table-header-utils.c +++ b/widgets/table/e-table-header-utils.c @@ -162,8 +162,12 @@ e_table_header_draw_button (cairo_t *cr, /* Inside area */ - inner_width = button_width - (padding.left + padding.right + 2 * HEADER_PADDING); - inner_height = button_height - (padding.top + padding.bottom + 2 * HEADER_PADDING); + inner_width = + button_width - + (padding.left + padding.right + 2 * HEADER_PADDING); + inner_height = + button_height - + (padding.top + padding.bottom + 2 * HEADER_PADDING); if (inner_width < 1 || inner_height < 1) { return; /* nothing fits */ diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index aab0971518..2045896532 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -902,7 +902,8 @@ eth_calc_widths (ETableHeader *eth) widths[i] = eth->columns[i]->min_width + eth->width_extras; } if (eth->sort_info) - extra -= e_table_sort_info_grouping_get_count (eth->sort_info) * GROUP_INDENT; + extra -= e_table_sort_info_grouping_get_count (eth->sort_info) + * GROUP_INDENT; if (expansion != 0 && extra > 0) { for (i = 0; i < last_resizable; i++) { next_position += diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 25ea433a66..7fb6bec9e1 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1760,7 +1760,9 @@ eti_realize (GnomeCanvasItem *item) eti->rows = e_table_model_row_count (eti->table_model); - g_signal_connect (GTK_LAYOUT(item->canvas), "scroll_event", G_CALLBACK (eti_tree_unfreeze), eti); + g_signal_connect ( + item->canvas, "scroll_event", + G_CALLBACK (eti_tree_unfreeze), eti); if (eti->cell_views == NULL) eti_attach_cell_views (eti); @@ -3780,29 +3782,25 @@ e_table_item_get_printable (ETableItem *item) g_object_ref (item); itemcontext->rows_printed = 0; - g_signal_connect (printable, - "print_page", - G_CALLBACK (e_table_item_print_page), - itemcontext); - g_signal_connect (printable, - "data_left", - G_CALLBACK (e_table_item_data_left), - itemcontext); - g_signal_connect (printable, - "reset", - G_CALLBACK (e_table_item_reset), - itemcontext); - g_signal_connect (printable, - "height", - G_CALLBACK (e_table_item_height), - itemcontext); - g_signal_connect (printable, - "will_fit", - G_CALLBACK (e_table_item_will_fit), - itemcontext); - g_object_weak_ref (G_OBJECT (printable), - e_table_item_printable_destroy, - itemcontext); + g_signal_connect ( + printable, "print_page", + G_CALLBACK (e_table_item_print_page), itemcontext); + g_signal_connect ( + printable, "data_left", + G_CALLBACK (e_table_item_data_left), itemcontext); + g_signal_connect ( + printable, "reset", + G_CALLBACK (e_table_item_reset), itemcontext); + g_signal_connect ( + printable, "height", + G_CALLBACK (e_table_item_height), itemcontext); + g_signal_connect ( + printable, "will_fit", + G_CALLBACK (e_table_item_will_fit), itemcontext); + + g_object_weak_ref ( + G_OBJECT (printable), + e_table_item_printable_destroy, itemcontext); return printable; } diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c index 55f96f5862..56c1dee33b 100644 --- a/widgets/table/e-table-memory-store.c +++ b/widgets/table/e-table-memory-store.c @@ -30,6 +30,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 { @@ -250,7 +254,7 @@ etms_finalize (GObject *object) { ETableMemoryStorePrivate *priv; - priv = E_TABLE_MEMORY_STORE (object)->priv; + priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (object); e_table_memory_store_clear (E_TABLE_MEMORY_STORE (object)); @@ -264,8 +268,7 @@ etms_finalize (GObject *object) static void e_table_memory_store_init (ETableMemoryStore *etms) { - etms->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etms, E_TYPE_TABLE_MEMORY_STORE, ETableMemoryStorePrivate); + etms->priv = E_TABLE_MEMORY_STORE_GET_PRIVATE (etms); } static void diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index 6fe853e6bb..e14997c92b 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -39,6 +39,10 @@ #include "e-table-memory.h" +#define E_TABLE_MEMORY_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_MEMORY, ETableMemoryPrivate)) + G_DEFINE_TYPE (ETableMemory, e_table_memory, E_TYPE_TABLE_MODEL) struct _ETableMemoryPrivate { @@ -52,7 +56,7 @@ etmm_finalize (GObject *object) { ETableMemoryPrivate *priv; - priv = E_TABLE_MEMORY (object)->priv; + priv = E_TABLE_MEMORY_GET_PRIVATE (object); g_free (priv->data); @@ -86,8 +90,7 @@ e_table_memory_class_init (ETableMemoryClass *class) static void e_table_memory_init (ETableMemory *etmm) { - etmm->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etmm, E_TYPE_TABLE_MEMORY, ETableMemoryPrivate); + etmm->priv = E_TABLE_MEMORY_GET_PRIVATE (etmm); } /** diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index 6f44379858..15b5286eb7 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -29,8 +29,8 @@ #include "e-table-model.h" -#define ETM_CLASS(e) (E_TABLE_MODEL_GET_CLASS (e)) -#define ETM_FROZEN(e) (GPOINTER_TO_INT (g_object_get_data (G_OBJECT(e), "frozen")) != 0) +#define ETM_FROZEN(e) \ + (GPOINTER_TO_INT (g_object_get_data (G_OBJECT(e), "frozen")) != 0) #define d(x) @@ -50,7 +50,7 @@ enum { LAST_SIGNAL }; -static guint e_table_model_signals[LAST_SIGNAL] = { 0, }; +static guint signals[LAST_SIGNAL] = { 0, }; /** * e_table_model_column_count: @@ -61,10 +61,14 @@ static guint e_table_model_signals[LAST_SIGNAL] = { 0, }; gint e_table_model_column_count (ETableModel *e_table_model) { - g_return_val_if_fail (e_table_model != NULL, 0); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0); - return ETM_CLASS (e_table_model)->column_count (e_table_model); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + g_return_val_if_fail (class->column_count != NULL, 0); + + return class->column_count (e_table_model); } /** @@ -76,10 +80,14 @@ e_table_model_column_count (ETableModel *e_table_model) gint e_table_model_row_count (ETableModel *e_table_model) { - g_return_val_if_fail (e_table_model != NULL, 0); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0); - return ETM_CLASS (e_table_model)->row_count (e_table_model); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + g_return_val_if_fail (class->row_count != NULL, 0); + + return class->row_count (e_table_model); } /** @@ -94,11 +102,14 @@ e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, gint row) { - g_return_if_fail (e_table_model != NULL); + ETableModelClass *class; + g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - if (ETM_CLASS (e_table_model)->append_row) - ETM_CLASS (e_table_model)->append_row (e_table_model, source, row); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->append_row != NULL) + class->append_row (e_table_model, source, row); } /** @@ -125,10 +136,14 @@ e_table_model_value_at (ETableModel *e_table_model, gint col, gint row) { - g_return_val_if_fail (e_table_model != NULL, NULL); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - return ETM_CLASS (e_table_model)->value_at (e_table_model, col, row); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + g_return_val_if_fail (class->value_at != NULL, NULL); + + return class->value_at (e_table_model, col, row); } /** @@ -152,10 +167,14 @@ e_table_model_set_value_at (ETableModel *e_table_model, gint row, gconstpointer value) { - g_return_if_fail (e_table_model != NULL); + ETableModelClass *class; + g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, value); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + g_return_if_fail (class->set_value_at != NULL); + + class->set_value_at (e_table_model, col, row, value); } /** @@ -172,10 +191,14 @@ e_table_model_is_cell_editable (ETableModel *e_table_model, gint col, gint row) { - g_return_val_if_fail (e_table_model != NULL, FALSE); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + g_return_val_if_fail (class->is_cell_editable != NULL, FALSE); + + return class->is_cell_editable (e_table_model, col, row); } gpointer @@ -183,13 +206,16 @@ e_table_model_duplicate_value (ETableModel *e_table_model, gint col, gconstpointer value) { - g_return_val_if_fail (e_table_model != NULL, NULL); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - if (ETM_CLASS (e_table_model)->duplicate_value) - return ETM_CLASS (e_table_model)->duplicate_value (e_table_model, col, value); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->duplicate_value == NULL) return NULL; + + return class->duplicate_value (e_table_model, col, value); } void @@ -197,61 +223,76 @@ e_table_model_free_value (ETableModel *e_table_model, gint col, gpointer value) { - g_return_if_fail (e_table_model != NULL); + ETableModelClass *class; + g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - if (ETM_CLASS (e_table_model)->free_value) - ETM_CLASS (e_table_model)->free_value (e_table_model, col, value); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->free_value != NULL) + class->free_value (e_table_model, col, value); } gboolean e_table_model_has_save_id (ETableModel *e_table_model) { - g_return_val_if_fail (e_table_model != NULL, FALSE); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - if (ETM_CLASS (e_table_model)->has_save_id) - return ETM_CLASS (e_table_model)->has_save_id (e_table_model); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->has_save_id == NULL) return FALSE; + + return class->has_save_id (e_table_model); } gchar * e_table_model_get_save_id (ETableModel *e_table_model, gint row) { - g_return_val_if_fail (e_table_model != NULL, NULL); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - if (ETM_CLASS (e_table_model)->get_save_id) - return ETM_CLASS (e_table_model)->get_save_id (e_table_model, row); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->get_save_id == NULL) return NULL; + + return class->get_save_id (e_table_model, row); } gboolean e_table_model_has_change_pending (ETableModel *e_table_model) { - g_return_val_if_fail (e_table_model != NULL, FALSE); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - if (ETM_CLASS (e_table_model)->has_change_pending) - return ETM_CLASS (e_table_model)->has_change_pending (e_table_model); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->has_change_pending == NULL) return FALSE; + + return class->has_change_pending (e_table_model); } gpointer e_table_model_initialize_value (ETableModel *e_table_model, gint col) { - g_return_val_if_fail (e_table_model != NULL, NULL); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - if (ETM_CLASS (e_table_model)->initialize_value) - return ETM_CLASS (e_table_model)->initialize_value (e_table_model, col); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->initialize_value == NULL) return NULL; + + return class->initialize_value (e_table_model, col); } gboolean @@ -259,13 +300,16 @@ e_table_model_value_is_empty (ETableModel *e_table_model, gint col, gconstpointer value) { - g_return_val_if_fail (e_table_model != NULL, FALSE); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE); - if (ETM_CLASS (e_table_model)->value_is_empty) - return ETM_CLASS (e_table_model)->value_is_empty (e_table_model, col, value); - else + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->value_is_empty == NULL) return FALSE; + + return class->value_is_empty (e_table_model, col, value); } gchar * @@ -273,13 +317,16 @@ e_table_model_value_to_string (ETableModel *e_table_model, gint col, gconstpointer value) { - g_return_val_if_fail (e_table_model != NULL, NULL); + ETableModelClass *class; + g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - if (ETM_CLASS (e_table_model)->value_to_string) - return ETM_CLASS (e_table_model)->value_to_string (e_table_model, col, value); - else - return g_strdup(""); + class = E_TABLE_MODEL_GET_CLASS (e_table_model); + + if (class->value_to_string == NULL) + return g_strdup (""); + + return class->value_to_string (e_table_model, col, value); } static void @@ -287,68 +334,75 @@ e_table_model_class_init (ETableModelClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - e_table_model_signals[MODEL_NO_CHANGE] = - g_signal_new ("model_no_change", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_no_change), - (GSignalAccumulator) NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - e_table_model_signals[MODEL_CHANGED] = - g_signal_new ("model_changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_changed), - (GSignalAccumulator) NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - e_table_model_signals[MODEL_PRE_CHANGE] = - g_signal_new ("model_pre_change", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_pre_change), - (GSignalAccumulator) NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - e_table_model_signals[MODEL_ROW_CHANGED] = - g_signal_new ("model_row_changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_row_changed), - (GSignalAccumulator) NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_table_model_signals[MODEL_CELL_CHANGED] = - g_signal_new ("model_cell_changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_cell_changed), - (GSignalAccumulator) NULL, NULL, - e_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_table_model_signals[MODEL_ROWS_INSERTED] = - g_signal_new ("model_rows_inserted", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted), - (GSignalAccumulator) NULL, NULL, - e_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_table_model_signals[MODEL_ROWS_DELETED] = - g_signal_new ("model_rows_deleted", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted), - (GSignalAccumulator) NULL, NULL, - e_marshal_VOID__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + signals[MODEL_NO_CHANGE] = g_signal_new ( + "model_no_change", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_no_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[MODEL_CHANGED] = g_signal_new ( + "model_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_changed), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[MODEL_PRE_CHANGE] = g_signal_new ( + "model_pre_change", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_pre_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[MODEL_ROW_CHANGED] = g_signal_new ( + "model_row_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_row_changed), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); + + signals[MODEL_CELL_CHANGED] = g_signal_new ( + "model_cell_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_cell_changed), + (GSignalAccumulator) NULL, NULL, + e_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, + G_TYPE_INT, + G_TYPE_INT); + + signals[MODEL_ROWS_INSERTED] = g_signal_new ( + "model_rows_inserted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted), + (GSignalAccumulator) NULL, NULL, + e_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, + G_TYPE_INT, + G_TYPE_INT); + + signals[MODEL_ROWS_DELETED] = g_signal_new ( + "model_rows_deleted", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted), + (GSignalAccumulator) NULL, NULL, + e_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, + G_TYPE_INT, + G_TYPE_INT); class->column_count = NULL; class->row_count = NULL; @@ -396,17 +450,15 @@ print_tabs (void) void e_table_model_pre_change (ETableModel *e_table_model) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (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)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_PRE_CHANGE], 0); + signals[MODEL_PRE_CHANGE], 0); d (depth--); } @@ -426,17 +478,15 @@ e_table_model_pre_change (ETableModel *e_table_model) void e_table_model_no_change (ETableModel *e_table_model) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (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)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_NO_CHANGE], 0); + signals[MODEL_NO_CHANGE], 0); d (depth--); } @@ -456,17 +506,15 @@ e_table_model_no_change (ETableModel *e_table_model) void e_table_model_changed (ETableModel *e_table_model) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (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)->class->type))); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_CHANGED], 0); + signals[MODEL_CHANGED], 0); d (depth--); } @@ -484,17 +532,15 @@ void e_table_model_row_changed (ETableModel *e_table_model, gint row) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (e_table_model)) 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)->class->type), row)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_ROW_CHANGED], 0, row); + signals[MODEL_ROW_CHANGED], 0, row); d (depth--); } @@ -514,17 +560,15 @@ e_table_model_cell_changed (ETableModel *e_table_model, gint col, gint row) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (e_table_model)) 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)->class->type), row, col)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_CELL_CHANGED], 0, col, row); + signals[MODEL_CELL_CHANGED], 0, col, row); d (depth--); } @@ -544,17 +588,15 @@ e_table_model_rows_inserted (ETableModel *e_table_model, gint row, gint count) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (e_table_model)) 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)->class->type), row)); d (depth++); g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_ROWS_INSERTED], 0, row, count); + signals[MODEL_ROWS_INSERTED], 0, row, count); d (depth--); } @@ -590,17 +632,15 @@ e_table_model_rows_deleted (ETableModel *e_table_model, gint row, gint count) { - g_return_if_fail (e_table_model != NULL); g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); if (ETM_FROZEN (e_table_model)) 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)->class->type), row)); d (depth++); - g_signal_emit (G_OBJECT (e_table_model), - e_table_model_signals[MODEL_ROWS_DELETED], 0, row, count); + g_signal_emit ( + e_table_model, signals[MODEL_ROWS_DELETED], 0, row, count); d (depth--); } @@ -624,13 +664,23 @@ void e_table_model_freeze (ETableModel *e_table_model) { e_table_model_pre_change (e_table_model); - g_object_set_data (G_OBJECT (e_table_model), "frozen", GINT_TO_POINTER (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (e_table_model), "frozen")) + 1)); + + /* FIXME This expression is awesome! */ + g_object_set_data ( + G_OBJECT (e_table_model), "frozen", + GINT_TO_POINTER (GPOINTER_TO_INT ( + g_object_get_data (G_OBJECT (e_table_model), "frozen")) + 1)); } void e_table_model_thaw (ETableModel *e_table_model) { - g_object_set_data (G_OBJECT (e_table_model), "frozen", GINT_TO_POINTER (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (e_table_model), "frozen")) - 1)); + /* FIXME This expression is awesome! */ + g_object_set_data ( + G_OBJECT (e_table_model), "frozen", + GINT_TO_POINTER (GPOINTER_TO_INT ( + g_object_get_data (G_OBJECT (e_table_model), "frozen")) - 1)); + e_table_model_changed (e_table_model); } diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 99f282c76f..99a0d7b9ab 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -47,6 +47,10 @@ enum { LAST_SIGNAL }; +#define E_TABLE_SEARCH_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_TABLE_SEARCH, ETableSearchPrivate)) + d (static gint depth = 0) static guint e_table_search_signals[LAST_SIGNAL] = { 0, }; @@ -110,7 +114,7 @@ e_table_search_finalize (GObject *object) { ETableSearchPrivate *priv; - priv = E_TABLE_SEARCH (object)->priv; + priv = E_TABLE_SEARCH_GET_PRIVATE (object); drop_timeout (E_TABLE_SEARCH (object)); @@ -155,8 +159,7 @@ e_table_search_class_init (ETableSearchClass *class) static void e_table_search_init (ETableSearch *ets) { - ets->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - ets, E_TYPE_TABLE_SEARCH, ETableSearchPrivate); + ets->priv = E_TABLE_SEARCH_GET_PRIVATE (ets); ets->priv->search_string = g_strdup (""); } diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 418ce3a5e8..0e6b4623a3 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -134,10 +134,12 @@ ets_set_property (GObject *object, ets->sort_info = E_TABLE_SORT_INFO (g_value_get_object (value)); g_object_ref (ets->sort_info); - ets->sort_info_changed_id = g_signal_connect (ets->sort_info, "sort_info_changed", - G_CALLBACK (ets_sort_info_changed), ets); - ets->group_info_changed_id = g_signal_connect (ets->sort_info, "group_info_changed", - G_CALLBACK (ets_sort_info_changed), ets); + ets->sort_info_changed_id = g_signal_connect ( + ets->sort_info, "sort_info_changed", + G_CALLBACK (ets_sort_info_changed), ets); + ets->group_info_changed_id = g_signal_connect ( + ets->sort_info, "group_info_changed", + G_CALLBACK (ets_sort_info_changed), ets); ets_clean (ets); break; @@ -216,20 +218,33 @@ e_table_sorter_new (ETableModel *source, ets->source = source; g_object_ref (ets->source); - ets->table_model_changed_id = g_signal_connect (source, "model_changed", - G_CALLBACK (ets_model_changed), ets); - ets->table_model_row_changed_id = g_signal_connect (source, "model_row_changed", - G_CALLBACK (ets_model_row_changed), ets); - ets->table_model_cell_changed_id = g_signal_connect (source, "model_cell_changed", - G_CALLBACK (ets_model_cell_changed), ets); - ets->table_model_rows_inserted_id = g_signal_connect (source, "model_rows_inserted", - G_CALLBACK (ets_model_rows_inserted), ets); - ets->table_model_rows_deleted_id = g_signal_connect (source, "model_rows_deleted", - G_CALLBACK (ets_model_rows_deleted), ets); - ets->sort_info_changed_id = g_signal_connect (sort_info, "sort_info_changed", - G_CALLBACK (ets_sort_info_changed), ets); - ets->group_info_changed_id = g_signal_connect (sort_info, "group_info_changed", - G_CALLBACK (ets_sort_info_changed), ets); + ets->table_model_changed_id = g_signal_connect ( + source, "model_changed", + G_CALLBACK (ets_model_changed), ets); + + ets->table_model_row_changed_id = g_signal_connect ( + source, "model_row_changed", + G_CALLBACK (ets_model_row_changed), ets); + + ets->table_model_cell_changed_id = g_signal_connect ( + source, "model_cell_changed", + G_CALLBACK (ets_model_cell_changed), ets); + + ets->table_model_rows_inserted_id = g_signal_connect ( + source, "model_rows_inserted", + G_CALLBACK (ets_model_rows_inserted), ets); + + ets->table_model_rows_deleted_id = g_signal_connect ( + source, "model_rows_deleted", + G_CALLBACK (ets_model_rows_deleted), ets); + + ets->sort_info_changed_id = g_signal_connect ( + sort_info, "sort_info_changed", + G_CALLBACK (ets_sort_info_changed), ets); + + ets->group_info_changed_id = g_signal_connect ( + sort_info, "group_info_changed", + G_CALLBACK (ets_sort_info_changed), ets); return ets; } diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 9a26020296..0d5cd1ae63 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -32,13 +32,32 @@ #include "e-table-subset.h" -static void etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm); -static void etss_proxy_model_no_change_real (ETableSubset *etss, ETableModel *etm); -static void etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm); -static void etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, gint row); -static void etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, gint col, gint row); -static void etss_proxy_model_rows_inserted_real (ETableSubset *etss, ETableModel *etm, gint row, gint count); -static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel *etm, gint row, gint count); +static void etss_proxy_model_pre_change_real + (ETableSubset *etss, + ETableModel *etm); +static void etss_proxy_model_no_change_real (ETableSubset *etss, + ETableModel *etm); +static void etss_proxy_model_changed_real (ETableSubset *etss, + ETableModel *etm); +static void etss_proxy_model_row_changed_real + (ETableSubset *etss, + ETableModel *etm, + gint row); +static void etss_proxy_model_cell_changed_real + (ETableSubset *etss, + ETableModel *etm, + gint col, + gint row); +static void etss_proxy_model_rows_inserted_real + (ETableSubset *etss, + ETableModel *etm, + gint row, + gint count); +static void etss_proxy_model_rows_deleted_real + (ETableSubset *etss, + ETableModel *etm, + gint row, + gint count); #define d(x) diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index a534f22f07..da886295b6 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -182,9 +182,13 @@ e_table_util_calculate_current_search_col (ETableHeader *header, gint i; gint count; ETableCol *col = NULL; + count = e_table_sort_info_grouping_get_count (sort_info); + for (i = 0; i < count; i++) { - ETableSortColumn column = e_table_sort_info_grouping_get_nth (sort_info, i); + ETableSortColumn column; + + column = e_table_sort_info_grouping_get_nth (sort_info, i); col = e_table_header_get_column (full_header, column.column); @@ -197,7 +201,9 @@ e_table_util_calculate_current_search_col (ETableHeader *header, if (col == NULL) { count = e_table_sort_info_sorting_get_count (sort_info); for (i = 0; i < count; i++) { - ETableSortColumn column = e_table_sort_info_sorting_get_nth (sort_info, i); + ETableSortColumn column; + + column = e_table_sort_info_sorting_get_nth (sort_info, i); col = e_table_header_get_column (full_header, column.column); diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 785feb456b..6fba6cbe12 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -32,6 +32,10 @@ #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_TYPE_TABLE_SUBSET) @@ -145,7 +149,7 @@ etw_dispose (GObject *object) { ETableWithoutPrivate *priv; - priv = E_TABLE_WITHOUT (object)->priv; + priv = E_TABLE_WITHOUT_GET_PRIVATE (object); if (priv->hash != NULL) { g_hash_table_foreach (priv->hash, delete_hash_element, object); @@ -258,8 +262,7 @@ etw_class_init (ETableWithoutClass *class) static void etw_init (ETableWithout *etw) { - etw->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etw, E_TYPE_TABLE_WITHOUT, ETableWithoutPrivate); + etw->priv = E_TABLE_WITHOUT_GET_PRIVATE (etw); } ETableModel * @@ -285,7 +288,8 @@ e_table_without_construct (ETableWithout *etw, etw->priv->free_duplicated_key_func = free_duplicated_key_func; etw->priv->closure = closure; - etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func); + etw->priv->hash = g_hash_table_new ( + etw->priv->hash_func, etw->priv->compare_func); return E_TABLE_MODEL (etw); } @@ -394,7 +398,8 @@ e_table_without_show_all (ETableWithout *etw) g_hash_table_destroy (etw->priv->hash); etw->priv->hash = NULL; } - etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func); + etw->priv->hash = g_hash_table_new ( + etw->priv->hash_func, etw->priv->compare_func); row_count = e_table_model_row_count (E_TABLE_MODEL (etss->source)); g_free (etss->map_table); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index e81dc6b23c..50751c8889 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -178,20 +178,20 @@ et_disconnect_model (ETable *et) return; if (et->table_model_change_id != 0) - g_signal_handler_disconnect (G_OBJECT (et->model), - et->table_model_change_id); + g_signal_handler_disconnect ( + et->model, et->table_model_change_id); if (et->table_row_change_id != 0) - g_signal_handler_disconnect (G_OBJECT (et->model), - et->table_row_change_id); + g_signal_handler_disconnect ( + et->model, et->table_row_change_id); if (et->table_cell_change_id != 0) - g_signal_handler_disconnect (G_OBJECT (et->model), - et->table_cell_change_id); + g_signal_handler_disconnect ( + et->model, et->table_cell_change_id); if (et->table_rows_inserted_id != 0) - g_signal_handler_disconnect (G_OBJECT (et->model), - et->table_rows_inserted_id); + g_signal_handler_disconnect ( + et->model, et->table_rows_inserted_id); if (et->table_rows_deleted_id != 0) - g_signal_handler_disconnect (G_OBJECT (et->model), - et->table_rows_deleted_id); + g_signal_handler_disconnect ( + et->model, et->table_rows_deleted_id); et->table_model_change_id = 0; et->table_row_change_id = 0; @@ -206,7 +206,7 @@ e_table_state_change (ETable *et) if (et->state_change_freeze) et->state_changed = TRUE; else - g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); + g_signal_emit (et, et_signals[STATE_CHANGE], 0); } #define CHECK_HORIZONTAL(et) \ @@ -300,14 +300,14 @@ disconnect_header (ETable *e_table) return; if (e_table->structure_change_id) - g_signal_handler_disconnect (G_OBJECT (e_table->header), - e_table->structure_change_id); + g_signal_handler_disconnect ( + e_table->header, e_table->structure_change_id); if (e_table->expansion_change_id) - g_signal_handler_disconnect (G_OBJECT (e_table->header), - e_table->expansion_change_id); + g_signal_handler_disconnect ( + e_table->header, e_table->expansion_change_id); if (e_table->dimension_change_id) - g_signal_handler_disconnect (G_OBJECT (e_table->header), - e_table->dimension_change_id); + g_signal_handler_disconnect ( + e_table->header, e_table->dimension_change_id); g_object_unref (e_table->header); e_table->header = NULL; @@ -343,24 +343,24 @@ et_dispose (GObject *object) if (et->search) { if (et->search_search_id) - g_signal_handler_disconnect (G_OBJECT (et->search), - et->search_search_id); + g_signal_handler_disconnect ( + et->search, et->search_search_id); if (et->search_accept_id) - g_signal_handler_disconnect (G_OBJECT (et->search), - et->search_accept_id); + g_signal_handler_disconnect ( + et->search, et->search_accept_id); g_object_unref (et->search); et->search = NULL; } if (et->group_info_change_id) { - g_signal_handler_disconnect (G_OBJECT (et->sort_info), - et->group_info_change_id); + g_signal_handler_disconnect ( + et->sort_info, et->group_info_change_id); et->group_info_change_id = 0; } if (et->sort_info_change_id) { - g_signal_handler_disconnect (G_OBJECT (et->sort_info), - et->sort_info_change_id); + g_signal_handler_disconnect ( + et->sort_info, et->sort_info_change_id); et->sort_info_change_id = 0; } @@ -429,7 +429,7 @@ et_dispose (GObject *object) g_free (et->domain); et->domain = NULL; - (*G_OBJECT_CLASS (e_table_parent_class)->dispose)(object); + G_OBJECT_CLASS (e_table_parent_class)->dispose (object); } static void @@ -552,6 +552,7 @@ et_finalize (GObject *object) g_free (et->domain); et->domain = NULL; + G_OBJECT_CLASS (e_table_parent_class)->finalize (object); } @@ -734,7 +735,7 @@ e_table_setup_header (ETable *e_table) g_free (pointer); g_signal_connect ( - G_OBJECT (e_table->header_canvas), "size_allocate", + e_table->header_canvas, "size_allocate", G_CALLBACK (header_canvas_size_allocate), e_table); g_object_set ( @@ -835,7 +836,7 @@ group_cursor_change (ETableGroup *etg, old_cursor_loc = et->cursor_loc; et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE; - g_signal_emit (G_OBJECT (et), et_signals[CURSOR_CHANGE], 0, row); + g_signal_emit (et, et_signals[CURSOR_CHANGE], 0, row); if (old_cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) e_table_click_to_add_commit (E_TABLE_CLICK_TO_ADD (et->click_to_add)); @@ -846,7 +847,7 @@ group_cursor_activated (ETableGroup *etg, gint row, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[CURSOR_ACTIVATED], 0, row); + g_signal_emit (et, et_signals[CURSOR_ACTIVATED], 0, row); } static void @@ -856,7 +857,7 @@ group_double_click (ETableGroup *etg, GdkEvent *event, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[DOUBLE_CLICK], 0, row, col, event); + g_signal_emit (et, et_signals[DOUBLE_CLICK], 0, row, col, event); } static gboolean @@ -883,7 +884,11 @@ group_click (ETableGroup *etg, ETable *et) { gboolean return_val = 0; - g_signal_emit (G_OBJECT (et), et_signals[CLICK], 0, row, col, event, &return_val); + + g_signal_emit ( + et, et_signals[CLICK], 0, + row, col, event, &return_val); + return return_val; } @@ -961,8 +966,9 @@ group_key_press (ETableGroup *etg, (key->keyval >= GDK_KEY_A && key->keyval <= GDK_KEY_Z) || (key->keyval >= GDK_KEY_0 && key->keyval <= GDK_KEY_9))) e_table_search_input_character (et->search, key->keyval); - g_signal_emit (G_OBJECT (et), et_signals[KEY_PRESS], 0, - row, col, event, &return_val); + g_signal_emit ( + et, et_signals[KEY_PRESS], 0, + row, col, event, &return_val); break; } return return_val; @@ -976,8 +982,11 @@ group_start_drag (ETableGroup *etg, ETable *et) { gboolean return_val = TRUE; - g_signal_emit (G_OBJECT (et), et_signals[START_DRAG], 0, - row, col, event, &return_val); + + g_signal_emit ( + et, et_signals[START_DRAG], 0, + row, col, event, &return_val); + return return_val; } @@ -1195,8 +1204,11 @@ white_item_event (GnomeCanvasItem *white_item, ETable *e_table) { gboolean return_val = 0; - g_signal_emit (G_OBJECT (e_table), et_signals[WHITE_SPACE_EVENT], 0, - event, &return_val); + + g_signal_emit ( + e_table, et_signals[WHITE_SPACE_EVENT], 0, + event, &return_val); + return return_val; } @@ -1442,7 +1454,7 @@ e_table_setup_table (ETable *e_table, NULL); g_signal_connect ( - G_OBJECT (e_table->canvas_vbox), "event", + e_table->canvas_vbox, "event", G_CALLBACK (canvas_vbox_event), e_table); et_build_groups (e_table); @@ -1466,10 +1478,10 @@ e_table_setup_table (ETable *e_table, e_table->click_to_add); g_signal_connect ( - G_OBJECT (e_table->click_to_add), "event", + e_table->click_to_add, "event", G_CALLBACK (click_to_add_event), e_table); g_signal_connect ( - G_OBJECT (e_table->click_to_add), "cursor_change", + e_table->click_to_add, "cursor_change", G_CALLBACK (click_to_add_cursor_change), e_table); } } @@ -1512,16 +1524,19 @@ e_table_set_state_object (ETable *e_table, if (e_table->sort_info) { if (e_table->group_info_change_id) - g_signal_handler_disconnect (G_OBJECT (e_table->sort_info), - e_table->group_info_change_id); + g_signal_handler_disconnect ( + e_table->sort_info, + e_table->group_info_change_id); if (e_table->sort_info_change_id) - g_signal_handler_disconnect (G_OBJECT (e_table->sort_info), - e_table->sort_info_change_id); + g_signal_handler_disconnect ( + e_table->sort_info, + e_table->sort_info_change_id); g_object_unref (e_table->sort_info); } if (state->sort_info) { e_table->sort_info = e_table_sort_info_duplicate (state->sort_info); - e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping); + e_table_sort_info_set_can_group ( + e_table->sort_info, e_table->allow_grouping); e_table->group_info_change_id = g_signal_connect ( e_table->sort_info, "group_info_changed", G_CALLBACK (group_info_changed), e_table); @@ -1568,7 +1583,6 @@ e_table_set_state (ETable *e_table, { ETableState *state; - g_return_if_fail (e_table != NULL); g_return_if_fail (E_IS_TABLE (e_table)); g_return_if_fail (state_str != NULL); @@ -1595,7 +1609,6 @@ e_table_load_state (ETable *e_table, { ETableState *state; - g_return_if_fail (e_table != NULL); g_return_if_fail (E_IS_TABLE (e_table)); g_return_if_fail (filename != NULL); @@ -1695,7 +1708,7 @@ static void et_selection_model_selection_changed (ETableGroup *etg, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[SELECTION_CHANGE], 0); + g_signal_emit (et, et_signals[SELECTION_CHANGE], 0); } static void @@ -1703,7 +1716,7 @@ et_selection_model_selection_row_changed (ETableGroup *etg, gint row, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[SELECTION_CHANGE], 0); + g_signal_emit (et, et_signals[SELECTION_CHANGE], 0); } static ETable * @@ -1855,9 +1868,7 @@ e_table_construct (ETable *e_table, ETableSpecification *specification; ETableState *state; - g_return_val_if_fail (e_table != NULL, NULL); g_return_val_if_fail (E_IS_TABLE (e_table), NULL); - g_return_val_if_fail (etm != NULL, NULL); g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec_str != NULL, NULL); @@ -1918,9 +1929,7 @@ e_table_construct_from_spec_file (ETable *e_table, ETableSpecification *specification; ETableState *state; - g_return_val_if_fail (e_table != NULL, NULL); g_return_val_if_fail (E_IS_TABLE (e_table), NULL); - g_return_val_if_fail (etm != NULL, NULL); g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec_fn != NULL, NULL); @@ -1985,7 +1994,6 @@ e_table_new (ETableModel *etm, { ETable *e_table; - g_return_val_if_fail (etm != NULL, NULL); g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec != NULL, NULL); @@ -2025,7 +2033,6 @@ e_table_new_from_spec_file (ETableModel *etm, { ETable *e_table; - g_return_val_if_fail (etm != NULL, NULL); g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); g_return_val_if_fail (spec_fn != NULL, NULL); @@ -2037,158 +2044,6 @@ e_table_new_from_spec_file (ETableModel *etm, return GTK_WIDGET (e_table); } -#if 0 -static xmlNode * -et_build_column_spec (ETable *e_table) -{ - xmlNode *columns_shown; - gint i; - gint col_count; - - columns_shown = xmlNewNode (NULL, "columns-shown"); - - col_count = e_table_header_count (e_table->header); - for (i = 0; i < col_count; i++) { - gchar *text = g_strdup_printf ("%d", e_table_header_index(e_table->header, i)); - xmlNewChild (columns_shown, NULL, "column", text); - g_free (text); - } - - return columns_shown; -} - -static xmlNode * -et_build_grouping_spec (ETable *e_table) -{ - xmlNode *node; - xmlNode *grouping; - gint i; - const gint sort_count = e_table_sort_info_sorting_get_count (e_table->sort_info); - const gint group_count = e_table_sort_info_grouping_get_count (e_table->sort_info); - - grouping = xmlNewNode (NULL, "grouping"); - node = grouping; - - for (i = 0; i < group_count; i++) { - ETableSortColumn column = - e_table_sort_info_grouping_get_nth (e_table->sort_info, i); - xmlNode *new_node = xmlNewChild(node, NULL, "group", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - for (i = 0; i < sort_count; i++) { - ETableSortColumn column = - e_table_sort_info_sorting_get_nth (e_table->sort_info, i); - xmlNode *new_node = xmlNewChild(node, NULL, "leaf", NULL); - - e_xml_set_integer_prop_by_name (new_node, "column", column.column); - e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending); - node = new_node; - } - - return grouping; -} - -static xmlDoc * -et_build_tree (ETable *e_table) -{ - xmlDoc *doc; - xmlNode *root; - - doc = xmlNewDoc ("1.0"); - if (doc == NULL) - return NULL; - - root = xmlNewDocNode (doc, NULL, "ETableSpecification", NULL); - xmlDocSetRootElement (doc, root); - xmlAddChild (root, et_build_column_spec (e_table)); - xmlAddChild (root, et_build_grouping_spec (e_table)); - - return doc; -} - -gchar * -e_table_get_specification (ETable *e_table) -{ - xmlDoc *doc; - xmlChar *buffer; - gint size; - - g_return_val_if_fail (e_table != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE (e_table), NULL); - - doc = et_build_tree (e_table); - xmlDocDumpMemory (doc, &buffer, &size); - xmlFreeDoc (doc); - - return buffer; -} - -gint -e_table_set_specification (ETable *e_table, - const gchar *spec) -{ - xmlDoc *xmlSpec; - gint ret; - - g_return_val_if_fail (e_table != NULL, -1); - g_return_val_if_fail (E_IS_TABLE (e_table), -1); - g_return_val_if_fail (spec != NULL, -1); - - /* doesn't work yet, sigh */ - xmlSpec = xmlParseMemory ((gchar *) spec, strlen (spec)); - ret = et_real_set_specification (e_table, xmlSpec); - xmlFreeDoc (xmlSpec); - - return ret; -} - -void -e_table_save_specification (ETable *e_table, - const gchar *filename) -{ - xmlDoc *doc = et_build_tree (e_table); - - g_return_if_fail (e_table != NULL); - g_return_if_fail (E_IS_TABLE (e_table)); - g_return_if_fail (filename != NULL); - - e_xml_save_file (filename, doc); - - xmlFreeDoc (doc); -} - -gint -e_table_load_specification (ETable *e_table, - gchar *filename) -{ - xmlDoc *xmlSpec; - gint ret; - - g_return_val_if_fail (e_table != NULL, -1); - g_return_val_if_fail (E_IS_TABLE (e_table), -1); - g_return_val_if_fail (filename != NULL, -1); - - /* doesn't work yet, yay */ -#ifdef G_OS_WIN32 - { - gchar *locale_filename = g_win32_locale_filename_from_utf8 (filename); - xmlSpec = xmlParseFile (locale_filename); - g_free (locale_filename); - } -#else - xmlSpec = xmlParseFile (filename); -#endif - ret = et_real_set_specification (e_table, xmlSpec); - xmlFreeDoc (xmlSpec); - - return ret; -} -#endif - /** * e_table_set_cursor_row: * @e_table: The #ETable to set the cursor row of @@ -2200,7 +2055,6 @@ void e_table_set_cursor_row (ETable *e_table, gint row) { - g_return_if_fail (e_table != NULL); g_return_if_fail (E_IS_TABLE (e_table)); g_return_if_fail (row >= 0); @@ -2222,7 +2076,6 @@ gint e_table_get_cursor_row (ETable *e_table) { gint row; - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); g_object_get (e_table->selection, @@ -2249,7 +2102,6 @@ e_table_selected_row_foreach (ETable *e_table, EForeachFunc callback, gpointer closure) { - g_return_if_fail (e_table != NULL); g_return_if_fail (E_IS_TABLE (e_table)); e_selection_model_foreach (E_SELECTION_MODEL (e_table->selection), @@ -2269,7 +2121,6 @@ e_table_selected_row_foreach (ETable *e_table, gint e_table_selected_count (ETable *e_table) { - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); return e_selection_model_selected_count (E_SELECTION_MODEL (e_table->selection)); @@ -2284,7 +2135,6 @@ e_table_selected_count (ETable *e_table) void e_table_select_all (ETable *table) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); e_selection_model_select_all (E_SELECTION_MODEL (table->selection)); @@ -2299,7 +2149,6 @@ e_table_select_all (ETable *table) void e_table_invert_selection (ETable *table) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); e_selection_model_invert_selection (E_SELECTION_MODEL (table->selection)); @@ -2317,7 +2166,6 @@ e_table_invert_selection (ETable *table) EPrintable * e_table_get_printable (ETable *e_table) { - g_return_val_if_fail (e_table != NULL, NULL); g_return_val_if_fail (E_IS_TABLE (e_table), NULL); return e_table_group_get_printable (e_table->group); @@ -2526,7 +2374,6 @@ gint e_table_get_next_row (ETable *e_table, gint model_row) { - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); if (e_table->sorter) { @@ -2560,7 +2407,6 @@ gint e_table_get_prev_row (ETable *e_table, gint model_row) { - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); if (e_table->sorter) { @@ -2589,7 +2435,6 @@ gint e_table_model_to_view_row (ETable *e_table, gint model_row) { - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); if (e_table->sorter) @@ -2612,7 +2457,6 @@ gint e_table_view_to_model_row (ETable *e_table, gint view_row) { - g_return_val_if_fail (e_table != NULL, -1); g_return_val_if_fail (E_IS_TABLE (e_table), -1); if (e_table->sorter) @@ -2728,7 +2572,6 @@ e_table_get_mouse_over_cell (ETable *table, gint *row, gint *col) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); if (!table->group) @@ -2750,7 +2593,6 @@ e_table_get_mouse_over_cell (ETable *table, ESelectionModel * e_table_get_selection_model (ETable *table) { - g_return_val_if_fail (table != NULL, NULL); g_return_val_if_fail (E_IS_TABLE (table), NULL); return E_SELECTION_MODEL (table->selection); @@ -2843,7 +2685,6 @@ e_table_drag_get_data (ETable *table, GdkAtom target, guint32 time) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); gtk_drag_get_data (GTK_WIDGET (table), @@ -2923,7 +2764,6 @@ e_table_drag_highlight (ETable *table, void e_table_drag_unhighlight (ETable *table) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); if (table->drop_highlight) { @@ -2932,34 +2772,29 @@ 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 (ETable *table, + GtkDestDefaults flags, + const GtkTargetEntry *targets, + gint n_targets, + GdkDragAction actions) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); - gtk_drag_dest_set (GTK_WIDGET (table), - flags, - targets, - n_targets, - actions); + gtk_drag_dest_set ( + GTK_WIDGET (table), flags, targets, n_targets, actions); } -void e_table_drag_dest_set_proxy (ETable *table, - GdkWindow *proxy_window, - GdkDragProtocol protocol, - gboolean use_coordinates) +void +e_table_drag_dest_set_proxy (ETable *table, + GdkWindow *proxy_window, + GdkDragProtocol protocol, + gboolean use_coordinates) { - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); - gtk_drag_dest_set_proxy (GTK_WIDGET (table), - proxy_window, - protocol, - use_coordinates); + gtk_drag_dest_set_proxy ( + GTK_WIDGET (table), proxy_window, protocol, use_coordinates); } /* @@ -2970,7 +2805,6 @@ void e_table_drag_dest_set_proxy (ETable *table, void e_table_drag_dest_unset (GtkWidget *widget) { - g_return_if_fail (widget != NULL); g_return_if_fail (E_IS_TABLE (widget)); gtk_drag_dest_unset (widget); @@ -3034,7 +2868,6 @@ e_table_drag_source_set (ETable *table, ETableDragSourceSite *site; GtkWidget *canvas; - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); canvas = GTK_WIDGET (table->table_canvas); @@ -3076,7 +2909,6 @@ e_table_drag_source_unset (ETable *table) { ETableDragSourceSite *site; - g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); site = table->site; @@ -3118,17 +2950,13 @@ e_table_drag_begin (ETable *table, gint button, GdkEvent *event) { - g_return_val_if_fail (table != NULL, NULL); g_return_val_if_fail (E_IS_TABLE (table), NULL); table->drag_row = row; table->drag_col = col; - return gtk_drag_begin (GTK_WIDGET (table), - targets, - actions, - button, - event); + return gtk_drag_begin ( + GTK_WIDGET (table), targets, actions, button, event); } static void @@ -3136,8 +2964,9 @@ et_drag_begin (GtkWidget *widget, GdkDragContext *context, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_BEGIN], 0, - et->drag_row, et->drag_col, context); + g_signal_emit ( + et, et_signals[TABLE_DRAG_BEGIN], 0, + et->drag_row, et->drag_col, context); } static void @@ -3145,8 +2974,9 @@ et_drag_end (GtkWidget *widget, GdkDragContext *context, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_END], 0, - et->drag_row, et->drag_col, context); + g_signal_emit ( + et, et_signals[TABLE_DRAG_END], 0, + et->drag_row, et->drag_col, context); } static void @@ -3157,9 +2987,10 @@ et_drag_data_get (GtkWidget *widget, guint time, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_GET], 0, - et->drag_row, et->drag_col, context, selection_data, - info, time); + g_signal_emit ( + et, et_signals[TABLE_DRAG_DATA_GET], 0, + et->drag_row, et->drag_col, context, selection_data, + info, time); } static void @@ -3167,8 +2998,9 @@ et_drag_data_delete (GtkWidget *widget, GdkDragContext *context, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_DELETE], 0, - et->drag_row, et->drag_col, context); + g_signal_emit ( + et, et_signals[TABLE_DRAG_DATA_DELETE], 0, + et->drag_row, et->drag_col, context); } static gboolean @@ -3184,13 +3016,17 @@ do_drag_motion (ETable *et, e_table_get_cell_at (et, x, y, &row, &col); if (row != et->drop_row && col != et->drop_row) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0, - et->drop_row, et->drop_col, context, time); + g_signal_emit ( + et, et_signals[TABLE_DRAG_LEAVE], 0, + et->drop_row, et->drop_col, context, time); } + et->drop_row = row; et->drop_col = col; - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_MOTION], 0, - et->drop_row, et->drop_col, context, x, y, time, &ret_val); + + g_signal_emit ( + et, et_signals[TABLE_DRAG_MOTION], 0, + et->drop_row, et->drop_col, context, x, y, time, &ret_val); return ret_val; } @@ -3308,8 +3144,10 @@ et_drag_leave (GtkWidget *widget, guint time, ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0, - et->drop_row, et->drop_col, context, time); + g_signal_emit ( + et, et_signals[TABLE_DRAG_LEAVE], 0, + et->drop_row, et->drop_col, context, time); + et->drop_row = -1; et->drop_col = -1; @@ -3369,15 +3207,18 @@ et_drag_drop (GtkWidget *widget, e_table_get_cell_at (et, x, y, &row, &col); if (row != et->drop_row && col != et->drop_row) { - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_LEAVE], 0, - et->drop_row, et->drop_col, context, time); - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_MOTION], 0, - row, col, context, x, y, time, &ret_val); + g_signal_emit ( + et, et_signals[TABLE_DRAG_LEAVE], 0, + et->drop_row, et->drop_col, context, time); + g_signal_emit ( + et, et_signals[TABLE_DRAG_MOTION], 0, + row, col, context, x, y, time, &ret_val); } et->drop_row = row; et->drop_col = col; - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DROP], 0, - et->drop_row, et->drop_col, context, x, y, time, &ret_val); + g_signal_emit ( + et, et_signals[TABLE_DRAG_DROP], 0, + et->drop_row, et->drop_col, context, x, y, time, &ret_val); et->drop_row = -1; et->drop_col = -1; @@ -3400,8 +3241,9 @@ et_drag_data_received (GtkWidget *widget, e_table_get_cell_at (et, x, y, &row, &col); - g_signal_emit (G_OBJECT (et), et_signals[TABLE_DRAG_DATA_RECEIVED], 0, - row, col, context, x, y, selection_data, info, time); + g_signal_emit ( + et, et_signals[TABLE_DRAG_DATA_RECEIVED], 0, + row, col, context, x, y, selection_data, info, time); } static void @@ -3446,251 +3288,272 @@ e_table_class_init (ETableClass *class) class->table_drag_drop = NULL; class->table_drag_data_received = NULL; - et_signals[CURSOR_CHANGE] = - g_signal_new ("cursor_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, cursor_change), - NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - et_signals[CURSOR_ACTIVATED] = - g_signal_new ("cursor_activated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, cursor_activated), - NULL, NULL, - g_cclosure_marshal_VOID__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - et_signals[SELECTION_CHANGE] = - g_signal_new ("selection_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, selection_change), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - et_signals[DOUBLE_CLICK] = - g_signal_new ("double_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, double_click), - NULL, NULL, - e_marshal_NONE__INT_INT_BOXED, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[RIGHT_CLICK] = - g_signal_new ("right_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, right_click), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__INT_INT_BOXED, - G_TYPE_BOOLEAN, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[CLICK] = - g_signal_new ("click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, click), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__INT_INT_BOXED, - G_TYPE_BOOLEAN, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[KEY_PRESS] = - g_signal_new ("key_press", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, key_press), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__INT_INT_BOXED, - G_TYPE_BOOLEAN, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[START_DRAG] = - g_signal_new ("start_drag", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, start_drag), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__INT_INT_BOXED, - G_TYPE_BOOLEAN, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[STATE_CHANGE] = - g_signal_new ("state_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, state_change), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - et_signals[WHITE_SPACE_EVENT] = - g_signal_new ("white_space_event", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, white_space_event), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__BOXED, - G_TYPE_BOOLEAN, 1, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - - et_signals[TABLE_DRAG_BEGIN] = - g_signal_new ("table_drag_begin", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_begin), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT); - et_signals[TABLE_DRAG_END] = - g_signal_new ("table_drag_end", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_end), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT); - et_signals[TABLE_DRAG_DATA_GET] = - g_signal_new ("table_drag_data_get", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_data_get), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT_BOXED_UINT_UINT, - G_TYPE_NONE, 6, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT, - GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE, - G_TYPE_UINT, - G_TYPE_UINT); - et_signals[TABLE_DRAG_DATA_DELETE] = - g_signal_new ("table_drag_data_delete", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_data_delete), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT, - G_TYPE_NONE, 3, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT); - - et_signals[TABLE_DRAG_LEAVE] = - g_signal_new ("table_drag_leave", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_leave), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT_UINT, - G_TYPE_NONE, 4, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT, - G_TYPE_UINT); - et_signals[TABLE_DRAG_MOTION] = - g_signal_new ("table_drag_motion", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_motion), - NULL, NULL, - e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, - G_TYPE_BOOLEAN, 6, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_UINT); - et_signals[TABLE_DRAG_DROP] = - g_signal_new ("table_drag_drop", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_drop), - NULL, NULL, - e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, - G_TYPE_BOOLEAN, 6, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_UINT); - et_signals[TABLE_DRAG_DATA_RECEIVED] = - g_signal_new ("table_drag_data_received", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ETableClass, table_drag_data_received), - NULL, NULL, - e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT, - G_TYPE_NONE, 8, - G_TYPE_INT, - G_TYPE_INT, - GDK_TYPE_DRAG_CONTEXT, - G_TYPE_INT, - G_TYPE_INT, - GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE, - G_TYPE_UINT, - G_TYPE_UINT); - - g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD, - g_param_spec_int ("length_threshold", - "Length Threshold", - NULL, - 0, G_MAXINT, 0, - G_PARAM_WRITABLE)); - - g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT, - g_param_spec_boolean ("uniform_row_height", - "Uniform row height", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_ALWAYS_SEARCH, - g_param_spec_boolean ("always_search", - "Always search", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_USE_CLICK_TO_ADD, - g_param_spec_boolean ("use_click_to_add", - "Use click to add", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - "Model", - NULL, - E_TYPE_TABLE_MODEL, - G_PARAM_READABLE)); + et_signals[CURSOR_CHANGE] = g_signal_new ( + "cursor_change", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, cursor_change), + NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + + et_signals[CURSOR_ACTIVATED] = g_signal_new ( + "cursor_activated", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, cursor_activated), + NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); + + et_signals[SELECTION_CHANGE] = g_signal_new ( + "selection_change", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, selection_change), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + et_signals[DOUBLE_CLICK] = g_signal_new ( + "double_click", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, double_click), + NULL, NULL, + e_marshal_NONE__INT_INT_BOXED, + G_TYPE_NONE, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[RIGHT_CLICK] = g_signal_new ( + "right_click", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, right_click), + g_signal_accumulator_true_handled, NULL, + e_marshal_BOOLEAN__INT_INT_BOXED, + G_TYPE_BOOLEAN, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[CLICK] = g_signal_new ( + "click", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, click), + g_signal_accumulator_true_handled, NULL, + e_marshal_BOOLEAN__INT_INT_BOXED, + G_TYPE_BOOLEAN, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[KEY_PRESS] = g_signal_new ( + "key_press", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, key_press), + g_signal_accumulator_true_handled, NULL, + e_marshal_BOOLEAN__INT_INT_BOXED, + G_TYPE_BOOLEAN, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[START_DRAG] = g_signal_new ( + "start_drag", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, start_drag), + g_signal_accumulator_true_handled, NULL, + e_marshal_BOOLEAN__INT_INT_BOXED, + G_TYPE_BOOLEAN, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[STATE_CHANGE] = g_signal_new ( + "state_change", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, state_change), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + et_signals[WHITE_SPACE_EVENT] = g_signal_new ( + "white_space_event", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, white_space_event), + g_signal_accumulator_true_handled, NULL, + e_marshal_BOOLEAN__BOXED, + G_TYPE_BOOLEAN, 1, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); + + et_signals[TABLE_DRAG_BEGIN] = g_signal_new ( + "table_drag_begin", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_begin), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT, + G_TYPE_NONE, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT); + + et_signals[TABLE_DRAG_END] = g_signal_new ( + "table_drag_end", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_end), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT, + G_TYPE_NONE, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT); + + et_signals[TABLE_DRAG_DATA_GET] = g_signal_new ( + "table_drag_data_get", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_data_get), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT_BOXED_UINT_UINT, + G_TYPE_NONE, 6, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT, + GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE, + G_TYPE_UINT, + G_TYPE_UINT); + + et_signals[TABLE_DRAG_DATA_DELETE] = g_signal_new ( + "table_drag_data_delete", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_data_delete), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT, + G_TYPE_NONE, 3, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT); + + et_signals[TABLE_DRAG_LEAVE] = g_signal_new ( + "table_drag_leave", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_leave), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT_UINT, + G_TYPE_NONE, 4, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT, + G_TYPE_UINT); + + et_signals[TABLE_DRAG_MOTION] = g_signal_new ( + "table_drag_motion", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_motion), + NULL, NULL, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, + G_TYPE_BOOLEAN, 6, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_UINT); + + et_signals[TABLE_DRAG_DROP] = g_signal_new ( + "table_drag_drop", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_drop), + NULL, NULL, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, + G_TYPE_BOOLEAN, 6, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT, + G_TYPE_INT, + G_TYPE_INT, + G_TYPE_UINT); + + et_signals[TABLE_DRAG_DATA_RECEIVED] = g_signal_new ( + "table_drag_data_received", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETableClass, table_drag_data_received), + NULL, NULL, + e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT, + G_TYPE_NONE, 8, + G_TYPE_INT, + G_TYPE_INT, + GDK_TYPE_DRAG_CONTEXT, + G_TYPE_INT, + G_TYPE_INT, + GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE, + G_TYPE_UINT, + G_TYPE_UINT); + + g_object_class_install_property ( + object_class, + PROP_LENGTH_THRESHOLD, + g_param_spec_int ( + "length_threshold", + "Length Threshold", + NULL, + 0, G_MAXINT, 0, + G_PARAM_WRITABLE)); + + g_object_class_install_property ( + object_class, + PROP_UNIFORM_ROW_HEIGHT, + g_param_spec_boolean ( + "uniform_row_height", + "Uniform row height", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_ALWAYS_SEARCH, + g_param_spec_boolean ( + "always_search", + "Always search", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_USE_CLICK_TO_ADD, + g_param_spec_boolean ( + "use_click_to_add", + "Use click to add", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MODEL, + g_param_spec_object ( + "model", + "Model", + NULL, + E_TYPE_TABLE_MODEL, + G_PARAM_READABLE)); gtk_widget_class_install_style_property ( widget_class, diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index 4f279aabb9..1b1bb9b2ba 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -39,6 +39,10 @@ #include "e-tree-memory.h" +#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 { @@ -216,7 +220,7 @@ etmm_dispose (GObject *object) { ETreeMemoryPrivate *priv; - priv = E_TREE_MEMORY (object)->priv; + priv = E_TREE_MEMORY_GET_PRIVATE (object); if (priv->root) e_tree_memory_node_remove ( @@ -401,8 +405,7 @@ e_tree_memory_class_init (ETreeMemoryClass *class) static void e_tree_memory_init (ETreeMemory *etmm) { - etmm->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etmm, E_TYPE_TREE_MEMORY, ETreeMemoryPrivate); + etmm->priv = E_TREE_MEMORY_GET_PRIVATE (etmm); } /** diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 24221418c0..9bed842a35 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -59,14 +59,14 @@ enum { LAST_SIGNAL }; -static guint e_tree_model_signals[LAST_SIGNAL] = {0, }; +static guint signals[LAST_SIGNAL] = {0, }; static void e_tree_model_class_init (ETreeModelClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - e_tree_model_signals[PRE_CHANGE] = + signals[PRE_CHANGE] = g_signal_new ("pre_change", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -75,7 +75,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - e_tree_model_signals[NO_CHANGE] = + signals[NO_CHANGE] = g_signal_new ("no_change", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -84,7 +84,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - e_tree_model_signals[REBUILT] = + signals[REBUILT] = g_signal_new ("rebuilt", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -93,7 +93,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - e_tree_model_signals[NODE_CHANGED] = + signals[NODE_CHANGED] = g_signal_new ("node_changed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -102,7 +102,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - e_tree_model_signals[NODE_DATA_CHANGED] = + signals[NODE_DATA_CHANGED] = g_signal_new ("node_data_changed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -111,7 +111,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - e_tree_model_signals[NODE_COL_CHANGED] = + signals[NODE_COL_CHANGED] = g_signal_new ("node_col_changed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -120,7 +120,7 @@ e_tree_model_class_init (ETreeModelClass *class) e_marshal_VOID__POINTER_INT, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT); - e_tree_model_signals[NODE_INSERTED] = + signals[NODE_INSERTED] = g_signal_new ("node_inserted", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -129,7 +129,7 @@ e_tree_model_class_init (ETreeModelClass *class) e_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); - e_tree_model_signals[NODE_REMOVED] = + signals[NODE_REMOVED] = g_signal_new ("node_removed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -138,7 +138,7 @@ e_tree_model_class_init (ETreeModelClass *class) e_marshal_VOID__POINTER_POINTER_INT, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_INT); - e_tree_model_signals[NODE_DELETED] = + signals[NODE_DELETED] = g_signal_new ("node_deleted", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -147,7 +147,7 @@ e_tree_model_class_init (ETreeModelClass *class) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - e_tree_model_signals[NODE_REQUEST_COLLAPSE] = + signals[NODE_REQUEST_COLLAPSE] = g_signal_new ("node_request_collapse", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, @@ -224,12 +224,9 @@ e_tree_model_init (ETreeModel *tree_model) void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[PRE_CHANGE], 0); + g_signal_emit (tree_model, signals[PRE_CHANGE], 0); } /** @@ -244,12 +241,9 @@ e_tree_model_pre_change (ETreeModel *tree_model) void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NO_CHANGE], 0); + g_signal_emit (tree_model, signals[NO_CHANGE], 0); } /** @@ -264,12 +258,9 @@ e_tree_model_no_change (ETreeModel *tree_model) void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[REBUILT], 0); + g_signal_emit (tree_model, signals[REBUILT], 0); } /** * e_tree_model_node_changed: @@ -284,12 +275,9 @@ void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_CHANGED], 0, node); + g_signal_emit (tree_model, signals[NODE_CHANGED], 0, node); } /** @@ -305,12 +293,9 @@ void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DATA_CHANGED], 0, node); + g_signal_emit (tree_model, signals[NODE_DATA_CHANGED], 0, node); } /** @@ -327,12 +312,9 @@ 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_COL_CHANGED], 0, node, col); + g_signal_emit (tree_model, signals[NODE_COL_CHANGED], 0, node, col); } /** @@ -348,13 +330,11 @@ e_tree_model_node_inserted (ETreeModel *tree_model, ETreePath parent_node, ETreePath inserted_node) { - 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_INSERTED], 0, - parent_node, inserted_node); + g_signal_emit ( + tree_model, signals[NODE_INSERTED], 0, + parent_node, inserted_node); } /** @@ -371,13 +351,11 @@ e_tree_model_node_removed (ETreeModel *tree_model, ETreePath removed_node, gint old_position) { - 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REMOVED], 0, - parent_node, removed_node, old_position); + g_signal_emit ( + tree_model, signals[NODE_REMOVED], 0, + parent_node, removed_node, old_position); } /** @@ -391,12 +369,9 @@ void 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_DELETED], 0, deleted_node); + g_signal_emit (tree_model, signals[NODE_DELETED], 0, deleted_node); } /** @@ -410,12 +385,9 @@ void e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed_node) { - 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)->class->type))); - - g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals[NODE_REQUEST_COLLAPSE], 0, collapsed_node); + g_signal_emit (tree_model, signals[NODE_REQUEST_COLLAPSE], 0, collapsed_node); } /** @@ -442,7 +414,6 @@ e_tree_model_new (void) ETreePath e_tree_model_get_root (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_root) @@ -464,7 +435,8 @@ ETreePath e_tree_model_node_get_parent (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); + g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); + if (ETM_CLASS (etree)->get_parent) return ETM_CLASS (etree)->get_parent (etree, node); else @@ -484,7 +456,6 @@ ETreePath e_tree_model_node_get_first_child (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_first_child) @@ -506,7 +477,6 @@ ETreePath e_tree_model_node_get_last_child (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_last_child) @@ -528,7 +498,6 @@ ETreePath e_tree_model_node_get_next (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_next) @@ -550,7 +519,6 @@ ETreePath e_tree_model_node_get_prev (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_prev) @@ -627,7 +595,6 @@ guint e_tree_model_node_depth (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, 0); g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0); if (ETM_CLASS (etree)->depth) @@ -649,7 +616,6 @@ GdkPixbuf * e_tree_model_icon_at (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->icon_at) @@ -669,7 +635,6 @@ e_tree_model_icon_at (ETreeModel *etree, gboolean e_tree_model_get_expanded_default (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, FALSE); g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE); if (ETM_CLASS (etree)->get_expanded_default) @@ -689,7 +654,6 @@ e_tree_model_get_expanded_default (ETreeModel *etree) gint e_tree_model_column_count (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, 0); g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0); if (ETM_CLASS (etree)->column_count) @@ -709,7 +673,6 @@ e_tree_model_column_count (ETreeModel *etree) gboolean e_tree_model_has_save_id (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, FALSE); g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE); if (ETM_CLASS (etree)->has_save_id) @@ -731,7 +694,6 @@ gchar * e_tree_model_get_save_id (ETreeModel *etree, ETreePath node) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_save_id) @@ -751,7 +713,6 @@ e_tree_model_get_save_id (ETreeModel *etree, gboolean e_tree_model_has_get_node_by_id (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, FALSE); g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE); if (ETM_CLASS (etree)->has_get_node_by_id) @@ -776,7 +737,6 @@ ETreePath e_tree_model_get_node_by_id (ETreeModel *etree, const gchar *save_id) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->get_node_by_id) @@ -796,7 +756,6 @@ e_tree_model_get_node_by_id (ETreeModel *etree, gboolean e_tree_model_has_change_pending (ETreeModel *etree) { - g_return_val_if_fail (etree != NULL, FALSE); g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE); if (ETM_CLASS (etree)->has_change_pending) @@ -830,7 +789,6 @@ e_tree_model_sort_value_at (ETreeModel *etree, ETreePath node, gint col) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->sort_value_at) @@ -863,7 +821,6 @@ e_tree_model_value_at (ETreeModel *etree, ETreePath node, gint col) { - g_return_val_if_fail (etree != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL); if (ETM_CLASS (etree)->value_at) @@ -878,7 +835,6 @@ e_tree_model_set_value_at (ETreeModel *etree, gint col, gconstpointer val) { - g_return_if_fail (etree != NULL); g_return_if_fail (E_IS_TREE_MODEL (etree)); if (ETM_CLASS (etree)->set_value_at) @@ -1031,7 +987,6 @@ e_tree_model_node_traverse (ETreeModel *model, { ETreePath child; - g_return_if_fail (model != NULL); g_return_if_fail (E_IS_TREE_MODEL (model)); g_return_if_fail (path != NULL); @@ -1066,7 +1021,6 @@ e_tree_model_node_traverse_preorder (ETreeModel *model, { ETreePath child; - g_return_if_fail (model != NULL); g_return_if_fail (E_IS_TREE_MODEL (model)); g_return_if_fail (path != NULL); @@ -1104,7 +1058,6 @@ e_tree_model_node_real_traverse (ETreeModel *model, { ETreePath child; - g_return_val_if_fail (model != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL); g_return_val_if_fail (path != NULL, NULL); @@ -1119,7 +1072,9 @@ e_tree_model_node_real_traverse (ETreeModel *model, if (forward_direction && (child == end_path || func (model, child, data))) return child; - if ((result = e_tree_model_node_real_traverse (model, child, end_path, forward_direction, func, data))) + if ((result = e_tree_model_node_real_traverse ( + model, child, end_path, + forward_direction, func, data))) return result; if (!forward_direction && (child == end_path || func (model, child, data))) @@ -1153,7 +1108,6 @@ e_tree_model_node_find (ETreeModel *model, ETreePath result; ETreePath next; - g_return_val_if_fail (model != NULL, NULL); g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL); /* Just search the whole tree in this case. */ @@ -1164,7 +1118,9 @@ e_tree_model_node_find (ETreeModel *model, if (forward_direction && (end_path == root || func (model, root, data))) return root; - if ((result = e_tree_model_node_real_traverse (model, root, end_path, forward_direction, func, data))) + result = e_tree_model_node_real_traverse ( + model, root, end_path, forward_direction, func, data); + if (result) return result; if (!forward_direction && (end_path == root || func (model, root, data))) @@ -1176,12 +1132,16 @@ e_tree_model_node_find (ETreeModel *model, while (1) { if (forward_direction) { - if ((result = e_tree_model_node_real_traverse (model, path, end_path, forward_direction, func, data))) + if ((result = e_tree_model_node_real_traverse ( + model, path, end_path, + forward_direction, func, data))) return result; next = e_tree_model_node_get_next (model, path); } else { next = e_tree_model_node_get_prev (model, path); - if (next && (result = e_tree_model_node_real_traverse (model, next, end_path, forward_direction, func, data))) + if (next && (result = e_tree_model_node_real_traverse ( + model, next, end_path, + forward_direction, func, data))) return result; } diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 9d04086b2f..33e4ab0780 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -31,6 +31,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) @@ -66,7 +70,8 @@ static gint get_cursor_row (ETreeSelectionModel *etsm) { if (etsm->priv->cursor_path) - return e_tree_table_adapter_row_of_node (etsm->priv->etta, etsm->priv->cursor_path); + return e_tree_table_adapter_row_of_node ( + etsm->priv->etta, etsm->priv->cursor_path); return -1; } @@ -137,7 +142,8 @@ restore_cursor (ETreeSelectionModel *etsm, etsm->priv->cursor_path = NULL; if (etsm->priv->cursor_save_id) { - etsm->priv->cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id); + etsm->priv->cursor_path = e_tree_model_get_node_by_id ( + etm, etsm->priv->cursor_save_id); if (etsm->priv->cursor_path != NULL && etsm->priv->cursor_col == -1) etsm->priv->cursor_col = 0; @@ -148,10 +154,14 @@ restore_cursor (ETreeSelectionModel *etsm, if (etsm->priv->cursor_path) { gint cursor_row = get_cursor_row (etsm); - e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), cursor_row, etsm->priv->cursor_col); + e_selection_model_cursor_changed ( + E_SELECTION_MODEL (etsm), + cursor_row, etsm->priv->cursor_col); } else { - e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), -1, -1); - e_selection_model_cursor_activated (E_SELECTION_MODEL (etsm), -1, -1); + e_selection_model_cursor_changed ( + E_SELECTION_MODEL (etsm), -1, -1); + e_selection_model_cursor_activated ( + E_SELECTION_MODEL (etsm), -1, -1); } @@ -165,8 +175,11 @@ etsm_pre_change (ETreeModel *etm, g_free (etsm->priv->cursor_save_id); etsm->priv->cursor_save_id = NULL; - if (e_tree_model_has_get_node_by_id (etm) && e_tree_model_has_save_id (etm) && etsm->priv->cursor_path) { - etsm->priv->cursor_save_id = e_tree_model_get_save_id (etm, etsm->priv->cursor_path); + if (e_tree_model_has_get_node_by_id (etm) && + e_tree_model_has_save_id (etm) && + etsm->priv->cursor_path) { + etsm->priv->cursor_save_id = e_tree_model_get_save_id ( + etm, etsm->priv->cursor_path); } } @@ -241,22 +254,38 @@ add_model (ETreeSelectionModel *etsm, return; g_object_ref (priv->model); - priv->tree_model_pre_change_id = g_signal_connect_after (G_OBJECT (priv->model), "pre_change", - G_CALLBACK (etsm_pre_change), etsm); - priv->tree_model_no_change_id = g_signal_connect_after (G_OBJECT (priv->model), "no_change", - G_CALLBACK (etsm_no_change), etsm); - priv->tree_model_node_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_changed", - G_CALLBACK (etsm_node_changed), etsm); - priv->tree_model_node_data_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_data_changed", - G_CALLBACK (etsm_node_data_changed), etsm); - priv->tree_model_node_col_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_col_changed", - G_CALLBACK (etsm_node_col_changed), etsm); - priv->tree_model_node_inserted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_inserted", - G_CALLBACK (etsm_node_inserted), etsm); - priv->tree_model_node_removed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_removed", - G_CALLBACK (etsm_node_removed), etsm); - priv->tree_model_node_deleted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_deleted", - G_CALLBACK (etsm_node_deleted), etsm); + + priv->tree_model_pre_change_id = g_signal_connect_after ( + priv->model, "pre_change", + G_CALLBACK (etsm_pre_change), etsm); + + priv->tree_model_no_change_id = g_signal_connect_after ( + priv->model, "no_change", + G_CALLBACK (etsm_no_change), etsm); + + priv->tree_model_node_changed_id = g_signal_connect_after ( + priv->model, "node_changed", + G_CALLBACK (etsm_node_changed), etsm); + + priv->tree_model_node_data_changed_id = g_signal_connect_after ( + priv->model, "node_data_changed", + G_CALLBACK (etsm_node_data_changed), etsm); + + priv->tree_model_node_col_changed_id = g_signal_connect_after ( + priv->model, "node_col_changed", + G_CALLBACK (etsm_node_col_changed), etsm); + + priv->tree_model_node_inserted_id = g_signal_connect_after ( + priv->model, "node_inserted", + G_CALLBACK (etsm_node_inserted), etsm); + + priv->tree_model_node_removed_id = g_signal_connect_after ( + priv->model, "node_removed", + G_CALLBACK (etsm_node_removed), etsm); + + priv->tree_model_node_deleted_id = g_signal_connect_after ( + priv->model, "node_deleted", + G_CALLBACK (etsm_node_deleted), etsm); } static void @@ -267,22 +296,22 @@ drop_model (ETreeSelectionModel *etsm) if (!priv->model) return; - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_pre_change_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_no_change_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_data_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_col_changed_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_inserted_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_removed_id); - g_signal_handler_disconnect (G_OBJECT (priv->model), - priv->tree_model_node_deleted_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_pre_change_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_no_change_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_changed_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_data_changed_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_col_changed_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_inserted_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_removed_id); + g_signal_handler_disconnect ( + priv->model, priv->tree_model_node_deleted_id); g_object_unref (priv->model); priv->model = NULL; @@ -313,7 +342,7 @@ etsm_finalize (GObject *object) { ETreeSelectionModelPrivate *priv; - priv = E_TREE_SELECTION_MODEL (object)->priv; + priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (object); clear_selection (E_TREE_SELECTION_MODEL (object)); g_hash_table_destroy (priv->paths); @@ -360,11 +389,15 @@ etsm_set_property (GObject *object, switch (property_id) { case PROP_CURSOR_ROW: - e_selection_model_do_something (esm, g_value_get_int (value), etsm->priv->cursor_col, 0); + e_selection_model_do_something ( + esm, g_value_get_int (value), + etsm->priv->cursor_col, 0); break; case PROP_CURSOR_COL: - e_selection_model_do_something (esm, get_cursor_row (etsm), g_value_get_int (value), 0); + e_selection_model_do_something ( + esm, get_cursor_row (etsm), + g_value_get_int (value), 0); break; case PROP_MODEL: @@ -373,7 +406,8 @@ etsm_set_property (GObject *object, break; case PROP_ETTA: - etsm->priv->etta = E_TREE_TABLE_ADAPTER (g_value_get_object (value)); + etsm->priv->etta = + E_TREE_TABLE_ADAPTER (g_value_get_object (value)); break; } } @@ -404,7 +438,9 @@ etsm_is_row_selected (ESelectionModel *selection, ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); ETreePath path; - g_return_val_if_fail (row < e_table_model_row_count (E_TABLE_MODEL (etsm->priv->etta)), FALSE); + g_return_val_if_fail ( + row < e_table_model_row_count ( + E_TABLE_MODEL (etsm->priv->etta)), FALSE); g_return_val_if_fail (row >= 0, FALSE); g_return_val_if_fail (etsm != NULL, FALSE); @@ -425,7 +461,8 @@ etsm_row_foreach_cb (gpointer key, { ETreePath path = key; ModelAndCallback *mac = user_data; - gint row = e_tree_table_adapter_row_of_node (mac->etsm->priv->etta, path); + gint row = e_tree_table_adapter_row_of_node ( + mac->etsm->priv->etta, path); if (row >= 0) mac->callback (row, mac->closure); } @@ -516,10 +553,14 @@ etsm_select_all (ESelectionModel *selection) select_range (etsm, 0, etsm_row_count (selection) - 1); if (etsm->priv->cursor_path == NULL) - etsm->priv->cursor_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, 0); + etsm->priv->cursor_path = e_tree_table_adapter_node_at_row ( + etsm->priv->etta, 0); e_selection_model_selection_changed (E_SELECTION_MODEL (etsm)); - e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), get_cursor_row (etsm), etsm->priv->cursor_col); + + e_selection_model_cursor_changed ( + E_SELECTION_MODEL (etsm), + get_cursor_row (etsm), etsm->priv->cursor_col); } /** @@ -537,7 +578,9 @@ etsm_invert_selection (ESelectionModel *selection) gint i; for (i = 0; i < count; i++) { - ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i); + ETreePath path; + + path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i); if (!path) continue; if (g_hash_table_lookup (etsm->priv->paths, path)) @@ -561,7 +604,9 @@ etsm_change_one_row (ESelectionModel *selection, ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); ETreePath path; - g_return_if_fail (row < e_table_model_row_count (E_TABLE_MODEL (etsm->priv->etta))); + g_return_if_fail ( + row < e_table_model_row_count ( + E_TABLE_MODEL (etsm->priv->etta))); g_return_if_fail (row >= 0); g_return_if_fail (selection != NULL); @@ -588,7 +633,9 @@ etsm_change_cursor (ESelectionModel *selection, if (row == -1) { etsm->priv->cursor_path = NULL; } else { - etsm->priv->cursor_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); + etsm->priv->cursor_path = + e_tree_table_adapter_node_at_row ( + etsm->priv->etta, row); } etsm->priv->cursor_col = col; } @@ -621,9 +668,10 @@ etsm_select_single_row (ESelectionModel *selection, gint row) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); - ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); + ETreePath path; gint rows[5], *rowp = NULL, size; + path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); g_return_if_fail (path != NULL); /* we really only care about the size=1 case (cursor changed), @@ -643,9 +691,11 @@ etsm_select_single_row (ESelectionModel *selection, gint *p = rows; while (p < rowp) - e_selection_model_selection_row_changed ((ESelectionModel *) etsm, *p++); + e_selection_model_selection_row_changed ( + (ESelectionModel *) etsm, *p++); } - e_selection_model_selection_row_changed ((ESelectionModel *) etsm, row); + e_selection_model_selection_row_changed ( + (ESelectionModel *) etsm, row); } } @@ -654,8 +704,9 @@ etsm_toggle_single_row (ESelectionModel *selection, gint row) { ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (selection); - ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); + ETreePath path; + path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); g_return_if_fail (path); if (g_hash_table_lookup (etsm->priv->paths, path)) @@ -672,12 +723,14 @@ static void etsm_real_move_selection_end (ETreeSelectionModel *etsm, gint row) { - ETreePath end_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); + ETreePath end_path; gint start; + end_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row); g_return_if_fail (end_path); - start = e_tree_table_adapter_row_of_node (etsm->priv->etta, etsm->priv->start_path); + start = e_tree_table_adapter_row_of_node ( + etsm->priv->etta, etsm->priv->start_path); clear_selection (etsm); select_range (etsm, start, row); } @@ -782,8 +835,10 @@ e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, E_SELECTION_MODEL (etsm)->old_selection = -1; - e_selection_model_cursor_changed (E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col); - e_selection_model_cursor_activated (E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col); + e_selection_model_cursor_changed ( + E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col); + e_selection_model_cursor_activated ( + E_SELECTION_MODEL (etsm), row, etsm->priv->cursor_col); } ETreePath @@ -795,8 +850,7 @@ e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm) static void e_tree_selection_model_init (ETreeSelectionModel *etsm) { - etsm->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etsm, E_TYPE_TREE_SELECTION_MODEL, ETreeSelectionModelPrivate); + etsm->priv = E_TREE_SELECTION_MODEL_GET_PRIVATE (etsm); etsm->priv->paths = g_hash_table_new (NULL, NULL); etsm->priv->cursor_col = -1; @@ -835,33 +889,45 @@ e_tree_selection_model_class_init (ETreeSelectionModelClass *class) esm_class->move_selection_end = etsm_move_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", - "Cursor Row", - NULL, - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CURSOR_COL, - g_param_spec_int ("cursor_col", - "Cursor Column", - NULL, - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - "Model", - NULL, - E_TYPE_TREE_MODEL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_ETTA, - g_param_spec_object ("etta", - "ETTA", - NULL, - E_TYPE_TREE_TABLE_ADAPTER, - G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_CURSOR_ROW, + g_param_spec_int ( + "cursor_row", + "Cursor Row", + NULL, + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_CURSOR_COL, + g_param_spec_int ( + "cursor_col", + "Cursor Column", + NULL, + 0, G_MAXINT, 0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MODEL, + g_param_spec_object ( + "model", + "Model", + NULL, + E_TYPE_TREE_MODEL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_ETTA, + g_param_spec_object ( + "etta", + "ETTA", + NULL, + E_TYPE_TREE_TABLE_ADAPTER, + G_PARAM_READWRITE)); } diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 4d95fcc74b..eee9414d2a 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -50,6 +50,10 @@ #define d(x) +#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 { @@ -600,7 +604,7 @@ ets_dispose (GObject *object) { ETreeSortedPrivate *priv; - priv = E_TREE_SORTED (object)->priv; + priv = E_TREE_SORTED_GET_PRIVATE (object); if (priv->source) { g_signal_handler_disconnect ( @@ -666,7 +670,7 @@ ets_finalize (GObject *object) { ETreeSortedPrivate *priv; - priv = E_TREE_SORTED (object)->priv; + priv = E_TREE_SORTED_GET_PRIVATE (object); if (priv->root) free_path (priv->root); @@ -1267,8 +1271,7 @@ e_tree_sorted_class_init (ETreeSortedClass *class) static void e_tree_sorted_init (ETreeSorted *ets) { - ets->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - ets, E_TYPE_TREE_SORTED, ETreeSortedPrivate); + ets->priv = E_TREE_SORTED_GET_PRIVATE (ets); } /** diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 1b87211c7b..dd7c1e7705 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -39,6 +39,10 @@ #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_TYPE_TABLE_MODEL) @@ -535,7 +539,7 @@ etta_finalize (GObject *object) { ETreeTableAdapterPrivate *priv; - priv = E_TREE_TABLE_ADAPTER (object)->priv; + priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object); if (priv->resort_idle_id) { g_source_remove (priv->resort_idle_id); @@ -560,7 +564,7 @@ etta_dispose (GObject *object) { ETreeTableAdapterPrivate *priv; - priv = E_TREE_TABLE_ADAPTER (object)->priv; + priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (object); if (priv->sort_info) { g_signal_handler_disconnect ( @@ -787,8 +791,7 @@ etta_class_init (ETreeTableAdapterClass *class) static void etta_init (ETreeTableAdapter *etta) { - etta->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - etta, E_TYPE_TREE_TABLE_ADAPTER, ETreeTableAdapterPrivate); + etta->priv = E_TREE_TABLE_ADAPTER_GET_PRIVATE (etta); etta->priv->root_visible = TRUE; etta->priv->remap_needed = TRUE; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index ffcca22457..f78a477643 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -58,6 +58,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, @@ -396,7 +400,7 @@ et_dispose (GObject *object) { ETreePrivate *priv; - priv = E_TREE (object)->priv; + priv = E_TREE_GET_PRIVATE (object); if (priv->search != NULL) { g_signal_handler_disconnect ( @@ -602,8 +606,7 @@ e_tree_init (ETree *e_tree) gtk_table_set_homogeneous (GTK_TABLE (e_tree), FALSE); - e_tree->priv = G_TYPE_INSTANCE_GET_PRIVATE ( - e_tree, E_TYPE_TREE, ETreePrivate); + e_tree->priv = E_TREE_GET_PRIVATE (e_tree); e_tree->priv->alternating_row_colors = 1; e_tree->priv->horizontal_draw_grid = 1; @@ -669,7 +672,8 @@ et_focus (GtkWidget *container, return FALSE; } - return gtk_widget_child_focus (GTK_WIDGET (e_tree->priv->table_canvas), direction); + return gtk_widget_child_focus ( + GTK_WIDGET (e_tree->priv->table_canvas), direction); } static void @@ -681,17 +685,19 @@ set_header_canvas_width (ETree *e_tree) e_tree->priv->header_canvas && e_tree->priv->table_canvas)) return; - gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas), - NULL, NULL, &width, NULL); - gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->header_canvas), - NULL, NULL, &oldwidth, &oldheight); + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (e_tree->priv->table_canvas), + NULL, NULL, &width, NULL); + gnome_canvas_get_scroll_region ( + GNOME_CANVAS (e_tree->priv->header_canvas), + NULL, NULL, &oldwidth, &oldheight); if (oldwidth != width || oldheight != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1) gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_tree->priv->header_canvas), - 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */ - E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1); + GNOME_CANVAS (e_tree->priv->header_canvas), + 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */ + E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1); } @@ -966,7 +972,8 @@ item_key_press (ETableItem *eti, e_tree_get_cell_at (et, 30, y, &row_local, &col_local); if (row_local == -1) - row_local = e_table_model_row_count (E_TABLE_MODEL (et->priv->etta)) - 1; + row_local = e_table_model_row_count ( + E_TABLE_MODEL (et->priv->etta)) - 1; row_local = e_tree_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col ( @@ -984,7 +991,8 @@ item_key_press (ETableItem *eti, e_tree_get_cell_at (et, 30, y, &row_local, &col_local); if (row_local == -1) - row_local = e_table_model_row_count (E_TABLE_MODEL (et->priv->etta)) - 1; + row_local = e_table_model_row_count ( + E_TABLE_MODEL (et->priv->etta)) - 1; row_local = e_tree_view_to_model_row (et, row_local); col_local = e_selection_model_cursor_col ( @@ -1005,9 +1013,11 @@ item_key_press (ETableItem *eti, GDK_MOD1_MASK)) != GDK_SHIFT_MASK) break; if (row != -1) { - path = e_tree_table_adapter_node_at_row (et->priv->etta, row); + path = e_tree_table_adapter_node_at_row ( + et->priv->etta, row); if (path) - e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE); + e_tree_table_adapter_node_set_expanded ( + et->priv->etta, path, TRUE); } return_val = 1; break; @@ -1021,9 +1031,11 @@ item_key_press (ETableItem *eti, GDK_MOD1_MASK)) != GDK_SHIFT_MASK) break; if (row != -1) { - path = e_tree_table_adapter_node_at_row (et->priv->etta, row); + path = e_tree_table_adapter_node_at_row ( + et->priv->etta, row); if (path) - e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE); + e_tree_table_adapter_node_set_expanded ( + et->priv->etta, path, FALSE); } return_val = 1; break; @@ -1102,20 +1114,27 @@ et_build_item (ETree *et) "uniform_row_height", et->priv->uniform_row_height, NULL); - g_signal_connect (et->priv->item, "cursor_change", - G_CALLBACK (item_cursor_change), et); - g_signal_connect (et->priv->item, "cursor_activated", - G_CALLBACK (item_cursor_activated), et); - g_signal_connect (et->priv->item, "double_click", - G_CALLBACK (item_double_click), et); - g_signal_connect (et->priv->item, "right_click", - G_CALLBACK (item_right_click), et); - g_signal_connect (et->priv->item, "click", - G_CALLBACK (item_click), et); - g_signal_connect (et->priv->item, "key_press", - G_CALLBACK (item_key_press), et); - g_signal_connect (et->priv->item, "start_drag", - G_CALLBACK (item_start_drag), et); + g_signal_connect ( + et->priv->item, "cursor_change", + G_CALLBACK (item_cursor_change), et); + g_signal_connect ( + et->priv->item, "cursor_activated", + G_CALLBACK (item_cursor_activated), et); + g_signal_connect ( + et->priv->item, "double_click", + G_CALLBACK (item_double_click), et); + g_signal_connect ( + et->priv->item, "right_click", + G_CALLBACK (item_right_click), et); + g_signal_connect ( + et->priv->item, "click", + G_CALLBACK (item_click), et); + g_signal_connect ( + et->priv->item, "key_press", + G_CALLBACK (item_key_press), et); + g_signal_connect ( + et->priv->item, "start_drag", + G_CALLBACK (item_start_drag), et); } static void @@ -1241,8 +1260,9 @@ e_tree_setup_table (ETree *e_tree) e_tree, "drag_data_received", G_CALLBACK (et_drag_data_received), e_tree); - g_signal_connect (e_tree->priv->table_canvas, "reflow", - G_CALLBACK (tree_canvas_reflow), e_tree); + g_signal_connect ( + e_tree->priv->table_canvas, "reflow", + G_CALLBACK (tree_canvas_reflow), e_tree); widget = GTK_WIDGET (e_tree->priv->table_canvas); style = gtk_widget_get_style (widget); @@ -1601,10 +1621,12 @@ et_real_construct (ETree *e_tree, "cursor_mode", specification->cursor_mode, NULL); - g_signal_connect (e_tree->priv->selection, "selection_changed", - G_CALLBACK (et_selection_model_selection_changed), e_tree); - g_signal_connect (e_tree->priv->selection, "selection_row_changed", - G_CALLBACK (et_selection_model_selection_row_changed), e_tree); + g_signal_connect ( + e_tree->priv->selection, "selection_changed", + G_CALLBACK (et_selection_model_selection_changed), e_tree); + g_signal_connect ( + e_tree->priv->selection, "selection_row_changed", + G_CALLBACK (et_selection_model_selection_row_changed), e_tree); if (!specification->no_headers) { e_tree_setup_header (e_tree); @@ -1623,17 +1645,22 @@ et_real_construct (ETree *e_tree, /* * The header */ - gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->header_canvas), - 0, 1, 0 + row, 1 + row, - GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + gtk_table_attach ( + GTK_TABLE (e_tree), + GTK_WIDGET (e_tree->priv->header_canvas), + 0, 1, 0 + row, 1 + row, + GTK_FILL | GTK_EXPAND, + GTK_FILL, 0, 0); row++; } - gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->table_canvas), - 0, 1, 0 + row, 1 + row, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); + + gtk_table_attach ( + GTK_TABLE (e_tree), + GTK_WIDGET (e_tree->priv->table_canvas), + 0, 1, 0 + row, 1 + row, + GTK_FILL | GTK_EXPAND, + GTK_FILL | GTK_EXPAND, + 0, 0); g_object_unref (ete); @@ -2001,12 +2028,15 @@ et_get_property (GObject *object, case PROP_ETTA: g_value_set_object (value, etree->priv->etta); break; + case PROP_UNIFORM_ROW_HEIGHT: g_value_set_boolean (value, etree->priv->uniform_row_height); break; + case PROP_ALWAYS_SEARCH: g_value_set_boolean (value, etree->priv->always_search); break; + case PROP_HADJUSTMENT: if (etree->priv->table_canvas) g_object_get_property ( @@ -2015,6 +2045,7 @@ et_get_property (GObject *object, else g_value_set_object (value, NULL); break; + case PROP_VADJUSTMENT: if (etree->priv->table_canvas) g_object_get_property ( @@ -2023,6 +2054,7 @@ et_get_property (GObject *object, else g_value_set_object (value, NULL); break; + case PROP_HSCROLL_POLICY: if (etree->priv->table_canvas) g_object_get_property ( @@ -2031,6 +2063,7 @@ et_get_property (GObject *object, else g_value_set_enum (value, 0); break; + case PROP_VSCROLL_POLICY: if (etree->priv->table_canvas) g_object_get_property ( @@ -2039,6 +2072,7 @@ et_get_property (GObject *object, else g_value_set_enum (value, 0); break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -2062,45 +2096,55 @@ et_set_property (GObject *object, case PROP_LENGTH_THRESHOLD: etree->priv->length_threshold = g_value_get_int (value); if (etree->priv->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item), - "length_threshold", etree->priv->length_threshold, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etree->priv->item), + "length_threshold", + etree->priv->length_threshold, + NULL); } break; case PROP_HORIZONTAL_DRAW_GRID: etree->priv->horizontal_draw_grid = g_value_get_boolean (value); if (etree->priv->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item), - "horizontal_draw_grid", etree->priv->horizontal_draw_grid, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etree->priv->item), + "horizontal_draw_grid", + etree->priv->horizontal_draw_grid, + NULL); } break; case PROP_VERTICAL_DRAW_GRID: etree->priv->vertical_draw_grid = g_value_get_boolean (value); if (etree->priv->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item), - "vertical_draw_grid", etree->priv->vertical_draw_grid, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etree->priv->item), + "vertical_draw_grid", + etree->priv->vertical_draw_grid, + NULL); } break; case PROP_DRAW_FOCUS: etree->priv->draw_focus = g_value_get_boolean (value); if (etree->priv->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item), - "drawfocus", etree->priv->draw_focus, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etree->priv->item), + "drawfocus", + etree->priv->draw_focus, + NULL); } break; case PROP_UNIFORM_ROW_HEIGHT: etree->priv->uniform_row_height = g_value_get_boolean (value); if (etree->priv->item) { - gnome_canvas_item_set (GNOME_CANVAS_ITEM (etree->priv->item), - "uniform_row_height", etree->priv->uniform_row_height, - NULL); + gnome_canvas_item_set ( + GNOME_CANVAS_ITEM (etree->priv->item), + "uniform_row_height", + etree->priv->uniform_row_height, + NULL); } break; @@ -2117,18 +2161,21 @@ et_set_property (GObject *object, G_OBJECT (etree->priv->table_canvas), "hadjustment", value); break; + case PROP_VADJUSTMENT: if (etree->priv->table_canvas) g_object_set_property ( G_OBJECT (etree->priv->table_canvas), "vadjustment", value); break; + case PROP_HSCROLL_POLICY: if (etree->priv->table_canvas) g_object_set_property ( G_OBJECT (etree->priv->table_canvas), "hscroll-policy", value); break; + case PROP_VSCROLL_POLICY: if (etree->priv->table_canvas) g_object_set_property ( diff --git a/widgets/table/gal-a11y-e-cell-registry.c b/widgets/table/gal-a11y-e-cell-registry.c index ce533882ab..db05ac05c1 100644 --- a/widgets/table/gal-a11y-e-cell-registry.c +++ b/widgets/table/gal-a11y-e-cell-registry.c @@ -93,7 +93,8 @@ gal_a11y_e_cell_registry_get_type (void) NULL /* value_cell */ }; - type = g_type_register_static (PARENT_TYPE, "GalA11yECellRegistry", &info, 0); + type = g_type_register_static ( + PARENT_TYPE, "GalA11yECellRegistry", &info, 0); } return type; @@ -130,10 +131,10 @@ gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry, type = g_type_parent (type); } - if (func) - return func (item, cell_view, parent, model_col, view_col, row); - else - return gal_a11y_e_cell_new (item, cell_view, parent, model_col, view_col, row); + if (func == NULL) + func = gal_a11y_e_cell_new; + + return func (item, cell_view, parent, model_col, view_col, row); } void diff --git a/widgets/table/gal-a11y-e-cell-toggle.c b/widgets/table/gal-a11y-e-cell-toggle.c index 991d3c0721..ca6fdfc14d 100644 --- a/widgets/table/gal-a11y-e-cell-toggle.c +++ b/widgets/table/gal-a11y-e-cell-toggle.c @@ -179,10 +179,9 @@ gal_a11y_e_cell_toggle_new (ETableItem *item, NULL, /* action keybinding */ toggle_cell_action); - toggle_cell->model_id = g_signal_connect (item->table_model, - "model_cell_changed", - (GCallback) model_change_cb, - a11y); + toggle_cell->model_id = g_signal_connect ( + item->table_model, "model_cell_changed", + (GCallback) model_change_cb, a11y); value = GPOINTER_TO_INT ( e_table_model_value_at (cell->cell_view->e_table_model, diff --git a/widgets/table/gal-a11y-e-cell-tree.c b/widgets/table/gal-a11y-e-cell-tree.c index 148731d4b8..a1653698a2 100644 --- a/widgets/table/gal-a11y-e-cell-tree.c +++ b/widgets/table/gal-a11y-e-cell-tree.c @@ -246,10 +246,9 @@ gal_a11y_e_cell_tree_new (ETableItem *item, model_col, view_col, row); - a11y->model_row_changed_id = - g_signal_connect (item->table_model, "model_row_changed", - G_CALLBACK (ectr_model_row_changed_cb), - subcell_a11y); + a11y->model_row_changed_id = g_signal_connect ( + item->table_model, "model_row_changed", + G_CALLBACK (ectr_model_row_changed_cb), subcell_a11y); if (subcell_a11y && subcell_view) { 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 e4b5255e4c..1f116ee6b3 100644 --- a/widgets/table/gal-a11y-e-table-click-to-add.c +++ b/widgets/table/gal-a11y-e-table-click-to-add.c @@ -335,11 +335,13 @@ gal_a11y_e_table_click_to_add_new (GObject *widget) priv->rect = etcta->rect; priv->row = etcta->row; - g_signal_connect_after (G_OBJECT(widget), "event", - G_CALLBACK (etcta_event), a11y); + g_signal_connect_after ( + widget, "event", + G_CALLBACK (etcta_event), a11y); - g_signal_connect (etcta->selection, "cursor_changed", - G_CALLBACK (etcta_selection_cursor_changed), a11y); + g_signal_connect ( + etcta->selection, "cursor_changed", + G_CALLBACK (etcta_selection_cursor_changed), a11y); return ATK_OBJECT (a11y); } @@ -348,9 +350,9 @@ void gal_a11y_e_table_click_to_add_init (void) { if (atk_get_root ()) - atk_registry_set_factory_type (atk_get_default_registry (), - E_TYPE_TABLE_CLICK_TO_ADD, - gal_a11y_e_table_click_to_add_factory_get_type ()); - + atk_registry_set_factory_type ( + atk_get_default_registry (), + 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-column-header.c b/widgets/table/gal-a11y-e-table-column-header.c index 8e13fd6865..05a99e381b 100644 --- a/widgets/table/gal-a11y-e-table-column-header.c +++ b/widgets/table/gal-a11y-e-table-column-header.c @@ -123,14 +123,17 @@ gal_a11y_e_table_column_header_do_action (AtkAction *action, switch (i) { case 0: a11y = GAL_A11Y_E_TABLE_COLUMN_HEADER (action); - col = E_TABLE_COL (etch_a11y_get_gobject (ATK_GOBJECT_ACCESSIBLE (a11y))); + col = E_TABLE_COL (etch_a11y_get_gobject ( + ATK_GOBJECT_ACCESSIBLE (a11y))); item = GET_PRIVATE (a11y)->item; widget = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas)); if (E_IS_TREE (widget)) { - ethi = E_TABLE_HEADER_ITEM (e_tree_get_header_item (E_TREE (widget))); + ethi = E_TABLE_HEADER_ITEM ( + e_tree_get_header_item (E_TREE (widget))); } else if (E_IS_TABLE (widget)) - ethi = E_TABLE_HEADER_ITEM (E_TABLE (widget)->header_item); + ethi = E_TABLE_HEADER_ITEM ( + E_TABLE (widget)->header_item); else break; ethi_change_sort_state (ethi, col); diff --git a/widgets/table/gal-a11y-e-table-factory.c b/widgets/table/gal-a11y-e-table-factory.c index 2270cbaa5b..a3905ab393 100644 --- a/widgets/table/gal-a11y-e-table-factory.c +++ b/widgets/table/gal-a11y-e-table-factory.c @@ -93,7 +93,8 @@ gal_a11y_e_table_factory_get_type (void) NULL /* value_table */ }; - type = g_type_register_static (PARENT_TYPE, "GalA11yETableFactory", &info, 0); + type = g_type_register_static ( + PARENT_TYPE, "GalA11yETableFactory", &info, 0); } return type; -- cgit