[evolution] Add format checker (in compile time) to e_notice()



commit bac4efc7ced9ec16f6cdc30959797d8fe3cffde1
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 17 14:40:59 2012 +0200

    Add format checker (in compile time) to e_notice()

 calendar/gui/itip-utils.c      |    7 ++-----
 e-util/e-dialog-utils.h        |    2 +-
 shell/e-shell-window-actions.c |   11 ++++-------
 3 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 350fb5d..b7b31db 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -1123,11 +1123,8 @@ comp_server_send (ECalComponentItipMethod method,
 					_("Unable to book a resource, the "
 					  "new event collides with some other."));
 			} else {
-				gchar *msg = g_strconcat (
-					_("Unable to book a resource, error: "),
-					error->message, NULL);
-				e_notice (NULL, GTK_MESSAGE_ERROR, msg);
-				g_free (msg);
+				e_notice (NULL, GTK_MESSAGE_ERROR,
+					_("Unable to book a resource, error: %s"), error->message);
 			}
 
 			retval = FALSE;
diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h
index d1e8b90..f4f04b0 100644
--- a/e-util/e-dialog-utils.h
+++ b/e-util/e-dialog-utils.h
@@ -28,6 +28,6 @@
 void		e_notice			(gpointer parent,
 						 GtkMessageType type,
 						 const gchar *format,
-						 ...);
+						 ...) G_GNUC_PRINTF (3, 4);
 
 #endif /* E_DIALOG_UTILS_H */
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 247b381..ece1c24 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1222,13 +1222,10 @@ action_submit_bug_cb (GtkAction *action,
 	g_spawn_command_line_async (command_line, &error);
 
 	if (error != NULL) {
-		const gchar *message;
-
-		if (error->code == G_SPAWN_ERROR_NOENT)
-			message = _("Bug Buddy is not installed.");
-		else
-			message = _("Bug Buddy could not be run.");
-		e_notice (shell_window, GTK_MESSAGE_ERROR, message);
+		e_notice (shell_window, GTK_MESSAGE_ERROR,
+			error->code == G_SPAWN_ERROR_NOENT ?
+			_("Bug Buddy is not installed.") :
+			_("Bug Buddy could not be run."));
 		g_error_free (error);
 	}
 }



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