aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/calendar.error.xml17
-rw-r--r--calendar/gui/apps_evolution_calendar.schemas.in25
-rw-r--r--calendar/gui/calendar-commands.c7
-rw-r--r--calendar/gui/calendar-component.c40
-rw-r--r--calendar/gui/calendar-component.h2
-rw-r--r--calendar/gui/e-calendar-view.c33
-rw-r--r--calendar/gui/e-calendar-view.h3
-rw-r--r--calendar/gui/gnome-cal.c96
9 files changed, 219 insertions, 22 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e711b5517b..dfb8323c51 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -264,6 +264,24 @@ License Changes
* gui/e-cal-model.c: (e_cal_view_objects_modified_cb):
Use result of g_list_prepend, thus report changes properly.
+2008-11-03 Ashish Shrivastava <shashish@novell.com>
+
+ ** Most of the errors are now non-intrusive
+
+ * calendar.error.xml: Added a new error message for
+ non-intrusive backend_died.
+ * apps_evolution_calendar.schemas.in:
+ * calendar-commands.c: Added new verb for help debug message
+ (help_debug):
+ * gnome-cal.c: Support for non-intrusive error.
+ (client_cal_opened_cb), Define fash table and accessing errors:
+ * e-calendar-view.c: (error_response):
+ (e_calendar_utils_show_error_silent), (e_calendar_utils_show_info_silent):
+ * e-calendar-view.h:
+ * calendar-component.c: Added EActivityHandler and ELogger:
+ (calendar_component_peek_activity_handler), (calendar_component_show_logger):
+ * calendar-component.h:
+
2008-09-08 Chenthill Palanisamy <pchenthill@novell.com>
Fixes #544187
diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml
index d74c27b1fe..996f439a3f 100644
--- a/calendar/calendar.error.xml
+++ b/calendar/calendar.error.xml
@@ -176,6 +176,23 @@
<_secondary>Your memos will not be available until Evolution is restarted.</_secondary>
</error>
+<error id="backend_died" type="error">
+ <_primary>The Evolution calendars have quit unexpectedly.</_primary>
+ <_secondary>Your calendars will not be available until Evolution is restarted.</_secondary>
+</error>
+
+<error id="unable-to-load-the-calendar" type="error" default="GTK_RESPONSE_YES">
+ <_primary>Unable to load the calendar</_primary>
+ <_secondary>Calendar repository is offline.</_secondary>
+ <button stock ="gtk-ok" response="GTK_RESPONSE_YES"/>
+</error>
+<error id="error-on-loading-the-calendar" type="error" default="GTK_RESPONSE_YES">
+ <!-- For Translators: {0} is specify the backend server -->
+ <_primary>Error on '{0}'</_primary>
+ <_secondary>No response from the server.</_secondary>
+ <button stock ="gtk-ok" response="GTK_RESPONSE_YES"/>
+</error>
+
<error id="editor-error" type="error">
<_primary>Editor could not be loaded.</_primary>
<_secondary>{0}.</_secondary>
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in
index e024826c95..bd3a8ab220 100644
--- a/calendar/gui/apps_evolution_calendar.schemas.in
+++ b/calendar/gui/apps_evolution_calendar.schemas.in
@@ -591,5 +591,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 5cc75275f2..1d55920779 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -554,6 +554,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 [] = {
BONOBO_UI_VERB ("EventOpen", file_open_event_cb),
@@ -579,7 +584,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 791384079f..93c4407cb3 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"
@@ -66,6 +68,8 @@
#define CONTACTS_BASE_URI "contacts://"
#define WEATHER_BASE_URI "weather://"
#define PERSONAL_RELATIVE_URI "system"
+#define CALENDAR_ERROR_LEVEL_KEY "/apps/evolution/calendar/display/error_level"
+#define CALENDAR_ERROR_TIME_OUT_KEY "/apps/evolution/calendar/display/error_timeout"
enum DndTargetType {
DND_TARGET_TYPE_CALENDAR_LIST,
@@ -77,8 +81,9 @@ static GtkTargetEntry drag_types[] = {
{ XCALENDAR_TYPE, 0, DND_TARGET_TYPE_CALENDAR_LIST }
};
static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
+#define CALENDAR_COMPONENT_DEFAULT(cc) if (cc == NULL) cc = calendar_component_peek()
#define PARENT_TYPE bonobo_object_get_type ()
+
static BonoboObjectClass *parent_class = NULL;
typedef struct
@@ -120,6 +125,9 @@ struct _CalendarComponentPrivate {
ESourceList *task_source_list;
ESourceList *memo_source_list;
+ EActivityHandler *activity_handler;
+ ELogger *logger;
+
GList *views;
ECal *create_ecal;
@@ -1460,6 +1468,8 @@ create_component_view (CalendarComponent *calendar_component)
statusbar_widget = e_task_bar_new ();
component_view->activity_handler = e_activity_handler_new ();
e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
+ e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget));
+
gtk_widget_show (statusbar_widget);
component_view->statusbar_control = bonobo_control_new (statusbar_widget);
@@ -1697,6 +1707,11 @@ impl_dispose (GObject *object)
priv->gconf_client = 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;
@@ -1733,6 +1748,7 @@ impl_finalize (GObject *object)
g_free (priv->base_directory);
g_free (priv->config_directory);
+ g_object_unref (priv->logger);
g_free (priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
@@ -1775,6 +1791,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;
ensure_sources (component);
@@ -1825,4 +1846,21 @@ calendar_component_peek_source_list (CalendarComponent *component)
return component->priv->source_list;
}
+EActivityHandler *
+calendar_component_peek_activity_handler (CalendarComponent *component)
+{
+ CALENDAR_COMPONENT_DEFAULT(component);
+
+ return component->priv->activity_handler;
+}
+
+void
+calendar_component_show_logger (gpointer top)
+{
+ CalendarComponent *cc = calendar_component_peek ();
+ ELogger *logger = cc->priv->logger;
+
+ eni_show_logger(logger, top, CALENDAR_ERROR_TIME_OUT_KEY, CALENDAR_ERROR_LEVEL_KEY);
+}
+
BONOBO_TYPE_FUNC_FULL (CalendarComponent, GNOME_Evolution_Component, PARENT_TYPE, calendar_component)
diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h
index 131ffd3a3a..1688618197 100644
--- a/calendar/gui/calendar-component.h
+++ b/calendar/gui/calendar-component.h
@@ -60,6 +60,6 @@ CalendarComponent *calendar_component_peek (void);
const char *calendar_component_peek_base_directory (CalendarComponent *component);
const char *calendar_component_peek_config_directory (CalendarComponent *component);
ESourceList *calendar_component_peek_source_list (CalendarComponent *component);
-
+void calendar_component_show_logger (gpointer);
#endif /* _CALENDAR_COMPONENT_H_ */
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index c58ceea2d6..b1c5819c35 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -2411,3 +2411,36 @@ 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);
+}
+
+void
+e_calendar_utils_show_error_silent (GtkWidget *widget)
+{
+ EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ());
+
+ if(!g_object_get_data ((GObject *) widget, "response-handled")) {
+ g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
+ }
+
+ e_activity_handler_make_error (handler, "calendar", E_LOG_ERROR, widget);
+}
+
+void
+e_calendar_utils_show_info_silent (GtkWidget *widget)
+{
+ EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ());
+
+ if(!g_object_get_data ((GObject *) widget, "response-handled")) {
+ g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL);
+ }
+
+ e_activity_handler_make_error (handler, "calendar", E_LOG_WARNINGS, widget);
+}
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 334988a6e9..8f8eddf53f 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -27,6 +27,7 @@
#include <gtk/gtk.h>
#include "e-cal-model.h"
#include "gnome-cal.h"
+#include "e-activity-handler.h"
G_BEGIN_DECLS
@@ -166,6 +167,8 @@ void e_calendar_view_modify_and_send (ECalComponent *comp,
CalObjModType mod,
GtkWindow *toplevel,
gboolean new);
+void e_calendar_utils_show_error_silent (struct _GtkWidget *widget);
+void e_calendar_utils_show_info_silent(struct _GtkWidget *widget);
gboolean e_calendar_view_get_tooltips (ECalendarViewEventData *data);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 2273ec65b3..ef9e3b7f25 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -93,6 +93,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 */
@@ -1820,6 +1823,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;
@@ -1889,7 +1895,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;
}
@@ -1925,6 +1931,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;
@@ -2711,6 +2722,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)
{
@@ -2720,6 +2737,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;
@@ -2751,14 +2770,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 */
@@ -2767,8 +2798,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);
@@ -2870,7 +2914,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;
@@ -2948,21 +2992,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);
}
@@ -2975,6 +3023,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;
@@ -2990,7 +3039,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);
@@ -2998,7 +3047,7 @@ backend_died_cb (ECal *ecal, gpointer data)
break;
case E_CAL_SOURCE_TYPE_TODO:
- id = "calendar:tasks-crashed";
+ id = g_strdup ("calendar:calendar-crashed");
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL, -1);
@@ -3006,7 +3055,7 @@ backend_died_cb (ECal *ecal, gpointer data)
break;
case E_CAL_SOURCE_TYPE_JOURNAL:
- id = "calendar:memos-crashed";
+ id = g_strdup ("calendar:calendar-crashed");
e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
@@ -3018,7 +3067,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, id, g_object_ref(w));
+ g_signal_connect((GtkObject *)w, "destroy", G_CALLBACK(non_intrusive_error_remove),id);
}
GtkWidget *