From 5c80f1534b435ff5c1c9cc88eb9f5c5c1124f82a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 3 Jan 2010 22:47:27 -0500 Subject: Coding style and whitespace cleanup. --- widgets/e-timezone-dialog/e-timezone-dialog.c | 36 ++++++--- widgets/misc/e-calendar-item.c | 101 ++++++++++++++++++++------ widgets/misc/e-url-entry.c | 4 +- widgets/table/e-cell-popup.c | 27 ++++--- widgets/table/e-table-click-to-add.c | 16 ++-- widgets/table/e-table-extras.c | 30 ++++++-- 6 files changed, 158 insertions(+), 56 deletions(-) (limited to 'widgets') diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c index 715313c072..fa8c5ed347 100644 --- a/widgets/e-timezone-dialog/e-timezone-dialog.c +++ b/widgets/e-timezone-dialog/e-timezone-dialog.c @@ -239,7 +239,9 @@ e_timezone_dialog_add_timezones (ETimezoneDialog *etd) g_hash_table_insert (index, (gchar *)(l->data), GINT_TO_POINTER (i)); } - g_object_set_data_full (G_OBJECT (list_store), "index", index, (GDestroyNotify) g_hash_table_destroy); + g_object_set_data_full ( + G_OBJECT (list_store), "index", index, + (GDestroyNotify) g_hash_table_destroy); gtk_combo_box_set_model (combo, (GtkTreeModel *) list_store); @@ -272,12 +274,16 @@ e_timezone_dialog_construct (ETimezoneDialog *etd) e_load_ui_builder_definition (priv->builder, "e-timezone-dialog.ui"); if (!get_widgets (etd)) { - g_message ("e_timezone_dialog_construct(): Could not find all widgets in the XML file!"); + g_message ( + "%s(): Could not find all widgets in the XML file!", + G_STRFUNC); goto error; } - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (priv->app)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (priv->app)->action_area), 12); + gtk_container_set_border_width ( + GTK_CONTAINER (GTK_DIALOG (priv->app)->vbox), 0); + gtk_container_set_border_width ( + GTK_CONTAINER (GTK_DIALOG (priv->app)->action_area), 12); priv->map = e_map_new (); map = GTK_WIDGET (priv->map); @@ -296,12 +302,22 @@ e_timezone_dialog_construct (ETimezoneDialog *etd) /* Ensure a reasonable minimum amount of map is visible */ gtk_widget_set_size_request (priv->map_window, 200, 200); - g_signal_connect (map, "motion-notify-event", G_CALLBACK (on_map_motion), etd); - g_signal_connect (map, "leave-notify-event", G_CALLBACK (on_map_leave), etd); - g_signal_connect (map, "visibility-notify-event", G_CALLBACK (on_map_visibility_changed), etd); - g_signal_connect (map, "button-press-event", G_CALLBACK (on_map_button_pressed), etd); - - g_signal_connect (GTK_COMBO_BOX (priv->timezone_combo), "changed", G_CALLBACK (on_combo_changed), etd); + g_signal_connect ( + map, "motion-notify-event", + G_CALLBACK (on_map_motion), etd); + g_signal_connect ( + map, "leave-notify-event", + G_CALLBACK (on_map_leave), etd); + g_signal_connect ( + map, "visibility-notify-event", + G_CALLBACK (on_map_visibility_changed), etd); + g_signal_connect ( + map, "button-press-event", + G_CALLBACK (on_map_button_pressed), etd); + + g_signal_connect ( + priv->timezone_combo, "changed", + G_CALLBACK (on_combo_changed), etd); return etd; diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 8d879b1826..742dd763a8 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -884,6 +884,7 @@ e_calendar_item_update (GnomeCanvasItem *item, ArtSVP *clip_path, gint flags) { + GnomeCanvasItemClass *item_class; ECalendarItem *calitem; GtkStyle *style; gint char_height, width, height, space, space_per_cal, space_per_cell; @@ -892,8 +893,9 @@ e_calendar_item_update (GnomeCanvasItem *item, PangoContext *pango_context; PangoFontMetrics *font_metrics; - if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->update) (item, affine, clip_path, flags); + item_class = GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class); + if (item_class->update != NULL) + item_class->update (item, affine, clip_path, flags); calitem = E_CALENDAR_ITEM (item); style = GTK_WIDGET (item->canvas)->style; @@ -2158,10 +2160,14 @@ e_calendar_item_button_press (ECalendarItem *calitem, } if (round_up_end) - e_calendar_item_round_up_selection (calitem, &calitem->selection_end_month_offset, &calitem->selection_end_day); + e_calendar_item_round_up_selection ( + calitem, &calitem->selection_end_month_offset, + &calitem->selection_end_day); if (round_down_start) - e_calendar_item_round_down_selection (calitem, &calitem->selection_start_month_offset, &calitem->selection_start_day); + e_calendar_item_round_down_selection ( + calitem, &calitem->selection_start_month_offset, + &calitem->selection_start_day); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem)); @@ -2219,11 +2225,13 @@ e_calendar_item_motion (ECalendarItem *calitem, end_month = tmp_month; end_day = tmp_day; - calitem->selection_dragging_end = !calitem->selection_dragging_end; + calitem->selection_dragging_end = + !calitem->selection_dragging_end; } if (calitem->days_to_start_week_selection > 0) { - days_in_selection = e_calendar_item_get_inclusive_days (calitem, start_month, start_day, end_month, end_day); + days_in_selection = e_calendar_item_get_inclusive_days ( + calitem, start_month, start_day, end_month, end_day); if (days_in_selection >= calitem->days_to_start_week_selection) { round_down_start = TRUE; round_up_end = TRUE; @@ -2628,8 +2636,12 @@ e_calendar_item_set_first_month(ECalendarItem *calitem, gint selected_day; struct tm tmp_tm = { 0 }; - old_days_in_selection = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, - calitem->selection_end_month_offset, calitem->selection_end_day); + old_days_in_selection = e_calendar_item_get_inclusive_days ( + calitem, + calitem->selection_start_month_offset, + calitem->selection_start_day, + calitem->selection_end_month_offset, + calitem->selection_end_day); /* Calculate the currently selected day */ tmp_tm.tm_year = calitem->year - 1900; @@ -2652,17 +2664,31 @@ e_calendar_item_set_first_month(ECalendarItem *calitem, calitem->year = new_year; calitem->month = new_month; - e_calendar_item_ensure_valid_day (calitem, &calitem->selection_start_month_offset, &calitem->selection_start_day); - e_calendar_item_ensure_valid_day (calitem, &calitem->selection_end_month_offset, &calitem->selection_end_day); + e_calendar_item_ensure_valid_day ( + calitem, &calitem->selection_start_month_offset, + &calitem->selection_start_day); + e_calendar_item_ensure_valid_day ( + calitem, &calitem->selection_end_month_offset, + &calitem->selection_end_day); if (calitem->preserve_day_when_moving) { - e_calendar_item_preserve_day_selection (calitem, selected_day, &calitem->selection_start_month_offset, &calitem->selection_start_day); + e_calendar_item_preserve_day_selection ( + calitem, selected_day, + &calitem->selection_start_month_offset, + &calitem->selection_start_day); } - new_days_in_selection = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, calitem->selection_end_month_offset, calitem->selection_end_day); + new_days_in_selection = e_calendar_item_get_inclusive_days ( + calitem, + calitem->selection_start_month_offset, + calitem->selection_start_day, + calitem->selection_end_month_offset, + calitem->selection_end_day); if (old_days_in_selection != new_days_in_selection) - e_calendar_item_add_days_to_selection (calitem, old_days_in_selection - new_days_in_selection); + e_calendar_item_add_days_to_selection ( + calitem, old_days_in_selection - + new_days_in_selection); /* Flag that we need to emit the "selection_changed" signal. We don't want to emit it here since setting @@ -2839,6 +2865,7 @@ e_calendar_item_mark_day (ECalendarItem *calitem, gboolean add_day_style) { gint month_offset; + gint index; month_offset = (year - calitem->year) * 12 + month - calitem->month; if (month_offset < -1 || month_offset > calitem->rows * calitem->cols) @@ -2847,7 +2874,9 @@ e_calendar_item_mark_day (ECalendarItem *calitem, if (!calitem->styles) calitem->styles = g_new0 (guint8, (calitem->rows * calitem->cols + 2) * 32); - calitem->styles[(month_offset + 1) * 32 + day] = (add_day_style ? calitem->styles[(month_offset + 1) * 32 + day] : 0) | day_style; + index = (month_offset + 1) * 32 + day; + calitem->styles[index] = day_style | + (add_day_style ? calitem->styles[index] : 0); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem)); } @@ -2891,6 +2920,8 @@ e_calendar_item_mark_days (ECalendarItem *calitem, calitem->styles = g_new0 (guint8, (calitem->rows * calitem->cols + 2) * 32); for (;;) { + gint index; + if (month_offset == end_month_offset && day > end_day) break; @@ -2902,7 +2933,9 @@ e_calendar_item_mark_days (ECalendarItem *calitem, #if 0 g_print ("Marking Month:%i Day:%i\n", month_offset, day); #endif - calitem->styles[(month_offset + 1) * 32 + day] = (add_day_style ? calitem->styles[(month_offset + 1) * 32 + day] : 0) | day_style; + index = (month_offset + 1) * 32 + day; + calitem->styles[index] = day_style | + (add_day_style ? calitem->styles[index] : 0); day++; if (day == 32) { @@ -3148,11 +3181,22 @@ e_calendar_item_set_selection_if_emission (ECalendarItem *calitem, void e_calendar_item_style_set (GtkWidget *widget, ECalendarItem *calitem) { - calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX] = widget->style->bg[GTK_STATE_SELECTED]; - calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG] = widget->style->base[GTK_STATE_NORMAL]; - calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED] = widget->style->bg[GTK_STATE_SELECTED]; - calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG] = widget->style->fg[GTK_STATE_INSENSITIVE]; - calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG] = widget->style->fg[GTK_STATE_INSENSITIVE]; + GdkColor *color; + + color = &widget->style->bg[GTK_STATE_SELECTED]; + calitem->colors[E_CALENDAR_ITEM_COLOR_TODAY_BOX] = *color; + + color = &widget->style->base[GTK_STATE_NORMAL]; + calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_FG] = *color; + + color = &widget->style->bg[GTK_STATE_SELECTED]; + calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG_FOCUSED] = *color; + + color = &widget->style->fg[GTK_STATE_INSENSITIVE]; + calitem->colors[E_CALENDAR_ITEM_COLOR_SELECTION_BG] = *color; + + color = &widget->style->fg[GTK_STATE_INSENSITIVE]; + calitem->colors[E_CALENDAR_ITEM_COLOR_PREV_OR_NEXT_MONTH_FG] = *color; } void @@ -3333,10 +3377,16 @@ e_calendar_item_on_menu_item_activate (GtkWidget *menuitem, ECalendarItem *calitem) { gint year, month_offset, month; + gpointer data; + + data = g_object_get_data (G_OBJECT (menuitem->parent), "year"); + year = GPOINTER_TO_INT (data); + + data = g_object_get_data (G_OBJECT (menuitem->parent), "month_offset"); + month_offset = GPOINTER_TO_INT (data); - year = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "year")); - month_offset = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "month_offset")); - month = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem), "month")); + data = g_object_get_data (G_OBJECT (menuitem), "month"); + month = GPOINTER_TO_INT (data); month -= month_offset; e_calendar_item_normalize_date (calitem, &year, &month); @@ -3397,7 +3447,10 @@ static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem) { if (calitem->signal_emission_idle_id == 0) { - calitem->signal_emission_idle_id = g_idle_add_full (G_PRIORITY_HIGH, e_calendar_item_signal_emission_idle_cb, calitem, NULL); + calitem->signal_emission_idle_id = g_idle_add_full ( + G_PRIORITY_HIGH, (GSourceFunc) + e_calendar_item_signal_emission_idle_cb, + calitem, NULL); } } diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c index 6900bd12f3..3109f16989 100644 --- a/widgets/misc/e-url-entry.c +++ b/widgets/misc/e-url-entry.c @@ -100,7 +100,9 @@ init (EUrlEntry *url_entry) priv->button = gtk_button_new (); gtk_widget_set_sensitive (priv->button, FALSE); gtk_box_pack_start (GTK_BOX (url_entry), priv->button, FALSE, FALSE, 0); - atk_object_set_name (gtk_widget_get_accessible (priv->button), _("Click here to go to URL")); + atk_object_set_name ( + gtk_widget_get_accessible (priv->button), + _("Click here to go to URL")); pixmap = gtk_image_new_from_icon_name ("go-jump", GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (priv->button), pixmap); gtk_widget_show (pixmap); diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index 45c6d07377..c4ca572a85 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -212,14 +212,16 @@ ecp_kill_view (ECellView *ecv) { ECellPopupView *ecp_view = (ECellPopupView *) ecv; - if (ecp_view->cell_view.kill_view_cb) - (ecp_view->cell_view.kill_view_cb)(ecv, ecp_view->cell_view.kill_view_cb_data); + if (ecp_view->cell_view.kill_view_cb) + ecp_view->cell_view.kill_view_cb ( + ecv, ecp_view->cell_view.kill_view_cb_data); - if (ecp_view->cell_view.kill_view_cb_data) - g_list_free(ecp_view->cell_view.kill_view_cb_data); + if (ecp_view->cell_view.kill_view_cb_data) + g_list_free (ecp_view->cell_view.kill_view_cb_data); if (ecp_view->child_view) e_cell_kill_view (ecp_view->child_view); + g_free (ecp_view); } @@ -261,14 +263,18 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable, { ECellPopup *ecp = E_CELL_POPUP (ecv->ecell); ECellPopupView *ecp_view = (ECellPopupView *) ecv; - GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas); + GtkWidget *canvas; GtkShadowType shadow; GdkRectangle rect; gboolean show_popup_arrow; + canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas); + /* Display the popup arrow if we are the cursor cell, or the popup is shown for this cell. */ - show_popup_arrow = e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) && + show_popup_arrow = + e_table_model_is_cell_editable ( + ecv->e_table_model, model_col, row) && (flags & E_CELL_CURSOR || (ecp->popup_shown && ecp->popup_view_col == view_col && ecp->popup_row == row @@ -486,10 +492,13 @@ e_cell_popup_do_popup (ECellPopupView *ecp_view, void e_cell_popup_queue_cell_redraw (ECellPopup *ecp) { - ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); + ETableItem *eti; + + eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view); - e_table_item_redraw_range (eti, ecp->popup_view_col, ecp->popup_row, - ecp->popup_view_col, ecp->popup_row); + e_table_item_redraw_range ( + eti, ecp->popup_view_col, ecp->popup_row, + ecp->popup_view_col, ecp->popup_row); } void diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 7cceadcec8..c71e10bde4 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -187,7 +187,10 @@ etcta_dispose (GObject *object) } static void -etcta_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +etcta_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GnomeCanvasItem *item; ETableClickToAdd *etcta; @@ -311,7 +314,11 @@ etcta_unrealize (GnomeCanvasItem *item) static void finish_editing (ETableClickToAdd *etcta); static gint -item_key_press (ETableItem *item, gint row, gint col, GdkEvent *event, ETableClickToAdd *etcta) +item_key_press (ETableItem *item, + gint row, + gint col, + GdkEvent *event, + ETableClickToAdd *etcta) { switch (event->key.keyval) { case GDK_Return: @@ -368,9 +375,8 @@ finish_editing (ETableClickToAdd *etcta) } } -/* - * Handles the events on the ETableClickToAdd, particularly it creates the ETableItem and passes in some events. - */ +/* Handles the events on the ETableClickToAdd, particularly + * it creates the ETableItem and passes in some events. */ static gint etcta_event (GnomeCanvasItem *item, GdkEvent *e) { diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index 9d9b7ee65c..a02ac45e42 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -163,6 +163,8 @@ safe_unref (gpointer object) static void ete_init (ETableExtras *extras) { + ECell *cell; + extras->priv = E_TABLE_EXTRAS_GET_PRIVATE (extras); extras->priv->cells = g_hash_table_new_full ( @@ -193,13 +195,27 @@ ete_init (ETableExtras *extras) e_table_extras_add_search(extras, "string", e_string_search); - e_table_extras_add_cell(extras, "checkbox", e_cell_checkbox_new()); - e_table_extras_add_cell(extras, "date", e_cell_date_new (NULL, GTK_JUSTIFY_LEFT)); - e_table_extras_add_cell(extras, "number", e_cell_number_new (NULL, GTK_JUSTIFY_RIGHT)); - e_table_extras_add_cell(extras, "pixbuf", e_cell_pixbuf_new ()); - e_table_extras_add_cell(extras, "size", e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT)); - e_table_extras_add_cell(extras, "string", e_cell_text_new (NULL, GTK_JUSTIFY_LEFT)); - e_table_extras_add_cell(extras, "tree-string", e_cell_tree_new (NULL, NULL, TRUE, e_cell_text_new (NULL, GTK_JUSTIFY_LEFT))); + cell = e_cell_checkbox_new (); + e_table_extras_add_cell(extras, "checkbox", cell); + + cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); + e_table_extras_add_cell(extras, "date", cell); + + cell = e_cell_number_new (NULL, GTK_JUSTIFY_RIGHT); + e_table_extras_add_cell(extras, "number", cell); + + cell = e_cell_pixbuf_new (); + e_table_extras_add_cell(extras, "pixbuf", cell); + + cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); + e_table_extras_add_cell(extras, "size", cell); + + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + e_table_extras_add_cell(extras, "string", cell); + + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + cell = e_cell_tree_new (NULL, NULL, TRUE, cell); + e_table_extras_add_cell(extras, "tree-string", cell); } ETableExtras * -- cgit