aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog18
-rw-r--r--mail/em-folder-utils.c9
-rw-r--r--mail/em-folder-view.c6
-rw-r--r--mail/em-utils.c38
-rw-r--r--mail/em-utils.h4
-rw-r--r--mail/mail-autofilter.c3
-rw-r--r--mail/mail-component.c2
-rw-r--r--mail/mail-mt.c3
-rw-r--r--mail/mail-session.c7
-rw-r--r--mail/mail-vfolder.c7
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-activity-handler.c34
-rw-r--r--widgets/misc/e-activity-handler.h5
-rw-r--r--widgets/misc/e-task-widget.c2
14 files changed, 117 insertions, 31 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 89f075fe98..3315c1b57c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,21 @@
+2008-01-10 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Most of the errors are now non-intrusive
+
+ * em-folder-utils.c: (emfu_copy_folder_selected),
+ (emfu_delete_response), (em_folder_utils_delete_folder):
+ * em-folder-view.c: (emfv_delete_msg_response):
+ * em-utils.c: (em_utils_edit_filters),
+ (em_utils_save_part_to_file), (em_utils_temp_save_part),
+ (error_response), (em_utils_show_error_silent),
+ (em_utils_show_info_silent):
+ * em-utils.h:
+ * mail-autofilter.c: (mail_filter_delete_uri):
+ * mail-component.c: (mail_component_show_logger):
+ * mail-mt.c: (mail_msg_free):
+ * mail-session.c: (do_user_message):
+ * mail-vfolder.c: (mail_vfolder_delete_uri), (vfolder_edit_rule):
+
2008-01-10 Sankar P <psankar@novell.com>
* em-format-html.c: (efh_format_headers):
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index e32efee827..e66213f9d6 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -290,8 +290,9 @@ emfu_copy_folder_selected (const char *uri, void *data)
}
if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) {
- e_error_run(NULL,
+ GtkWidget *w = e_error_new (NULL,
"mail:no-rename-special-folder", cfd->fi->full_name, NULL);
+ em_utils_show_error_silent (w);
goto fail;
}
@@ -438,8 +439,9 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data)
camel_exception_init (&ex);
emfu_delete_folders (store, full_name, &ex);
if (camel_exception_is_set (&ex)) {
- e_error_run(NULL,
+ GtkWidget *w = e_error_new(NULL,
"mail:no-delete-folder", full_name, ex.desc, NULL);
+ em_utils_show_error_silent (w);
camel_exception_clear (&ex);
}
}
@@ -457,7 +459,8 @@ em_folder_utils_delete_folder (CamelFolder *folder)
local = mail_component_peek_local_store (NULL);
if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) {
- e_error_run(NULL, "mail:no-delete-special-folder", folder->full_name, NULL);
+ dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL);
+ em_utils_show_error_silent (dialog);
return;
}
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 914f335063..97b7359402 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1091,8 +1091,10 @@ emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data)
_("Mail Deletion Failed"),
_("You do not have sufficient permissions to delete this mail."));
gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK);
- } else
- e_error_run (NULL, "mail:no-delete-permission", "", "");
+ } else {
+ GtkWidget *w = e_error_new (NULL, "mail:no-delete-permission", "", "");
+ em_utils_show_error_silent (w);
+ }
count = -1;
break;
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 552f7cc609..1e41708afa 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -79,6 +79,7 @@
#include "em-format-quote.h"
#include "em-account-editor.h"
#include "e-attachment.h"
+#include "e-activity-handler.h"
static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data);
@@ -299,7 +300,8 @@ em_utils_edit_filters (GtkWidget *parent)
g_free (system);
if (((RuleContext *) fc)->error) {
- e_error_run((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL);
+ GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL);
+ em_utils_show_error_silent (w);
return;
}
@@ -564,8 +566,9 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
dirname = g_path_get_dirname(filename);
if (g_mkdir_with_parents(dirname, 0777) == -1) {
- e_error_run((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL);
+ GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL);
g_free(dirname);
+ em_utils_show_error_silent (w);
return FALSE;
}
g_free(dirname);
@@ -578,7 +581,8 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
}
if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) {
- e_error_run((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL);
+ GtkWidget *w = e_error_new((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL);
+ em_utils_show_error_silent (w);
return FALSE;
}
@@ -1275,10 +1279,12 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode)
const char *filename;
char *tmpdir, *path, *utf8_mfilename = NULL, *mfilename = NULL;
int done;
+ GtkWidget *w;
tmpdir = e_mkdtemp("evolution-tmp-XXXXXX");
if (tmpdir == NULL) {
- e_error_run((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL);
+ w = e_error_new((GtkWindow *)parent, "mail:no-create-tmp-path", g_strerror(errno), NULL);
+ em_utils_show_error_silent (w);
return NULL;
}
@@ -2214,3 +2220,27 @@ em_utils_clear_get_password_canceled_accounts_flag (void)
g_object_unref (iter);
}
}
+
+
+static void error_response(GtkObject *o, int button, void *data)
+{
+ gtk_widget_destroy((GtkWidget *)o);
+}
+
+void
+em_utils_show_error_silent (GtkWidget *widget)
+{
+ EActivityHandler *handler = mail_component_peek_activity_handler (mail_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, "mail", E_LOG_ERROR, widget);
+}
+
+void
+em_utils_show_info_silent (GtkWidget *widget)
+{
+ EActivityHandler *handler = mail_component_peek_activity_handler (mail_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, "mail", E_LOG_WARNINGS, widget);
+}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 7e627c414c..587e2c18b7 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -102,6 +102,10 @@ char *em_utils_folder_name_from_uri (const char *uri);
char *em_uri_from_camel (const char *curi);
char *em_uri_to_camel (const char *euri);
+/* Run errors silently on the status bar */
+void em_utils_show_error_silent (struct _GtkWidget *widget);
+void em_utils_show_info_silent (struct _GtkWidget *widget);
+
/* is this address in the addressbook? caches results */
gboolean em_utils_in_addressbook(struct _CamelInternetAddress *addr);
struct _CamelMimePart *em_utils_contact_photo (struct _CamelInternetAddress *addr, gboolean local);
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 675dbcc9bc..9fa59622da 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -436,9 +436,8 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
}
dialog = e_error_new(NULL, "mail:filter-updated", s->str, euri, NULL);
- g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
g_string_free(s, TRUE);
- gtk_widget_show(dialog);
+ em_utils_show_info_silent (dialog);
d(printf("Folder delete/rename '%s' changed filters, resaving\n", euri));
if (rule_context_save ((RuleContext *) fc, user) == -1)
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 036ad0a667..f1aec270cf 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -1624,7 +1624,7 @@ mail_component_show_logger (gpointer top)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_transient_for ((GtkWindow *) window, (GtkWindow *) gtk_widget_get_toplevel ((GtkWidget *) top));
gtk_container_set_border_width ((GtkContainer *) window, 6);
-
+ gtk_window_set_default_size ((GtkWindow *)window, 500, 400);
gtk_window_set_title ((GtkWindow *) window, _("Debug Logs"));
vbox = gtk_vbox_new (FALSE, 6);
hbox = gtk_hbox_new (FALSE, 6);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 77ae1bfa54..141abad095 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -260,8 +260,7 @@ mail_msg_unref (gpointer msg)
activity_id = mail_msg->priv->activity_id;
error = mail_msg->priv->error;
if (error && !activity_id) {
- e_activity_handler_make_error (mail_component_peek_activity_handler (mail_component_peek ()), "mail",
- g_object_get_data ((GObject *) error, "primary"), error);
+ e_activity_handler_make_error (mail_component_peek_activity_handler (mail_component_peek ()), "mail", E_LOG_ERROR, error);
printf("Making error\n");
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 6dd7d5a8cd..010b758146 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -47,6 +47,7 @@
#include "em-filter-context.h"
#include "em-filter-rule.h"
+#include "em-utils.h"
#include "mail-component.h"
#include "mail-config.h"
#include "mail-mt.h"
@@ -331,7 +332,8 @@ user_message_exec (struct _user_message_msg *m)
"mail:session-message-error";
break;
default:
- g_assert_not_reached ();
+ error_type = NULL;
+ g_return_if_reached ();
}
user_message_dialog = e_error_new (NULL, error_type, m->prompt, NULL);
@@ -345,10 +347,11 @@ user_message_exec (struct _user_message_msg *m)
gint response = gtk_dialog_run (user_message_dialog);
user_message_response (user_message_dialog, response, m);
} else {
+ g_object_set_data ((GObject *) user_message_dialog, "response-handled", GINT_TO_POINTER(TRUE));
g_signal_connect (
user_message_dialog, "response",
G_CALLBACK (user_message_response), m);
- gtk_widget_show (user_message_dialog);
+ em_utils_show_error_silent (user_message_dialog);
}
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 6a959a2280..c240826b68 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -586,8 +586,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
char *user;
dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL);
- g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
- gtk_widget_show (dialog);
+ em_utils_show_info_silent (dialog);
user = g_strdup_printf ("%s/mail/vfolders.xml",
mail_component_peek_base_directory (mail_component_peek ()));
@@ -1061,8 +1060,10 @@ vfolder_edit_rule(const char *uri)
g_signal_connect(gd, "response", G_CALLBACK(edit_rule_response), NULL);
gtk_widget_show((GtkWidget *)gd);
} else {
+ GtkWidget *w;
/* TODO: we should probably just create it ... */
- e_error_run(NULL, "mail:vfolder-notexist", uri, NULL);
+ w = e_error_new(NULL, "mail:vfolder-notexist", uri, NULL);
+ em_utils_show_error_silent (w);
}
if (url)
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index e40195bdeb..5aa92bc051 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-10 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Add better support to show info/errors
+
+ * e-activity-handler.c: (setup_task_bar), (cancel_wrapper),
+ (handle_error), (error_cleanup), (e_activity_handler_make_error),
+ (e_activity_handler_operation_set_error):
+ * e-activity-handler.h:
+ * e-task-widget.c: (e_task_widget_update_image):
+
2008-01-07 Milan Crha <mcrha@redhat.com>
** Fix for bug #339813
diff --git a/widgets/misc/e-activity-handler.c b/widgets/misc/e-activity-handler.c
index 305d2cc5f3..08eecebc26 100644
--- a/widgets/misc/e-activity-handler.c
+++ b/widgets/misc/e-activity-handler.c
@@ -40,6 +40,7 @@
struct _ActivityInfo {
char *component_id;
GdkPixbuf *icon_pixbuf;
+ int error_type;
guint id;
char *information;
gboolean cancellable;
@@ -62,6 +63,9 @@ struct _EActivityHandlerPrivate {
};
+/* In the status bar, we show only errors and info. Errors are pictured as warnings. */
+const char *icon_data [] = {"stock_dialog-warning", "stock_dialog-info"};
+
G_DEFINE_TYPE (EActivityHandler, e_activity_handler, G_TYPE_OBJECT)
/* Utility functions. */
@@ -202,12 +206,15 @@ setup_task_bar (EActivityHandler *activity_handler,
if (info->error) {
/* Prepare to handle existing errors*/
GtkWidget *tool;
+ const char *stock;
- tool = e_task_widget_update_image (task_widget, "stock_dialog-warning", g_object_get_data (info->error, "error"));
+ stock = info->error_type ? icon_data [1] : icon_data[0];
+ tool = e_task_widget_update_image (task_widget, (char *)stock, info->information);
g_object_set_data ((GObject *) task_widget, "tool", tool);
g_object_set_data ((GObject *) task_widget, "error", info->error);
g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(info->id));
+ g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(info->error_type));
g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
}
}
@@ -380,7 +387,6 @@ cancel_wrapper (gpointer pdata)
e_logger_log (handler->priv->logger, E_LOG_ERROR, g_object_get_data (data->info->error, "primary"),
g_object_get_data (data->info->error, "secondary"));
gtk_widget_destroy (data->info->error);
- printf("%p %p %d\n", data->info->error, data->info, data->info->id);
data->info->error = NULL;
for (sp = handler->priv->task_bars; sp != NULL; sp = sp->next) {
ETaskBar *task_bar;
@@ -481,14 +487,15 @@ handle_error (ETaskWidget *task)
GtkWidget *tool, *error;
EActivityHandler *activity_handler;
guint id;
-
+ int error_type = GPOINTER_TO_INT((g_object_get_data ((GObject *) task, "error-type")));
tool = g_object_get_data ((GObject *) task, "tool");
error = g_object_get_data ((GObject *) task, "error");
activity_handler = g_object_get_data ((GObject *) task, "activity-handler");
id = GPOINTER_TO_UINT (g_object_get_data ((GObject *) task, "activity"));
e_activity_handler_operation_finished (activity_handler, id);
gtk_widget_show (error);
- e_logger_log (activity_handler->priv->logger, E_LOG_ERROR, g_object_get_data ((GObject *) error, "primary"),
+ e_logger_log (activity_handler->priv->logger, error_type,
+ g_object_get_data ((GObject *) error, "primary"),
g_object_get_data ((GObject *) error, "secondary"));
}
@@ -510,7 +517,7 @@ error_cleanup (EActivityHandler *activity_handler)
berror = TRUE;
if (info->error && info->error_time && (now - info->error_time) > 5 ) {
/* Error older than wanted time. So cleanup */
- e_logger_log (priv->logger, E_LOG_ERROR, g_object_get_data (info->error, "primary"),
+ e_logger_log (priv->logger, info->error_type, g_object_get_data (info->error, "primary"),
g_object_get_data (info->error, "secondary"));
gtk_widget_destroy (info->error);
node = p;
@@ -536,22 +543,25 @@ error_cleanup (EActivityHandler *activity_handler)
guint
e_activity_handler_make_error (EActivityHandler *activity_handler,
const char *component_id,
- const char *information,
+ int error_type,
GtkWidget *error)
{
EActivityHandlerPrivate *priv;
ActivityInfo *activity_info;
unsigned int activity_id;
GSList *p;
-
+ char *information = g_object_get_data((GObject *) error, "primary");
priv = activity_handler->priv;
+ const char *img;
activity_id = get_new_activity_id (activity_handler);
activity_info = activity_info_new (component_id, activity_id, NULL, information, TRUE);
activity_info->error = error;
activity_info->error_time = time (NULL);
-
+ activity_info->error_type = error_type;
+
+ img = error_type ? icon_data[1] : icon_data[0];
for (p = priv->task_bars; p != NULL; p = p->next) {
ETaskBar *task_bar;
ETaskWidget *task_widget;
@@ -562,11 +572,12 @@ e_activity_handler_make_error (EActivityHandler *activity_handler,
task_widget->id = activity_id;
e_task_bar_prepend_task (E_TASK_BAR (p->data), task_widget);
- tool = e_task_widget_update_image (task_widget, "stock_dialog-warning", g_object_get_data ((GObject *) error, "primary"));
+ tool = e_task_widget_update_image (task_widget, (char *)img, information);
g_object_set_data ((GObject *) task_widget, "tool", tool);
g_object_set_data ((GObject *) task_widget, "error", error);
g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(activity_id));
+ g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(error_type));
g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
}
@@ -598,6 +609,8 @@ e_activity_handler_operation_set_error(EActivityHandler *activity_handler,
activity_info = (ActivityInfo *) p->data;
activity_info->error = error;
activity_info->error_time = time (NULL);
+ activity_info->error_type = E_LOG_ERROR;
+ activity_info->information = g_strdup (g_object_get_data ((GObject *) error, "primary"));
for (sp = priv->task_bars; sp != NULL; sp = sp->next) {
ETaskBar *task_bar;
ETaskWidget *task_widget;
@@ -608,11 +621,12 @@ e_activity_handler_operation_set_error(EActivityHandler *activity_handler,
if (!task_widget)
continue;
- tool = e_task_widget_update_image (task_widget, "stock_dialog-warning", g_object_get_data ((GObject *) error, "primary"));
+ tool = e_task_widget_update_image (task_widget, (char *)icon_data[0], g_object_get_data ((GObject *) error, "primary"));
g_object_set_data ((GObject *) task_widget, "tool", tool);
g_object_set_data ((GObject *) task_widget, "error", error);
g_object_set_data ((GObject *) task_widget, "activity-handler", activity_handler);
g_object_set_data ((GObject *) task_widget, "activity", GINT_TO_POINTER(activity_id));
+ g_object_set_data ((GObject *) task_widget, "error-type", GINT_TO_POINTER(E_LOG_ERROR));
g_signal_connect_swapped (tool, "clicked", G_CALLBACK(handle_error), task_widget);
}
diff --git a/widgets/misc/e-activity-handler.h b/widgets/misc/e-activity-handler.h
index 619359bf28..98ba6c38da 100644
--- a/widgets/misc/e-activity-handler.h
+++ b/widgets/misc/e-activity-handler.h
@@ -43,6 +43,9 @@ typedef struct _EActivityHandler EActivityHandler;
typedef struct _EActivityHandlerPrivate EActivityHandlerPrivate;
typedef struct _EActivityHandlerClass EActivityHandlerClass;
+#define EAH_ICON_INFO "stock_dialog-info"
+#define EAH_ICON_ERROR "stock_dialog-warning"
+
struct _EActivityHandler {
GObject parent;
@@ -90,7 +93,7 @@ void e_activity_handler_operation_finished (EActivityHandler *activity_handler
void e_activity_handler_set_logger (EActivityHandler *handler, ELogger *logger);
guint e_activity_handler_make_error (EActivityHandler *activity_handler,
const char *component_id,
- const char *information,
+ int error_type,
GtkWidget *error);
void
e_activity_handler_operation_set_error (EActivityHandler *activity_handler,
diff --git a/widgets/misc/e-task-widget.c b/widgets/misc/e-task-widget.c
index f440548796..7b06e9a464 100644
--- a/widgets/misc/e-task-widget.c
+++ b/widgets/misc/e-task-widget.c
@@ -269,8 +269,8 @@ e_task_widget_update_image (ETaskWidget *task_widget,
img = e_icon_factory_get_image (stock, E_ICON_SIZE_MENU);
tool = (GtkWidget *) gtk_tool_button_new (img, NULL);
gtk_box_pack_start (GTK_BOX(task_widget->priv->box), tool, FALSE, TRUE, 0);
- gtk_widget_destroy (task_widget->priv->image);
gtk_widget_show_all (task_widget->priv->box);
+ gtk_widget_hide (task_widget->priv->image);
task_widget->priv->image = img;
gtk_label_set_text (GTK_LABEL (task_widget->priv->label), text);