1169 lines
39 KiB
Diff
1169 lines
39 KiB
Diff
|
--- calendar/calendar.error.xml 2008-10-13 14:13:56.000000000 +0530
|
||
|
+++ calendar/calendar.error.xml 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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>
|
||
|
--- calendar/gui/apps_evolution_calendar.schemas.in 2008-10-13 14:13:50.000000000 +0530
|
||
|
+++ calendar/gui/apps_evolution_calendar.schemas.in 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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>
|
||
|
--- calendar/gui/calendar-commands.c 2008-10-17 10:02:39.000000000 +0530
|
||
|
+++ calendar/gui/calendar-commands.c 2008-11-05 17:00:16.000000000 +0530
|
||
|
@@ -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"
|
||
|
@@ -554,6 +555,11 @@ gcal_taskpad_focus_change_cb (GnomeCalen
|
||
|
|
||
|
}
|
||
|
|
||
|
+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 +585,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
|
||
|
};
|
||
|
|
||
|
--- calendar/gui/calendar-component.c 2008-10-13 14:13:50.000000000 +0530
|
||
|
+++ calendar/gui/calendar-component.c 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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;
|
||
|
@@ -1433,6 +1441,8 @@ create_component_view (CalendarComponent
|
||
|
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);
|
||
|
@@ -1670,6 +1680,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;
|
||
|
@@ -1706,6 +1721,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);
|
||
|
@@ -1748,6 +1764,11 @@ calendar_component_init (CalendarCompone
|
||
|
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);
|
||
|
|
||
|
@@ -1798,4 +1819,21 @@ calendar_component_peek_source_list (Cal
|
||
|
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)
|
||
|
--- calendar/gui/calendar-component.h 2008-10-13 14:13:50.000000000 +0530
|
||
|
+++ calendar/gui/calendar-component.h 2008-11-05 17:00:29.000000000 +0530
|
||
|
@@ -26,6 +26,7 @@
|
||
|
|
||
|
#include <bonobo/bonobo-object.h>
|
||
|
#include <libedataserver/e-source-list.h>
|
||
|
+#include <widgets/misc/e-activity-handler.h>
|
||
|
#include "Evolution.h"
|
||
|
|
||
|
|
||
|
@@ -60,6 +61,7 @@ CalendarComponent *calendar_component_pe
|
||
|
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);
|
||
|
-
|
||
|
+EActivityHandler *calendar_component_peek_activity_handler (CalendarComponent *component);
|
||
|
+void calendar_component_show_logger (gpointer);
|
||
|
|
||
|
#endif /* _CALENDAR_COMPONENT_H_ */
|
||
|
--- calendar/gui/e-calendar-view.h 2008-10-13 14:13:50.000000000 +0530
|
||
|
+++ calendar/gui/e-calendar-view.h 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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_an
|
||
|
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);
|
||
|
|
||
|
--- calendar/gui/gnome-cal.c 2008-10-17 10:02:39.000000000 +0530
|
||
|
+++ calendar/gui/gnome-cal.c 2008-11-05 17:00:47.000000000 +0530
|
||
|
@@ -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 *objec
|
||
|
}
|
||
|
|
||
|
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 *objec
|
||
|
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 *cli
|
||
|
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, ECalen
|
||
|
ECalModel *model;
|
||
|
ECalLoadState state;
|
||
|
char *msg;
|
||
|
+ GtkWidget *w = NULL;
|
||
|
+ gchar *id;
|
||
|
|
||
|
priv = gcal->priv;
|
||
|
|
||
|
@@ -2751,14 +2770,26 @@ client_cal_opened_cb (ECal *ecal, ECalen
|
||
|
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, ECalen
|
||
|
}
|
||
|
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
|
||
|
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 ch
|
||
|
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");
|
||
|
|
||
|
- 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));
|
||
|
+ 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 = (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 da
|
||
|
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 da
|
||
|
|
||
|
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 da
|
||
|
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 da
|
||
|
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 da
|
||
|
|
||
|
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 *
|
||
|
--- e-util/Makefile.am 2008-10-13 14:13:22.000000000 +0530
|
||
|
+++ e-util/Makefile.am 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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 \
|
||
|
--- mail/mail-component.c 2008-10-13 14:07:24.000000000 +0530
|
||
|
+++ mail/mail-component.c 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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_ne
|
||
|
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)
|
||
|
--- ui/evolution-calendar.xml 2008-10-13 14:14:04.000000000 +0530
|
||
|
+++ ui/evolution-calendar.xml 2008-11-05 16:53:41.000000000 +0530
|
||
|
@@ -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">
|
||
|
--- /dev/null 2008-10-14 15:16:33.000000000 +0530
|
||
|
+++ e-util/e-non-intrusive-error-dialog.c 2008-11-05 17:01:04.000000000 +0530
|
||
|
@@ -0,0 +1,308 @@
|
||
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||
|
+ *
|
||
|
+ * Authors: Ashish Shrivastava <shashish@novell.com>
|
||
|
+ *
|
||
|
+ * This program is free software; you can redistribute it and/or modify
|
||
|
+ * it under the terms of the GNU General Public License as published by
|
||
|
+ * the Free Software Foundation; either version 2 of the License, or
|
||
|
+ * (at your option) any later version.
|
||
|
+ *
|
||
|
+ * This program is distributed in the hope that it will be useful,
|
||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
+ * GNU General Public License for more details.
|
||
|
+ *
|
||
|
+ * You should have received a copy of the GNU General Public License
|
||
|
+ * along with this program; if not, write to the Free Software
|
||
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
+ *
|
||
|
+ */
|
||
|
+
|
||
|
+#ifdef HAVE_CONFIG_H
|
||
|
+#include <config.h>
|
||
|
+#endif
|
||
|
+
|
||
|
+#include <stdio.h>
|
||
|
+#include <string.h>
|
||
|
+#include <stdlib.h>
|
||
|
+
|
||
|
+#include <glib.h>
|
||
|
+#include <glib/gi18n.h>
|
||
|
+#include <glib/gstdio.h>
|
||
|
+#include <glib/gstdio.h>
|
||
|
+#include "e-non-intrusive-error-dialog.h"
|
||
|
+
|
||
|
+/* eni - non intrusive error */
|
||
|
+
|
||
|
+static gboolean
|
||
|
+eni_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
|
||
|
+eni_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
|
||
|
+eni_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
|
||
|
+eni_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 guint
|
||
|
+eni_config_get_error_level (const char *path)
|
||
|
+{
|
||
|
+ GConfClient *gconf_client;
|
||
|
+ guint error_level;
|
||
|
+
|
||
|
+ gconf_client = gconf_client_get_default ();
|
||
|
+ error_level = gconf_client_get_int (gconf_client, path, NULL);
|
||
|
+
|
||
|
+ g_object_unref (gconf_client);
|
||
|
+ return error_level;
|
||
|
+}
|
||
|
+
|
||
|
+guint
|
||
|
+eni_config_get_error_timeout (const char *path)
|
||
|
+{
|
||
|
+ GConfClient *gconf_client;
|
||
|
+ guint error_time;
|
||
|
+
|
||
|
+ gconf_client = gconf_client_get_default ();
|
||
|
+ error_time = gconf_client_get_int (gconf_client, path, NULL);
|
||
|
+
|
||
|
+ g_object_unref (gconf_client);
|
||
|
+ return error_time;
|
||
|
+}
|
||
|
+
|
||
|
+static void
|
||
|
+eni_error_timeout_changed (GtkSpinButton *b, void *data)
|
||
|
+{
|
||
|
+ GConfClient *gconf_client;
|
||
|
+ int value = gtk_spin_button_get_value_as_int (b);
|
||
|
+
|
||
|
+ gconf_client = gconf_client_get_default ();
|
||
|
+
|
||
|
+ gconf_client_set_int (gconf_client, (char *) data, value, NULL);
|
||
|
+ g_object_unref (gconf_client);
|
||
|
+}
|
||
|
+
|
||
|
+static void
|
||
|
+eni_error_level_value_changed (GtkComboBox *w, gpointer *data)
|
||
|
+{
|
||
|
+ GConfClient *gconf_client;
|
||
|
+ int value = gtk_combo_box_get_active (w);
|
||
|
+
|
||
|
+ gconf_client = gconf_client_get_default ();
|
||
|
+
|
||
|
+ gconf_client_set_int (gconf_client, (char *) data, value, NULL);
|
||
|
+
|
||
|
+ g_object_unref (gconf_client);
|
||
|
+}
|
||
|
+
|
||
|
+void
|
||
|
+eni_show_logger(ELogger *logger, GtkWidget *top,const char *error_timeout_path, const char *error_level_path)
|
||
|
+{
|
||
|
+ GtkWidget *container;
|
||
|
+ GtkWidget *label;
|
||
|
+ GtkWidget *toplevel;
|
||
|
+ GtkWidget *vbox;
|
||
|
+ GtkWidget *widget;
|
||
|
+ GtkWidget *window;
|
||
|
+ GtkListStore *store;
|
||
|
+ GtkCellRenderer *renderer;
|
||
|
+ GtkTreeViewColumn *column;
|
||
|
+ int i;
|
||
|
+
|
||
|
+ 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) eni_config_get_error_timeout (error_timeout_path));
|
||
|
+ g_signal_connect (
|
||
|
+ widget, "value-changed",
|
||
|
+ G_CALLBACK (eni_error_timeout_changed),
|
||
|
+ (gpointer) error_timeout_path);
|
||
|
+
|
||
|
+ 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);
|
||
|
+ gtk_combo_box_set_active ((GtkComboBox *) widget, eni_config_get_error_level(error_level_path));
|
||
|
+
|
||
|
+ g_signal_connect (
|
||
|
+ widget, "changed",
|
||
|
+ G_CALLBACK (eni_error_level_value_changed),
|
||
|
+ (gpointer) error_level_path);
|
||
|
+
|
||
|
+ 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) eni_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 (eni_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, eni_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, eni_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);
|
||
|
+}
|
||
|
+
|
||
|
--- /dev/null 2008-10-14 15:16:33.000000000 +0530
|
||
|
+++ e-util/e-non-intrusive-error-dialog.h 2008-11-05 17:01:14.000000000 +0530
|
||
|
@@ -0,0 +1,61 @@
|
||
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||
|
+ *
|
||
|
+ * Authors: Ashish Shrivastava <shashish@novell.com>
|
||
|
+ *
|
||
|
+ *
|
||
|
+ * This program is free software; you can redistribute it and/or modify
|
||
|
+ * it under the terms of the GNU General Public License as published by
|
||
|
+ * the Free Software Foundation; either version 2 of the License, or
|
||
|
+ * (at your option) any later version.
|
||
|
+ *
|
||
|
+ * This program is distributed in the hope that it will be useful,
|
||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
+ * GNU General Public License for more details.
|
||
|
+ *
|
||
|
+ * You should have received a copy of the GNU General Public License
|
||
|
+ * along with this program; if not, write to the Free Software
|
||
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
+ *
|
||
|
+ */
|
||
|
+
|
||
|
+#ifndef __E_ERROR_DIALOG_H__
|
||
|
+#define __E_ERROR_DIALOG_H__
|
||
|
+
|
||
|
+#include <glib-object.h>
|
||
|
+#include "e-error.h"
|
||
|
+#include "e-icon-factory.h"
|
||
|
+#include "e-logger.h"
|
||
|
+#include "e-util/gconf-bridge.h"
|
||
|
+
|
||
|
+G_BEGIN_DECLS
|
||
|
+
|
||
|
+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
|
||
|
+};
|
||
|
+
|
||
|
+/* eni - error non intrusive*/
|
||
|
+guint eni_config_get_error_timeout (const char *path);
|
||
|
+void eni_show_logger (ELogger *logger,
|
||
|
+ GtkWidget *widget,
|
||
|
+ const char *error_timeout_path,
|
||
|
+ const char *error_level_path);
|
||
|
+
|
||
|
+G_END_DECLS
|
||
|
+
|
||
|
+#endif /* __E_ERROR_DIALOG_H__ */
|
||
|
--- calendar/gui/e-calendar-view.c 2008-10-13 14:13:50.000000000 +0530
|
||
|
+++ calendar/gui/e-calendar-view.c 2008-11-06 15:16:04.000000000 +0530
|
||
|
@@ -2411,3 +2411,33 @@ draw_curved_rectangle (cairo_t *cr, doub
|
||
|
}
|
||
|
cairo_close_path (cr);
|
||
|
}
|
||
|
+
|
||
|
+static void
|
||
|
+error_response(GtkWidget *widget, gint response, void *data)
|
||
|
+{
|
||
|
+ 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);
|
||
|
+}
|