[evolution] Identify calendar/memo/task sources in error messages



commit 4c699e7e03975639db4a0aa1eddb935e79702248
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 27 13:11:18 2012 +0100

    Identify calendar/memo/task sources in error messages

 calendar/calendar.error.xml             |   54 +++++++++++++++++++-----------
 modules/calendar/e-cal-shell-sidebar.c  |   22 +++++++++++-
 modules/calendar/e-memo-shell-sidebar.c |   22 +++++++++++-
 modules/calendar/e-task-shell-sidebar.c |   22 +++++++++++-
 4 files changed, 94 insertions(+), 26 deletions(-)
---
diff --git a/calendar/calendar.error.xml b/calendar/calendar.error.xml
index 1dc93ee..a99521e 100644
--- a/calendar/calendar.error.xml
+++ b/calendar/calendar.error.xml
@@ -220,22 +220,22 @@
   </error>
 
   <error id="prompt-delete-remote-calendar" type="question" default="GTK_RESPONSE_CANCEL">
-    <_primary>Delete remote calendar &quot;{0}&quot;?</_primary>
-    <_secondary>This will permanently remove the calendar &quot;{0}&quot; from the server.  Are you sure you want to proceed?</_secondary>
+    <_primary>Delete remote calendar '{0}'?</_primary>
+    <_secondary>This will permanently remove the calendar '{0}' from the server. Are you sure you want to proceed?</_secondary>
     <button _label="Do _Not Delete" response="GTK_RESPONSE_CANCEL"/>
     <button _label="_Delete From Server" response="GTK_RESPONSE_YES"/>
   </error>
 
   <error id="prompt-delete-remote-task-list" type="question" default="GTK_RESPONSE_CANCEL">
-    <_primary>Delete remote task list &quot;{0}&quot;?</_primary>
-    <_secondary>This will permanently remove the task list &quot;{0}&quot; from the server.  Are you sure you want to proceed?</_secondary>
+    <_primary>Delete remote task list '{0}'?</_primary>
+    <_secondary>This will permanently remove the task list '{0}' from the server. Are you sure you want to proceed?</_secondary>
     <button _label="Do _Not Delete" response="GTK_RESPONSE_CANCEL"/>
     <button _label="_Delete From Server" response="GTK_RESPONSE_YES"/>
   </error>
 
   <error id="prompt-delete-remote-memo-list" type="question" default="GTK_RESPONSE_CANCEL">
-    <_primary>Delete remote memo list &quot;{0}&quot;?</_primary>
-    <_secondary>This will permanently remove the memo list &quot;{0}&quot; from the server.  Are you sure you want to proceed?</_secondary>
+    <_primary>Delete remote memo list '{0}'?</_primary>
+    <_secondary>This will permanently remove the memo list '{0}' from the server. Are you sure you want to proceed?</_secondary>
     <button _label="Do _Not Delete" response="GTK_RESPONSE_CANCEL"/>
     <button _label="_Delete From Server" response="GTK_RESPONSE_YES"/>
   </error>
@@ -261,62 +261,76 @@
   </error>
 
   <error id="prompt-no-contents-offline-calendar" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading calendar</_primary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading calendar '{0}: {1}'</_primary>
     <_secondary>The calendar is not marked for offline usage.</_secondary>
   </error>
 
   <error id="prompt-read-only-cal" type="error" default="GTK_RESPONSE_YES">
     <_primary>Cannot create a new event</_primary>
-    <!-- For Translators: {0} is the name of the calendar source -->
+    <!-- Translators: {0} is the name of the calendar source -->
     <_secondary>'{0}' is a read-only calendar and cannot be modified. Please select a different calendar from the side bar in the Calendar view.</_secondary>
   </error>
 
   <error id="prompt-read-only-cal-editor" type="error" default="GTK_RESPONSE_YES">
     <_primary>Cannot save event</_primary>
-    <!-- For Translators: {0} is the name of the calendar source -->
+    <!-- Translators: {0} is the name of the calendar source -->
     <_secondary>'{0}' is a read-only calendar and cannot be modified. Please select a different calendar that can accept appointments.</_secondary>
   </error>
 
   <error id="prompt-no-task-assignment-editor" type="error" default="GTK_RESPONSE_YES">
     <_primary>Cannot save task</_primary>
