1
/* winutil.c - window/dialog related helper functions
3
* Copyright (C) 2002 Jochen Voss. */
5
static const char rcsid[] = "$Id: winutil.c,v 1.1 2002/02/22 19:03:21 voss Rel $";
13
#include "sandcommon.h"
16
/**********************************************************************
21
window_show_cb (GtkObject *obj, gpointer data)
22
/* A wrapper for 'main_loop_ref'.
23
* This may be used as a "show" signal handler. */
29
window_destroy_cb (GtkObject *obj, gpointer data)
30
/* A wrapper for 'main_loop_unref'.
31
* This may be used as a "destroy" signal handler. */
37
window_close_cb (GtkObject *obj, gpointer data)
38
/* A wrapper for 'main_loop_unref'.
39
* This may be used as a "close" signal handler
40
* for GnomeDialog objects. */
46
/**********************************************************************
51
display_error_message (const char *str, GtkWindow *parent)
52
/* Create a modal dialog to display the error message STR.
53
* If PARENT is non-null, create a parented dialog. */
58
dialog = gnome_error_dialog_parented (str, parent);
60
dialog = gnome_error_dialog (str);
62
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
65
gtk_signal_connect (GTK_OBJECT (dialog),
67
GTK_SIGNAL_FUNC (window_close_cb),
69
gtk_widget_show (dialog);
74
ask_yes_no_question (const char *str, GtkWindow *parent)
75
/* Display a modal dialog with question STR.
76
* Return 0, if the user clicks YES,
77
* 1, if the user clicks NO, and
78
* -1, if the user closes the dialog. */
82
dialog = gnome_message_box_new (str, GNOME_MESSAGE_BOX_QUESTION,
83
GNOME_STOCK_BUTTON_YES,
84
GNOME_STOCK_BUTTON_NO,
86
if (parent) gnome_dialog_set_parent (GNOME_DIALOG(dialog), parent);
87
gtk_widget_show_all (dialog);
88
return gnome_dialog_run (GNOME_DIALOG (dialog));