aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2008-01-10 17:31:07 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2008-01-10 17:31:07 +0800
commit510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40 (patch)
treebd1ab6db455a33645abebb4c306a2999a707f356 /widgets
parente5cef658e433f10644bbccb74d10e4f1db4e4c24 (diff)
downloadgsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar.gz
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar.bz2
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar.lz
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar.xz
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.tar.zst
gsoc2013-evolution-510eb1f01695c5d92df90bb3a2d2fbbc2bec8f40.zip
** Most of the errors are now non-intrusive
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): svn path=/trunk/; revision=34787
Diffstat (limited to 'widgets')
-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
4 files changed, 39 insertions, 12 deletions
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);