aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2008-09-14 23:11:01 +0800
committerSuman Manjunath <msuman@src.gnome.org>2008-09-14 23:11:01 +0800
commit8f5784a308d8c3f3593ec88387122fa268caaf48 (patch)
tree5a8ea6ae1b3bec8d0a2311dd773df31067583029
parentfb544a663e361d958157fc58efdd4b25e30f2cf8 (diff)
downloadgsoc2013-evolution-8f5784a308d8c3f3593ec88387122fa268caaf48.tar.gz
gsoc2013-evolution-8f5784a308d8c3f3593ec88387122fa268caaf48.tar.zst
gsoc2013-evolution-8f5784a308d8c3f3593ec88387122fa268caaf48.zip
Milan Crha <mcrha@redhat.com> Fix for bug #551915 (Manage error on idle, to call gtk functions in the main thread).
svn path=/trunk/; revision=36326
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-junk-hook.c42
2 files changed, 46 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 403a3d0fa0..6d86658947 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-14 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #551915
+
+ * em-junk-hook.c: (struct manage_error_idle_data), (free_mei),
+ (manage_error_idle), (manage_error):
+ Manage error on idle, to call gtk functions in the main thread.
+
2008-09-12 Sankar P <psankar@novell.com>
License Changes
diff --git a/mail/em-junk-hook.c b/mail/em-junk-hook.c
index 62a05fd4ff..c4ea8b16f3 100644
--- a/mail/em-junk-hook.c
+++ b/mail/em-junk-hook.c
@@ -300,18 +300,52 @@ emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
return 0;
}
+struct manage_error_idle_data
+{
+ const char *msg;
+ GError *error;
+};
+
static void
-manage_error (const char *msg, GError *error)
+free_mei (gpointer data)
+{
+ struct manage_error_idle_data *mei = (struct manage_error_idle_data*) data;
+
+ if (!mei)
+ return;
+
+ g_error_free (mei->error);
+ g_free (mei);
+}
+
+static gboolean
+manage_error_idle (gpointer data)
{
GtkWidget *w;
+ struct manage_error_idle_data *mei = (struct manage_error_idle_data *) data;
+
+ if (!mei)
+ return FALSE;
+
+ w = e_error_new (NULL, mei->msg, mei->error->message, NULL);
+ em_utils_show_error_silent (w);
+
+ return FALSE;
+}
+
+static void
+manage_error (const char *msg, GError *error)
+{
+ struct manage_error_idle_data *mei;
if (!error)
return;
- w = e_error_new (NULL, msg, error->message, NULL);
- em_utils_show_error_silent (w);
+ mei = g_new0 (struct manage_error_idle_data, 1);
+ mei->msg = msg; /* it's a static string, should be safe to use it as this */
+ mei->error = error;
- g_error_free (error);
+ g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, manage_error_idle, mei, free_mei);
}
/*XXX: don't think we need here*/