diff options
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/calendar.error.xml | 17 | ||||
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in | 25 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 7 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 40 | ||||
-rw-r--r-- | calendar/gui/calendar-component.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 33 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.h | 3 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 96 | ||||
-rw-r--r-- | e-util/ChangeLog | 7 | ||||
-rw-r--r-- | e-util/Makefile.am | 2 | ||||
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-component.c | 250 | ||||
-rw-r--r-- | ui/ChangeLog | 6 | ||||
-rw-r--r-- | ui/evolution-calendar.xml | 6 |
15 files changed, 255 insertions, 265 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 * diff --git a/e-util/ChangeLog b/e-util/ChangeLog index d53074fdcd..964eb6b298 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -68,6 +68,13 @@ License Changes * e-dialog-utils.c: * e-sorter-array.c: +2008-11-03 Ashish Shrivastava <shashish@novell.com> + + ** Support for Non-intrusive error in calendar. + + * Makefile.am: Added new files: + * e-non-intrusive-error-dialog.c, e-non-intrusive-error-dialog.h: + 2008-09-04 Sankar P <psankar@novell.com> License Changes diff --git a/e-util/Makefile.am b/e-util/Makefile.am index f22d8e6161..f003ff9068 100644 --- a/e-util/Makefile.am +++ b/e-util/Makefile.am @@ -57,6 +57,7 @@ eutilinclude_HEADERS = \ e-icon-factory.h \ e-import.h \ e-logger.h \ + e-non-intrusive-error-dialog.h \ e-menu.h \ e-mktemp.h \ e-print.h \ @@ -98,6 +99,7 @@ libeutil_la_SOURCES = \ e-icon-factory.c \ e-import.c \ e-logger.c \ + e-non-intrusive-error-dialog.c \ e-menu.c \ e-mktemp.c \ e-plugin.c \ diff --git a/mail/ChangeLog b/mail/ChangeLog index d9af440011..76ed190ad0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -351,6 +351,14 @@ License Changes * em-format-html-display.c: (efhd_image): Do not try to access widget of the pury when the operation has been cancelled. +2008-11-03 Ashish Shrivastava <shashish@novell.com> + + ** Support for Non-intrusive error in calendar. + + * mail-component.c: Remove common code between + mailer and calendar and moved to + e-util/e-non-intrusive-error-dialog.c + 2008-09-08 Milan Crha <mcrha@redhat.com> ** Fix for bug #328216 diff --git a/mail/mail-component.c b/mail/mail-component.c index ba39c9f273..b16cbca936 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -90,6 +90,11 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-widget.h> +#include "e-util/e-non-intrusive-error-dialog.h" + +#define MAILER_ERROR_LEVEL_KEY "/apps/evolution/mail/display/error_level" +#define MAILER_ERROR_TIME_OUT_KEY "/apps/evolution/mail/display/error_timeout" + #define d(x) static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data); @@ -1585,254 +1590,13 @@ mail_indicate_new_mail (gboolean have_new_mail) e_component_view_set_button_icon (mc->priv->component_view, icon); } -struct _log_data { - int level; - char *key; - char *text; - char *stock_id; - GdkPixbuf *pbuf; -} ldata [] = { - { E_LOG_ERROR, N_("Error"), N_("Errors"), GTK_STOCK_DIALOG_ERROR }, - { E_LOG_WARNINGS, N_("Warning"), N_("Warnings and Errors"), GTK_STOCK_DIALOG_WARNING }, - { E_LOG_DEBUG, N_("Debug"), N_("Error, Warnings and Debug messages"), GTK_STOCK_DIALOG_INFO } -}; - -enum -{ - COL_LEVEL = 0, - COL_TIME, - COL_DATA -}; - -static gboolean -query_tooltip_cb (GtkTreeView *view, - gint x, - gint y, - gboolean keyboard_mode, - GtkTooltip *tooltip) -{ - GtkTreeViewColumn *column; - GtkTreeModel *model; - GtkTreePath *path; - GtkTreeIter iter; - gint level; - - if (!gtk_tree_view_get_tooltip_context ( - view, &x, &y, keyboard_mode, NULL, &path, &iter)) - return FALSE; - - /* Figure out which column we're pointing at. */ - if (keyboard_mode) - gtk_tree_view_get_cursor (view, NULL, &column); - else - gtk_tree_view_get_path_at_pos ( - view, x, y, NULL, &column, NULL, NULL); - - /* Restrict the tip area to a single cell. */ - gtk_tree_view_set_tooltip_cell (view, tooltip, path, column, NULL); - - /* This only works if the tree view is NOT reorderable. */ - if (column != gtk_tree_view_get_column (view, 0)) - return FALSE; - - model = gtk_tree_view_get_model (view); - gtk_tree_model_get (model, &iter, COL_LEVEL, &level, -1); - gtk_tooltip_set_text (tooltip, ldata[level].key); - - return TRUE; -} - -static void -render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer, - GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) -{ - gint level; - - gtk_tree_model_get (model, iter, COL_LEVEL, &level, -1); - g_object_set ( - renderer, "stock-id", ldata[level].stock_id, - "stock-size", GTK_ICON_SIZE_MENU, NULL); -} - -static void -render_date (GtkTreeViewColumn *column, GtkCellRenderer *renderer, - GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) -{ - time_t t; - char sdt[100]; /* Should be sufficient? */ - - gtk_tree_model_get (model, iter, COL_TIME, &t, -1); - strftime (sdt, 100, "%x %X", localtime (&t)); - g_object_set (renderer, "text", sdt, NULL); -} - - - -static void -append_logs (const char *txt, GtkListStore *store) -{ - char **str; - - str = g_strsplit (txt, ":", 3); - if (str[0] && str[1] && str[2]) { - GtkTreeIter iter; - - gtk_list_store_append (store, &iter); - gtk_list_store_set ( - store, &iter, - COL_LEVEL, atoi (str[0]), - COL_TIME, atol (str[1]), - COL_DATA, g_strstrip (str[2]), - -1); - } else - g_printerr ("Unable to decode error log: %s\n", txt); - - g_strfreev (str); -} - -static void -spin_value_changed (GtkSpinButton *b, gpointer data) -{ - int value = gtk_spin_button_get_value_as_int (b); - GConfClient *client = mail_config_get_gconf_client (); - - gconf_client_set_int (client, "/apps/evolution/mail/display/error_timeout", value, NULL); -} - void mail_component_show_logger (gpointer top) { MailComponent *mc = mail_component_peek (); - GConfBridge *bridge; - GtkWidget *container; - GtkWidget *label; - GtkWidget *toplevel; - GtkWidget *vbox; - GtkWidget *widget; - GtkWidget *window; ELogger *logger = mc->priv->logger; - int i; - GtkListStore *store; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - - bridge = gconf_bridge_get (); - toplevel = gtk_widget_get_toplevel (top); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size (GTK_WINDOW (window), 500, 400); - gtk_window_set_title (GTK_WINDOW (window), _("Debug Logs")); - gtk_window_set_transient_for ( - GTK_WINDOW (window), GTK_WINDOW (toplevel)); - gtk_container_set_border_width (GTK_CONTAINER (window), 12); - - vbox = gtk_vbox_new (FALSE, 12); - gtk_container_add (GTK_CONTAINER (window), vbox); - - container = gtk_hbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0); - - /* Translators: This is the first part of the sentence - * "Show _errors in the status bar for" - XXX - "second(s)." */ - widget = gtk_label_new_with_mnemonic ( - _("Show _errors in the status bar for")); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - label = widget; - - widget = gtk_spin_button_new_with_range (1.0, 60.0, 1.0); - gtk_spin_button_set_value ( - GTK_SPIN_BUTTON (widget), - (gdouble) mail_config_get_error_timeout ()); - g_signal_connect ( - widget, "value-changed", - G_CALLBACK (spin_value_changed), NULL); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - - /* Translators: This is the second part of the sentence - * "Show _errors in the status bar for" - XXX - "second(s)." */ - widget = gtk_label_new_with_mnemonic (_("second(s).")); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - - container = gtk_hbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0); - - widget = gtk_label_new_with_mnemonic (_("Log Messages:")); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - label = widget; - - 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); - gconf_bridge_bind_property ( - bridge, "/apps/evolution/mail/display/error_level", - G_OBJECT (widget), "active"); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - - store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_LONG, G_TYPE_STRING); - e_logger_get_logs (logger, (ELogFunction) append_logs, store); - gtk_tree_sortable_set_sort_column_id ( - GTK_TREE_SORTABLE (store), COL_TIME, GTK_SORT_DESCENDING); - - container = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy ( - GTK_SCROLLED_WINDOW (container), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type ( - GTK_SCROLLED_WINDOW (container), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (vbox), container, TRUE, TRUE, 0); - - widget = gtk_tree_view_new(); - gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (widget), TRUE); - gtk_tree_view_set_reorderable (GTK_TREE_VIEW (widget), FALSE); - gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (store)); - gtk_tree_view_set_search_column (GTK_TREE_VIEW (widget), COL_DATA); - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), TRUE); - gtk_widget_set_has_tooltip (widget, TRUE); - gtk_container_add (GTK_CONTAINER (container), widget); - - g_signal_connect ( - widget, "query-tooltip", - G_CALLBACK (query_tooltip_cb), NULL); - - column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Log Level")); - gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); - - renderer = gtk_cell_renderer_pixbuf_new (); - gtk_tree_view_column_pack_start (column, renderer, TRUE); - gtk_tree_view_column_set_cell_data_func ( - column, renderer, render_pixbuf, NULL, NULL); - - column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Time")); - gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); - - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer, FALSE); - gtk_tree_view_column_set_cell_data_func ( - column, renderer, render_date, NULL, NULL); - - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes( - GTK_TREE_VIEW (widget), -1, _("Messages"), - renderer, "markup", COL_DATA, NULL); - - container = gtk_hbutton_box_new (); - gtk_button_box_set_layout ( - GTK_BUTTON_BOX (container), GTK_BUTTONBOX_END); - gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0); - - widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE); - gtk_widget_set_tooltip_text (widget, _("Close this window")); - g_signal_connect_swapped ( - widget, "clicked", - G_CALLBACK (gtk_widget_destroy), window); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - - gtk_widget_show_all (window); + + eni_show_logger(logger, top, MAILER_ERROR_TIME_OUT_KEY, MAILER_ERROR_LEVEL_KEY); } BONOBO_TYPE_FUNC_FULL (MailComponent, GNOME_Evolution_MailComponent, PARENT_TYPE, mail_component) diff --git a/ui/ChangeLog b/ui/ChangeLog index 7cb0adbcf6..c591ce10b6 100644 --- a/ui/ChangeLog +++ b/ui/ChangeLog @@ -7,6 +7,12 @@ * evolution-mail-list.xml: No period at the end of tooltips, and use sentence case. +2008-11-03 Ashish Shrivastava <shashish@novell.com> + + ** Support for Non-intrusive error in calendar. + + * evolution-calendar.xml: Add menu for HelpDebug. + 2008-08-27 Philip Withnall <philip@tecnocode.co.uk> ** Fix for bug #534762 diff --git a/ui/evolution-calendar.xml b/ui/evolution-calendar.xml index 5d7a5d875b..36aa0df0ef 100644 --- a/ui/evolution-calendar.xml +++ b/ui/evolution-calendar.xml @@ -25,6 +25,7 @@ <cmd name="DeleteAllOccurrences" _tip="Delete all occurrences" pixtype="pixbuf"/> <cmd name="CalendarPurge" _label="Purg_e" _tip="Purge old appointments and meetings" accel="*Control*e"/> + <cmd name="HelpDebug" _tip="View the debug console for log messages"/> </commands> <menu> @@ -71,6 +72,11 @@ <menuitem name="CalendarPurge" verb=""/> </submenu> </placeholder> + <submenu name="Help" _label="_Help"> + <placeholder name="PlaceHolderDebug"> + <menuitem name="HelpDebug" verb="" _label="_Debug Logs"/> + </placeholder> + </submenu> </menu> <dockitem name="Toolbar"> |