int gui_input_askyesno ( const char *  question  ) 

Display a standard Yes/No question at the bottom of the screen and return the user response.

Definition at line 607 of file gui_input.c.

00608 {
00609         char *msg, input;
00610         const char *yes, *no;
00611         int ret;
00612 
00613         /* Skip the question if the user really wants so */
00614         if (!config_getopt_bool("gui.input.confirm"))
00615                 return (0);
00616 
00617         yes = _("yes");
00618         no = _("no");
00619 
00620         /* Print the question on screen */
00621         msg = g_strdup_printf("%s ([%s]/%s): ", question, yes, no);
00622         gui_msgbar_ask(msg);
00623         g_free(msg);
00624 
00625         for (;;) {
00626                 input = gui_input_getch();
00627 
00628 #ifdef BUILD_NLS
00629                 /* Localized yes/no buttons */
00630                 if (input == yes[0]) {
00631                         ret = 0;
00632                         goto done;
00633                 } else if (input == no[0]) {
00634                         ret = -1;
00635                         goto done;
00636                 }
00637 #endif /* BUILD_NLS */
00638 
00639                 /* Default y/n behaviour */
00640                 switch (input) {
00641                 case 'y':
00642                 case 'Y':
00643                 case '\r':
00644                         ret = 0;
00645                         goto done;
00646                 case CTRL('['):
00647                 case 'n':
00648                 case 'N':
00649                 case CTRL('C'):
00650                         ret = -1;
00651                         goto done;
00652                 }
00653         }
00654 done:
00655         gui_msgbar_flush();
00656         return (ret);
00657 }

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:16 2010 for herrie by  doxygen 1.6.3