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. --- addressbook/gui/widgets/e-minicard-view.c | 19 +- addressbook/importers/evolution-csv-importer.c | 4 +- addressbook/importers/evolution-vcard-importer.c | 18 +- calendar/gui/dialogs/comp-editor.h | 27 +- calendar/gui/e-task-table.c | 50 ++- calendar/gui/ea-cal-view-event.c | 4 +- calendar/gui/gnome-cal.h | 20 +- calendar/gui/weekday-picker.c | 475 ++++++++++----------- e-util/e-html-utils.c | 5 +- e-util/e-logger.c | 10 +- e-util/e-non-intrusive-error-dialog.c | 11 +- e-util/e-util.c | 85 ++-- filter/e-filter-option.c | 13 +- filter/e-filter-rule.h | 2 +- modules/calendar/e-cal-shell-backend.c | 52 ++- modules/calendar/e-cal-shell-view.c | 61 +-- plugins/bbdb/gaimbuddies.c | 16 +- .../mailing-list-actions/mailing-list-actions.c | 18 +- shell/e-shell-nm.c | 3 +- shell/main.c | 52 ++- smclient/eggsmclient-xsmp.c | 33 +- smime/lib/e-cert-db.c | 130 +++--- 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 +- 28 files changed, 797 insertions(+), 525 deletions(-) diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index cca537d65e..c3c6cf1090 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -125,7 +125,9 @@ clear_drag_data (EMinicardView *view) } static gint -e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event, EMinicardView *view) +e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, + GdkEvent *event, + EMinicardView *view) { GdkDragContext *context; GtkTargetList *target_list; @@ -197,13 +199,16 @@ set_empty_message (EMinicardView *view) } static void -writable_status_change (EAddressbookModel *model, gboolean writable, EMinicardView *view) +writable_status_change (EAddressbookModel *model, + gboolean writable, + EMinicardView *view) { set_empty_message (view); } static void -stop_state_changed (EAddressbookModel *model, EMinicardView *view) +stop_state_changed (EAddressbookModel *model, + EMinicardView *view) { set_empty_message (view); } @@ -410,7 +415,9 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) } static gint -e_minicard_view_selection_event (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event) +e_minicard_view_selection_event (EReflow *reflow, + GnomeCanvasItem *item, + GdkEvent *event) { EMinicardView *view; gint return_val = FALSE; @@ -651,7 +658,9 @@ static void add_to_list (gint index, gpointer closure) { ModelAndList *mal = closure; - mal->list = g_list_prepend (mal->list, e_addressbook_reflow_adapter_get_contact (mal->adapter, index)); + mal->list = g_list_prepend ( + mal->list, e_addressbook_reflow_adapter_get_contact ( + mal->adapter, index)); } GList * diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index 0fd7d09129..81dc9b6dac 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -657,7 +657,9 @@ csv_import_contacts(gpointer d) { return FALSE; } else { - e_import_status(gci->import, gci->target, _("Importing..."), ftell(gci->file) *100 / gci->size); + e_import_status ( + gci->import, gci->target, _("Importing..."), + ftell (gci->file) * 100 / gci->size); return TRUE; } } diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index b3b965ffa0..1222566387 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -249,7 +249,9 @@ vcard_import_contacts(gpointer data) vcard_import_done(gci); return FALSE; } else { - e_import_status(gci->import, gci->target, _("Importing..."), gci->count * 100 / gci->total); + e_import_status ( + gci->import, gci->target, _("Importing..."), + gci->count * 100 / gci->total); return TRUE; } } @@ -397,12 +399,17 @@ vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); g_object_ref(primary); - g_datalist_set_data_full(&target->data, "vcard-source", primary, g_object_unref); + g_datalist_set_data_full ( + &target->data, "vcard-source", primary, + (GDestroyNotify) g_object_unref); } - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); + e_source_selector_set_primary_selection ( + E_SOURCE_SELECTOR (selector), primary); g_object_unref (source_list); - g_signal_connect (selector, "primary_selection_changed", G_CALLBACK (primary_selection_changed_cb), target); + g_signal_connect ( + selector, "primary_selection_changed", + G_CALLBACK (primary_selection_changed_cb), target); gtk_widget_show_all (vbox); @@ -469,7 +476,8 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im) encoding = guess_vcard_encoding(filename); if (encoding == VCARD_ENCODING_NONE) { g_free (filename); - /* this check is superfluous, we've already checked otherwise we can't get here ... */ + /* This check is superfluous, we've already + * checked otherwise we can't get here ... */ e_import_complete(ei, target); return; } diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 54672ec3b8..4871beae8f 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -67,16 +67,25 @@ struct _CompEditorClass { const gchar *help_section; /* Virtual functions */ - void (*edit_comp) (CompEditor *page, ECalComponent *comp); - void (*object_created) (CompEditor *page); - gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method, gboolean strip_alarms); + void (*edit_comp) (CompEditor *page, + ECalComponent *comp); + void (*object_created) (CompEditor *page); + gboolean (*send_comp) (CompEditor *page, + ECalComponentItipMethod method, + gboolean strip_alarms); - void (*show_categories) (CompEditor *editor, gboolean visible); - void (*show_role) (CompEditor *editor, gboolean visible); - void (*show_rsvp) (CompEditor *editor, gboolean visible); - void (*show_status) (CompEditor *editor, gboolean visible); - void (*show_time_zone) (CompEditor *editor, gboolean visible); - void (*show_type) (CompEditor *editor, gboolean visible); + void (*show_categories) (CompEditor *editor, + gboolean visible); + void (*show_role) (CompEditor *editor, + gboolean visible); + void (*show_rsvp) (CompEditor *editor, + gboolean visible); + void (*show_status) (CompEditor *editor, + gboolean visible); + void (*show_time_zone) (CompEditor *editor, + gboolean visible); + void (*show_type) (CompEditor *editor, + gboolean visible); }; typedef enum { diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index 009d47daec..c4d364a930 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -739,7 +739,9 @@ task_table_query_tooltip (GtkWidget *widget, use_24_hour_format = e_cal_model_get_use_24_hour_format (model); if (dtstart.tzid) { - zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid); + zone = icalcomponent_get_timezone ( + e_cal_component_get_icalcomponent (new_comp), + dtstart.tzid); if (!zone) e_cal_get_timezone ( comp_data->client, dtstart.tzid, &zone, NULL); @@ -1390,20 +1392,23 @@ check_for_retract (ECalComponent *comp, ECal *client) ECalComponentOrganizer org; gchar *email = NULL; const gchar *strip = NULL; - gboolean ret_val = FALSE; + gboolean ret_val; - if (!(e_cal_component_has_attendees (comp) && - e_cal_get_save_schedules (client))) - return ret_val; + if (!e_cal_component_has_attendees (comp)) + return FALSE; + + if (!e_cal_get_save_schedules (client)) + return FALSE; e_cal_component_get_organizer (comp, &org); strip = itip_strip_mailto (org.value); - if (e_cal_get_cal_address (client, &email, NULL) && !g_ascii_strcasecmp (email, strip)) { - ret_val = TRUE; - } + ret_val = + e_cal_get_cal_address (client, &email, NULL) && + g_ascii_strcasecmp (email, strip) == 0; g_free (email); + return ret_val; } @@ -1438,14 +1443,17 @@ e_task_table_delete_selected (ETaskTable *task_table) if (comp_data) { comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); + e_cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (comp_data->icalcomp)); } if ((n_selected == 1) && comp && check_for_retract (comp, comp_data->client)) { gchar *retract_comment = NULL; gboolean retract = FALSE; - delete = prompt_retract_dialog (comp, &retract_comment, GTK_WIDGET (task_table), &retract); + delete = prompt_retract_dialog ( + comp, &retract_comment, + GTK_WIDGET (task_table), &retract); if (retract) { GList *users = NULL; icalcomponent *icalcomp = NULL, *mod_comp = NULL; @@ -1471,7 +1479,9 @@ e_task_table_delete_selected (ETaskTable *task_table) } } else { - delete = delete_component_dialog (comp, FALSE, n_selected, E_CAL_COMPONENT_TODO, GTK_WIDGET (task_table)); + delete = delete_component_dialog ( + comp, FALSE, n_selected, + E_CAL_COMPONENT_TODO, GTK_WIDGET (task_table)); } if (delete) @@ -1506,7 +1516,10 @@ e_task_table_get_selected (ETaskTable *task_table) } static void -hide_completed_rows (ECalModel *model, GList *clients_list, gchar *hide_sexp, GPtrArray *comp_objects) +hide_completed_rows (ECalModel *model, + GList *clients_list, + gchar *hide_sexp, + GPtrArray *comp_objects) { GList *l, *m, *objects; ECal *client; @@ -1548,13 +1561,17 @@ hide_completed_rows (ECalModel *model, GList *clients_list, gchar *hide_sexp, GP } if (changed) { - /* to notify about changes, because in call of row_deleted there are still all events */ + /* To notify about changes, because in call of + * row_deleted there are still all events. */ e_table_model_changed (E_TABLE_MODEL (model)); } } static void -show_completed_rows (ECalModel *model, GList *clients_list, gchar *show_sexp, GPtrArray *comp_objects) +show_completed_rows (ECalModel *model, + GList *clients_list, + gchar *show_sexp, + GPtrArray *comp_objects) { GList *l, *m, *objects; ECal *client; @@ -1583,7 +1600,10 @@ show_completed_rows (ECalModel *model, GList *clients_list, gchar *show_sexp, GP comp_data->icalcomp = icalcomponent_new_clone (m->data); e_cal_model_set_instance_times (comp_data, e_cal_model_get_timezone (model)); - comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL; + comp_data->dtstart = NULL; + comp_data->dtend = NULL; + comp_data->due = NULL; + comp_data->completed = NULL; comp_data->color = NULL; g_ptr_array_add (comp_objects, comp_data); diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c index 5f0af90261..4fbc93e3e2 100644 --- a/calendar/gui/ea-cal-view-event.c +++ b/calendar/gui/ea-cal-view-event.c @@ -276,7 +276,9 @@ ea_cal_view_event_get_name (AtkObject *accessible) else summary_string = g_strdup (_("Calendar Event: It has no summary.")); - name_string = g_strdup_printf ("%s %s %s %s", summary_string, alarm_string, recur_string, meeting_string); + name_string = g_strdup_printf ( + "%s %s %s %s", summary_string, + alarm_string, recur_string, meeting_string); g_free (summary_string); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, name_string); diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 197396dbd6..5703b99811 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -93,19 +93,23 @@ struct _GnomeCalendarClass { GtkVBoxClass parent_class; /* Notification signals */ - void (* dates_shown_changed) (GnomeCalendar *gcal); + void (*dates_shown_changed) (GnomeCalendar *gcal); - void (* calendar_selection_changed) (GnomeCalendar *gcal); + void (*calendar_selection_changed) (GnomeCalendar *gcal); - void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in); - void (* change_view) (GnomeCalendar *gcal, - GnomeCalendarViewType view_type); + void (*calendar_focus_change) (GnomeCalendar *gcal, + gboolean in); + void (*change_view) (GnomeCalendar *gcal, + GnomeCalendarViewType view_type); - void (* source_added) (GnomeCalendar *gcal, ESource *source); - void (* source_removed) (GnomeCalendar *gcal, ESource *source); + void (*source_added) (GnomeCalendar *gcal, + ESource *source); + void (*source_removed) (GnomeCalendar *gcal, + ESource *source); /* Action signals */ - void (* goto_date) (GnomeCalendar *gcal, GnomeCalendarGotoDateType date); + void (*goto_date) (GnomeCalendar *gcal, + GnomeCalendarGotoDateType date); }; GType gnome_calendar_get_type (void); diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 12c09b43c5..6e9f4bb34f 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -70,196 +70,19 @@ enum { LAST_SIGNAL }; -static void weekday_picker_destroy (GtkObject *object); - -static void weekday_picker_realize (GtkWidget *widget); -static void weekday_picker_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void weekday_picker_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style); -static gboolean weekday_picker_focus (GtkWidget *widget, GtkDirectionType direction); -static void colorize_items (WeekdayPicker *wp); - static guint wp_signals[LAST_SIGNAL]; G_DEFINE_TYPE (WeekdayPicker, weekday_picker, GNOME_TYPE_CANVAS) -/* Class initialization function for the weekday picker */ -static void -weekday_picker_class_init (WeekdayPickerClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - wp_signals[CHANGED] = - g_signal_new ("changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (WeekdayPickerClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - object_class->destroy = weekday_picker_destroy; - - widget_class->realize = weekday_picker_realize; - widget_class->size_request = weekday_picker_size_request; - widget_class->size_allocate = weekday_picker_size_allocate; - widget_class->style_set = weekday_picker_style_set; - widget_class->focus = weekday_picker_focus; - - class->changed = NULL; -} - -static void -day_clicked (WeekdayPicker *wp, gint index) -{ - WeekdayPickerPrivate *priv = wp->priv; - guint8 day_mask; - - if (priv->blocked_day_mask & (0x1 << index)) - return; - - if (priv->day_mask & (0x1 << index)) - day_mask = priv->day_mask & ~(0x1 << index); - else - day_mask = priv->day_mask | (0x1 << index); - - weekday_picker_set_days (wp, day_mask); -} - -static gint -handle_key_press_event (WeekdayPicker *wp, GdkEvent *event) -{ - WeekdayPickerPrivate *priv = wp->priv; - guint keyval = event->key.keyval; - - if (priv->focus_day == -1) - priv->focus_day = priv->week_start_day; - - switch (keyval) { - case GDK_Up: - case GDK_Right: - priv->focus_day += 1; - break; - case GDK_Down: - case GDK_Left: - priv->focus_day -= 1; - break; - case GDK_space: - case GDK_Return: - day_clicked (wp, priv->focus_day); - return TRUE; - default: - return FALSE; - } - - if (priv->focus_day > 6) - priv->focus_day = 0; - if (priv->focus_day < 0) - priv->focus_day = 6; - - colorize_items (wp); - gnome_canvas_item_grab_focus (priv->boxes[priv->focus_day]); - return TRUE; -} - -/* Event handler for the day items */ -static gint -day_event_cb (GnomeCanvasItem *item, GdkEvent *event, gpointer data) -{ - WeekdayPicker *wp; - WeekdayPickerPrivate *priv; - gint i; - - wp = WEEKDAY_PICKER (data); - priv = wp->priv; - - if (event->type == GDK_KEY_PRESS) - return handle_key_press_event(wp, event); - - if (!(event->type == GDK_BUTTON_PRESS && event->button.button == 1)) - return FALSE; - - /* Find which box was clicked */ - - for (i = 0; i < 7; i++) - if (priv->boxes[i] == item || priv->labels[i] == item) - break; - - g_return_val_if_fail (i != 7, TRUE); - - i += priv->week_start_day; - if (i >= 7) - i -= 7; - - priv->focus_day = i; - gnome_canvas_item_grab_focus (priv->boxes[i]); - day_clicked (wp, i); - return TRUE; -} - -/* Creates the canvas items for the weekday picker. The items are empty until - * they are configured elsewhere. - */ -static void -create_items (WeekdayPicker *wp) -{ - WeekdayPickerPrivate *priv; - GnomeCanvasGroup *parent; - gint i; - - priv = wp->priv; - - parent = gnome_canvas_root (GNOME_CANVAS (wp)); - - for (i = 0; i < 7; i++) { - priv->boxes[i] = gnome_canvas_item_new (parent, - GNOME_TYPE_CANVAS_RECT, - NULL); - g_signal_connect (priv->boxes[i], "event", G_CALLBACK (day_event_cb), wp); - - priv->labels[i] = gnome_canvas_item_new (parent, - GNOME_TYPE_CANVAS_TEXT, - NULL); - g_signal_connect (priv->labels[i], "event", G_CALLBACK (day_event_cb), wp); - } -} - -/* Object initialization function for the weekday picker */ -static void -weekday_picker_init (WeekdayPicker *wp) -{ - WeekdayPickerPrivate *priv; - - priv = g_new0 (WeekdayPickerPrivate, 1); - - wp->priv = priv; - - create_items (wp); - priv->focus_day = -1; -} - -/* Finalize handler for the weekday picker */ -static void -weekday_picker_destroy (GtkObject *object) +static gchar * +get_day_text (gint day_index) { - WeekdayPicker *wp; - WeekdayPickerPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_WEEKDAY_PICKER (object)); - - wp = WEEKDAY_PICKER (object); - priv = wp->priv; + GDateWeekday weekday; - g_free (priv); - wp->priv = NULL; + /* Convert from tm_wday to GDateWeekday. */ + weekday = (day_index == 0) ? G_DATE_SUNDAY : day_index; - if (GTK_OBJECT_CLASS (weekday_picker_parent_class)->destroy) - (* GTK_OBJECT_CLASS (weekday_picker_parent_class)->destroy) (object); + return g_strdup (e_get_weekday_name (weekday, TRUE)); } static void @@ -314,18 +137,6 @@ colorize_items (WeekdayPicker *wp) } } -/* Configures the items in the weekday picker by setting their attributes. */ -static gchar * -get_day_text (gint day_index) -{ - GDateWeekday weekday; - - /* Convert from tm_wday to GDateWeekday. */ - weekday = (day_index == 0) ? G_DATE_SUNDAY : day_index; - - return g_strdup (e_get_weekday_name (weekday, TRUE)); -} - static void configure_items (WeekdayPicker *wp) { @@ -370,7 +181,25 @@ configure_items (WeekdayPicker *wp) colorize_items (wp); } -/* Realize handler for the weekday picker */ +static void +weekday_picker_destroy (GtkObject *object) +{ + WeekdayPicker *wp; + WeekdayPickerPrivate *priv; + + g_return_if_fail (object != NULL); + g_return_if_fail (IS_WEEKDAY_PICKER (object)); + + wp = WEEKDAY_PICKER (object); + priv = wp->priv; + + g_free (priv); + wp->priv = NULL; + + /* Chain up to parent's destroy() method. */ + GTK_OBJECT_CLASS (weekday_picker_parent_class)->destroy (object); +} + static void weekday_picker_realize (GtkWidget *widget) { @@ -378,15 +207,15 @@ weekday_picker_realize (GtkWidget *widget) wp = WEEKDAY_PICKER (widget); - if (GTK_WIDGET_CLASS (weekday_picker_parent_class)->realize) - (* GTK_WIDGET_CLASS (weekday_picker_parent_class)->realize) (widget); + /* Chain up to parent's realize() method. */ + GTK_WIDGET_CLASS (weekday_picker_parent_class)->realize (widget); configure_items (wp); } -/* Size_request handler for the weekday picker */ static void -weekday_picker_size_request (GtkWidget *widget, GtkRequisition *requisition) +weekday_picker_size_request (GtkWidget *widget, + GtkRequisition *requisition) { WeekdayPicker *wp; WeekdayPickerPrivate *priv; @@ -398,27 +227,31 @@ weekday_picker_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->height = (priv->font_ascent + priv->font_descent + 2 * PADDING + 2); } -/* Size_allocate handler for the weekday picker */ static void -weekday_picker_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +weekday_picker_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) { + GtkWidgetClass *widget_class; WeekdayPicker *wp; wp = WEEKDAY_PICKER (widget); - if (GTK_WIDGET_CLASS (weekday_picker_parent_class)->size_allocate) - (* GTK_WIDGET_CLASS (weekday_picker_parent_class)->size_allocate) (widget, allocation); + /* Chain up to parent's size_allocate() method. */ + widget_class = GTK_WIDGET_CLASS (weekday_picker_parent_class); + widget_class->size_allocate (widget, allocation); - gnome_canvas_set_scroll_region (GNOME_CANVAS (wp), - 0, 0, allocation->width, allocation->height); + gnome_canvas_set_scroll_region ( + GNOME_CANVAS (wp), 0, 0, + allocation->width, allocation->height); configure_items (wp); } -/* Style_set handler for the weekday picker */ static void -weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) +weekday_picker_style_set (GtkWidget *widget, + GtkStyle *previous_style) { + GtkWidgetClass *widget_class; WeekdayPicker *wp; WeekdayPickerPrivate *priv; gint max_width; @@ -434,12 +267,15 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) /* Set up Pango prerequisites */ font_desc = gtk_widget_get_style (widget)->font_desc; pango_context = gtk_widget_get_pango_context (widget); - font_metrics = pango_context_get_metrics (pango_context, font_desc, - pango_context_get_language (pango_context)); + font_metrics = pango_context_get_metrics ( + pango_context, font_desc, + pango_context_get_language (pango_context)); layout = pango_layout_new (pango_context); - priv->font_ascent = PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)); - priv->font_descent = PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)); + priv->font_ascent = + PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)); + priv->font_descent = + PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)); max_width = 0; @@ -462,11 +298,193 @@ weekday_picker_style_set (GtkWidget *widget, GtkStyle *previous_style) g_object_unref (layout); pango_font_metrics_unref (font_metrics); - if (GTK_WIDGET_CLASS (weekday_picker_parent_class)->style_set) - (* GTK_WIDGET_CLASS (weekday_picker_parent_class)->style_set) (widget, previous_style); + /* Chain up to parent's style_set() method. */ + widget_class = GTK_WIDGET_CLASS (weekday_picker_parent_class); + widget_class->style_set (widget, previous_style); } - +static gboolean +weekday_picker_focus (GtkWidget *widget, + GtkDirectionType direction) +{ + WeekdayPicker *wp; + WeekdayPickerPrivate *priv; + + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (IS_WEEKDAY_PICKER (widget), FALSE); + wp = WEEKDAY_PICKER (widget); + priv = wp->priv; + + if (!GTK_WIDGET_CAN_FOCUS (widget)) + return FALSE; + + if (GTK_WIDGET_HAS_FOCUS (widget)) { + priv->focus_day = -1; + colorize_items (wp); + return FALSE; + } + + priv->focus_day = priv->week_start_day; + gnome_canvas_item_grab_focus (priv->boxes[priv->focus_day]); + colorize_items (wp); + + return TRUE; +} +static void +weekday_picker_class_init (WeekdayPickerClass *class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = GTK_OBJECT_CLASS (class); + object_class->destroy = weekday_picker_destroy; + + widget_class = GTK_WIDGET_CLASS (class); + widget_class->realize = weekday_picker_realize; + widget_class->size_request = weekday_picker_size_request; + widget_class->size_allocate = weekday_picker_size_allocate; + widget_class->style_set = weekday_picker_style_set; + widget_class->focus = weekday_picker_focus; + + class->changed = NULL; + + wp_signals[CHANGED] = g_signal_new ( + "changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (WeekdayPickerClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +static void +day_clicked (WeekdayPicker *wp, gint index) +{ + WeekdayPickerPrivate *priv = wp->priv; + guint8 day_mask; + + if (priv->blocked_day_mask & (0x1 << index)) + return; + + if (priv->day_mask & (0x1 << index)) + day_mask = priv->day_mask & ~(0x1 << index); + else + day_mask = priv->day_mask | (0x1 << index); + + weekday_picker_set_days (wp, day_mask); +} + +static gint +handle_key_press_event (WeekdayPicker *wp, GdkEvent *event) +{ + WeekdayPickerPrivate *priv = wp->priv; + guint keyval = event->key.keyval; + + if (priv->focus_day == -1) + priv->focus_day = priv->week_start_day; + + switch (keyval) { + case GDK_Up: + case GDK_Right: + priv->focus_day += 1; + break; + case GDK_Down: + case GDK_Left: + priv->focus_day -= 1; + break; + case GDK_space: + case GDK_Return: + day_clicked (wp, priv->focus_day); + return TRUE; + default: + return FALSE; + } + + if (priv->focus_day > 6) + priv->focus_day = 0; + if (priv->focus_day < 0) + priv->focus_day = 6; + + colorize_items (wp); + gnome_canvas_item_grab_focus (priv->boxes[priv->focus_day]); + return TRUE; +} + +/* Event handler for the day items */ +static gint +day_event_cb (GnomeCanvasItem *item, GdkEvent *event, gpointer data) +{ + WeekdayPicker *wp; + WeekdayPickerPrivate *priv; + gint i; + + wp = WEEKDAY_PICKER (data); + priv = wp->priv; + + if (event->type == GDK_KEY_PRESS) + return handle_key_press_event(wp, event); + + if (!(event->type == GDK_BUTTON_PRESS && event->button.button == 1)) + return FALSE; + + /* Find which box was clicked */ + + for (i = 0; i < 7; i++) + if (priv->boxes[i] == item || priv->labels[i] == item) + break; + + g_return_val_if_fail (i != 7, TRUE); + + i += priv->week_start_day; + if (i >= 7) + i -= 7; + + priv->focus_day = i; + gnome_canvas_item_grab_focus (priv->boxes[i]); + day_clicked (wp, i); + return TRUE; +} + +/* Creates the canvas items for the weekday picker. The items are empty until + * they are configured elsewhere. + */ +static void +create_items (WeekdayPicker *wp) +{ + WeekdayPickerPrivate *priv; + GnomeCanvasGroup *parent; + gint i; + + priv = wp->priv; + + parent = gnome_canvas_root (GNOME_CANVAS (wp)); + + for (i = 0; i < 7; i++) { + priv->boxes[i] = gnome_canvas_item_new (parent, + GNOME_TYPE_CANVAS_RECT, + NULL); + g_signal_connect (priv->boxes[i], "event", G_CALLBACK (day_event_cb), wp); + + priv->labels[i] = gnome_canvas_item_new (parent, + GNOME_TYPE_CANVAS_TEXT, + NULL); + g_signal_connect (priv->labels[i], "event", G_CALLBACK (day_event_cb), wp); + } +} + +static void +weekday_picker_init (WeekdayPicker *wp) +{ + WeekdayPickerPrivate *priv; + + priv = g_new0 (WeekdayPickerPrivate, 1); + + wp->priv = priv; + + create_items (wp); + priv->focus_day = -1; +} /** * weekday_picker_new: @@ -614,30 +632,3 @@ weekday_picker_get_week_start_day (WeekdayPicker *wp) return priv->week_start_day; } -/* focus handler for weekday picker */ -static gboolean -weekday_picker_focus (GtkWidget *widget, GtkDirectionType direction) -{ - WeekdayPicker *wp; - WeekdayPickerPrivate *priv; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (IS_WEEKDAY_PICKER (widget), FALSE); - wp = WEEKDAY_PICKER (widget); - priv = wp->priv; - - if (!GTK_WIDGET_CAN_FOCUS (widget)) - return FALSE; - - if (GTK_WIDGET_HAS_FOCUS (widget)) { - priv->focus_day = -1; - colorize_items (wp); - return FALSE; - } - - priv->focus_day = priv->week_start_day; - gnome_canvas_item_grab_focus (priv->boxes[priv->focus_day]); - colorize_items (wp); - - return TRUE; -} diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index 03e5b73fc0..8e3b050f65 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -496,7 +496,10 @@ main (gint argc, gchar **argv) gchar *html, *url, *p; for (i = 0; i < num_url_tests; i++) { - html = e_text_to_html (url_tests[i].text, E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES); + html = e_text_to_html ( + url_tests[i].text, + E_TEXT_TO_HTML_CONVERT_URLS | + E_TEXT_TO_HTML_CONVERT_ADDRESSES); url = strstr (html, "href=\""); if (url) { diff --git a/e-util/e-logger.c b/e-util/e-logger.c index 07571d229a..dd151b6009 100644 --- a/e-util/e-logger.c +++ b/e-util/e-logger.c @@ -93,7 +93,10 @@ logger_set_name (ELogger *logger, logger->priv->timer = 0; if (!logger->priv->fp) - g_warning ("%s: Failed to open log file '%s' for writing.", G_STRFUNC, logger->priv->logfile ? logger->priv->logfile : "[null]"); + g_warning ( + "%s: Failed to open log file '%s' for writing.", + G_STRFUNC, logger->priv->logfile ? + logger->priv->logfile : "[null]"); g_free (temp); } @@ -260,7 +263,10 @@ e_logger_get_logs (ELogger *logger, fp = g_fopen (logger->priv->logfile, "r"); if (!fp) { - g_warning ("%s: Cannot open log file '%s' for reading! No flush yet?\n", G_STRFUNC, logger->priv->logfile ? logger->priv->logfile : "[null]"); + g_warning ( + "%s: Cannot open log file '%s' for reading! " + "No flush yet?\n", G_STRFUNC, logger->priv->logfile ? + logger->priv->logfile : "[null]"); return; } diff --git a/e-util/e-non-intrusive-error-dialog.c b/e-util/e-non-intrusive-error-dialog.c index e36190fc9a..4e7e8a2d58 100644 --- a/e-util/e-non-intrusive-error-dialog.c +++ b/e-util/e-non-intrusive-error-dialog.c @@ -171,7 +171,10 @@ eni_error_level_value_changed (GtkComboBox *w, gpointer *data) } void -eni_show_logger(ELogger *logger, GtkWidget *top,const gchar *error_timeout_path, const gchar *error_level_path) +eni_show_logger (ELogger *logger, + GtkWidget *top, + const gchar *error_timeout_path, + const gchar *error_level_path) { GtkWidget *container; GtkWidget *label; @@ -233,8 +236,10 @@ eni_show_logger(ELogger *logger, GtkWidget *top,const gchar *error_timeout_path, widget = gtk_combo_box_new_text (); for (i = E_LOG_ERROR; i <= E_LOG_DEBUG; i++) gtk_combo_box_append_text ( - GTK_COMBO_BOX (widget), ldata[i].text); - gtk_combo_box_set_active ((GtkComboBox *) widget, eni_config_get_error_level(error_level_path)); + GTK_COMBO_BOX (widget), ldata[i].text); + gtk_combo_box_set_active ( + GTK_COMBO_BOX (widget), + eni_config_get_error_level (error_level_path)); g_signal_connect ( widget, "changed", diff --git a/e-util/e-util.c b/e-util/e-util.c index ade2b38fbf..eaf98f33e5 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -724,7 +724,9 @@ e_format_number (gint number) } if (list) { - value = g_new(gchar, 1 + char_length + (group_count - 1) * strlen(locality->thousands_sep)); + value = g_new ( + gchar, 1 + char_length + (group_count - 1) * + strlen (locality->thousands_sep)); iterator = list; value_iterator = value; @@ -1232,23 +1234,34 @@ e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d) } /* font options cache */ -static gchar *fo_antialiasing = NULL, *fo_hinting = NULL, *fo_subpixel_order = NULL; +static gchar *fo_antialiasing = NULL; +static gchar *fo_hinting = NULL; +static gchar *fo_subpixel_order = NULL; static GStaticMutex fo_lock = G_STATIC_MUTEX_INIT; static void -fo_option_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) +fo_option_changed (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) { - #define update_value(key,variable) \ - g_free (variable); \ - variable = gconf_client_get_string (client, "/desktop/gnome/font_rendering/" key, NULL); + const gchar *key; g_static_mutex_lock (&fo_lock); - update_value ("antialiasing", fo_antialiasing); - update_value ("hinting", fo_hinting); - update_value ("rgba_order", fo_subpixel_order); - g_static_mutex_unlock (&fo_lock); - #undef update_value + g_free (fo_antialiasing); + key = "/desktop/gnome/font_rendering/antialiasing"; + fo_antialiasing = gconf_client_get_string (client, key, NULL); + + g_free (fo_hinting); + key = "/desktop/gnome/font_rendering/hinting"; + fo_hinting = gconf_client_get_string (client, key, NULL); + + g_free (fo_subpixel_order); + key = "/desktop/gnome/font_rendering/rgba_order"; + fo_subpixel_order = gconf_client_get_string (client, key, NULL); + + g_static_mutex_unlock (&fo_lock); } cairo_font_options_t * @@ -1258,12 +1271,25 @@ get_font_options (void) cairo_font_options_t *font_options = cairo_font_options_create (); if (fo_gconf == NULL) { + const gchar *key; + fo_gconf = gconf_client_get_default (); - gconf_client_add_dir (fo_gconf, "/desktop/gnome/font_rendering", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_notify_add (fo_gconf, "/desktop/gnome/font_rendering/antialiasing", fo_option_changed, NULL, NULL, NULL); - gconf_client_notify_add (fo_gconf, "/desktop/gnome/font_rendering/hinting", fo_option_changed, NULL, NULL, NULL); - gconf_client_notify_add (fo_gconf, "/desktop/gnome/font_rendering/rgba_order", fo_option_changed, NULL, NULL, NULL); + key = "/desktop/gnome/font_rendering"; + gconf_client_add_dir ( + fo_gconf, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + + key = "/desktop/gnome/font_rendering/antialiasing"; + gconf_client_notify_add ( + fo_gconf, key, fo_option_changed, NULL, NULL, NULL); + + key = "/desktop/gnome/font_rendering/hinting"; + gconf_client_notify_add ( + fo_gconf, key, fo_option_changed, NULL, NULL, NULL); + + key = "/desktop/gnome/font_rendering/rgba_order"; + gconf_client_notify_add ( + fo_gconf, key, fo_option_changed, NULL, NULL, NULL); fo_option_changed (fo_gconf, 0, NULL, NULL); } @@ -1391,24 +1417,23 @@ e_util_guess_mime_type (const gchar *filename, gboolean localfile) if (localfile) { GFile *file; + GFileInfo *fi; if (strstr (filename, "://")) file = g_file_new_for_uri (filename); else file = g_file_new_for_path (filename); - if (file) { - GFileInfo *fi; - - fi = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL); - if (fi) { - mime_type = g_content_type_get_mime_type (g_file_info_get_content_type (fi)); - - g_object_unref (fi); - } - - g_object_unref (file); + fi = g_file_query_info ( + file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + G_FILE_QUERY_INFO_NONE, NULL, NULL); + if (fi) { + mime_type = g_content_type_get_mime_type ( + g_file_info_get_content_type (fi)); + g_object_unref (fi); } + + g_object_unref (file); } if (!mime_type) { @@ -1456,7 +1481,8 @@ e_util_get_category_filter_options (void) * Sets an #ESourceList of a given GConf path to an #ESourceComboBox. **/ void -e_util_set_source_combo_box_list (GtkWidget *source_combo_box, const gchar *source_gconf_path) +e_util_set_source_combo_box_list (GtkWidget *source_combo_box, + const gchar *source_gconf_path) { ESourceList *source_list; GConfClient *gconf_client; @@ -1465,8 +1491,9 @@ e_util_set_source_combo_box_list (GtkWidget *source_combo_box, const gchar *sour g_return_if_fail (source_gconf_path != NULL); gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, source_gconf_path); - g_object_set (G_OBJECT (source_combo_box), "source-list", source_list, NULL); + source_list = e_source_list_new_for_gconf ( + gconf_client, source_gconf_path); + g_object_set (source_combo_box, "source-list", source_list, NULL); g_object_unref (source_list); g_object_unref (gconf_client); } diff --git a/filter/e-filter-option.c b/filter/e-filter-option.c index 3765238a80..79899bce80 100644 --- a/filter/e-filter-option.c +++ b/filter/e-filter-option.c @@ -149,7 +149,8 @@ filter_option_xml_create (EFilterElement *element, value = (gchar *)xmlGetProp (n, (xmlChar *)"value"); work = n->children; while (work) { - if (!strcmp ((gchar *)work->name, "title") || !strcmp ((gchar *)work->name, "_title")) { + if (!strcmp ((gchar *)work->name, "title") || + !strcmp ((gchar *)work->name, "_title")) { if (!title) { if (!(tmp = (gchar *)xmlNodeGetContent (work))) tmp = (gchar *)xmlStrdup ((xmlChar *)""); @@ -175,7 +176,10 @@ filter_option_xml_create (EFilterElement *element, g_free (code); } else if (g_str_equal ((gchar *)n->name, "dynamic")) { if (option->dynamic_func) { - g_warning ("Only one 'dynamic' node is acceptable in the optionlist '%s'", element->name); + g_warning ( + "Only one 'dynamic' node is " + "acceptable in the optionlist '%s'", + element->name); } else { /* Expecting only one in the option list, The 'cb' should be of this prototype: @@ -205,7 +209,10 @@ filter_option_xml_create (EFilterElement *element, g_slist_free (items); } else { - g_warning ("Missing 'func' attribute within '%s' node in optionlist '%s'", n->name, element->name); + g_warning ( + "Missing 'func' attribute within " + "'%s' node in optionlist '%s'", + n->name, element->name); } xmlFree (fn); diff --git a/filter/e-filter-rule.h b/filter/e-filter-rule.h index 924fb14074..75f003b0e0 100644 --- a/filter/e-filter-rule.h +++ b/filter/e-filter-rule.h @@ -73,7 +73,7 @@ enum _filter_threading_t { #define E_FILTER_SOURCE_DEMAND "demand" /* performed on the selected folder * when the user asks for it */ #define E_FILTER_SOURCE_OUTGOING "outgoing"/* performed on outgoing mail */ -#define E_FILTER_SOURCE_JUNKTEST "junktest"/* perform only junktest on incoming mail */ +#define E_FILTER_SOURCE_JUNKTEST "junktest"/* check incoming mail for junk */ struct _EFilterRule { GObject parent_object; diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 2c3d459085..e70daec074 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -109,18 +109,22 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) g_free (filename); if (strlen (base_uri) > 7) { - /* compare only file:// part. If user home dir name changes we do not want to create - one more group */ + /* Compare only file:// part. If user home dir name + * changes we do not want to create one more group. */ base_uri_seventh = base_uri[7]; base_uri[7] = 0; } else { base_uri_seventh = -1; } - on_this_computer = e_source_list_ensure_group (priv->source_list, _("On This Computer"), base_uri, TRUE); - contacts = e_source_list_ensure_group (priv->source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE); - e_source_list_ensure_group (priv->source_list, _("On The Web"), WEB_BASE_URI, FALSE); - e_source_list_ensure_group (priv->source_list, _("Weather"), WEATHER_BASE_URI, FALSE); + on_this_computer = e_source_list_ensure_group ( + priv->source_list, _("On This Computer"), base_uri, TRUE); + contacts = e_source_list_ensure_group ( + priv->source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE); + e_source_list_ensure_group ( + priv->source_list, _("On The Web"), WEB_BASE_URI, FALSE); + e_source_list_ensure_group ( + priv->source_list, _("Weather"), WEATHER_BASE_URI, FALSE); if (base_uri_seventh != -1) { base_uri[7] = base_uri_seventh; @@ -267,7 +271,11 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend) } static void -cal_new_event (ECal *cal, ECalendarStatus status, EShell *shell, CompEditorFlags flags, gboolean all_day) +cal_shell_backend_new_event (ECal *cal, + ECalendarStatus status, + EShell *shell, + CompEditorFlags flags, + gboolean all_day) { ECalComponent *comp; CompEditor *editor; @@ -293,7 +301,10 @@ cal_shell_backend_event_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG, FALSE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG; + cal_shell_backend_new_event (cal, status, shell, flags, FALSE); g_object_unref (cal); } @@ -303,7 +314,10 @@ cal_shell_backend_event_all_day_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG, TRUE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG; + cal_shell_backend_new_event (cal, status, shell, flags, TRUE); g_object_unref (cal); } @@ -313,7 +327,10 @@ cal_shell_backend_event_meeting_new_cb (ECal *cal, ECalendarStatus status, EShell *shell) { - cal_new_event (cal, status, shell, COMP_EDITOR_USER_ORG | COMP_EDITOR_MEETING, FALSE); + CompEditorFlags flags; + + flags = COMP_EDITOR_USER_ORG | COMP_EDITOR_MEETING; + cal_shell_backend_new_event (cal, status, shell, flags, FALSE); g_object_unref (cal); } @@ -328,13 +345,17 @@ action_event_new_cb (GtkAction *action, EShellSettings *shell_settings; EShellView *shell_view; EShell *shell; + const gchar *view_name; const gchar *action_name; gchar *uid; - /* With a 'calendar' active shell view pass the new appointment request to it, - thus the event will inherit selected time from the view. */ - shell_view = e_shell_window_get_shell_view (shell_window, e_shell_window_get_active_view (shell_window)); - if (shell_view && g_ascii_strcasecmp (e_shell_view_get_name (shell_view), "calendar") == 0) { + /* With a 'calendar' active shell view pass the new appointment + * request to it, thus the event will inherit selected time from + * the view. */ + view_name = e_shell_window_get_active_view (shell_window); + shell_view = e_shell_window_get_shell_view (shell_window, view_name); + + if (shell_view && g_ascii_strcasecmp (view_name, "calendar") == 0) { EShellContent *shell_content; GnomeCalendar *gcal; GnomeCalendarViewType view_type; @@ -342,7 +363,8 @@ action_event_new_cb (GtkAction *action, shell_content = e_shell_view_get_shell_content (shell_view); - gcal = e_cal_shell_content_get_calendar (E_CAL_SHELL_CONTENT (shell_content)); + gcal = e_cal_shell_content_get_calendar ( + E_CAL_SHELL_CONTENT (shell_content)); view_type = gnome_calendar_get_view (gcal); view = gnome_calendar_get_calendar_view (gcal, view_type); diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 5b9940b1dd..c2eac56216 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -316,49 +316,52 @@ cal_shell_view_update_actions (EShellView *shell_view) for (iter = list; iter != NULL; iter = iter->next) { ECalendarViewEvent *event = iter->data; + ECal *client; + ECalComponent *comp; + icalcomponent *icalcomp; + gchar *user_email = NULL; + gboolean user_org = FALSE; gboolean read_only = TRUE; if (!event || !event->comp_data) continue; - e_cal_is_read_only (event->comp_data->client, &read_only, NULL); + client = event->comp_data->client; + icalcomp = event->comp_data->icalcomp; + + e_cal_is_read_only (client, &read_only, NULL); editable = editable && !read_only; - if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) - recurring = TRUE; + is_instance |= e_cal_util_component_is_instance (icalcomp); - if (e_cal_util_component_is_instance (event->comp_data->icalcomp)) { - recurring = TRUE; - is_instance = TRUE; - } + recurring |= + e_cal_util_component_is_instance (icalcomp) || + e_cal_util_component_has_recurrences (icalcomp); - if (iter == list && !iter->next) { - ECalComponent *comp; - gchar *user_email = NULL; - gboolean user_org = FALSE; + /* The following tests only apply if one event is selected. */ + if (iter != list || n_selected > 1) + continue; - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - user_email = itip_get_comp_attendee (comp, event->comp_data->client); + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (icalcomp)); + user_email = itip_get_comp_attendee (comp, client); - is_meeting = e_cal_util_component_has_attendee (event->comp_data->icalcomp); + is_meeting = e_cal_util_component_has_attendee (icalcomp); - if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) { - if (itip_organizer_is_user (comp, event->comp_data->client)) { - user_org = TRUE; - } - } + user_org = + e_cal_util_component_has_organizer (icalcomp) && + itip_organizer_is_user (comp, client); - if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED)) { - if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) - is_delegatable = TRUE; - else if (!user_org && !is_delegated (event->comp_data->icalcomp, user_email)) - is_delegatable = TRUE; - } + is_delegatable = + e_cal_get_static_capability ( + client, CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED) && + ((e_cal_get_static_capability ( + client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)) || + (!user_org && !is_delegated (icalcomp, user_email))); - g_free (user_email); - g_object_unref (comp); - } + g_free (user_email); + g_object_unref (comp); } g_list_free (list); diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c index d01950b879..13744187f9 100644 --- a/plugins/bbdb/gaimbuddies.c +++ b/plugins/bbdb/gaimbuddies.c @@ -300,7 +300,9 @@ bbdb_sync_buddy_list (void) g_thread_create (bbdb_sync_buddy_list_in_thread, std, FALSE, &error); if (error) { - g_warning ("%s: Creation of the thread failed with error: %s", G_STRFUNC, error->message); + g_warning ( + "%s: Creation of the thread failed with error: %s", + G_STRFUNC, error->message); g_error_free (error); G_UNLOCK (syncing); @@ -355,7 +357,9 @@ bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c) photo = g_new0 (EContactPhoto, 1); photo->type = E_CONTACT_PHOTO_TYPE_INLINED; - if (! g_file_get_contents (b->icon, &contents, &photo->data.inlined.length, &error)) { + if (!g_file_get_contents ( + b->icon, &contents, + &photo->data.inlined.length, &error)) { g_warning ("bbdb: Could not read buddy icon: %s\n", error->message); g_error_free (error); for (l = ims; l != NULL; l = l->next) @@ -544,7 +548,9 @@ parse_contact (xmlNodePtr contact, GList **buddies, GSList *blocked) } if (buddy == NULL) { - fprintf (stderr, "bbdb: Could not find buddy in contact. Malformed Pidgin buddy list file.\n"); + fprintf ( + stderr, "bbdb: Could not find buddy in contact. " + "Malformed Pidgin buddy list file.\n"); return; } @@ -563,7 +569,9 @@ parse_contact (xmlNodePtr contact, GList **buddies, GSList *blocked) g_free (setting_type); } else if (! strcmp ((const gchar *)child->name, "name")) { gb->account_name = get_node_text (child); - is_blocked = g_slist_find_custom (blocked, gb->account_name, (GCompareFunc)strcmp) != NULL; + is_blocked = g_slist_find_custom ( + blocked, gb->account_name, + (GCompareFunc) strcmp) != NULL; } else if (! strcmp ((const gchar *)child->name, "alias")) gb->alias = get_node_text (child); diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c index 59e54e621a..699ec1efd9 100644 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ b/plugins/mailing-list-actions/mailing-list-actions.c @@ -69,9 +69,15 @@ typedef enum { } EmlaAction; typedef struct { - EmlaAction action; /* action enumeration */ - gboolean interactive; /* whether the user needs to edit a mailto: message (e.g. for post action) */ - const gchar * header; /* header representing the action */ + /* action enumeration */ + EmlaAction action; + + /* whether the user needs to edit a mailto: + * message (e.g. for post action) */ + gboolean interactive; + + /* header representing the action */ + const gchar *header; } EmlaActionHeader; const EmlaActionHeader emla_action_headers[] = { @@ -117,7 +123,8 @@ emla_list_action_do (CamelFolder *folder, for (t = 0; t < G_N_ELEMENTS (emla_action_headers); t++) { if (emla_action_headers[t].action == action && - (header = camel_medium_get_header (CAMEL_MEDIUM (msg), emla_action_headers[t].header)) != NULL) + (header = camel_medium_get_header (CAMEL_MEDIUM (msg), + emla_action_headers[t].header)) != NULL) break; } @@ -132,7 +139,8 @@ emla_list_action_do (CamelFolder *folder, if (action == EMLA_ACTION_POST) { while (*headerpos == ' ') headerpos++; if (g_ascii_strcasecmp (headerpos, "NO") == 0) { - e_alert_run_dialog_for_args (window, MESSAGE_POSTING_NOT_ALLOWED, NULL); + e_alert_run_dialog_for_args ( + window, MESSAGE_POSTING_NOT_ALLOWED, NULL); goto exit; } } diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c index c520600769..7f17d9716f 100644 --- a/shell/e-shell-nm.c +++ b/shell/e-shell-nm.c @@ -149,7 +149,8 @@ e_shell_dbus_initialize (EShell *shell) dbus_connection_setup_with_g_main (dbus_connection, NULL); dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE); - if (!dbus_connection_add_filter (dbus_connection, e_shell_network_monitor, shell, NULL)) + if (!dbus_connection_add_filter ( + dbus_connection, e_shell_network_monitor, shell, NULL)) goto exception; check_initial_state (shell); diff --git a/shell/main.c b/shell/main.c index eb8e566ed1..38384d879a 100644 --- a/shell/main.c +++ b/shell/main.c @@ -139,19 +139,26 @@ show_development_warning(void) gchar *text; warning_dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (warning_dialog), "Evolution " VERSION); - gtk_window_set_modal (GTK_WINDOW (warning_dialog), TRUE); - gtk_dialog_add_button (GTK_DIALOG (warning_dialog), GTK_STOCK_OK, GTK_RESPONSE_OK); - - gtk_dialog_set_has_separator (GTK_DIALOG (warning_dialog), FALSE); - - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (warning_dialog)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (warning_dialog)->action_area), 12); + gtk_window_set_title ( + GTK_WINDOW (warning_dialog), "Evolution " VERSION); + gtk_window_set_modal ( + GTK_WINDOW (warning_dialog), TRUE); + gtk_dialog_add_button ( + GTK_DIALOG (warning_dialog), + GTK_STOCK_OK, GTK_RESPONSE_OK); + gtk_dialog_set_has_separator ( + GTK_DIALOG (warning_dialog), FALSE); + + gtk_container_set_border_width ( + GTK_CONTAINER (GTK_DIALOG (warning_dialog)->vbox), 0); + gtk_container_set_border_width ( + GTK_CONTAINER (GTK_DIALOG (warning_dialog)->action_area), 12); vbox = gtk_vbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), vbox, - TRUE, TRUE, 0); + gtk_box_pack_start ( + GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), + vbox, TRUE, TRUE, 0); text = g_strdup_printf( /* xgettext:no-c-format */ @@ -504,17 +511,19 @@ main (gint argc, gchar **argv) #ifdef G_OS_WIN32 if (strcmp (gettext (""), "") == 0) { - /* No message catalog installed for the current locale language, - * so don't bother with the localisations provided by other things then - * either. Reset thread locale to "en-US" and C library locale to "C". - */ + /* No message catalog installed for the current locale + * language, so don't bother with the localisations + * provided by other things then either. Reset thread + * locale to "en-US" and C library locale to "C". */ SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); setlocale (LC_ALL, "C"); } #endif if (start_online && start_offline) { - g_printerr (_("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"), + g_printerr ( + _("%s: --online and --offline cannot be used " + "together.\n Use %s --help for more information.\n"), argv[0], argv[0]); exit (1); } @@ -530,9 +539,16 @@ main (gint argc, gchar **argv) #endif if (disable_preview) { - gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL); - gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL); - gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL); + const gchar *key; + + key = "/apps/evolution/mail/display/safe_list"; + gconf_client_set_bool (client, key, TRUE, NULL); + + key = "/apps/evolution/addressbook/display/show_preview"; + gconf_client_set_bool (client, key, FALSE, NULL); + + key = "/apps/evolution/calendar/display/show_task_preview"; + gconf_client_set_bool (client, key, FALSE, NULL); } setup_segv_redirect (); diff --git a/smclient/eggsmclient-xsmp.c b/smclient/eggsmclient-xsmp.c index e709f6dd6d..7ae1feb0f2 100644 --- a/smclient/eggsmclient-xsmp.c +++ b/smclient/eggsmclient-xsmp.c @@ -37,12 +37,23 @@ #include -#define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ()) -#define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)) -#define EGG_SM_CLIENT_XSMP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)) -#define EGG_IS_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT_XSMP)) -#define EGG_IS_SM_CLIENT_XSMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT_XSMP)) -#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)) +#define EGG_TYPE_SM_CLIENT_XSMP \ + (egg_sm_client_xsmp_get_type ()) +#define EGG_SM_CLIENT_XSMP(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)) +#define EGG_SM_CLIENT_XSMP_CLASS(class) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((class), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)) +#define EGG_IS_SM_CLIENT_XSMP(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EGG_TYPE_SM_CLIENT_XSMP)) +#define EGG_IS_SM_CLIENT_XSMP_CLASS(class) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((class), EGG_TYPE_SM_CLIENT_XSMP)) +#define EGG_SM_CLIENT_XSMP_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMPClass)) typedef struct _EggSMClientXSMP EggSMClientXSMP; typedef struct _EggSMClientXSMPClass EggSMClientXSMPClass; @@ -179,9 +190,9 @@ egg_sm_client_xsmp_init (EggSMClientXSMP *xsmp) } static void -egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass) +egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *class) { - EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (klass); + EggSMClientClass *sm_client_class = EGG_SM_CLIENT_CLASS (class); sm_client_class->startup = sm_client_xsmp_startup; sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command; @@ -603,7 +614,8 @@ fix_broken_state (EggSMClientXSMP *xsmp, const gchar *message, if (send_save_yourself_done) SmcSaveYourselfDone (xsmp->connection, True); - xsmp->state = send_save_yourself_done ? XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE; + xsmp->state = send_save_yourself_done ? + XSMP_STATE_SAVE_YOURSELF_DONE : XSMP_STATE_IDLE; } /* SM callbacks */ @@ -704,7 +716,8 @@ xsmp_save_yourself (SmcConn smc_conn, * emit ::quit_requested if the application isn't listening to the * signal. */ - wants_quit_requested = g_signal_has_handler_pending (xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT), 0, FALSE); + wants_quit_requested = g_signal_has_handler_pending ( + xsmp, g_signal_lookup ("quit_requested", EGG_TYPE_SM_CLIENT), 0, FALSE); xsmp->need_save_state = (save_type != SmSaveGlobal); xsmp->need_quit_requested = (shutdown && wants_quit_requested && diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index c21d071a96..faae2182c7 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -93,9 +93,57 @@ struct _ECertDBPrivate { #define PARENT_TYPE G_TYPE_OBJECT static GObjectClass *parent_class; -static CERTDERCerts* e_cert_db_get_certs_from_package (PRArenaPool *arena, gchar *data, guint32 length); +static SECStatus PR_CALLBACK +collect_certs(gpointer arg, SECItem **certs, gint numcerts) +{ + CERTDERCerts *collectArgs; + SECItem *cert; + SECStatus rv; - + collectArgs = (CERTDERCerts *)arg; + + collectArgs->numcerts = numcerts; + collectArgs->rawCerts = (SECItem *) PORT_ArenaZAlloc( + collectArgs->arena, sizeof (SECItem) * numcerts); + if ( collectArgs->rawCerts == NULL ) + return(SECFailure); + + cert = collectArgs->rawCerts; + + while ( numcerts-- ) { + rv = SECITEM_CopyItem(collectArgs->arena, cert, *certs); + if ( rv == SECFailure ) + return(SECFailure); + cert++; + certs++; + } + + return (SECSuccess); +} + +static CERTDERCerts* +e_cert_db_get_certs_from_package (PRArenaPool *arena, + gchar *data, + guint32 length) +{ + /*nsNSSShutDownPreventionLock locker;*/ + CERTDERCerts *collectArgs = + (CERTDERCerts *)PORT_ArenaZAlloc(arena, sizeof(CERTDERCerts)); + SECStatus sec_rv; + + if (!collectArgs) + return NULL; + + collectArgs->arena = arena; + sec_rv = CERT_DecodeCertPackage(data, + length, collect_certs, + (gpointer)collectArgs); + + if (sec_rv != SECSuccess) + return NULL; + + return collectArgs; +} static void e_cert_db_dispose (GObject *object) @@ -490,16 +538,19 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, { /* nsNSSShutDownPreventionLock locker; */ ECert *cert; - CERTCertificate *any_cert = CERT_FindCertByNicknameOrEmailAddr(CERT_GetDefaultCertDB(), - (gchar *)email); + CERTCertificate *any_cert; CERTCertList *certlist; + any_cert = CERT_FindCertByNicknameOrEmailAddr ( + CERT_GetDefaultCertDB(), (gchar *) email); + if (!any_cert) { /* XXX gerror */ return NULL; } - /* any_cert now contains a cert with the right subject, but it might not have the correct usage */ + /* any_cert now contains a cert with the right subject, + * but it might not have the correct usage. */ certlist = CERT_CreateSubjectCertList(NULL, CERT_GetDefaultCertDB(), &any_cert->derSubject, @@ -510,7 +561,8 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, return NULL; } - if (SECSuccess != CERT_FilterCertListByUsage(certlist, certUsageEmailRecipient, PR_FALSE)) { + if (SECSuccess != CERT_FilterCertListByUsage ( + certlist, certUsageEmailRecipient, PR_FALSE)) { /* XXX gerror */ CERT_DestroyCertificate(any_cert); CERT_DestroyCertList (certlist); @@ -533,7 +585,11 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, } static gboolean -confirm_download_ca_cert (ECertDB *cert_db, ECert *cert, gboolean *trust_ssl, gboolean *trust_email, gboolean *trust_objsign) +confirm_download_ca_cert (ECertDB *cert_db, + ECert *cert, + gboolean *trust_ssl, + gboolean *trust_email, + gboolean *trust_objsign) { gboolean rv = FALSE; @@ -662,7 +718,9 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) SECStatus srv; CERTCertTrust trust; - if (!confirm_download_ca_cert (cert_db, certToShow, &trust_ssl, &trust_email, &trust_objsign)) { + if (!confirm_download_ca_cert ( + cert_db, certToShow, &trust_ssl, + &trust_email, &trust_objsign)) { /* XXX gerror */ return FALSE; } @@ -1210,63 +1268,11 @@ e_cert_db_login_to_slot (ECertDB *cert_db, PK11_SetPasswordFunc(pk11_password); if (PK11_Authenticate (slot, PR_TRUE, NULL) != SECSuccess) { - printf ("PK11_Authenticate failed (err = %d/%d)\n", PORT_GetError(), PORT_GetError() + 0x2000); + printf ("PK11_Authenticate failed (err = %d/%d)\n", + PORT_GetError(), PORT_GetError() + 0x2000); return FALSE; } } return TRUE; } - - - -static SECStatus PR_CALLBACK -collect_certs(gpointer arg, SECItem **certs, gint numcerts) -{ - CERTDERCerts *collectArgs; - SECItem *cert; - SECStatus rv; - - collectArgs = (CERTDERCerts *)arg; - - collectArgs->numcerts = numcerts; - collectArgs->rawCerts = (SECItem *) PORT_ArenaZAlloc(collectArgs->arena, sizeof(SECItem) * numcerts); - if ( collectArgs->rawCerts == NULL ) - return(SECFailure); - - cert = collectArgs->rawCerts; - - while ( numcerts-- ) { - rv = SECITEM_CopyItem(collectArgs->arena, cert, *certs); - if ( rv == SECFailure ) - return(SECFailure); - cert++; - certs++; - } - - return (SECSuccess); -} - -static CERTDERCerts* -e_cert_db_get_certs_from_package (PRArenaPool *arena, - gchar *data, - guint32 length) -{ - /*nsNSSShutDownPreventionLock locker;*/ - CERTDERCerts *collectArgs = - (CERTDERCerts *)PORT_ArenaZAlloc(arena, sizeof(CERTDERCerts)); - SECStatus sec_rv; - - if (!collectArgs) - return NULL; - - collectArgs->arena = arena; - sec_rv = CERT_DecodeCertPackage(data, - length, collect_certs, - (gpointer)collectArgs); - - if (sec_rv != SECSuccess) - return NULL; - - return collectArgs; -} 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