aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorAshish Shrivastava <shashish@novell.com>2008-11-03 20:10:48 +0800
committerAkhil Laddha <lakhil@src.gnome.org>2008-11-03 20:10:48 +0800
commit26fe8fb76ea445c87fd72997f97e7c4950b53bd1 (patch)
tree76ff236dcf412c1e52da7607bbfa3b4d70afd561 /mail
parentc495bcad905e857b01f5d61c160f9897942d3394 (diff)
downloadgsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar.gz
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar.bz2
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar.lz
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar.xz
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.tar.zst
gsoc2013-evolution-26fe8fb76ea445c87fd72997f97e7c4950b53bd1.zip
** Fix for bug #559086
2008-11-03 Ashish Shrivastava <shashish@novell.com> ** Fix for bug #559086 * Most of the calendar errors are now non-intrusive * calendar.error.xml: Added a new error message for non-intrusive backend_died. * apps_evolution_calendar.schemas.in: * calendar-commands.c: Added new verb for help debug message (help_debug): * gnome-cal.c: Support for non-intrusive error. (client_cal_opened_cb), Define fash table and accessing errors: * e-calendar-view.c: (error_response): (e_calendar_utils_show_error_silent), (e_calendar_utils_show_info_silent): * e-calendar-view.h: * calendar-component.c: Added EActivityHandler and ELogger: (calendar_component_peek_activity_handler), (calendar_component_show_logger): * calendar-component.h: svn path=/trunk/; revision=36727
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-component.c250
2 files changed, 15 insertions, 243 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index d9af440011..76ed190ad0 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -351,6 +351,14 @@ License Changes
* em-format-html-display.c: (efhd_image): Do not try to access widget
of the pury when the operation has been cancelled.
+2008-11-03 Ashish Shrivastava <shashish@novell.com>
+
+ ** Support for Non-intrusive error in calendar.
+
+ * mail-component.c: Remove common code between
+ mailer and calendar and moved to
+ e-util/e-non-intrusive-error-dialog.c
+
2008-09-08 Milan Crha <mcrha@redhat.com>
** Fix for bug #328216
diff --git a/mail/mail-component.c b/mail/mail-component.c
index ba39c9f273..b16cbca936 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -90,6 +90,11 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
+#include "e-util/e-non-intrusive-error-dialog.h"
+
+#define MAILER_ERROR_LEVEL_KEY "/apps/evolution/mail/display/error_level"
+#define MAILER_ERROR_TIME_OUT_KEY "/apps/evolution/mail/display/error_timeout"
+
#define d(x)
static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data);
@@ -1585,254 +1590,13 @@ mail_indicate_new_mail (gboolean have_new_mail)
e_component_view_set_button_icon (mc->priv->component_view, icon);
}
-struct _log_data {
- int level;
- char *key;
- char *text;
- char *stock_id;
- GdkPixbuf *pbuf;
-} ldata [] = {
- { E_LOG_ERROR, N_("Error"), N_("Errors"), GTK_STOCK_DIALOG_ERROR },
- { E_LOG_WARNINGS, N_("Warning"), N_("Warnings and Errors"), GTK_STOCK_DIALOG_WARNING },
- { E_LOG_DEBUG, N_("Debug"), N_("Error, Warnings and Debug messages"), GTK_STOCK_DIALOG_INFO }
-};
-
-enum
-{
- COL_LEVEL = 0,
- COL_TIME,
- COL_DATA
-};
-
-static gboolean
-query_tooltip_cb (GtkTreeView *view,
- gint x,
- gint y,
- gboolean keyboard_mode,
- GtkTooltip *tooltip)
-{
- GtkTreeViewColumn *column;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
- gint level;
-
- if (!gtk_tree_view_get_tooltip_context (
- view, &x, &y, keyboard_mode, NULL, &path, &iter))
- return FALSE;
-
- /* Figure out which column we're pointing at. */
- if (keyboard_mode)
- gtk_tree_view_get_cursor (view, NULL, &column);
- else
- gtk_tree_view_get_path_at_pos (
- view, x, y, NULL, &column, NULL, NULL);
-
- /* Restrict the tip area to a single cell. */
- gtk_tree_view_set_tooltip_cell (view, tooltip, path, column, NULL);
-
- /* This only works if the tree view is NOT reorderable. */
- if (column != gtk_tree_view_get_column (view, 0))
- return FALSE;
-
- model = gtk_tree_view_get_model (view);
- gtk_tree_model_get (model, &iter, COL_LEVEL, &level, -1);
- gtk_tooltip_set_text (tooltip, ldata[level].key);
-
- return TRUE;
-}
-
-static void
-render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
- GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
-{
- gint level;
-
- gtk_tree_model_get (model, iter, COL_LEVEL, &level, -1);
- g_object_set (
- renderer, "stock-id", ldata[level].stock_id,
- "stock-size", GTK_ICON_SIZE_MENU, NULL);
-}
-
-static void
-render_date (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
- GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
-{
- time_t t;
- char sdt[100]; /* Should be sufficient? */
-
- gtk_tree_model_get (model, iter, COL_TIME, &t, -1);
- strftime (sdt, 100, "%x %X", localtime (&t));
- g_object_set (renderer, "text", sdt, NULL);
-}
-
-
-
-static void
-append_logs (const char *txt, GtkListStore *store)
-{
- char **str;
-
- str = g_strsplit (txt, ":", 3);
- if (str[0] && str[1] && str[2]) {
- GtkTreeIter iter;
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (
- store, &iter,
- COL_LEVEL, atoi (str[0]),
- COL_TIME, atol (str[1]),
- COL_DATA, g_strstrip (str[2]),
- -1);
- } else
- g_printerr ("Unable to decode error log: %s\n", txt);
-
- g_strfreev (str);
-}
-
-static void
-spin_value_changed (GtkSpinButton *b, gpointer data)
-{
- int value = gtk_spin_button_get_value_as_int (b);
- GConfClient *client = mail_config_get_gconf_client ();
-
- gconf_client_set_int (client, "/apps/evolution/mail/display/error_timeout", value, NULL);
-}
-
void
mail_component_show_logger (gpointer top)
{
MailComponent *mc = mail_component_peek ();
- GConfBridge *bridge;
- GtkWidget *container;
- GtkWidget *label;
- GtkWidget *toplevel;
- GtkWidget *vbox;
- GtkWidget *widget;
- GtkWidget *window;
ELogger *logger = mc->priv->logger;
- int i;
- GtkListStore *store;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
-
- bridge = gconf_bridge_get ();
- toplevel = gtk_widget_get_toplevel (top);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 500, 400);
- gtk_window_set_title (GTK_WINDOW (window), _("Debug Logs"));
- gtk_window_set_transient_for (
- GTK_WINDOW (window), GTK_WINDOW (toplevel));
- gtk_container_set_border_width (GTK_CONTAINER (window), 12);
-
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- container = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0);
-
- /* Translators: This is the first part of the sentence
- * "Show _errors in the status bar for" - XXX - "second(s)." */
- widget = gtk_label_new_with_mnemonic (
- _("Show _errors in the status bar for"));
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- label = widget;
-
- widget = gtk_spin_button_new_with_range (1.0, 60.0, 1.0);
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (widget),
- (gdouble) mail_config_get_error_timeout ());
- g_signal_connect (
- widget, "value-changed",
- G_CALLBACK (spin_value_changed), NULL);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
- /* Translators: This is the second part of the sentence
- * "Show _errors in the status bar for" - XXX - "second(s)." */
- widget = gtk_label_new_with_mnemonic (_("second(s)."));
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
- container = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0);
-
- widget = gtk_label_new_with_mnemonic (_("Log Messages:"));
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- label = widget;
-
- widget = gtk_combo_box_new_text ();
- for (i = E_LOG_ERROR; i <= E_LOG_DEBUG; i++)
- gtk_combo_box_append_text (
- GTK_COMBO_BOX (widget), ldata[i].text);
- gconf_bridge_bind_property (
- bridge, "/apps/evolution/mail/display/error_level",
- G_OBJECT (widget), "active");
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
- store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_LONG, G_TYPE_STRING);
- e_logger_get_logs (logger, (ELogFunction) append_logs, store);
- gtk_tree_sortable_set_sort_column_id (
- GTK_TREE_SORTABLE (store), COL_TIME, GTK_SORT_DESCENDING);
-
- container = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (
- GTK_SCROLLED_WINDOW (container),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (container), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), container, TRUE, TRUE, 0);
-
- widget = gtk_tree_view_new();
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (widget), TRUE);
- gtk_tree_view_set_reorderable (GTK_TREE_VIEW (widget), FALSE);
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (store));
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (widget), COL_DATA);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), TRUE);
- gtk_widget_set_has_tooltip (widget, TRUE);
- gtk_container_add (GTK_CONTAINER (container), widget);
-
- g_signal_connect (
- widget, "query-tooltip",
- G_CALLBACK (query_tooltip_cb), NULL);
-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_title (column, _("Log Level"));
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column, renderer, TRUE);
- gtk_tree_view_column_set_cell_data_func (
- column, renderer, render_pixbuf, NULL, NULL);
-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_title (column, _("Time"));
- gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_set_cell_data_func (
- column, renderer, render_date, NULL, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes(
- GTK_TREE_VIEW (widget), -1, _("Messages"),
- renderer, "markup", COL_DATA, NULL);
-
- container = gtk_hbutton_box_new ();
- gtk_button_box_set_layout (
- GTK_BUTTON_BOX (container), GTK_BUTTONBOX_END);
- gtk_box_pack_start (GTK_BOX (vbox), container, FALSE, FALSE, 0);
-
- widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- gtk_widget_set_tooltip_text (widget, _("Close this window"));
- g_signal_connect_swapped (
- widget, "clicked",
- G_CALLBACK (gtk_widget_destroy), window);
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-
- gtk_widget_show_all (window);
+
+ eni_show_logger(logger, top, MAILER_ERROR_TIME_OUT_KEY, MAILER_ERROR_LEVEL_KEY);
}
BONOBO_TYPE_FUNC_FULL (MailComponent, GNOME_Evolution_MailComponent, PARENT_TYPE, mail_component)