MCPcopy Create free account
hub / github.com/NetHack/NetHack / ghack_ask_string_dialog

Function ghack_ask_string_dialog

outdated/win/gnome/gnaskstr.c:19–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19int
20ghack_ask_string_dialog(const char *szMessageStr, const char *szDefaultStr,
21 const char *szTitleStr, char *buffer)
22{
23 int i;
24 GtkWidget *dialog;
25 gchar *user_text = NULL;
26
27 dialog =
28 gnome_request_dialog(FALSE, szMessageStr, szDefaultStr, 0,
29 ghack_ask_string_callback, &user_text, NULL);
30 g_assert(dialog != NULL);
31
32 gtk_window_set_title(GTK_WINDOW(dialog), szTitleStr);
33
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()));
38
39 i = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
40
41 /* Quit */
42 if (i != 0 || user_text == NULL) {
43 if (user_text)
44 g_free(user_text);
45 return -1;
46 }
47
48 if (*user_text == 0) {
49 g_free(user_text);
50 return -1;
51 }
52
53 g_assert(strlen(user_text) > 0);
54 strcpy(buffer, user_text);
55 g_free(user_text);
56 return 0;
57}

Callers 2

gnome_asknameFunction · 0.85
gnome_getlinFunction · 0.85

Calls 1

ghack_get_main_windowFunction · 0.85

Tested by

no test coverage detected