evolution r34787 - in trunk: mail widgets/misc
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r34787 - in trunk: mail widgets/misc
- Date: Thu, 10 Jan 2008 09:31:07 +0000 (GMT)
Author: sragavan
Date: Thu Jan 10 09:31:07 2008
New Revision: 34787
URL: http://svn.gnome.org/viewvc/evolution?rev=34787&view=rev
Log:
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):
Modified:
trunk/mail/ChangeLog
trunk/mail/em-folder-utils.c
trunk/mail/em-folder-view.c
trunk/mail/em-utils.c
trunk/mail/em-utils.h
trunk/mail/mail-autofilter.c
trunk/mail/mail-component.c
trunk/mail/mail-mt.c
trunk/mail/mail-session.c
trunk/mail/mail-vfolder.c
trunk/widgets/misc/ChangeLog
trunk/widgets/misc/e-activity-handler.c
trunk/widgets/misc/e-activity-handler.h
trunk/widgets/misc/e-task-widget.c
Modified: trunk/mail/em-folder-utils.c
==============================================================================
--- trunk/mail/em-folder-utils.c (original)
+++ trunk/mail/em-folder-utils.c Thu Jan 10 09:31:07 2008
@@ -290,8 +290,9 @@
}
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 @@
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 @@
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;
}
Modified: trunk/mail/em-folder-view.c
==============================================================================
--- trunk/mail/em-folder-view.c (original)
+++ trunk/mail/em-folder-view.c Thu Jan 10 09:31:07 2008
@@ -1091,8 +1091,10 @@
_("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;
Modified: trunk/mail/em-utils.c
==============================================================================
--- trunk/mail/em-utils.c (original)
+++ trunk/mail/em-utils.c Thu Jan 10 09:31:07 2008
@@ -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 @@
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 @@
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 @@
}
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 @@
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 @@
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);
+}
Modified: trunk/mail/em-utils.h
==============================================================================
--- trunk/mail/em-utils.h (original)
+++ trunk/mail/em-utils.h Thu Jan 10 09:31:07 2008
@@ -102,6 +102,10 @@
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);
Modified: trunk/mail/mail-autofilter.c
==============================================================================
--- trunk/mail/mail-autofilter.c (original)
+++ trunk/mail/mail-autofilter.c Thu Jan 10 09:31:07 2008
@@ -436,9 +436,8 @@
}
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)
Modified: trunk/mail/mail-component.c
==============================================================================
--- trunk/mail/mail-component.c (original)
+++ trunk/mail/mail-component.c Thu Jan 10 09:31:07 2008
@@ -1624,7 +1624,7 @@
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);
Modified: trunk/mail/mail-mt.c
==============================================================================
--- trunk/mail/mail-mt.c (original)
+++ trunk/mail/mail-mt.c Thu Jan 10 09:31:07 2008
@@ -260,8 +260,7 @@
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");
}
Modified: trunk/mail/mail-session.c
==============================================================================
--- trunk/mail/mail-session.c (original)
+++ trunk/mail/mail-session.c Thu Jan 10 09:31:07 2008
@@ -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 @@
"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 @@
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);
}
}
Modified: trunk/mail/mail-vfolder.c
==============================================================================
--- trunk/mail/mail-vfolder.c (original)
+++ trunk/mail/mail-vfolder.c Thu Jan 10 09:31:07 2008
@@ -586,8 +586,7 @@
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 @@
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)
Modified: trunk/widgets/misc/e-activity-handler.c
==============================================================================
--- trunk/widgets/misc/e-activity-handler.c (original)
+++ trunk/widgets/misc/e-activity-handler.c Thu Jan 10 09:31:07 2008
@@ -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 @@
};
+/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
Modified: trunk/widgets/misc/e-activity-handler.h
==============================================================================
--- trunk/widgets/misc/e-activity-handler.h (original)
+++ trunk/widgets/misc/e-activity-handler.h Thu Jan 10 09:31:07 2008
@@ -43,6 +43,9 @@
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_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,
Modified: trunk/widgets/misc/e-task-widget.c
==============================================================================
--- trunk/widgets/misc/e-task-widget.c (original)
+++ trunk/widgets/misc/e-task-widget.c Thu Jan 10 09:31:07 2008
@@ -269,8 +269,8 @@
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]