summaryrefslogtreecommitdiff
path: root/src/sys/sys_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/sys_unix.c')
-rw-r--r--src/sys/sys_unix.c54
1 files changed, 21 insertions, 33 deletions
diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c
index 734a1e2c..7d497459 100644
--- a/src/sys/sys_unix.c
+++ b/src/sys/sys_unix.c
@@ -712,6 +712,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
qboolean tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
dialogCommandBuilder_t commands[ NUM_DIALOG_PROGRAMS ] = { NULL };
dialogCommandType_t preferredCommandType = NONE;
+ int i;
commands[ ZENITY ] = &Sys_ZenityCommand;
commands[ KDIALOG ] = &Sys_KdialogCommand;
@@ -723,50 +724,37 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
else if( !Q_stricmp( session, "kde" ) )
preferredCommandType = KDIALOG;
- while( 1 )
+ for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
{
- int i;
+ if( preferredCommandType != NONE && preferredCommandType != i )
+ continue;
- for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
+ if( !tried[ i ] )
{
- if( preferredCommandType != NONE && preferredCommandType != i )
- continue;
-
- if( !tried[ i ] )
- {
- int exitCode;
+ int exitCode;
- commands[ i ]( type, message, title );
- exitCode = Sys_Exec( );
+ commands[ i ]( type, message, title );
+ exitCode = Sys_Exec( );
- if( exitCode >= 0 )
+ if( exitCode >= 0 )
+ {
+ switch( type )
{
- switch( type )
- {
- case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
- case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
- default: return DR_OK;
- }
+ case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
+ case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
+ default: return DR_OK;
}
+ }
- tried[ i ] = qtrue;
+ tried[ i ] = qtrue;
- // The preference failed, so start again in order
- if( preferredCommandType != NONE )
- {
- preferredCommandType = NONE;
- break;
- }
+ // The preference failed, so start again in order
+ if( preferredCommandType != NONE )
+ {
+ preferredCommandType = NONE;
+ i = NONE + 1;
}
}
-
- for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
- {
- if( !tried[ i ] )
- continue;
- }
-
- break;
}
Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" );