[beast/devel: 32/35] BST: bst_status_eprintf: use string_format() which is type-safe and locale-stable
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 32/35] BST: bst_status_eprintf: use string_format() which is type-safe and locale-stable
- Date: Tue, 14 May 2013 19:40:36 +0000 (UTC)
commit 7f99700d5b2c9f77b2ca4834a41a92b718c6f1d3
Author: Tim Janik <timj gnu org>
Date: Tue May 14 21:08:23 2013 +0200
BST: bst_status_eprintf: use string_format() which is type-safe and locale-stable
beast-gtk/bstutils.cc | 16 +++-------------
beast-gtk/bstutils.hh | 6 +++---
2 files changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/beast-gtk/bstutils.cc b/beast-gtk/bstutils.cc
index 17b8898..af7ad9d 100644
--- a/beast-gtk/bstutils.cc
+++ b/beast-gtk/bstutils.cc
@@ -170,22 +170,12 @@ bst_stock_register_icon (const gchar *stock_id,
/* --- beast/bse specific extensions --- */
void
-bst_status_eprintf (BseErrorType error,
- const gchar *message_fmt,
- ...)
+bst_status_set_error (BseErrorType error, const std::string &message)
{
- gchar *buffer;
- va_list args;
-
- va_start (args, message_fmt);
- buffer = g_strdup_vprintf (message_fmt, args);
- va_end (args);
-
if (error)
- gxk_status_set (GXK_STATUS_ERROR, buffer, bse_error_blurb (error));
+ gxk_status_set (GXK_STATUS_ERROR, message.c_str(), bse_error_blurb (error));
else
- gxk_status_set (GXK_STATUS_DONE, buffer, NULL);
- g_free (buffer);
+ gxk_status_set (GXK_STATUS_DONE, message.c_str(), NULL);
}
void
diff --git a/beast-gtk/bstutils.hh b/beast-gtk/bstutils.hh
index 58f74b7..bcc9448 100644
--- a/beast-gtk/bstutils.hh
+++ b/beast-gtk/bstutils.hh
@@ -13,10 +13,10 @@
extern Bse::ServerH bse_server;
G_BEGIN_DECLS
+
/* --- GUI utilities --- */
-void bst_status_eprintf (BseErrorType error,
- const gchar *message_fmt,
- ...) G_GNUC_PRINTF (2, 3);
+void bst_status_set_error (BseErrorType error, const std::string &message);
+#define bst_status_eprintf(error, ...) bst_status_set_error (error, Rapicorn::string_format
(__VA_ARGS__))
void bst_gui_error_bell (gpointer widget);
void bst_window_sync_title_to_proxy (gpointer window,
SfiProxy proxy,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]