-    <!-- For Translators: {0} is the name of the calendar source -->
+    <!-- Translators: {0} is the name of the calendar source -->
     <_secondary>'{0}' does not support assigned tasks, please select a different task list.</_secondary>
   </error>
 
   <error id="prompt-no-contents-offline-tasks" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading task list</_primary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading task list '{0}: {1}'</_primary>
     <_secondary>The task list is not marked for offline usage.</_secondary>
   </error>
 
   <error id="prompt-no-contents-offline-memos" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading memo list</_primary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading memo list '{0}: {1}'</_primary>
     <_secondary>The memo list is not marked for offline usage.</_secondary>
   </error>
 
   <error id="failed-open-calendar" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading calendar</_primary>
-    <secondary>{0}</secondary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading calendar '{0}: {1}'</_primary>
+    <secondary>{2}</secondary>
   </error>
 
   <error id="failed-open-tasks" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading task list</_primary>
-    <secondary>{0}</secondary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading task list '{0}: {1}'</_primary>
+    <secondary>{2}</secondary>
   </error>
 
   <error id="failed-open-memos" type="error" default="GTK_RESPONSE_YES">
-    <_primary>Error loading memo list</_primary>
-    <secondary>{0}</secondary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Error loading memo list '{0}: {1}'</_primary>
+    <secondary>{2}</secondary>
   </error>
 
   <error id="backend-error" type="error" default="GTK_RESPONSE_YES">
     <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
      {1} is replaced with a calendar/task/memo list name, where the error happened -->
-    <_primary>Error on {0}: {1}</_primary>
+    <_primary>Error on '{0}: {1}'</_primary>
     <secondary>{2}</secondary>
   </error>
 
   <error id="online-operation" type="error">
-    <_primary>Could not perform this operation.</_primary>
+    <!-- Translators: {0} is replaced with a group name, like CalDAV, Google, or such;
+     {1} is replaced with a calendar/task/memo list name, where the error happened -->
+    <_primary>Could not perform this operation on '{0}: {1}'.</_primary>
     <_secondary>You must be working online to complete this operation.</_secondary>
   </error>
 
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index d734b21..809ccb5 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -242,10 +242,11 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 {
 	ECalClient *client = E_CAL_CLIENT (source_object);
 	ECalShellSidebar *cal_shell_sidebar = user_data;
-	ESource *source;
+	ESource *source, *parent;
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
+	ESourceRegistry *registry;
 	GError *error = NULL;
 
 	source = e_client_get_source (E_CLIENT (client));
@@ -279,6 +280,8 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 	shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
+	registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+	parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
 
 	/* Handle errors. */
 	switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) {
@@ -291,13 +294,15 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 
 		case E_CLIENT_ERROR_REPOSITORY_OFFLINE:
 			e_alert_submit (
 				E_ALERT_SINK (shell_content),
 				"calendar:prompt-no-contents-offline-calendar",
-				NULL);
+				e_source_get_display_name (parent),
+				e_source_get_display_name (source), NULL);
 			/* fall through */
 
 		default:
@@ -305,6 +310,8 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 				e_alert_submit (
 					E_ALERT_SINK (shell_content),
 					"calendar:failed-open-calendar",
+					e_source_get_display_name (parent),
+					e_source_get_display_name (source),
 					error->message, NULL);
 			}
 
@@ -312,10 +319,12 @@ cal_shell_sidebar_client_opened_cb (GObject *source_object,
 				cal_shell_sidebar,
 				e_client_get_source (E_CLIENT (client)));
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 	}
 
 	g_clear_error (&error);
+	g_object_unref (parent);
 
 	/* to have them ready for later use */
 	e_client_retrieve_capabilities (
@@ -386,12 +395,21 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object,
 		goto exit;
 
 	} else if (error != NULL) {
+		ESourceRegistry *registry;
+		ESource *parent;
+
+		registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+		parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
+
 		g_warn_if_fail (client == NULL);
 		e_alert_submit (
 			E_ALERT_SINK (shell_content),
 			"calendar:failed-open-calendar",
+			e_source_get_display_name (parent),
+			e_source_get_display_name (source),
 			error->message, NULL);
 		g_error_free (error);
+		g_object_unref (parent);
 		goto exit;
 	}
 
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index f59e0a8..7d46384 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -237,10 +237,11 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 {
 	ECalClient *client = E_CAL_CLIENT (source_object);
 	EMemoShellSidebar *memo_shell_sidebar = user_data;
-	ESource *source;
+	ESource *source, *parent;
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
+	ESourceRegistry *registry;
 	GError *error = NULL;
 
 	source = e_client_get_source (E_CLIENT (client));
@@ -274,6 +275,8 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 	shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
+	registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+	parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
 
 	/* Handle errors. */
 	switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) {
@@ -286,13 +289,15 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 
 		case E_CLIENT_ERROR_REPOSITORY_OFFLINE:
 			e_alert_submit (
 				E_ALERT_SINK (shell_content),
 				"calendar:prompt-no-contents-offline-memos",
-				NULL);
+				e_source_get_display_name (parent),
+				e_source_get_display_name (source), NULL);
 			/* fall through */
 
 		default:
