Commit 91b742e5 authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Removed unused code.

parent ff323f3a
......@@ -539,10 +539,6 @@ void Sys_ErrorDialog(const char *error) {
Sys_Print(va("%s\n", error));
#ifndef DEDICATED
Sys_Dialog(DT_ERROR, va("%s. See \"%s\" for details.", error, ospath), "Error");
#endif
// Make sure the write path for the crashlog exists...
if (!Sys_Mkdir(homepath)) {
......@@ -575,215 +571,6 @@ void Sys_ErrorDialog(const char *error) {
close(f);
}
#ifndef __APPLE__
static char execBuffer[1024];
static char *execBufferPointer;
static char *execArgv[16];
static int execArgc;
/*
==============
Sys_ClearExecBuffer
==============
*/
static void Sys_ClearExecBuffer(void) {
execBufferPointer = execBuffer;
Com_Memset(execArgv, 0, sizeof(execArgv));
execArgc = 0;
}
/*
==============
Sys_AppendToExecBuffer
==============
*/
static void Sys_AppendToExecBuffer(const char *text) {
size_t size = sizeof(execBuffer) - (execBufferPointer - execBuffer);
int length = strlen(text) + 1;
if (length > size || execArgc >= ARRAY_LEN(execArgv))
return;
Q_strncpyz(execBufferPointer, text, size);
execArgv[execArgc++] = execBufferPointer;
execBufferPointer += length;
}
/*
==============
Sys_Exec
==============
*/
static int Sys_Exec(void) {
return -1;
}
/*
==============
Sys_ZenityCommand
==============
*/
static void Sys_ZenityCommand(dialogType_t type, const char *message, const char *title) {
Sys_ClearExecBuffer();
Sys_AppendToExecBuffer("zenity");
switch (type) {
default:
case DT_INFO:
Sys_AppendToExecBuffer("--info");
break;
case DT_WARNING:
Sys_AppendToExecBuffer("--warning");
break;
case DT_ERROR:
Sys_AppendToExecBuffer("--error");
break;
case DT_YES_NO:
Sys_AppendToExecBuffer("--question");
Sys_AppendToExecBuffer("--ok-label=Yes");
Sys_AppendToExecBuffer("--cancel-label=No");
break;
case DT_OK_CANCEL:
Sys_AppendToExecBuffer("--question");
Sys_AppendToExecBuffer("--ok-label=OK");
Sys_AppendToExecBuffer("--cancel-label=Cancel");
break;
}
Sys_AppendToExecBuffer(va("--text=%s", message));
Sys_AppendToExecBuffer(va("--title=%s", title));
}
/*
==============
Sys_KdialogCommand
==============
*/
static void Sys_KdialogCommand(dialogType_t type, const char *message, const char *title) {
Sys_ClearExecBuffer();
Sys_AppendToExecBuffer("kdialog");
switch (type) {
default:
case DT_INFO:
Sys_AppendToExecBuffer("--msgbox");
break;
case DT_WARNING:
Sys_AppendToExecBuffer("--sorry");
break;
case DT_ERROR:
Sys_AppendToExecBuffer("--error");
break;
case DT_YES_NO:
Sys_AppendToExecBuffer("--warningyesno");
break;
case DT_OK_CANCEL:
Sys_AppendToExecBuffer("--warningcontinuecancel");
break;
}
Sys_AppendToExecBuffer(message);
Sys_AppendToExecBuffer(va("--title=%s", title));
}
/*
==============
Sys_XmessageCommand
==============
*/
static void Sys_XmessageCommand(dialogType_t type, const char *message, const char *title) {
Sys_ClearExecBuffer();
Sys_AppendToExecBuffer("xmessage");
Sys_AppendToExecBuffer("-buttons");
switch (type) {
default:
Sys_AppendToExecBuffer("OK:0");
break;
case DT_YES_NO:
Sys_AppendToExecBuffer("Yes:0,No:1");
break;
case DT_OK_CANCEL:
Sys_AppendToExecBuffer("OK:0,Cancel:1");
break;
}
Sys_AppendToExecBuffer("-center");
Sys_AppendToExecBuffer(message);
}
/*
==============
Sys_Dialog
Display a *nix dialog box
==============
*/
dialogResult_t Sys_Dialog(dialogType_t type, const char *message, const char *title) {
typedef enum {
NONE = 0,
ZENITY,
KDIALOG,
XMESSAGE,
NUM_DIALOG_PROGRAMS
} dialogCommandType_t;
typedef void (*dialogCommandBuilder_t)(dialogType_t, const char *, const char *);
const char *session = getenv("DESKTOP_SESSION");
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;
commands[XMESSAGE] = &Sys_XmessageCommand;
// This may not be the best way
if (!Q_stricmp(session, "gnome"))
preferredCommandType = ZENITY;
else if (!Q_stricmp(session, "kde"))
preferredCommandType = KDIALOG;
for (i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++) {
if (preferredCommandType != NONE && preferredCommandType != i)
continue;
if (!tried[i]) {
int exitCode;
commands[i](type, message, title);
exitCode = Sys_Exec();
if (exitCode >= 0) {
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;
}
}
tried[i] = qtrue;
// The preference failed, so start again in order
if (preferredCommandType != NONE) {
preferredCommandType = NONE;
i = NONE + 1;
}
}
}
Com_DPrintf(S_COLOR_YELLOW "WARNING: failed to show a dialog\n");
return DR_OK;
}
#endif
/*
==============
Sys_GLimpSafeInit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment