diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 3b5402b4a6..bc3af20e3c 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -49,6 +49,9 @@ struct _AlarmNotifyPrivate { ESourceList *source_lists[E_CAL_CLIENT_SOURCE_TYPE_LAST]; ESourceList *selected_calendars; GMutex *mutex; + + GSList *offline_sources; + guint offline_timeout_id; }; typedef struct { @@ -100,6 +103,21 @@ process_removal_in_hash (const gchar *uri, prd->removals = g_list_prepend (prd->removals, (gpointer) uri); } +static gint +find_slist_source_uri_cb (gconstpointer a, gconstpointer b) +{ + ESource *asource = (ESource *) a; + const gchar *buri = b; + gchar *auri; + gint res; + + auri = e_source_get_uri (asource); + res = g_strcmp0 (auri, buri); + g_free (auri); + + return res; +} + static void alarm_notify_list_changed_cb (ESourceList *source_list, AlarmNotify *an) @@ -139,9 +157,10 @@ alarm_notify_list_changed_cb (ESourceList *source_list, continue; uri = e_source_get_uri (source); - if (!g_hash_table_lookup (an->priv->uri_client_hash[source_type], uri)) { + if (!g_hash_table_lookup (an->priv->uri_client_hash[source_type], uri) && + !g_slist_find_custom (an->priv->offline_sources, uri, find_slist_source_uri_cb)) { debug (("Adding Calendar %s", uri)); - alarm_notify_add_calendar (an, source_type, source, FALSE); + alarm_notify_add_calendar (an, source_type, source); } g_free (uri); } @@ -194,7 +213,7 @@ alarm_notify_load_calendars (AlarmNotify *an, uri = e_source_get_uri (source); debug (("Loading Calendar %s", uri)); - alarm_notify_add_calendar (an, source_type, source, FALSE); + alarm_notify_add_calendar (an, source_type, source); g_free (uri); } @@ -222,6 +241,12 @@ alarm_notify_finalize (GObject *object) priv = ALARM_NOTIFY (object)->priv; + if (priv->offline_timeout_id) + g_source_remove (priv->offline_timeout_id); + priv->offline_timeout_id = 0; + g_slist_free_full (priv->offline_sources, g_object_unref); + priv->offline_sources = NULL; + for (ii = 0; ii < E_CAL_CLIENT_SOURCE_TYPE_LAST; ii++) { g_hash_table_foreach ( priv->uri_client_hash[ii], @@ -349,6 +374,32 @@ alarm_notify_new (GCancellable *cancellable, "application-id", APPLICATION_ID, NULL); } +static gboolean +try_open_offline_timeout_cb (gpointer user_data) +{ + AlarmNotify *an = ALARM_NOTIFY (user_data); + GSList *sources, *iter; + + g_return_val_if_fail (an != NULL, FALSE); + g_return_val_if_fail (an->priv != NULL, FALSE); + + sources = an->priv->offline_sources; + an->priv->offline_sources = NULL; + an->priv->offline_timeout_id = 0; + + for (iter = sources; iter; iter = iter->next) { + ESource *source = iter->data; + + alarm_notify_add_calendar (an, + GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (source), "source-type")), + source); + } + + g_slist_free_full (sources, g_object_unref); + + return FALSE; +} + static void client_opened_cb (GObject *source_object, GAsyncResult *result, @@ -360,11 +411,22 @@ client_opened_cb (GObject *source_object, ECalClient *cal_client; ECalClientSourceType source_type; const gchar *uri; + GError *error = NULL; - e_client_utils_open_new_finish (source, result, &client, NULL); + e_client_utils_open_new_finish (source, result, &client, &error); + + if (client == NULL) { + if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_REPOSITORY_OFFLINE)) { + if (an->priv->offline_timeout_id) + g_source_remove (an->priv->offline_timeout_id); + an->priv->offline_sources = g_slist_append (an->priv->offline_sources, g_object_ref (source)); + an->priv->offline_timeout_id = g_timeout_add_seconds (5 * 60, try_open_offline_timeout_cb, an); + } + + g_clear_error (&error); - if (client == NULL) return; + } cal_client = E_CAL_CLIENT (client); source_type = e_cal_client_get_source_type (cal_client); @@ -385,8 +447,6 @@ client_opened_cb (GObject *source_object, * alarm_notify_add_calendar: * @an: An alarm notification service. * @uri: URI of the calendar to load. - * @load_afterwards: Whether this calendar should be loaded in the future - * when the alarm daemon starts up. * * Tells the alarm notification service to load a calendar and start monitoring * its alarms. It can optionally be made to save the URI of this calendar so @@ -395,8 +455,7 @@ client_opened_cb (GObject *source_object, void alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, - ESource *source, - gboolean load_afterwards) + ESource *source) { AlarmNotifyPrivate *priv; EClientSourceType client_source_type; @@ -459,6 +518,8 @@ alarm_notify_add_calendar (AlarmNotify *an, client_source_type = E_CLIENT_SOURCE_TYPE_LAST; } + g_object_set_data (G_OBJECT (source), "source-type", GUINT_TO_POINTER (source_type)); + e_client_utils_open_new ( source, client_source_type, TRUE, NULL, e_client_utils_authenticate_handler, NULL, @@ -476,6 +537,7 @@ alarm_notify_remove_calendar (AlarmNotify *an, { AlarmNotifyPrivate *priv; ECalClient *cal_client; + GSList *in_offline; priv = an->priv; @@ -486,4 +548,17 @@ alarm_notify_remove_calendar (AlarmNotify *an, alarm_queue_remove_client (cal_client, FALSE); g_hash_table_remove (priv->uri_client_hash[source_type], str_uri); } + + in_offline = g_slist_find_custom (priv->offline_sources, str_uri, find_slist_source_uri_cb); + if (in_offline) { + ESource *source = in_offline->data; + + priv->offline_sources = g_slist_remove (priv->offline_sources, source); + if (!priv->offline_sources && priv->offline_timeout_id) { + g_source_remove (priv->offline_timeout_id); + priv->offline_timeout_id = 0; + } + + g_object_unref (source); + } } diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index f95a4d6b33..b48cd5a602 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -69,8 +69,7 @@ AlarmNotify * alarm_notify_new (GCancellable *cancellable, GError **error); void alarm_notify_add_calendar (AlarmNotify *an, ECalClientSourceType source_type, - ESource *source, - gboolean load_afterwards); + ESource *source); void alarm_notify_remove_calendar (AlarmNotify *an, ECalClientSourceType source_type, const gchar *str_uri); diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 35f3a7d743..ced8414ef9 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -29,6 +29,9 @@ #include #include + +#include "e-util/e-datetime-format.h" + #include "calendar-config.h" #include "e-meeting-time-sel-item.h" #include "e-meeting-time-sel.h" @@ -389,9 +392,10 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, { EMeetingTimeSelector *mts; gint y, grid_x; - gchar buffer[128], *format; + gchar *str; gint hour, hour_x, hour_y; PangoLayout *layout; + struct tm tm_time; cairo_save (cr); @@ -437,29 +441,31 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, cairo_rel_line_to (cr, 0, height); cairo_stroke (cr); + g_date_to_struct_tm (date, &tm_time); + str = e_datetime_format_format_tm ("calendar", "table", DTFormatKindDate, &tm_time); + + g_return_if_fail (str != NULL); + /* Draw the date. Set a clipping rectangle so we don't draw over the * next day. */ - if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_FULL) - /* This is a strftime() format string %A = full weekday name, - * %B = full month name, %d = month day, %Y = full year. */ - format = _("%A, %B %d, %Y"); - else if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY) - /* This is a strftime() format string %a = abbreviated weekday - * name, %m = month number, %d = month day, %Y = full year. */ - format = _("%a %m/%d/%Y"); - else - /* This is a strftime() format string %m = month number, - * %d = month day, %Y = full year. */ - format = _("%m/%d/%Y"); + if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY + && !e_datetime_format_includes_day_name ("calendar", "table", DTFormatKindDate)) { + gchar buffer[128]; + gchar *tmp; - g_date_strftime (buffer, sizeof (buffer), format, date); + g_date_strftime (buffer, sizeof (buffer), "%a", date); + + tmp = str; + str = g_strconcat (buffer, " ", str, NULL); + g_free (tmp); + } cairo_save (cr); cairo_rectangle (cr, x, -scroll_y, mts->day_width - 2, mts->row_height - 2); cairo_clip (cr); - pango_layout_set_text (layout, buffer, -1); + pango_layout_set_text (layout, str, -1); cairo_move_to (cr, x + 2, 4 - scroll_y); pango_cairo_show_layout (cr, layout); @@ -484,6 +490,7 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, g_object_unref (layout); cairo_restore (cr); + g_free (str); } /* This paints the colored bars representing busy periods for the combined diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 36e7ad7d42..9957be998d 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -41,6 +41,7 @@ #include "misc/e-dateedit.h" #include "e-util/e-util.h" +#include "e-util/e-datetime-format.h" #include "e-meeting-utils.h" #include "e-meeting-list-view.h" @@ -2327,10 +2328,11 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts) GDate date; gint max_date_width, longest_weekday_width, longest_month_width, width; gint day, longest_weekday, month, longest_month; - gchar buffer[128]; + gchar buffer[128], *str; const gchar *name; PangoContext *pango_context; PangoLayout *layout; + struct tm tm_time; /* Set up Pango prerequisites */ pango_context = gtk_widget_get_pango_context (GTK_WIDGET (mts)); @@ -2368,28 +2370,6 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts) } } - /* See if we can use the full date. We want to use a date with a - * month day > 20 and also the longest weekday. We use a - * pre-calculated array of days for each month and add on the - * weekday (which is 1 (Mon) to 7 (Sun). */ - g_date_set_dmy (&date, days[longest_month - 1] + longest_weekday, - longest_month, 2000); - /* This is a strftime() format string %A = full weekday name, - * %B = full month name, %d = month day, %Y = full year. */ - g_date_strftime (buffer, sizeof (buffer), _("%A, %B %d, %Y"), &date); - -#if 0 - g_print ("longest_month: %i longest_weekday: %i date: %s\n", - longest_month, longest_weekday, buffer); -#endif - - pango_layout_set_text (layout, buffer, -1); - pango_layout_get_pixel_size (layout, &width, NULL); - if (width < max_date_width) { - mts->date_format = E_MEETING_TIME_SELECTOR_DATE_FULL; - return; - } - /* Now try it with abbreviated weekday names. */ longest_weekday_width = 0; longest_weekday = G_DATE_MONDAY; @@ -2405,16 +2385,28 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts) g_date_set_dmy (&date, days[longest_month - 1] + longest_weekday, longest_month, 2000); - /* This is a strftime() format string %a = abbreviated weekday name, - * %m = month number, %d = month day, %Y = full year. */ - g_date_strftime (buffer, sizeof (buffer), _("%a %m/%d/%Y"), &date); + + g_date_to_struct_tm (&date, &tm_time); + str = e_datetime_format_format_tm ("calendar", "table", DTFormatKindDate, &tm_time); + + g_return_if_fail (str != NULL); + + if (!e_datetime_format_includes_day_name ("calendar", "table", DTFormatKindDate)) { + gchar *tmp; + + g_date_strftime (buffer, sizeof (buffer), "%a", &date); + + tmp = str; + str = g_strconcat (buffer, " ", str, NULL); + g_free (tmp); + } #if 0 g_print ("longest_month: %i longest_weekday: %i date: %s\n", - longest_month, longest_weekday, buffer); + longest_month, longest_weekday, str); #endif - pango_layout_set_text (layout, buffer, -1); + pango_layout_set_text (layout, str, -1); pango_layout_get_pixel_size (layout, &width, NULL); if (width < max_date_width) mts->date_format = E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY; @@ -2422,6 +2414,7 @@ e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts) mts->date_format = E_MEETING_TIME_SELECTOR_DATE_SHORT; g_object_unref (layout); + g_free (str); } /* Turn off the background of the canvas windows. This reduces flicker diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h index 7f45242006..7c3f7c3021 100644 --- a/calendar/gui/e-meeting-time-sel.h +++ b/calendar/gui/e-meeting-time-sel.h @@ -68,13 +68,13 @@ G_BEGIN_DECLS /* This is used to specify the format used when displaying the dates. - * The full format is like 'Sunday, September 12, 1999'. The abbreviated format - * is like 'Sun 12/9/99'. The short format is like '12/9/99'. The actual - * format used is determined in e_meeting_time_selector_style_set (), once we - * know the font being used. */ + * The abbreviated format is like 'Sun 12/9/99'. + * The short format is like '12/9/99'. + * The actual format used is determined in e_meeting_time_selector_style_set (), + * once we know the font being used. + */ typedef enum { - E_MEETING_TIME_SELECTOR_DATE_FULL, E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY, E_MEETING_TIME_SELECTOR_DATE_SHORT } EMeetingTimeSelectorDateFormat; diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt index 765bb28f8a..562af01fc9 100644 --- a/doc/reference/shell/eshell-sections.txt +++ b/doc/reference/shell/eshell-sections.txt @@ -1099,8 +1099,6 @@ e_util_guess_mime_type e_util_get_category_filter_options e_binding_transform_color_to_string e_binding_transform_string_to_color -e_binding_transform_enum_nick_to_value -e_binding_transform_enum_value_to_nick e_binding_transform_source_to_uid e_binding_transform_uid_to_source e_charset_add_radio_actions diff --git a/e-util/e-datetime-format.c b/e-util/e-datetime-format.c index c21d025794..877b170218 100644 --- a/e-util/e-datetime-format.c +++ b/e-util/e-datetime-format.c @@ -662,3 +662,25 @@ e_datetime_format_format_tm (const gchar *component, return res; } + +gboolean +e_datetime_format_includes_day_name (const gchar *component, const gchar *part, DTFormatKind kind) +{ + gchar *key; + const gchar *fmt; + gboolean res; + + g_return_val_if_fail (component != NULL, FALSE); + g_return_val_if_fail (*component != 0, FALSE); + + key = gen_key (component, part, kind); + g_return_val_if_fail (key != NULL, FALSE); + + fmt = get_format_internal (key, kind); + + res = fmt && (strstr (fmt, "%a") != NULL || strstr (fmt, "%A") != NULL); + + g_free (key); + + return res; +} diff --git a/e-util/e-datetime-format.h b/e-util/e-datetime-format.h index 2c19c65133..28eed151b3 100644 --- a/e-util/e-datetime-format.h +++ b/e-util/e-datetime-format.h @@ -39,6 +39,7 @@ void e_datetime_format_add_setup_widget (GtkWidget *table, gint row, const gchar gchar *e_datetime_format_format (const gchar *component, const gchar *part, DTFormatKind kind, time_t value); gchar *e_datetime_format_format_tm (const gchar *component, const gchar *part, DTFormatKind kind, struct tm *tm_time); +gboolean e_datetime_format_includes_day_name (const gchar *component, const gchar *part, DTFormatKind kind); G_END_DECLS diff --git a/e-util/e-util.c b/e-util/e-util.c index cda17cbbc9..d41f43630e 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1439,80 +1439,6 @@ e_binding_transform_string_to_color (GBinding *binding, return success; } -/** - * e_binding_transform_enum_value_to_nick: - * @binding: a #GBinding - * @source_value: a #GValue whose type is derived from #G_TYPE_ENUM - * @target_value: a #GValue of type #G_TYPE_STRING - * @not_used: not used - * - * Transforms an enumeration value to its corresponding nickname. - * - * Returns: %TRUE if the enum value has a corresponding nickname - **/ -gboolean -e_binding_transform_enum_value_to_nick (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer not_used) -{ - GEnumClass *enum_class; - GEnumValue *enum_value; - gint value; - gboolean success = FALSE; - - g_return_val_if_fail (G_IS_BINDING (binding), FALSE); - - enum_class = g_type_class_peek (G_VALUE_TYPE (source_value)); - g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE); - - value = g_value_get_enum (source_value); - enum_value = g_enum_get_value (enum_class, value); - if (enum_value != NULL) { - g_value_set_string (target_value, enum_value->value_nick); - success = TRUE; - } - - return success; -} - -/** - * e_binding_transform_enum_nick_to_value: - * @binding: a #GBinding - * @source_value: a #GValue of type #G_TYPE_STRING - * @target_value: a #GValue whose type is derived from #G_TYPE_ENUM - * @not_used: not_used - * - * Transforms an enumeration nickname to its corresponding value. - * - * Returns: %TRUE if the enum nickname has a corresponding value - **/ -gboolean -e_binding_transform_enum_nick_to_value (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer not_used) -{ - GEnumClass *enum_class; - GEnumValue *enum_value; - const gchar *string; - gboolean success = FALSE; - - g_return_val_if_fail (G_IS_BINDING (binding), FALSE); - - enum_class = g_type_class_peek (G_VALUE_TYPE (target_value)); - g_return_val_if_fail (G_IS_ENUM_CLASS (enum_class), FALSE); - - string = g_value_get_string (source_value); - enum_value = g_enum_get_value_by_nick (enum_class, string); - if (enum_value != NULL) { - g_value_set_enum (target_value, enum_value->value); - success = TRUE; - } - - return success; -} - /** * e_binding_transform_source_to_uid: * @binding: a #GBinding diff --git a/e-util/e-util.h b/e-util/e-util.h index 1117781186..de2a817171 100644 --- a/e-util/e-util.h +++ b/e-util/e-util.h @@ -137,7 +137,7 @@ void e_util_set_source_combo_box_list (GtkWidget *source_combo_box, const gchar *source_gconf_path); -/* Useful GBinding transformation functions */ +/* Useful GBinding transform functions */ gboolean e_binding_transform_color_to_string (GBinding *binding, const GValue *source_value, @@ -148,16 +148,6 @@ gboolean e_binding_transform_string_to_color const GValue *source_value, GValue *target_value, gpointer not_used); -gboolean e_binding_transform_enum_value_to_nick - (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer not_used); -gboolean e_binding_transform_enum_nick_to_value - (GBinding *binding, - const GValue *source_value, - GValue *target_value, - gpointer not_used); gboolean e_binding_transform_source_to_uid (GBinding *binding, const GValue *source_value, diff --git a/filter/e-filter-color.c b/filter/e-filter-color.c index bf80fbb778..1540841968 100644 --- a/filter/e-filter-color.c +++ b/filter/e-filter-color.c @@ -26,7 +26,6 @@ #endif #include -#include #include "e-filter-color.h" @@ -127,7 +126,7 @@ filter_color_format_sexp (EFilterElement *element, g_snprintf (spec, sizeof (spec), "#%04x%04x%04x", fc->color.red, fc->color.green, fc->color.blue); - e_sexp_encode_string (out, spec); + camel_sexp_encode_string (out, spec); } static void diff --git a/filter/e-filter-element.h b/filter/e-filter-element.h index 9abd83ca0a..c0bcadd169 100644 --- a/filter/e-filter-element.h +++ b/filter/e-filter-element.h @@ -25,6 +25,7 @@ #define E_FILTER_ELEMENT_H #include +#include #include #include #include diff --git a/filter/e-filter-file.c b/filter/e-filter-file.c index a5199fe064..baf75e71bb 100644 --- a/filter/e-filter-file.c +++ b/filter/e-filter-file.c @@ -31,8 +31,6 @@ #include #include -#include - #include "e-util/e-alert.h" #include "e-filter-file.h" @@ -203,7 +201,7 @@ filter_file_format_sexp (EFilterElement *element, { EFilterFile *file = E_FILTER_FILE (element); - e_sexp_encode_string (out, file->path); + camel_sexp_encode_string (out, file->path); } static void diff --git a/filter/e-filter-input.c b/filter/e-filter-input.c index 10fa1f1765..8b92f5486e 100644 --- a/filter/e-filter-input.c +++ b/filter/e-filter-input.c @@ -32,8 +32,6 @@ #include #include -#include - #include "e-util/e-alert.h" #include "e-filter-input.h" @@ -243,7 +241,7 @@ filter_input_format_sexp (EFilterElement *element, GList *link; for (link = input->values; link != NULL; link = g_list_next (link)) - e_sexp_encode_string (out, link->data); + camel_sexp_encode_string (out, link->data); } static void diff --git a/filter/e-filter-int.c b/filter/e-filter-int.c index dcb9b18fba..883c560795 100644 --- a/filter/e-filter-int.c +++ b/filter/e-filter-int.c @@ -27,8 +27,6 @@ #include #include -#include - #include "e-filter-int.h" G_DEFINE_TYPE ( diff --git a/filter/e-filter-option.c b/filter/e-filter-option.c index 0cea021666..2f5af12e3b 100644 --- a/filter/e-filter-option.c +++ b/filter/e-filter-option.c @@ -31,8 +31,6 @@ #include #include -#include - #include "e-filter-option.h" #include "e-filter-part.h" @@ -409,7 +407,7 @@ filter_option_format_sexp (EFilterElement *element, EFilterOption *option = E_FILTER_OPTION (element); if (option->current) - e_sexp_encode_string (out, option->current->value); + camel_sexp_encode_string (out, option->current->value); } static void diff --git a/filter/e-filter-part.c b/filter/e-filter-part.c index 0b31097d7c..2154699178 100644 --- a/filter/e-filter-part.c +++ b/filter/e-filter-part.c @@ -501,7 +501,7 @@ e_filter_part_expand_code (EFilterPart *part, #if 0 } else if ((val = g_hash_table_lookup (part->globals, name))) { g_string_append_printf (out, "%.*s", newstart-start, start); - e_sexp_encode_string (out, val); + camel_sexp_encode_string (out, val); #endif } else { g_string_append_printf (out, "%.*s", (gint)(end-start+1), start); diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index af861f575f..f4fcbb26af 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -122,10 +122,10 @@ struct _user_message_msg { CamelSessionAlertType type; gchar *prompt; + GSList *button_captions; EFlag *done; - guint allow_cancel : 1; - guint result : 1; + gint result; guint ismain : 1; }; @@ -160,8 +160,8 @@ user_message_response (GtkDialog *dialog, struct _user_message_msg *m) { /* if !allow_cancel, then we've already replied */ - if (m->allow_cancel) { - m->result = button == GTK_RESPONSE_OK; + if (m->button_captions) { + m->result = button; e_flag_set (m->done); } @@ -175,6 +175,8 @@ user_message_exec (struct _user_message_msg *m, { GtkWindow *parent; const gchar *error_type; + gint index; + GSList *iter; if (!m->ismain && user_message_dialog != NULL) { g_queue_push_tail (&user_message_queue, mail_msg_ref (m)); @@ -183,19 +185,13 @@ user_message_exec (struct _user_message_msg *m, switch (m->type) { case CAMEL_SESSION_ALERT_INFO: - error_type = m->allow_cancel ? - "mail:session-message-info-cancel" : - "mail:session-message-info"; + error_type = "mail:session-message-info"; break; case CAMEL_SESSION_ALERT_WARNING: - error_type = m->allow_cancel ? - "mail:session-message-warning-cancel" : - "mail:session-message-warning"; + error_type = "mail:session-message-warning"; break; case CAMEL_SESSION_ALERT_ERROR: - error_type = m->allow_cancel ? - "mail:session-message-error-cancel" : - "mail:session-message-error"; + error_type = "mail:session-message-error"; break; default: error_type = NULL; @@ -208,6 +204,25 @@ user_message_exec (struct _user_message_msg *m, parent, error_type, m->prompt, NULL); g_object_set (user_message_dialog, "resizable", TRUE, NULL); + if (m->button_captions) { + GtkWidget *action_area; + GList *children, *child; + + /* remove all default buttons and keep only those requested */ + action_area = gtk_dialog_get_action_area (GTK_DIALOG (user_message_dialog)); + + children = gtk_container_get_children (GTK_CONTAINER (action_area)); + for (child = children; child != NULL; child = child->next) { + gtk_container_remove (GTK_CONTAINER (action_area), child->data); + } + + g_list_free (children); + } + + for (index = 0, iter = m->button_captions; iter; index++, iter = iter->next) { + gtk_dialog_add_button (GTK_DIALOG (user_message_dialog), iter->data, index); + } + /* XXX This is a case where we need to be able to construct * custom EAlerts without a predefined XML definition. */ if (m->ismain) { @@ -228,6 +243,7 @@ static void user_message_free (struct _user_message_msg *m) { g_free (m->prompt); + g_slist_free_full (m->button_captions, g_free); e_flag_free (m->done); } @@ -889,24 +905,28 @@ mail_session_forget_password (CamelSession *session, return TRUE; } -static gboolean +static gint mail_session_alert_user (CamelSession *session, CamelSessionAlertType type, const gchar *prompt, - gboolean cancel) + GSList *button_captions) { struct _user_message_msg *m; GCancellable *cancellable; - gboolean result = TRUE; + gint result = -1; + GSList *iter; m = mail_msg_new (&user_message_info); m->ismain = mail_in_main_thread (); m->type = type; m->prompt = g_strdup (prompt); m->done = e_flag_new (); - m->allow_cancel = cancel; + m->button_captions = g_slist_copy (button_captions); - if (cancel) + for (iter = m->button_captions; iter; iter = iter->next) + iter->data = g_strdup (iter->data); + + if (g_slist_length (button_captions) > 1) mail_msg_ref (m); cancellable = e_activity_get_cancellable (m->base.activity); @@ -916,7 +936,7 @@ mail_session_alert_user (CamelSession *session, else mail_msg_main_loop_push (m); - if (cancel) { + if (g_slist_length (button_captions) > 1) { e_flag_wait (m->done); result = m->result; mail_msg_unref (m); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 2bc3bf3d81..64aa851d6c 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -2092,13 +2092,6 @@ emae_setup_settings (EMAccountEditorService *service) settings_type = class->settings_type; g_type_class_unref (class); - /* If we already have a CamelSettings instance - * of the appropriate type, leave it alone. */ - if (service->settings != NULL) { - if (G_OBJECT_TYPE (service->settings) == settings_type) - return; - } - url = emae_account_url ( service->emae, emae_service_info[service->type].account_uri_key); @@ -2830,8 +2823,8 @@ emae_create_basic_assistant_page (EMAccountEditor *emae, title = _("Sending Email"); label = _("Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider."); } else if (g_ascii_strcasecmp (page_id, "review_page") == 0) { - title = _("Review Account"); - label = _("Time to check things over before we try and connect to the server and fetch your mail."); + title = _("Account Summary"); + label = _("This is a summary of the settings which will be used to access your mail."); } else if (g_ascii_strcasecmp (page_id, "finish_page") == 0) { page_type = GTK_ASSISTANT_PAGE_CONFIRM; fill_space = TRUE; @@ -3592,13 +3585,10 @@ emae_send_page (EConfig *ec, GtkWidget *w; GtkBuilder *builder; - provider = emae_get_transport_provider (emae); - - if (provider == NULL) - return NULL; + provider = emae_get_store_provider (emae); /* no transport options page at all for these types of providers */ - if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider)) { + if (provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider)) { memset (&priv->transport.frame, 0, ((gchar *) &priv->transport.check_dialog) - ((gchar *) &priv->transport.frame)); return NULL; } @@ -4622,9 +4612,9 @@ emae_check_complete (EConfig *ec, gtk_label_set_text (emae->priv->receive_name, url->user); g_object_get (emae->priv->source.settings, "security-method", &method, NULL); if (method == CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT) - enc = g_strdup (_("Always(SSL)")); + enc = g_strdup (_("Always (SSL)")); else if (method == CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT) - enc = g_strdup (_("When possible(TLS)")); + enc = g_strdup (_("When possible (TLS)")); else enc = g_strdup (_("Never")); @@ -4638,9 +4628,9 @@ emae_check_complete (EConfig *ec, gtk_label_set_text (emae->priv->send_name, url->user); g_object_get (emae->priv->transport.settings, "security-method", &method, NULL); if (method == CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT) - enc = g_strdup (_("Always(SSL)")); + enc = g_strdup (_("Always (SSL)")); else if (method == CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT) - enc = g_strdup (_("When possible(TLS)")); + enc = g_strdup (_("When possible (TLS)")); else enc = g_strdup (_("Never")); @@ -4766,13 +4756,18 @@ emae_check_complete (EConfig *ec, } if (ok && (pageid == NULL || !strcmp (pageid, "30.send"))) { - if (emae->type != EMAE_NOTEBOOK && refresh) { - emae_refresh_providers (emae, &emae->priv->transport); - emae_provider_changed (emae->priv->transport.providers, &emae->priv->transport); - } - ok = emae_service_complete (emae, &emae->priv->transport); - if (!ok) { - d (printf ("send page incomplete\n")); + CamelProvider *provider; + + provider = emae_get_store_provider (emae); + if (!provider || !CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider)) { + if (emae->type != EMAE_NOTEBOOK && refresh) { + emae_refresh_providers (emae, &emae->priv->transport); + emae_provider_changed (emae->priv->transport.providers, &emae->priv->transport); + } + ok = emae_service_complete (emae, &emae->priv->transport); + if (!ok) { + d (printf ("send page incomplete\n")); + } } } @@ -5132,7 +5127,7 @@ emae_commit (EConfig *ec, } else { CamelProvider *provider; - d (printf ("Adding new account '%s'\n", e_account_get_string (account, E_ACCOUNT_NAME))); + d (printf ("Adding new account '%s'\n", e_account_get_string (modified_account, E_ACCOUNT_NAME))); e_account_list_add (accounts, modified_account); account = modified_account; diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 06db108b8e..85fc96d751 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1412,17 +1412,23 @@ emu_update_composers_security (EMsgComposer *composer, guint32 validity_found) { GtkToggleAction *action; + EShell *shell; + EShellSettings *shell_settings; g_return_if_fail (composer != NULL); + shell = e_msg_composer_get_shell (composer); + shell_settings = e_shell_get_shell_settings (shell); + /* Pre-set only for encrypted messages, not for signed */ - /*if (validity_found & EM_FORMAT_VALIDITY_FOUND_SIGNED) { + if ((validity_found & EM_FORMAT_VALIDITY_FOUND_SIGNED) != 0 + && e_shell_settings_get_boolean (shell_settings, "composer-sign-reply-if-signed")) { if (validity_found & EM_FORMAT_VALIDITY_FOUND_SMIME) action = GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_SIGN (composer)); else action = GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_SIGN (composer)); gtk_toggle_action_set_active (action, TRUE); - }*/ + } if (validity_found & EM_FORMAT_VALIDITY_FOUND_ENCRYPTED) { if (validity_found & EM_FORMAT_VALIDITY_FOUND_SMIME) diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index 74f386481e..6098c9354d 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -36,7 +36,6 @@ #include "mail/em-utils.h" #include "shell/e-shell.h" #include "filter/e-filter-part.h" -#include "libedataserver/e-sexp.h" #include "e-util/e-alert.h" #define EM_FILTER_FOLDER_ELEMENT_GET_PRIVATE(obj) \ @@ -264,7 +263,7 @@ filter_folder_element_format_sexp (EFilterElement *fe, { EMFilterFolderElement *ff = (EMFilterFolderElement *) fe; - e_sexp_encode_string (out, ff->priv->uri); + camel_sexp_encode_string (out, ff->priv->uri); } static void diff --git a/mail/em-filter-source-element.c b/mail/em-filter-source-element.c index b95c140c58..b6d518d6d6 100644 --- a/mail/em-filter-source-element.c +++ b/mail/em-filter-source-element.c @@ -32,8 +32,6 @@ #include #include -#include - #include #include @@ -402,7 +400,7 @@ filter_source_element_format_sexp (EFilterElement *fe, { EMFilterSourceElement *fs = (EMFilterSourceElement *) fe; - e_sexp_encode_string (out, fs->priv->active_id); + camel_sexp_encode_string (out, fs->priv->active_id); } static void diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index c26c0feb96..f7c3844b8a 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -76,6 +76,21 @@ + + /schemas/apps/evolution/mail/composer/sign_reply_if_signed + /apps/evolution/mail/composer/sign_reply_if_signed + evolution-mail + bool + false + + Digitally sign messages when original message signed (PGP or S/MIME) + + Automatically enable PGP or S/MIME signatures when replying + to a message which is also PGP or S/MIME signed. + + + + /schemas/apps/evolution/mail/composer/reply_start_bottom /apps/evolution/mail/composer/reply_start_bottom diff --git a/mail/mail-config.ui b/mail/mail-config.ui index 02bf640a3a..e95a812b59 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -594,7 +594,7 @@ for display purposes only. True False - 6 + 7 2 6 6 @@ -696,6 +696,23 @@ for display purposes only. + + + Digitally _sign messages when original message signed (PGP or S/MIME) + True + True + False + False + True + True + + + 2 + 6 + 7 + + + True @@ -4887,6 +4904,7 @@ For example: "Work" or "Personal" 0 description True + 40 1 @@ -5398,6 +5416,7 @@ For example: "Work" or "Personal" 0 description True + 40 1 diff --git a/mail/mail.error.xml b/mail/mail.error.xml index 006cc559a4..f811abb9fd 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -140,32 +140,14 @@ Many email systems add an Apparently-To header to messages that only have BCC re {0} - - {0} -