[perl-Gtk2] Accept format strings in Gtk2::MessageDialog->format_secondary_markup



commit 9455a67598262d1cfd0f4d2a37df035bf90692c8
Author: Quentin Sculo <squentin free fr>
Date:   Fri Dec 4 16:49:06 2009 +0100

    Accept format strings in Gtk2::MessageDialog->format_secondary_markup

 t/GtkMessageDialog.t   |    1 +
 xs/GtkMessageDialog.xs |   14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/t/GtkMessageDialog.t b/t/GtkMessageDialog.t
index d331330..77f8da4 100644
--- a/t/GtkMessageDialog.t
+++ b/t/GtkMessageDialog.t
@@ -54,6 +54,7 @@ SKIP: {
   $dialog -> format_secondary_text("Bla, 23");
   $dialog -> format_secondary_text(undef);
 
+  $dialog -> format_secondary_markup("<span>%s, %d</span>", "Bla", 23);
   $dialog -> format_secondary_markup("<span>Bla, 23</span>");
   $dialog -> format_secondary_markup(undef);
 }
diff --git a/xs/GtkMessageDialog.xs b/xs/GtkMessageDialog.xs
index 2c47b2c..03851a4 100644
--- a/xs/GtkMessageDialog.xs
+++ b/xs/GtkMessageDialog.xs
@@ -169,11 +169,17 @@ gtk_message_dialog_format_secondary_text (message_dialog, message_format, ...)
 		gtk_message_dialog_format_secondary_text (message_dialog, NULL);
 
 void
-gtk_message_dialog_format_secondary_markup (message_dialog, message)
+gtk_message_dialog_format_secondary_markup (message_dialog, message_format, ...)
 	GtkMessageDialog *message_dialog
-	const gchar_ornull *message
-    C_ARGS:
-	message_dialog, message
+	SV * message_format
+    CODE:
+	if (gperl_sv_is_defined (message_format))
+		gtk_message_dialog_format_secondary_markup (
+		  message_dialog,
+		  "%s",
+		  format_message (message_format, &(ST (2)), items - 2));
+	else
+		gtk_message_dialog_format_secondary_markup (message_dialog, NULL);
 
 #endif
 



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