Add ag_app_message_dialog() to create multi-purpose message dialogs

This commit is contained in:
Gergely Polonkai 2014-07-04 22:31:59 +02:00
parent d6fdffb01e
commit 165cf260c9
2 changed files with 17 additions and 0 deletions

View File

@ -342,3 +342,19 @@ ag_app_class_init(AgAppClass *klass)
application_class->open = ag_app_open; application_class->open = ag_app_open;
} }
void
ag_app_message_dialog(GtkWidget *window, GtkMessageType message_type, gchar *fmt, ...)
{
gchar *msg;
va_list args;
GtkWidget *dialog;
va_start(args, fmt);
msg = g_strdup_vprintf(fmt, args);
va_end(args);
dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, message_type, GTK_BUTTONS_OK, "%s", msg);
g_free(msg);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}

View File

@ -37,6 +37,7 @@ void ag_app_raise(AgApp *self);
void ag_app_run_action(AgApp *app, void ag_app_run_action(AgApp *app,
gboolean is_remote, gboolean is_remote,
const AstrognomeOptions *options); const AstrognomeOptions *options);
void ag_app_message_dialog(GtkWidget *window, GtkMessageType message_type, gchar *fmt, ...);
G_END_DECLS G_END_DECLS