/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Michael Meeks <michael@ximian.com>
* Ettore Perazzoli <ettore@ximian.com>
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "e-dialog-utils.h"
/**
* e_notice:
* @parent: the dialog's parent window, or %NULL
* @type: the type of dialog (%GTK_MESSAGE_INFO, %GTK_MESSAGE_WARNING,
* or %GTK_MESSAGE_ERROR)
* @format: printf-style format string, followed by arguments
*
* Convenience function to show a dialog with a message and an "OK"
* button.
**/
void
e_notice (gpointer parent,
GtkMessageType type,
const gchar *format,
...)
{
GtkWidget *dialog;
va_list args;
gchar *str;
va_start (args, format);
str = g_strdup_vprintf (format, args);
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
type,
GTK_BUTTONS_OK,
"%s",
str);
va_end (args);
g_free (str);
if (parent && !gtk_widget_is_toplevel (parent))
parent = gtk_widget_get_toplevel (parent);
if (parent)
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}