1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #include "gtkbutton.h"
28 #include "gtkdialog.h"
30 #include "gtkhseparator.h"
31 #include "gtkmarshalers.h"
33 #include "gtksignal.h"
34 #include "gdkkeysyms.h"
37 #include "gtkbindings.h"
39 static void gtk_dialog_class_init (GtkDialogClass *klass);
40 static void gtk_dialog_init (GtkDialog *dialog);
42 static void gtk_dialog_add_buttons_valist (GtkDialog *dialog,
43 const gchar *first_button_text,
46 static gint gtk_dialog_delete_event_handler (GtkWidget *widget,
50 static void gtk_dialog_set_property (GObject *object,
54 static void gtk_dialog_get_property (GObject *object,
58 static void gtk_dialog_style_set (GtkWidget *widget,
59 GtkStyle *prev_style);
60 static void gtk_dialog_map (GtkWidget *widget);
62 static void gtk_dialog_close (GtkDialog *dialog);
75 static gpointer parent_class;
76 static guint dialog_signals[LAST_SIGNAL];
79 gtk_dialog_get_type (void)
81 static GtkType dialog_type = 0;
85 static const GtkTypeInfo dialog_info =
89 sizeof (GtkDialogClass),
90 (GtkClassInitFunc) gtk_dialog_class_init,
91 (GtkObjectInitFunc) gtk_dialog_init,
92 /* reserved_1 */ NULL,
93 /* reserved_2 */ NULL,
94 (GtkClassInitFunc) NULL,
97 dialog_type = gtk_type_unique (GTK_TYPE_WINDOW, &dialog_info);
104 gtk_dialog_class_init (GtkDialogClass *class)
106 GObjectClass *gobject_class;
107 GtkObjectClass *object_class;
108 GtkWidgetClass *widget_class;
109 GtkBindingSet *binding_set;
111 gobject_class = G_OBJECT_CLASS (class);
112 object_class = GTK_OBJECT_CLASS (class);
113 widget_class = GTK_WIDGET_CLASS (class);
115 parent_class = g_type_class_peek_parent (class);
117 gobject_class->set_property = gtk_dialog_set_property;
118 gobject_class->get_property = gtk_dialog_get_property;
120 widget_class->map = gtk_dialog_map;
121 widget_class->style_set = gtk_dialog_style_set;
123 class->close = gtk_dialog_close;
125 g_object_class_install_property (gobject_class,
127 g_param_spec_boolean ("has_separator",
129 _("The dialog has a separator bar above its buttons"),
133 dialog_signals[RESPONSE] =
134 gtk_signal_new ("response",
136 GTK_CLASS_TYPE (object_class),
137 GTK_SIGNAL_OFFSET (GtkDialogClass, response),
138 _gtk_marshal_NONE__INT,
142 dialog_signals[CLOSE] =
143 gtk_signal_new ("close",
144 GTK_RUN_LAST | GTK_RUN_ACTION,
145 GTK_CLASS_TYPE (object_class),
146 GTK_SIGNAL_OFFSET (GtkDialogClass, close),
147 _gtk_marshal_NONE__NONE,
150 gtk_widget_class_install_style_property (widget_class,
151 g_param_spec_int ("content_area_border",
152 _("Content area border"),
153 _("Width of border around the main dialog area"),
158 gtk_widget_class_install_style_property (widget_class,
159 g_param_spec_int ("button_spacing",
161 _("Spacing between buttons"),
167 gtk_widget_class_install_style_property (widget_class,
168 g_param_spec_int ("action_area_border",
169 _("Action area border"),
170 _("Width of border around the button area at the bottom of the dialog"),
176 binding_set = gtk_binding_set_by_class (class);
178 gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
183 update_spacings (GtkDialog *dialog)
186 gint content_area_border;
188 gint action_area_border;
190 widget = GTK_WIDGET (dialog);
192 gtk_widget_style_get (widget,
193 "content_area_border",
194 &content_area_border,
197 "action_area_border",
201 gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
202 content_area_border);
203 gtk_box_set_spacing (GTK_BOX (dialog->action_area),
205 gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area),
210 gtk_dialog_init (GtkDialog *dialog)
212 /* To avoid breaking old code that prevents destroy on delete event
213 * by connecting a handler, we have to have the FIRST signal
214 * connection on the dialog.
216 gtk_signal_connect (GTK_OBJECT (dialog),
218 GTK_SIGNAL_FUNC (gtk_dialog_delete_event_handler),
221 dialog->vbox = gtk_vbox_new (FALSE, 0);
223 gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
224 gtk_widget_show (dialog->vbox);
226 dialog->action_area = gtk_hbutton_box_new ();
228 gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
231 gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area,
233 gtk_widget_show (dialog->action_area);
235 dialog->separator = gtk_hseparator_new ();
236 gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->separator, FALSE, TRUE, 0);
237 gtk_widget_show (dialog->separator);
239 gtk_window_set_type_hint (GTK_WINDOW (dialog),
240 GDK_WINDOW_TYPE_HINT_DIALOG);
241 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
246 gtk_dialog_set_property (GObject *object,
253 dialog = GTK_DIALOG (object);
257 case PROP_HAS_SEPARATOR:
258 gtk_dialog_set_has_separator (dialog, g_value_get_boolean (value));
262 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
268 gtk_dialog_get_property (GObject *object,
275 dialog = GTK_DIALOG (object);
279 case PROP_HAS_SEPARATOR:
280 g_value_set_boolean (value, dialog->separator != NULL);
284 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
290 gtk_dialog_delete_event_handler (GtkWidget *widget,
294 /* emit response signal */
295 gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_DELETE_EVENT);
297 /* Do the destroy by default */
301 /* A far too tricky heuristic for getting the right initial
302 * focus widget if none was set. What we do is we focus the first
303 * widget in the tab chain, but if this results in the focus
304 * ending up on one of the response widgets _other_ than the
305 * default response, we focus the default response instead.
308 gtk_dialog_map (GtkWidget *widget)
310 GtkWindow *window = GTK_WINDOW (widget);
311 GtkDialog *dialog = GTK_DIALOG (widget);
313 GTK_WIDGET_CLASS (parent_class)->map (widget);
315 if (!window->focus_widget)
317 GList *children, *tmp_list;
319 g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
321 tmp_list = children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
325 GtkWidget *child = tmp_list->data;
327 if (child == window->focus_widget && child != window->default_widget && window->default_widget)
329 gtk_widget_grab_focus (window->default_widget);
333 tmp_list = tmp_list->next;
336 g_list_free (children);
341 gtk_dialog_style_set (GtkWidget *widget,
342 GtkStyle *prev_style)
344 update_spacings (GTK_DIALOG (widget));
348 gtk_dialog_close (GtkDialog *dialog)
350 /* Synthesize delete_event to close dialog. */
355 widget = GTK_WIDGET (dialog);
357 event.type = GDK_DELETE;
358 event.window = widget->window;
359 event.send_event = TRUE;
361 g_object_ref (G_OBJECT (event.window));
363 gtk_main_do_event ((GdkEvent*)&event);
365 g_object_unref (G_OBJECT (event.window));
369 gtk_dialog_new (void)
371 return GTK_WIDGET (gtk_type_new (GTK_TYPE_DIALOG));
375 gtk_dialog_new_empty (const gchar *title,
377 GtkDialogFlags flags)
381 dialog = GTK_DIALOG (g_object_new (GTK_TYPE_DIALOG, NULL));
384 gtk_window_set_title (GTK_WINDOW (dialog), title);
387 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
389 if (flags & GTK_DIALOG_MODAL)
390 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
392 if (flags & GTK_DIALOG_DESTROY_WITH_PARENT)
393 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
395 if (flags & GTK_DIALOG_NO_SEPARATOR)
396 gtk_dialog_set_has_separator (dialog, FALSE);
398 return GTK_WIDGET (dialog);
402 * gtk_dialog_new_with_buttons:
403 * @title: Title of the dialog, or %NULL
404 * @parent: Transient parent of the dialog, or %NULL
405 * @flags: from #GtkDialogFlags
406 * @first_button_text: stock ID or text to go in first button, or %NULL
407 * @Varargs: response ID for first button, then additional buttons, ending with %NULL
409 * Creates a new #GtkDialog with title @title (or %NULL for the default
410 * title; see gtk_window_set_title()) and transient parent @parent (or
411 * %NULL for none; see gtk_window_set_transient_for()). The @flags
412 * argument can be used to make the dialog modal (#GTK_DIALOG_MODAL)
413 * and/or to have it destroyed along with its transient parent
414 * (#GTK_DIALOG_DESTROY_WITH_PARENT). After @flags, button
415 * text/response ID pairs should be listed, with a %NULL pointer ending
416 * the list. Button text can be either a stock ID such as
417 * #GTK_STOCK_OK, or some arbitrary text. A response ID can be
418 * any positive number, or one of the values in the #GtkResponseType
419 * enumeration. If the user clicks one of these dialog buttons,
420 * #GtkDialog will emit the "response" signal with the corresponding
421 * response ID. If a #GtkDialog receives the "delete_event" signal, it
422 * will emit "response" with a response ID of #GTK_RESPONSE_DELETE_EVENT.
423 * However, destroying a dialog does not emit the "response" signal;
424 * so be careful relying on "response" when using
425 * the #GTK_DIALOG_DESTROY_WITH_PARENT flag. Buttons are from left to right,
426 * so the first button in the list will be the leftmost button in the dialog.
428 * Here's a simple example:
429 * <informalexample><programlisting>
430 * <!>GtkWidget *dialog = gtk_dialog_new_with_buttons ("My dialog",
431 * <!> main_app_window,
432 * <!> GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
434 * <!> GTK_RESPONSE_ACCEPT,
435 * <!> GTK_STOCK_CANCEL,
436 * <!> GTK_RESPONSE_REJECT,
438 * </programlisting></informalexample>
440 * Return value: a new #GtkDialog
443 gtk_dialog_new_with_buttons (const gchar *title,
445 GtkDialogFlags flags,
446 const gchar *first_button_text,
452 dialog = GTK_DIALOG (gtk_dialog_new_empty (title, parent, flags));
454 va_start (args, first_button_text);
456 gtk_dialog_add_buttons_valist (dialog,
462 return GTK_WIDGET (dialog);
465 typedef struct _ResponseData ResponseData;
473 get_response_data (GtkWidget *widget)
475 ResponseData *ad = gtk_object_get_data (GTK_OBJECT (widget),
476 "gtk-dialog-response-data");
480 ad = g_new (ResponseData, 1);
482 gtk_object_set_data_full (GTK_OBJECT (widget),
483 "gtk-dialog-response-data",
492 action_widget_activated (GtkWidget *widget, GtkDialog *dialog)
497 g_return_if_fail (GTK_IS_DIALOG (dialog));
499 response_id = GTK_RESPONSE_NONE;
501 ad = get_response_data (widget);
503 g_assert (ad != NULL);
505 response_id = ad->response_id;
507 gtk_dialog_response (dialog, response_id);
510 * gtk_dialog_add_action_widget:
511 * @dialog: a #GtkDialog
512 * @child: an activatable widget
513 * @response_id: response ID for @child
515 * Adds an activatable widget to the action area of a #GtkDialog,
516 * connecting a signal handler that will emit the "response" signal on
517 * the dialog when the widget is activated. The widget is appended to
518 * the end of the dialog's action area. If you want to add a
519 * non-activatable widget, simply pack it into the
520 * <literal>action_area</literal> field of the #GtkDialog struct.
523 gtk_dialog_add_action_widget (GtkDialog *dialog,
530 g_return_if_fail (GTK_IS_DIALOG (dialog));
531 g_return_if_fail (GTK_IS_WIDGET (child));
533 ad = get_response_data (child);
535 ad->response_id = response_id;
537 if (GTK_IS_BUTTON (child))
539 signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
542 signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal != 0;
546 const gchar* name = gtk_signal_name (signal_id);
548 gtk_signal_connect_while_alive (GTK_OBJECT (child),
550 GTK_SIGNAL_FUNC (action_widget_activated),
552 GTK_OBJECT (dialog));
555 g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkDialog");
557 gtk_box_pack_end (GTK_BOX (dialog->action_area),
561 if (response_id == GTK_RESPONSE_HELP)
562 gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area), child, TRUE);
566 * gtk_dialog_add_button:
567 * @dialog: a #GtkDialog
568 * @button_text: text of button, or stock ID
569 * @response_id: response ID for the button
571 * Adds a button with the given text (or a stock button, if @button_text is a
572 * stock ID) and sets things up so that clicking the button will emit the
573 * "response" signal with the given @response_id. The button is appended to the
574 * end of the dialog's action area. The button widget is returned, but usually
577 * Return value: the button widget that was added
580 gtk_dialog_add_button (GtkDialog *dialog,
581 const gchar *button_text,
586 g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
587 g_return_val_if_fail (button_text != NULL, NULL);
589 button = gtk_button_new_from_stock (button_text);
591 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
593 gtk_widget_show (button);
595 gtk_dialog_add_action_widget (dialog,
603 gtk_dialog_add_buttons_valist(GtkDialog *dialog,
604 const gchar *first_button_text,
610 g_return_if_fail (GTK_IS_DIALOG (dialog));
612 if (first_button_text == NULL)
615 text = first_button_text;
616 response_id = va_arg (args, gint);
620 gtk_dialog_add_button (dialog, text, response_id);
622 text = va_arg (args, gchar*);
625 response_id = va_arg (args, int);
630 * gtk_dialog_add_buttons:
631 * @dialog: a #GtkDialog
632 * @first_button_text: button text or stock ID
633 * @Varargs: response ID for first button, then more text-response_id pairs
635 * Adds more buttons, same as calling gtk_dialog_add_button()
636 * repeatedly. The variable argument list should be %NULL-terminated
637 * as with gtk_dialog_new_with_buttons(). Each button must have both
638 * text and response ID.
641 gtk_dialog_add_buttons (GtkDialog *dialog,
642 const gchar *first_button_text,
647 va_start (args, first_button_text);
649 gtk_dialog_add_buttons_valist (dialog,
657 * gtk_dialog_set_response_sensitive:
658 * @dialog: a #GtkDialog
659 * @response_id: a response ID
660 * @setting: %TRUE for sensitive
662 * Calls <literal>gtk_widget_set_sensitive (widget, @setting)</literal>
663 * for each widget in the dialog's action area with the given @response_id.
664 * A convenient way to sensitize/desensitize dialog buttons.
667 gtk_dialog_set_response_sensitive (GtkDialog *dialog,
674 g_return_if_fail (GTK_IS_DIALOG (dialog));
676 children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
679 while (tmp_list != NULL)
681 GtkWidget *widget = tmp_list->data;
682 ResponseData *rd = g_object_get_data (G_OBJECT (widget),
683 "gtk-dialog-response-data");
685 if (rd && rd->response_id == response_id)
686 gtk_widget_set_sensitive (widget, setting);
688 tmp_list = g_list_next (tmp_list);
691 g_list_free (children);
695 * gtk_dialog_set_default_response:
696 * @dialog: a #GtkDialog
697 * @response_id: a response ID
699 * Sets the last widget in the dialog's action area with the given @response_id
700 * as the default widget for the dialog. Pressing "Enter" normally activates
701 * the default widget.
704 gtk_dialog_set_default_response (GtkDialog *dialog,
710 g_return_if_fail (GTK_IS_DIALOG (dialog));
712 children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
715 while (tmp_list != NULL)
717 GtkWidget *widget = tmp_list->data;
718 ResponseData *rd = g_object_get_data (G_OBJECT (widget),
719 "gtk-dialog-response-data");
721 if (rd && rd->response_id == response_id)
723 gtk_widget_grab_default (widget);
725 if (!GTK_WINDOW (dialog)->focus_widget)
726 gtk_widget_grab_focus (widget);
729 tmp_list = g_list_next (tmp_list);
732 g_list_free (children);
736 * gtk_dialog_set_has_separator:
737 * @dialog: a #GtkDialog
738 * @setting: %TRUE to have a separator
740 * Sets whether the dialog has a separator above the buttons.
744 gtk_dialog_set_has_separator (GtkDialog *dialog,
747 g_return_if_fail (GTK_IS_DIALOG (dialog));
749 /* this might fail if we get called before _init() somehow */
750 g_assert (dialog->vbox != NULL);
752 if (setting && dialog->separator == NULL)
754 dialog->separator = gtk_hseparator_new ();
755 gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->separator, FALSE, TRUE, 0);
757 /* The app programmer could screw this up, but, their own fault.
758 * Moves the separator just above the action area.
760 gtk_box_reorder_child (GTK_BOX (dialog->vbox), dialog->separator, 1);
761 gtk_widget_show (dialog->separator);
763 else if (!setting && dialog->separator != NULL)
765 gtk_widget_destroy (dialog->separator);
766 dialog->separator = NULL;
769 g_object_notify (G_OBJECT (dialog), "has_separator");
773 * gtk_dialog_get_has_separator:
774 * @dialog: a #GtkDialog
776 * Accessor for whether the dialog has a separator.
778 * Return value: %TRUE if the dialog has a separator
781 gtk_dialog_get_has_separator (GtkDialog *dialog)
783 g_return_val_if_fail (GTK_IS_DIALOG (dialog), FALSE);
785 return dialog->separator != NULL;
789 * gtk_dialog_response:
790 * @dialog: a #GtkDialog
791 * @response_id: response ID
793 * Emits the "response" signal with the given response ID. Used to
794 * indicate that the user has responded to the dialog in some way;
795 * typically either you or gtk_dialog_run() will be monitoring the
796 * "response" signal and take appropriate action.
799 gtk_dialog_response (GtkDialog *dialog,
802 g_return_if_fail (GTK_IS_DIALOG (dialog));
804 gtk_signal_emit (GTK_OBJECT (dialog),
805 dialog_signals[RESPONSE],
818 shutdown_loop (RunInfo *ri)
820 if (g_main_loop_is_running (ri->loop))
821 g_main_loop_quit (ri->loop);
825 run_unmap_handler (GtkDialog *dialog, gpointer data)
833 run_response_handler (GtkDialog *dialog,
841 ri->response_id = response_id;
847 run_delete_handler (GtkDialog *dialog,
855 return TRUE; /* Do not destroy */
859 run_destroy_handler (GtkDialog *dialog, gpointer data)
863 /* shutdown_loop will be called by run_unmap_handler */
865 ri->destroyed = TRUE;
870 * @dialog: a #GtkDialog
872 * Blocks in a recursive main loop until the @dialog either emits the
873 * response signal, or is destroyed. If the dialog is destroyed,
874 * gtk_dialog_run() returns #GTK_RESPONSE_NONE. Otherwise, it returns
875 * the response ID from the "response" signal emission. Before
876 * entering the recursive main loop, gtk_dialog_run() calls
877 * gtk_widget_show() on the dialog for you. Note that you still
878 * need to show any children of the dialog yourself.
880 * During gtk_dialog_run(), the default behavior of "delete_event" is
881 * disabled; if the dialog receives "delete_event", it will not be
882 * destroyed as windows usually are, and gtk_dialog_run() will return
883 * #GTK_RESPONSE_DELETE_EVENT. Also, during gtk_dialog_run() the dialog will be
884 * modal. You can force gtk_dialog_run() to return at any time by
885 * calling gtk_dialog_response() to emit the "response"
886 * signal. Destroying the dialog during gtk_dialog_run() is a very bad
887 * idea, because your post-run code won't know whether the dialog was
890 * After gtk_dialog_run() returns, you are responsible for hiding or
891 * destroying the dialog if you wish to do so.
893 * Typical usage of this function might be:
894 * <informalexample><programlisting>
895 * <!> gint result = gtk_dialog_run (GTK_DIALOG (dialog));
896 * <!> switch (result)
898 * <!> case GTK_RESPONSE_ACCEPT:
899 * <!> do_application_specific_something (<!-- -->);
902 * <!> do_nothing_since_dialog_was_cancelled (<!-- -->);
905 * <!> gtk_widget_destroy (dialog);
906 * </programlisting></informalexample>
908 * Return value: response ID
911 gtk_dialog_run (GtkDialog *dialog)
913 RunInfo ri = { NULL, GTK_RESPONSE_NONE, NULL };
915 guint response_handler;
917 guint destroy_handler;
918 guint delete_handler;
920 g_return_val_if_fail (GTK_IS_DIALOG (dialog), -1);
922 gtk_object_ref (GTK_OBJECT (dialog));
924 if (!GTK_WIDGET_VISIBLE (dialog))
925 gtk_widget_show (GTK_WIDGET (dialog));
927 was_modal = GTK_WINDOW (dialog)->modal;
929 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
932 gtk_signal_connect (GTK_OBJECT (dialog),
934 GTK_SIGNAL_FUNC (run_response_handler),
938 gtk_signal_connect (GTK_OBJECT (dialog),
940 GTK_SIGNAL_FUNC (run_unmap_handler),
944 gtk_signal_connect (GTK_OBJECT (dialog),
946 GTK_SIGNAL_FUNC (run_delete_handler),
950 gtk_signal_connect (GTK_OBJECT (dialog),
952 GTK_SIGNAL_FUNC (run_destroy_handler),
955 ri.loop = g_main_new (FALSE);
957 GDK_THREADS_LEAVE ();
958 g_main_loop_run (ri.loop);
959 GDK_THREADS_ENTER ();
961 g_main_loop_unref (ri.loop);
964 ri.destroyed = FALSE;
969 gtk_window_set_modal (GTK_WINDOW(dialog), FALSE);
971 gtk_signal_disconnect (GTK_OBJECT (dialog), response_handler);
972 gtk_signal_disconnect (GTK_OBJECT (dialog), unmap_handler);
973 gtk_signal_disconnect (GTK_OBJECT (dialog), delete_handler);
974 gtk_signal_disconnect (GTK_OBJECT (dialog), destroy_handler);
977 gtk_object_unref (GTK_OBJECT (dialog));
979 return ri.response_id;