[evolution-rss] error messages are way too large



commit bd7300621ad8a0ad7a77103565e456b586fde8c0
Author: Lucian Langa <lucilanga gnome org>
Date:   Wed Aug 17 08:36:11 2011 +0300

    error messages are way too large

 src/notification.c                    |    7 ++++
 src/org-gnome-evolution-rss.error.xml |    2 +-
 src/rss.c                             |   52 ++++++++++++++++-----------------
 3 files changed, 33 insertions(+), 28 deletions(-)
---
diff --git a/src/notification.c b/src/notification.c
index 018cd1a..e22036d 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -84,9 +84,16 @@ rss_error(gpointer key, gchar *name, gchar *error, gchar *emsg)
 		if (!g_hash_table_lookup(rf->error_hash, key)) {
 #if (EVOLUTION_VERSION >= 22900) //kb//
 			shell = e_shell_get_default ();
+#if (EVOLUTION_VERSION >= 30101)
+			gpointer alert = e_alert_new ("org-gnome-evolution-rss:feederr",
+						error, msg, NULL);
+			e_shell_submit_alert (shell, alert);
+			goto out;
+#endif
 			windows = e_shell_get_watched_windows (shell);
 			parent = (windows != NULL) ? GTK_WINDOW (windows->data) : NULL;
 
+
 #if (EVOLUTION_VERSION >= 29102)
 			backend = (EMailBackend *)e_shell_get_backend_by_name (shell, "mail");
 			e_mail_backend_submit_alert (
diff --git a/src/org-gnome-evolution-rss.error.xml b/src/org-gnome-evolution-rss.error.xml
index 37ad336..c6912d3 100644
--- a/src/org-gnome-evolution-rss.error.xml
+++ b/src/org-gnome-evolution-rss.error.xml
@@ -21,7 +21,7 @@
   <error id="feederr" type="error">
 	<primary>{0}</primary>
 	<secondary>{1}</secondary>
-    <button stock="gtk-ok" response="GTK_RESPONSE_OK"/>
+	<button _label="_Dismiss" response="GTK_RESPONSE_OK"/>
   </error>
 
 <error type="question" id="ask-delete-feed" default="GTK_RESPONSE_CANCEL">
diff --git a/src/rss.c b/src/rss.c
index 454cfd8..ddade8d 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -3399,13 +3399,10 @@ generic_finish_feed(rfMessage *msg, gpointer user_data)
 			NET_ERROR_GENERIC,
 			"%s",
 			soup_status_get_phrase(msg->status_code));
-		tmsg = g_strdup_printf("\n%s\n%s",
-			(gchar *)user_data,
-			(gchar *)err->message);
-		rss_error(user_data,
-			NULL,
-			_("Error fetching feed."),
-			tmsg);
+		tmsg = g_strdup_printf(_("Error fetching feed: %s"),
+			(gchar *)user_data);
+		rss_error(user_data, NULL, tmsg,
+			err->message);
 		g_free(tmsg);
 		goto out;
 	}
@@ -3458,13 +3455,16 @@ generic_finish_feed(rfMessage *msg, gpointer user_data)
 	r->cache = xml_parse_sux (response->str, response->len);
 	if (rsserror) {
 		gchar *title = g_strdup_printf(
-				_("Error while parsing feed %s"),
+				_("Error while parsing feed: %s"),
 				(gchar *)user_data);
 		xmlError *err = xmlGetLastError();
 		gchar *tmsg = g_strdup(
 				err ? err->message : _("illegal content type!"));
-		rss_error(user_data,
-			NULL, title, tmsg);
+		/* xmlGetLastError inserts unwanted \n at the end of error message
+ 		 * find a better way to get rid of those
+ 		 */
+		g_strdelimit(tmsg, "\n", ' ');
+		rss_error(user_data, NULL, title, tmsg);
 		g_free(tmsg);
 		g_free(title);
 		goto out;
@@ -3564,13 +3564,12 @@ display_feed_async(gpointer key)
 			&err);		// because we might lose it if
 					// feed gets deleted
 	if (err) {
-		msg = g_strdup_printf("\n%s\n%s",
-				(gchar *)key,
-				err->message);
+		msg = g_strdup_printf(_("Error fetching feed: %s"),
+				(gchar *)key);
 		rss_error(key,
 			NULL,
-			_("Error fetching feed."),
-			msg);
+			msg,
+			err->message);
 			g_free(msg);
 	}
 	return FALSE;
@@ -3603,13 +3602,12 @@ fetch_one_feed(gpointer key, gpointer value, gpointer user_data)
 						// feed gets deleted
 		if (err) {
 			rf->feed_queue--;
-			msg = g_strdup_printf("\n%s\n%s",
-					(gchar *)key,
-					err->message);
+			msg = g_strdup_printf(_("Error fetching feed: %s"),
+					(gchar *)key);
 			rss_error(key,
 				NULL,
-				_("Error fetching feed."),
-				msg);
+				msg,
+				err->message);
 			g_free(msg);
 		}
 		return TRUE;
@@ -3801,9 +3799,9 @@ fetch_comments(gchar *url, gchar *mainurl, EMFormatHTML *stream)
 	comments_session = g_slist_append(comments_session, comm_sess);
 
 	if (err) {
-		gchar *msg = g_strdup_printf("\n%s\n%s",
-				url, err->message);
-		rss_error(url, NULL, _("Error fetching feed."), msg);
+		gchar *msg = g_strdup_printf(_("Error fetching feed: %s"),
+				url);
+		rss_error(url, NULL, msg, err->message);
 		g_free(msg);
 	}
 }
@@ -4404,13 +4402,13 @@ custom_update_articles(CDATA *cdata)
 			&err);                // because we might lose it if
 			if (err) {
 				rf->feed_queue--;
-				msg = g_strdup_printf("\n%s\n%s",
-					(char *)cdata->key, err->message);
+				msg = g_strdup_printf(_("Error fetching feed: %s"),
+					(char *)cdata->key);
 				rss_error(
 					cdata->key,
 					NULL,
-					_("Error fetching feed."),
-					msg);
+					msg,
+					err->message);
 				g_free(msg);
 			}
 		} else if (rf->cancel && !rf->feed_queue) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]