diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-08 06:04:53 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-08 06:04:53 +0800 |
commit | d6445f8abfa78c0a9c8680a3ba7422d331391f8f (patch) | |
tree | 8d462e7747bccdc2108837401fd295dfa160943d /calendar/gui | |
parent | 6140798719beb44abaa4de89043f6d911c977621 (diff) | |
download | gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar.gz gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar.bz2 gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar.lz gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar.xz gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.tar.zst gsoc2013-evolution-d6445f8abfa78c0a9c8680a3ba7422d331391f8f.zip |
Merge revisions 36685:36729 from trunk.
svn path=/branches/kill-bonobo/; revision=36763
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in | 25 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 8 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 18 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 9 | ||||
-rw-r--r-- | calendar/gui/e-itip-control.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-week-view-event-item.c | 2 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 92 | ||||
-rw-r--r-- | calendar/gui/weekday-picker.c | 2 |
8 files changed, 136 insertions, 22 deletions
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in index 96bcf173f1..bae4b65ba4 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in @@ -603,5 +603,30 @@ </locale> </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/error_timeout</key> + <applyto>/apps/evolution/calendar/display/error_timeout</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>60</default> + <locale name="C"> + <short>Amount of time in seconds the error should be shown on the status bar.</short> + <long> Amount of time in seconds the error should be shown on the status bar. + </long> + </locale> + </schema> + <schema> + <key>/schemas/apps/evolution/calendar/display/error_level</key> + <applyto>/apps/evolution/calendar/display/error_level</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Level beyond which the message should be logged.</short> + <long> This can have three possible values. 0 for errors. 1 for warnings. + 2 for debug messages. + </long> + </locale> + </schema> </schemalist> </gconfschemafile> diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index c398b6e12b..6fcada753e 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -47,6 +47,7 @@ #include <libecal/e-cal-time-util.h> #include "shell/Evolution.h" #include "calendar-commands.h" +#include "calendar-component.h" #include "calendar-config.h" #include "e-day-view.h" #include "e-week-view.h" @@ -333,6 +334,11 @@ gcal_taskpad_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data) } +static void +help_debug (BonoboUIComponent *uid, void *data, const char *path) +{ + calendar_component_show_logger ((GtkWidget *) data); +} static BonoboUIVerb verbs [] = { @@ -343,7 +349,7 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("ShowListView", show_list_view_clicked), BONOBO_UI_VERB ("CalendarPurge", purge_cmd), - + BONOBO_UI_VERB ("HelpDebug", help_debug), BONOBO_UI_VERB_END }; diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index d22d43e5ff..eafdd8c4b2 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -53,6 +53,8 @@ #include "dialogs/copy-source-dialog.h" #include "dialogs/event-editor.h" #include "misc/e-info-label.h" +#include "e-util/e-non-intrusive-error-dialog.h" +#include "e-util/gconf-bridge.h" #include "e-util/e-error.h" #include "e-cal-menu.h" #include "e-cal-popup.h" @@ -62,8 +64,9 @@ #define CREATE_MEETING_ID "meeting" #define CREATE_ALLDAY_EVENT_ID "allday-event" #define CREATE_CALENDAR_ID "calendar" +#define CALENDAR_ERROR_LEVEL_KEY "/apps/evolution/calendar/display/error_level" +#define CALENDAR_ERROR_TIME_OUT_KEY "/apps/evolution/calendar/display/error_timeout" -#define PARENT_TYPE bonobo_object_get_type () static BonoboObjectClass *parent_class = NULL; typedef struct @@ -95,6 +98,9 @@ struct _CalendarComponentPrivate { ESourceList *task_source_list; ESourceList *memo_source_list; + EActivityHandler *activity_handler; + ELogger *logger; + GList *views; ECal *create_ecal; @@ -571,6 +577,11 @@ impl_dispose (GObject *object) priv->source_list = NULL; } + if (priv->activity_handler != NULL) { + g_object_unref (priv->activity_handler); + priv->activity_handler = NULL; + } + if (priv->create_ecal) { g_object_unref (priv->create_ecal); priv->create_ecal = NULL; @@ -615,6 +626,11 @@ calendar_component_init (CalendarComponent *component) component); priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); + priv->logger = e_logger_create ("calendar"); + priv->activity_handler = e_activity_handler_new (); + e_activity_handler_set_logger (priv->activity_handler, priv->logger); + e_activity_handler_set_error_flush_time (priv->activity_handler,eni_config_get_error_timeout (CALENDAR_ERROR_TIME_OUT_KEY)*1000); + component->priv = priv; if (!e_cal_get_sources (&priv->task_source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 62a8319935..63740563f9 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -2314,3 +2314,12 @@ draw_curved_rectangle (cairo_t *cr, double x0, double y0, } cairo_close_path (cr); } + +static void +error_response(GtkWidget *widget, gint response, void *data) +{ + if (response == GTK_RESPONSE_DELETE_EVENT) + gtk_widget_destroy(widget); + else if (response == GTK_RESPONSE_OK) + gtk_widget_destroy(widget); +} diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 6089e08863..5cafb4a106 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -872,7 +872,7 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp, /* For Translators:'a total of %d times' is part of the sentence of the form 'event recurring every day,a total of % times.' %d is a digit*/ g_string_append_printf ( buffer, ngettext ("a total of %d time", - " a total of %d times", r->count), r->count); + "a total of %d times", r->count), r->count); } else if (!icaltime_is_null_time (r->until)) { ECalComponentDateTime dt; diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 248e618bda..dcb3dd96f5 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -33,7 +33,7 @@ #include "e-util/e-categories-config.h" #include "e-week-view-event-item.h" -#include <gtk/gtksignal.h> +#include <gtk/gtk.h> #include "e-calendar-view.h" #include "comp-util.h" diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 1e396cdf12..3e31e39240 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -89,6 +89,9 @@ #define d(x) x +/* hash table define for non intrusive error dialog */ +static GHashTable *non_intrusive_error_table = NULL; + /* Private part of the GnomeCalendar structure */ struct _GnomeCalendarPrivate { /* The clients for display */ @@ -1576,6 +1579,9 @@ gnome_calendar_init (GnomeCalendar *gcal) for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) priv->clients[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + if (non_intrusive_error_table == NULL) + non_intrusive_error_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), gcal); priv->current_view_type = GNOME_CAL_DAY_VIEW; @@ -1642,7 +1648,7 @@ gnome_calendar_destroy (GtkObject *object) } for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { - if (priv->configs[i]) + if (priv->configs[i]) g_object_unref (priv->configs[i]); priv->configs[i] = NULL; } @@ -1664,6 +1670,11 @@ gnome_calendar_destroy (GtkObject *object) priv->dn_queries = NULL; } + if (non_intrusive_error_table) { + g_hash_table_destroy (non_intrusive_error_table); + non_intrusive_error_table = NULL; + } + if (priv->sexp) { g_free (priv->sexp); priv->sexp = NULL; @@ -2157,6 +2168,12 @@ add_mclient (ECalModel *model, ECal *client) message_push ((Message *) msg); } +static void +non_intrusive_error_remove(GtkWidget *w, void *data) +{ + g_hash_table_remove(non_intrusive_error_table, data); +} + static void client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) { @@ -2166,6 +2183,8 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) ECalModel *model; ECalLoadState state; char *msg; + GtkWidget *w = NULL; + gchar *id; priv = gcal->priv; @@ -2192,14 +2211,26 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) e_cal_open_async (ecal, FALSE); return; case E_CALENDAR_STATUS_INVALID_SERVER_VERSION: - e_error_run (NULL, "calendar:server-version", NULL); + id = g_strdup ("calendar:server-version"); + + if (g_hash_table_lookup(non_intrusive_error_table, id)) { + /* We already have it */ + g_message("Error occurred while existing dialog active:\n"); + return; + } + + w = e_error_new(NULL, "calendar:server-version", NULL); + e_calendar_utils_show_error_silent (w); + g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w)); + g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id); + status = E_CALENDAR_STATUS_OK; break; case E_CALENDAR_STATUS_AUTHENTICATION_FAILED: { const gchar *auth_domain = e_source_get_property (source, "auth-domain"); const gchar *component_name; - + component_name = auth_domain ? auth_domain : "Calendar"; /* Warn the user password is wrong */ @@ -2208,8 +2239,21 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) } case E_CALENDAR_STATUS_REPOSITORY_OFFLINE: if (source_type == E_CAL_SOURCE_TYPE_EVENT) - e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), - "calendar:prompt-no-contents-offline-calendar", NULL); + { + /* check to see if we have dialog already running for this operation */ + id = g_strdup ("calendar:unable-to-load-the-calendar"); + + if (g_hash_table_lookup(non_intrusive_error_table, id)) { + /* We already have it */ + g_message("Error occurred while existing dialog active:\n"); + return; + } + + w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL); + e_calendar_utils_show_error_silent (w); + g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w)); + g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id); + } default: /* Make sure the source doesn't disappear on us */ g_object_ref (source); @@ -2289,7 +2333,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar g_hash_table_remove (priv->clients[source_type], e_source_peek_uid (source)); /* FIXME Is there a better way to handle this? */ - if (priv->default_client[source_type]) + if (priv->default_client[source_type]) g_object_unref (priv->default_client[source_type]); priv->default_client[source_type] = NULL; @@ -2355,21 +2399,25 @@ backend_error_cb (ECal *client, const char *message, gpointer data) GnomeCalendar *gcal; GtkDialog *dialog; char *uristr; + gchar *id; gcal = GNOME_CALENDAR (data); uristr = get_uri_without_password (e_cal_get_uri (client)); + id = g_strdup ("calendar:error-on-loading-the-calendar"); + + if (g_hash_table_lookup(non_intrusive_error_table,id)) { + /* We already have it */ + g_message("Error occurred while existing dialog active:\n"); + return; + } - dialog = GTK_DIALOG (gtk_message_dialog_new ( - GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Error on %s:\n %s"), - uristr, message)); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (GTK_WIDGET (dialog)); + dialog = (GtkDialog *)e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:error-on-loading-the-calendar", uristr, message, NULL); + e_calendar_utils_show_error_silent(GTK_WIDGET (dialog)); + g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(dialog)); + g_signal_connect(GTK_WIDGET (dialog), "destroy", G_CALLBACK(non_intrusive_error_remove), id); + g_free (uristr); } @@ -2382,6 +2430,7 @@ backend_died_cb (ECal *ecal, gpointer data) ECalSourceType source_type; ESource *source; const char *id; + GtkWidget *w = NULL; gcal = GNOME_CALENDAR (data); priv = gcal->priv; @@ -2397,7 +2446,7 @@ backend_died_cb (ECal *ecal, gpointer data) switch (source_type) { case E_CAL_SOURCE_TYPE_EVENT: - id = "calendar:calendar-crashed"; + id = g_strdup ("calendar:calendar-crashed"); e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); @@ -2410,7 +2459,16 @@ backend_died_cb (ECal *ecal, gpointer data) g_object_unref (source); - e_error_run (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), id, NULL); + if (g_hash_table_lookup(non_intrusive_error_table,id)) { + /* We already have it */ + g_message("Error occurred while existing dialog active:\n"); + return; + } + + w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:backend_died", NULL); + e_calendar_utils_show_error_silent (w); + g_hash_table_insert (non_intrusive_error_table, (gpointer) id, g_object_ref(w)); + g_signal_connect((GtkObject *)w, "destroy", G_CALLBACK(non_intrusive_error_remove), (gpointer) id); } GtkWidget * diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 3140d69df5..53fe6dcce6 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -27,7 +27,7 @@ #endif #include <string.h> -#include <gtk/gtksignal.h> +#include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include <glib/gi18n.h> #include <libgnomecanvas/gnome-canvas-rect-ellipse.h> |