From 0ac49c9334cc8078430999fe6de49e42fa664408 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 2 Dec 2002 04:32:10 +0000 Subject: Add include of gnome-dialog.h 2002-11-27 Not Zed * e-charset-picker.c: Add include of gnome-dialog.h * *.[ch]: ran fix.sh script over everything. svn path=/trunk/; revision=18979 --- widgets/misc/e-gui-utils.c | 31 ++++++++----------------------- widgets/misc/e-gui-utils.h | 4 ++-- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c index 5572333521..e91dfb5f9d 100644 --- a/widgets/misc/e-gui-utils.c +++ b/widgets/misc/e-gui-utils.c @@ -33,40 +33,25 @@ /* should probably just deprecate/remove this and have callers change to using gtk_message_dialog_new */ +/* This should probably be moved into evolution/e-util */ void -e_notice (GtkWindow *window, const char *type, const char *format, ...) +e_notice (GtkWindow *parent, GtkMessageType type, const char *format, ...) { - GtkMessageType gtk_type; - GtkWidget *dialog; va_list args; char *str; - if (!strcmp (type, GNOME_MESSAGE_BOX_INFO) - || !strcmp (type, GNOME_MESSAGE_BOX_GENERIC)) - gtk_type = GTK_MESSAGE_INFO; - else if (!strcmp (type, GNOME_MESSAGE_BOX_WARNING)) - gtk_type = GTK_MESSAGE_WARNING; - else if (!strcmp (type, GNOME_MESSAGE_BOX_ERROR)) - gtk_type = GTK_MESSAGE_ERROR; - else if (!strcmp (type, GNOME_MESSAGE_BOX_QUESTION)) - gtk_type = GTK_MESSAGE_QUESTION; - else { - g_warning ("invalid dialog type '%s'", type); - gtk_type = GTK_MESSAGE_INFO; - } - va_start (args, format); str = g_strdup_vprintf (format, args); - dialog = gtk_message_dialog_new (window, 0, gtk_type, - GTK_BUTTONS_OK, - str, - NULL); + dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, type, + GTK_BUTTONS_CLOSE, + "%s", + str); va_end (args); g_free (str); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); + g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); + gtk_widget_show (dialog); } static void diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h index 43b1c0b0f2..b401748e20 100644 --- a/widgets/misc/e-gui-utils.h +++ b/widgets/misc/e-gui-utils.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include G_BEGIN_DECLS @@ -36,7 +36,7 @@ void e_popup_menu (GtkMenu *menu, GdkEvent *event); void e_auto_kill_popup_menu_on_hide (GtkMenu *menu); void e_notice (GtkWindow *window, - const char *type, + GtkMessageType type, const char *format, ...); void e_container_foreach_leaf (GtkContainer *container, -- cgit