@@ -300,6 +305,8 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 				e_alert_submit (
 					E_ALERT_SINK (shell_content),
 					"calendar:failed-open-memos",
+					e_source_get_display_name (parent),
+					e_source_get_display_name (source),
 					error->message, NULL);
 			}
 
@@ -307,10 +314,12 @@ memo_shell_sidebar_client_opened_cb (GObject *source_object,
 				memo_shell_sidebar,
 				e_client_get_source (E_CLIENT (client)));
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 	}
 
 	g_clear_error (&error);
+	g_object_unref (parent);
 
 	/* to have them ready for later use */
 	e_client_retrieve_capabilities (
@@ -381,12 +390,21 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object,
 		goto exit;
 
 	} else if (error != NULL) {
+		ESourceRegistry *registry;
+		ESource *parent;
+
+		registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+		parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
+
 		g_warn_if_fail (client == NULL);
 		e_alert_submit (
 			E_ALERT_SINK (shell_content),
 			"calendar:failed-open-memos",
+			e_source_get_display_name (parent),
+			e_source_get_display_name (source),
 			error->message, NULL);
 		g_error_free (error);
+		g_object_unref (parent);
 		goto exit;
 	}
 
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 1653fe2..d88d5e7 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -237,10 +237,11 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 {
 	ECalClient *client = E_CAL_CLIENT (source_object);
 	ETaskShellSidebar *task_shell_sidebar = user_data;
-	ESource *source;
+	ESource *source, *parent;
 	EShellView *shell_view;
 	EShellContent *shell_content;
 	EShellSidebar *shell_sidebar;
+	ESourceRegistry *registry;
 	GError *error = NULL;
 
 	source = e_client_get_source (E_CLIENT (client));
@@ -274,6 +275,8 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 	shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_content = e_shell_view_get_shell_content (shell_view);
+	registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+	parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
 
 	/* Handle errors. */
 	switch ((error && error->domain == E_CLIENT_ERROR) ? error->code : -1) {
@@ -286,13 +289,15 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 				G_STRFUNC, e_source_get_display_name (source),
 				error->message);
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 
 		case E_CLIENT_ERROR_REPOSITORY_OFFLINE:
 			e_alert_submit (
 				E_ALERT_SINK (shell_content),
 				"calendar:prompt-no-contents-offline-tasks",
-				NULL);
+				e_source_get_display_name (parent),
+				e_source_get_display_name (source), NULL);
 			/* fall through */
 
 		default:
@@ -300,6 +305,8 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 				e_alert_submit (
 					E_ALERT_SINK (shell_content),
 					"calendar:failed-open-tasks",
+					e_source_get_display_name (parent),
+					e_source_get_display_name (source),
 					error->message, NULL);
 			}
 
@@ -307,10 +314,12 @@ task_shell_sidebar_client_opened_cb (GObject *source_object,
 				task_shell_sidebar,
 				e_client_get_source (E_CLIENT (client)));
 			g_clear_error (&error);
+			g_object_unref (parent);
 			return;
 	}
 
 	g_clear_error (&error);
+	g_object_unref (parent);
 
 	/* to have them ready for later use */
 	e_client_retrieve_capabilities (
@@ -381,12 +390,21 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object,
 		goto exit;
 
 	} else if (error != NULL) {
+		ESourceRegistry *registry;
+		ESource *parent;
+
+		registry = e_shell_get_registry (e_shell_backend_get_shell (e_shell_view_get_shell_backend (shell_view)));
+		parent = e_source_registry_ref_source (registry, e_source_get_parent (source));
+
 		g_warn_if_fail (client == NULL);
 		e_alert_submit (
 			E_ALERT_SINK (shell_content),
 			"calendar:failed-open-tasks",
+			e_source_get_display_name (parent),
+			e_source_get_display_name (source),
 			error->message, NULL);
 		g_error_free (error);
+		g_object_unref (parent);
 		goto exit;
 	}
 



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