1 /* aNetHack 0.0.1 gnaskstr.c $ANH-Date: 1432512806 2015/05/25 00:13:26 $ $ANH-Branch: master $:$ANH-Revision: 1.8 $ */
2 /* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
3 /* aNetHack may be freely redistributed. See license for details. */
10 ghack_ask_string_callback(gchar
*string
, gpointer data
)
12 char **user_text
= (char **) data
;
14 g_assert(user_text
!= NULL
);
16 *user_text
= string
; /* note - value must be g_free'd */
20 ghack_ask_string_dialog(const char *szMessageStr
, const char *szDefaultStr
,
21 const char *szTitleStr
, char *buffer
)
25 gchar
*user_text
= NULL
;
28 gnome_request_dialog(FALSE
, szMessageStr
, szDefaultStr
, 0,
29 ghack_ask_string_callback
, &user_text
, NULL
);
30 g_assert(dialog
!= NULL
);
32 gtk_window_set_title(GTK_WINDOW(dialog
), szTitleStr
);
34 gnome_dialog_set_default(GNOME_DIALOG(dialog
), 0);
35 gtk_window_set_modal(GTK_WINDOW(dialog
), TRUE
);
36 gnome_dialog_set_parent(GNOME_DIALOG(dialog
),
37 GTK_WINDOW(ghack_get_main_window()));
39 i
= gnome_dialog_run_and_close(GNOME_DIALOG(dialog
));
42 if (i
!= 0 || user_text
== NULL
) {
48 if (*user_text
== 0) {
53 g_assert(strlen(user_text
) > 0);
54 strcpy(buffer
, user_text
);