2000-11-05 20:40:48 +00:00
|
|
|
/* XQF - Quake server browser and launcher
|
|
|
|
* Copyright (C) 1998-2000 Roman Pozlevich <roma@botik.ru>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
|
|
|
2002-04-23 21:04:36 +00:00
|
|
|
#include "gnuconfig.h"
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
#include <sys/types.h> /* FD_SETSIZE */
|
|
|
|
#include <stdio.h> /* fprintf */
|
|
|
|
#include <stdlib.h> /* strtol */
|
|
|
|
#include <string.h> /* strcmp, strlen */
|
|
|
|
#include <sys/time.h> /* FD_SETSIZE */
|
|
|
|
#include <sys/stat.h> /* stat */
|
|
|
|
#include <unistd.h> /* readlink */
|
|
|
|
#include <sys/resource.h> /* setrlimit */
|
2003-05-02 10:30:27 +00:00
|
|
|
#include <errno.h>
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2002-04-23 21:04:36 +00:00
|
|
|
#include "i18n.h"
|
2000-11-05 20:40:48 +00:00
|
|
|
#include "xqf.h"
|
2002-09-07 10:55:52 +00:00
|
|
|
#include "xqf-ui.h"
|
2000-11-05 20:40:48 +00:00
|
|
|
#include "game.h"
|
|
|
|
#include "pref.h"
|
|
|
|
#include "dialogs.h"
|
|
|
|
#include "skin.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "srv-prop.h"
|
|
|
|
#include "pixmaps.h"
|
|
|
|
#include "xutils.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "rc.h"
|
2001-10-19 22:01:42 +00:00
|
|
|
#include "debug.h"
|
2002-10-22 16:15:18 +00:00
|
|
|
#include "sort.h"
|
2002-12-07 18:38:23 +00:00
|
|
|
#include "q3maps.h"
|
2003-01-19 23:35:39 +00:00
|
|
|
#include "splash.h"
|
2004-11-11 16:54:11 +00:00
|
|
|
#include "srv-list.h"
|
2005-07-03 17:51:08 +00:00
|
|
|
#include "scripts.h"
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2002-05-05 12:46:17 +00:00
|
|
|
static struct generic_prefs* new_generic_prefs (void);
|
2004-05-23 21:18:02 +00:00
|
|
|
static GtkWidget *custom_args_options_page (enum server_type type);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2004-11-06 23:01:41 +00:00
|
|
|
static void scan_maps_for(enum server_type type);
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
char *user_rcdir = NULL;
|
|
|
|
|
|
|
|
char *default_q1_name = NULL;
|
|
|
|
char *default_qw_name = NULL;
|
|
|
|
char *default_q2_name = NULL;
|
|
|
|
char *default_t2_name = NULL;
|
|
|
|
char *default_qw_team = NULL;
|
|
|
|
char *default_qw_skin = NULL;
|
|
|
|
char *default_q2_skin = NULL;
|
|
|
|
int default_q1_top_color = 0;
|
|
|
|
int default_q1_bottom_color = 0;
|
|
|
|
int default_qw_top_color = 0;
|
|
|
|
int default_qw_bottom_color = 0;
|
|
|
|
|
|
|
|
int default_qw_rate;
|
|
|
|
int default_q2_rate;
|
|
|
|
int default_qw_cl_nodelta;
|
|
|
|
int default_q2_cl_nodelta;
|
|
|
|
int default_qw_cl_predict;
|
|
|
|
int default_q2_cl_predict;
|
|
|
|
int default_noaim;
|
|
|
|
int default_qw_noskins;
|
|
|
|
int default_q2_noskins;
|
|
|
|
int default_b_switch;
|
|
|
|
int default_w_switch;
|
|
|
|
|
|
|
|
int pushlatency_mode;
|
|
|
|
int pushlatency_value;
|
|
|
|
|
|
|
|
int default_nosound;
|
|
|
|
int default_nocdaudio;
|
|
|
|
|
|
|
|
int show_hostnames;
|
|
|
|
int show_default_port;
|
|
|
|
|
|
|
|
int serverlist_countbots;
|
|
|
|
|
|
|
|
int default_terminate;
|
|
|
|
int default_iconify;
|
|
|
|
int default_launchinfo;
|
|
|
|
int default_stopxmms;
|
|
|
|
int default_prelaunchexec;
|
|
|
|
int default_save_lists;
|
|
|
|
int default_save_srvinfo;
|
|
|
|
int default_save_plrinfo;
|
|
|
|
int default_auto_favorites;
|
|
|
|
int default_show_splash;
|
|
|
|
int default_auto_maps;
|
|
|
|
int skip_startup_mapscan;
|
|
|
|
int default_show_tray_icon;
|
|
|
|
int default_toolbar_style;
|
|
|
|
int default_toolbar_tips;
|
|
|
|
int default_refresh_sorts;
|
|
|
|
int default_refresh_on_update;
|
|
|
|
int default_resolve_on_update;
|
|
|
|
int default_show_only_configured_games;
|
|
|
|
char* default_icontheme;
|
|
|
|
|
|
|
|
int maxretries;
|
|
|
|
int maxsimultaneous;
|
|
|
|
char* qstat_srcip;
|
2004-11-11 16:54:11 +00:00
|
|
|
unsigned short qstat_srcport_low;
|
|
|
|
unsigned short qstat_srcport_high;
|
|
|
|
gboolean qstat_srcport_changed;
|
|
|
|
gboolean qstat_srcip_changed;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
int sound_enable;
|
|
|
|
char *sound_player = NULL;
|
|
|
|
char *sound_xqf_start = NULL;
|
|
|
|
char *sound_xqf_quit = NULL;
|
|
|
|
char *sound_update_done = NULL;
|
|
|
|
char *sound_refresh_done = NULL;
|
|
|
|
char *sound_stop = NULL;
|
|
|
|
char *sound_server_connect = NULL;
|
|
|
|
char *sound_redial_success = NULL;
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2005-02-19 18:15:37 +00:00
|
|
|
gboolean use_custom_gtkrc;
|
|
|
|
|
2002-10-25 01:41:58 +00:00
|
|
|
GtkTooltips *tooltips;
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static int pref_q1_top_color;
|
|
|
|
static int pref_q1_bottom_color;
|
|
|
|
static int pref_qw_top_color;
|
|
|
|
static int pref_qw_bottom_color;
|
|
|
|
static int pref_b_switch;
|
|
|
|
static int pref_w_switch;
|
|
|
|
static int pref_qw_noskins;
|
|
|
|
static int pref_q2_noskins;
|
|
|
|
static char *pref_qw_skin;
|
|
|
|
static char *pref_q2_skin;
|
|
|
|
|
|
|
|
static GtkWidget *games_notebook;
|
|
|
|
static GtkWidget *pref_notebook;
|
|
|
|
|
|
|
|
static GtkWidget *rate_spinner[2];
|
|
|
|
static GtkWidget *cl_nodelta_check_button[2];
|
|
|
|
static GtkWidget *cl_predict_check_button[2];
|
|
|
|
static GtkWidget *noaim_check_button;
|
|
|
|
static GtkWidget *nosound_check_button;
|
|
|
|
static GtkWidget *nocdaudio_check_button;
|
|
|
|
static GtkWidget *name_q1_entry;
|
|
|
|
static GtkWidget *name_qw_entry;
|
|
|
|
static GtkWidget *name_q2_entry;
|
|
|
|
static GtkWidget *name_t2_entry;
|
|
|
|
static GtkWidget *team_qw_entry;
|
|
|
|
static GtkWidget *q1_skin_preview = NULL;
|
|
|
|
static GtkWidget *qw_skin_preview = NULL;
|
|
|
|
static GtkWidget *q2_skin_preview = NULL;
|
|
|
|
static GtkWidget *qw_skin_combo;
|
|
|
|
static GtkWidget *q2_skin_combo;
|
|
|
|
static GtkWidget *q1_top_color_button;
|
|
|
|
static GtkWidget *q1_bottom_color_button;
|
|
|
|
static GtkWidget *qw_top_color_button;
|
|
|
|
static GtkWidget *qw_bottom_color_button;
|
|
|
|
|
|
|
|
static GtkWidget *terminate_check_button;
|
|
|
|
static GtkWidget *iconify_check_button;
|
|
|
|
static GtkWidget *launchinfo_check_button;
|
|
|
|
static GtkWidget *stopxmms_check_button;
|
|
|
|
static GtkWidget *prelaunchexec_check_button;
|
|
|
|
static GtkWidget *save_lists_check_button;
|
|
|
|
static GtkWidget *save_srvinfo_check_button;
|
|
|
|
static GtkWidget *save_plrinfo_check_button;
|
|
|
|
static GtkWidget *auto_favorites_check_button;
|
|
|
|
static GtkWidget *show_splash_button;
|
|
|
|
static GtkWidget *auto_maps_check_button;
|
2014-10-03 00:21:36 +02:00
|
|
|
|
|
|
|
/*Tray Icon*/
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *tray_icon_check_button;
|
|
|
|
|
|
|
|
static GtkWidget *show_hostnames_check_button;
|
|
|
|
static GtkWidget *show_defport_check_button;
|
|
|
|
static GtkWidget *toolbar_style_radio_buttons[3];
|
|
|
|
static GtkWidget *toolbar_tips_check_button;
|
|
|
|
static GtkWidget *countbots_check_button;
|
|
|
|
static GtkWidget *refresh_sorts_check_button;
|
|
|
|
static GtkWidget *refresh_on_update_check_button;
|
|
|
|
static GtkWidget *resolve_on_update_check_button;
|
|
|
|
static GtkWidget *show_only_configured_games_check_button;
|
|
|
|
static GtkWidget *use_custom_gtkrc_check_button;
|
|
|
|
|
|
|
|
static GtkWidget *pushlatency_mode_radio_buttons[3];
|
|
|
|
static GtkWidget *pushlatency_value_spinner;
|
|
|
|
|
|
|
|
static GtkWidget *maxretries_spinner;
|
|
|
|
static GtkWidget *maxsimultaneous_spinner;
|
|
|
|
static GtkWidget *qstat_srcip_entry;
|
|
|
|
static GtkWidget *qstat_srcport_entry_low;
|
|
|
|
static GtkWidget *qstat_srcport_entry_high;
|
|
|
|
|
|
|
|
static GtkWidget *sound_enable_check_button;
|
|
|
|
|
|
|
|
static GtkWidget *sound_player_entry;
|
|
|
|
static GtkWidget *sound_xqf_start_entry;
|
|
|
|
static GtkWidget *sound_xqf_quit_entry;
|
|
|
|
static GtkWidget *sound_update_done_entry;
|
|
|
|
static GtkWidget *sound_refresh_done_entry;
|
|
|
|
static GtkWidget *sound_stop_entry;
|
|
|
|
static GtkWidget *sound_server_connect_entry;
|
|
|
|
static GtkWidget *sound_redial_success_entry;
|
|
|
|
|
|
|
|
static GtkWidget *sound_player_file_dialog_button;
|
|
|
|
static GtkWidget *sound_xqf_start_file_dialog_button;
|
|
|
|
static GtkWidget *sound_xqf_quit_file_dialog_button;
|
|
|
|
static GtkWidget *sound_update_done_file_dialog_button;
|
|
|
|
static GtkWidget *sound_refresh_done_file_dialog_button;
|
|
|
|
static GtkWidget *sound_stop_file_dialog_button;
|
|
|
|
static GtkWidget *sound_server_connect_file_dialog_button;
|
|
|
|
static GtkWidget *sound_redial_success_file_dialog_button;
|
|
|
|
|
|
|
|
static GtkWidget *sound_xqf_start_file_test_button;
|
|
|
|
static GtkWidget *sound_xqf_start_file_test_button;
|
|
|
|
static GtkWidget *sound_xqf_quit_file_test_button;
|
|
|
|
static GtkWidget *sound_update_done_file_test_button;
|
|
|
|
static GtkWidget *sound_refresh_done_file_test_button;
|
|
|
|
static GtkWidget *sound_stop_file_test_button;
|
|
|
|
static GtkWidget *sound_server_connect_file_test_button;
|
|
|
|
static GtkWidget *sound_redial_success_file_test_button;
|
|
|
|
|
|
|
|
static guchar *q1_skin_data = NULL;
|
|
|
|
static int q1_skin_is_valid = TRUE;
|
|
|
|
|
|
|
|
static guchar *qw_skin_data = NULL;
|
|
|
|
static int qw_skin_is_valid = TRUE;
|
|
|
|
|
|
|
|
static guchar *q2_skin_data = NULL;
|
|
|
|
static int q2_skin_is_valid = TRUE;
|
|
|
|
|
|
|
|
static GtkWidget *color_menu = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2002-10-24 15:44:05 +00:00
|
|
|
static GtkWidget *custom_args_add_button[GAMES_TOTAL];
|
2002-10-22 01:55:17 +00:00
|
|
|
static GtkWidget *custom_args_entry_game[GAMES_TOTAL];
|
|
|
|
static GtkWidget *custom_args_entry_args[GAMES_TOTAL];
|
|
|
|
static int current_row = -1;
|
|
|
|
|
2000-11-05 20:40:48 +00:00
|
|
|
struct generic_prefs {
|
2014-10-16 02:04:09 +02:00
|
|
|
char *pref_dir;
|
|
|
|
char *real_dir;
|
|
|
|
GtkWidget *dir_entry;
|
|
|
|
GtkWidget *cmd_entry;
|
|
|
|
GtkWidget *cfg_combo;
|
|
|
|
GtkWidget *game_button;
|
|
|
|
// function for adding game specific tabs to notebook
|
|
|
|
void (*add_options_to_notebook) (GtkWidget *notebook, enum server_type type);
|
|
|
|
|
|
|
|
// game specific data
|
|
|
|
GData* games_data;
|
|
|
|
|
|
|
|
GSList *custom_args;
|
2000-11-05 20:40:48 +00:00
|
|
|
} *genprefs = NULL;
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
enum {
|
|
|
|
Q3_PREF_SETFS_GAME = 0x01,
|
|
|
|
Q3_PREF_PB = 0x02,
|
|
|
|
Q3_PREF_CONSOLE = 0x04,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Quake 3 settings */
|
2014-10-16 02:04:09 +02:00
|
|
|
struct q3_common_prefs_s {
|
|
|
|
const char** protocols;
|
|
|
|
const char* defproto;
|
|
|
|
unsigned flags;
|
|
|
|
GtkWidget *setfs_gamebutton;
|
|
|
|
GtkWidget *set_punkbusterbutton;
|
|
|
|
GtkWidget *proto_entry;
|
|
|
|
GtkWidget *console_button;
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
2002-10-07 23:24:40 +00:00
|
|
|
|
|
|
|
// change config_get_string below too!
|
2005-11-12 11:31:56 +00:00
|
|
|
static const char* q3_masterprotocols[] = {
|
2002-10-07 23:21:54 +00:00
|
|
|
"68 - v1.32",
|
2001-12-30 11:13:26 +00:00
|
|
|
"67 - v1.31",
|
|
|
|
"66 - v1.30",
|
|
|
|
"48 - v1.27",
|
|
|
|
"46 - v1.25",
|
|
|
|
"45 - v1.17",
|
|
|
|
"43 - v1.11",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s q3_prefs = {
|
|
|
|
protocols: q3_masterprotocols,
|
|
|
|
defproto : "68",
|
|
|
|
flags : Q3_PREF_SETFS_GAME | Q3_PREF_PB,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static GtkWidget *pass_memory_options_button;
|
|
|
|
static GtkWidget *com_hunkmegs_spinner;
|
|
|
|
static GtkWidget *com_soundmegs_spinner;
|
|
|
|
static GtkWidget *com_zonemegs_spinner;
|
|
|
|
static GtkWidget *cg_precachedmodels_spinner;
|
|
|
|
|
|
|
|
|
2002-11-07 12:54:28 +00:00
|
|
|
// change config_get_string below too!
|
2005-11-12 11:31:56 +00:00
|
|
|
static const char* wo_masterprotocols[] = {
|
2002-11-06 10:31:19 +00:00
|
|
|
"60 - v1.4",
|
2002-07-07 14:36:28 +00:00
|
|
|
"59 - v1.32",
|
2002-03-17 11:11:28 +00:00
|
|
|
"58 - v1.3",
|
2001-12-30 11:13:26 +00:00
|
|
|
"57 - retail",
|
|
|
|
"56 - test2",
|
|
|
|
"55 - test1",
|
|
|
|
NULL
|
|
|
|
};
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s wo_prefs = {
|
|
|
|
protocols: wo_masterprotocols,
|
|
|
|
defproto : "60",
|
|
|
|
flags : Q3_PREF_SETFS_GAME | Q3_PREF_PB,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
2003-04-25 21:15:46 +00:00
|
|
|
// change config_get_string below too!
|
2005-11-12 11:31:56 +00:00
|
|
|
static const char* woet_masterprotocols[] = {
|
2005-03-22 20:06:59 +00:00
|
|
|
"84 - v2.60",
|
2003-09-12 19:57:31 +00:00
|
|
|
"83 - v2.56",
|
2003-05-29 12:37:10 +00:00
|
|
|
"82 - v2.55 (Release)",
|
|
|
|
"71 - v2.32 (test)",
|
2003-04-25 21:15:46 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s woet_prefs = {
|
|
|
|
protocols: woet_masterprotocols,
|
|
|
|
defproto : "84",
|
|
|
|
flags : Q3_PREF_SETFS_GAME | Q3_PREF_PB,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
2014-09-30 06:21:30 +02:00
|
|
|
static const char* etl_masterprotocols[] = {
|
|
|
|
"84 - v2.71",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s etl_prefs = {
|
|
|
|
protocols: etl_masterprotocols,
|
|
|
|
defproto : "84",
|
|
|
|
flags : Q3_PREF_SETFS_GAME | Q3_PREF_PB,
|
2014-09-30 06:21:30 +02:00
|
|
|
};
|
|
|
|
|
2005-11-12 11:31:56 +00:00
|
|
|
static const char* ef_masterprotocols[] = {
|
2002-05-05 12:46:17 +00:00
|
|
|
"24",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s ef_prefs = {
|
|
|
|
protocols: ef_masterprotocols,
|
|
|
|
defproto : "24",
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* cod_masterprotocols[] = {
|
2005-12-28 10:44:04 +00:00
|
|
|
"6 - v1.5",
|
2004-08-22 11:53:13 +00:00
|
|
|
"5 - v1.4",
|
|
|
|
"1 - retail",
|
2003-11-18 18:06:10 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s cod_prefs = {
|
|
|
|
protocols: cod_masterprotocols,
|
|
|
|
defproto : "5",
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
2014-10-02 02:59:38 +02:00
|
|
|
static const char* jk2_masterprotocols[] = {
|
2014-10-02 03:04:12 +02:00
|
|
|
"26 - v1.5",
|
2014-10-02 02:59:38 +02:00
|
|
|
"16 - v1.04",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2005-11-12 11:31:56 +00:00
|
|
|
static const char* jk3_masterprotocols[] = {
|
2004-06-19 17:12:04 +00:00
|
|
|
"26 - v1.01",
|
2004-08-22 11:53:13 +00:00
|
|
|
"25 - v1.0",
|
2004-06-19 17:12:04 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s jk2_prefs = {
|
|
|
|
protocols: jk2_masterprotocols,
|
|
|
|
defproto : "26",
|
2014-10-02 02:59:38 +02:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s jk3_prefs = {
|
|
|
|
protocols: jk3_masterprotocols,
|
|
|
|
defproto : "26",
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* sof2_masterprotocols[] = {
|
2004-01-08 00:59:29 +00:00
|
|
|
"2004 - SOF2 1.02",
|
|
|
|
"2003 - SOF2 1.01",
|
|
|
|
"2002 - SOF2 1.00",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s sof2_prefs = {
|
|
|
|
protocols: sof2_masterprotocols,
|
|
|
|
defproto : "2004",
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* doom3_masterprotocols[] = {
|
2004-10-02 00:41:45 +00:00
|
|
|
"auto",
|
2005-06-01 18:24:02 +00:00
|
|
|
"1.40 - 1.3.1302",
|
|
|
|
"1.35 - 1.1.1282",
|
2004-08-07 18:34:05 +00:00
|
|
|
"1.33 - retail",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s doom3_prefs = {
|
|
|
|
protocols: doom3_masterprotocols,
|
|
|
|
defproto : "auto",
|
|
|
|
flags : Q3_PREF_PB,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* quake4_masterprotocols[] = {
|
2005-10-07 12:55:15 +00:00
|
|
|
"auto",
|
|
|
|
"0 - any",
|
|
|
|
"2.63 - German retail",
|
|
|
|
"2.62 - retail",
|
2007-11-03 19:07:54 +00:00
|
|
|
"2.32837 - 1.2 German",
|
|
|
|
"2.69 - 1.2",
|
|
|
|
"2.32853 - 1.4.2 German",
|
|
|
|
"2.85 - 1.4.2",
|
2005-10-07 12:55:15 +00:00
|
|
|
NULL
|
|
|
|
};
|
2004-08-07 18:34:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s q4_prefs = {
|
|
|
|
protocols: quake4_masterprotocols,
|
|
|
|
defproto : "auto",
|
|
|
|
flags : Q3_PREF_PB | Q3_PREF_CONSOLE,
|
2005-11-12 11:31:56 +00:00
|
|
|
};
|
|
|
|
|
2007-10-25 09:34:36 +00:00
|
|
|
static const char* etqw_masterprotocols[] = {
|
|
|
|
"auto",
|
|
|
|
"0 - any",
|
|
|
|
"10.16 - retail",
|
2007-11-03 19:07:54 +00:00
|
|
|
"10.17 - 1.2",
|
2007-10-25 09:34:36 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s etqw_prefs = {
|
|
|
|
protocols: etqw_masterprotocols,
|
|
|
|
defproto : "auto",
|
|
|
|
flags : Q3_PREF_PB | Q3_PREF_CONSOLE,
|
2007-10-25 09:34:36 +00:00
|
|
|
};
|
|
|
|
|
2005-11-12 13:15:48 +00:00
|
|
|
static const char* nexuiz_masterprotocols[] = {
|
|
|
|
"3",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s nexuiz_prefs = {
|
|
|
|
protocols: nexuiz_masterprotocols,
|
|
|
|
defproto : "3",
|
2005-11-12 13:15:48 +00:00
|
|
|
};
|
|
|
|
|
2013-10-25 03:58:45 +02:00
|
|
|
static const char* xonotic_masterprotocols[] = {
|
|
|
|
"3",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s xonotic_prefs = {
|
|
|
|
protocols: xonotic_masterprotocols,
|
|
|
|
defproto : "3",
|
2013-10-25 03:58:45 +02:00
|
|
|
};
|
|
|
|
|
2005-11-12 13:15:48 +00:00
|
|
|
static const char* warsow_masterprotocols[] = {
|
2013-10-27 14:45:22 +01:00
|
|
|
"auto",
|
|
|
|
"15 - v1.02",
|
2008-01-23 21:36:41 +00:00
|
|
|
"10 - v0.40",
|
|
|
|
"9 - v0.32",
|
2007-01-09 15:14:46 +00:00
|
|
|
"8 - v0.2",
|
2006-05-28 11:46:33 +00:00
|
|
|
"7 - v0.1",
|
|
|
|
"6 - v0.072",
|
2005-11-12 13:15:48 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s warsow_prefs = {
|
|
|
|
protocols: warsow_masterprotocols,
|
|
|
|
defproto : "15",
|
2005-11-12 13:15:48 +00:00
|
|
|
};
|
|
|
|
|
2006-04-08 08:00:56 +00:00
|
|
|
static const char* tremulous_masterprotocols[] = {
|
|
|
|
"auto",
|
|
|
|
"69 - v1.1.0",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s tremulous_prefs = {
|
|
|
|
protocols: tremulous_masterprotocols,
|
|
|
|
defproto : "69",
|
2006-04-08 08:00:56 +00:00
|
|
|
};
|
|
|
|
|
2014-09-28 09:55:53 +02:00
|
|
|
static const char* tremulousgpp_masterprotocols[] = {
|
|
|
|
"auto",
|
|
|
|
"70 - GPP",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s tremulousgpp_prefs = {
|
|
|
|
protocols: tremulousgpp_masterprotocols,
|
|
|
|
defproto : "70",
|
2014-09-28 09:55:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* tremfusion_masterprotocols[] = {
|
|
|
|
"auto",
|
|
|
|
"69 - v0.99",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s tremfusion_prefs = {
|
|
|
|
protocols: tremfusion_masterprotocols,
|
|
|
|
defproto : "69",
|
2014-09-28 09:55:53 +02:00
|
|
|
};
|
|
|
|
|
2013-10-26 00:11:19 +02:00
|
|
|
static const char* unvanquished_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
2013-10-26 00:11:19 +02:00
|
|
|
"86",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s unvanquished_prefs = {
|
|
|
|
protocols: unvanquished_masterprotocols,
|
|
|
|
defproto : "86",
|
2013-10-26 00:11:19 +02:00
|
|
|
};
|
|
|
|
|
2008-09-13 18:17:31 +00:00
|
|
|
static const char* openarena_masterprotocols[] = {
|
|
|
|
"auto",
|
2013-10-27 14:45:22 +01:00
|
|
|
"71 - v0.8.8"
|
2014-10-16 02:04:09 +02:00
|
|
|
"70 - v0.8.0",
|
2008-09-13 18:17:31 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s openarena_prefs = {
|
|
|
|
protocols: openarena_masterprotocols,
|
|
|
|
defproto : "71",
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* q3rally_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"71 - v0.0.0.3",
|
|
|
|
NULL
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s q3rally_prefs = {
|
|
|
|
protocols: q3rally_masterprotocols,
|
|
|
|
defproto : "71",
|
2008-09-13 18:17:31 +00:00
|
|
|
};
|
2006-04-08 08:00:56 +00:00
|
|
|
|
2013-11-10 00:20:39 +01:00
|
|
|
static const char* wop_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"71",
|
|
|
|
"70",
|
|
|
|
"69",
|
|
|
|
"68",
|
|
|
|
NULL
|
2013-11-10 00:20:39 +01:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s wop_prefs = {
|
|
|
|
protocols: wop_masterprotocols,
|
|
|
|
defproto : "71",
|
2013-11-10 00:20:39 +01:00
|
|
|
};
|
|
|
|
|
2008-11-23 16:55:17 +00:00
|
|
|
static const char* iourt_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"68 - v1.35",
|
|
|
|
NULL
|
2008-11-23 16:55:17 +00:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s iourt_prefs = {
|
|
|
|
protocols: iourt_masterprotocols,
|
|
|
|
defproto : "68",
|
2008-11-23 16:55:17 +00:00
|
|
|
};
|
|
|
|
|
2013-10-27 14:45:22 +01:00
|
|
|
static const char* reaction_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"68",
|
|
|
|
NULL
|
2013-10-26 01:24:33 +02:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s reaction_prefs = {
|
|
|
|
protocols: reaction_masterprotocols,
|
|
|
|
defproto : "68",
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char* smokinguns_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"68 - v1.1",
|
|
|
|
NULL
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s smokinguns_prefs = {
|
|
|
|
protocols: smokinguns_masterprotocols,
|
|
|
|
defproto : "68",
|
2013-10-26 01:24:33 +02:00
|
|
|
};
|
|
|
|
|
2014-10-10 07:31:50 +02:00
|
|
|
static const char* zeq2lite_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"75",
|
|
|
|
NULL
|
2014-10-10 07:31:50 +02:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s zeq2lite_prefs = {
|
|
|
|
protocols: zeq2lite_masterprotocols,
|
|
|
|
defproto : "75",
|
2014-10-10 07:31:50 +02:00
|
|
|
};
|
|
|
|
|
2014-10-14 23:14:48 +02:00
|
|
|
static const char* turtlearena_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"9",
|
|
|
|
NULL
|
2014-10-14 23:14:48 +02:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s turtlearena_prefs = {
|
|
|
|
protocols: turtlearena_masterprotocols,
|
|
|
|
defproto : "9",
|
2014-10-14 23:14:48 +02:00
|
|
|
};
|
|
|
|
|
2013-10-27 14:45:22 +01:00
|
|
|
static const char* alienarena_masterprotocols[] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
"auto",
|
|
|
|
"34 - v7.66",
|
|
|
|
NULL
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static struct q3_common_prefs_s alienarena_prefs = {
|
|
|
|
protocols: alienarena_masterprotocols,
|
|
|
|
defproto : "34",
|
2013-10-27 14:45:22 +01:00
|
|
|
};
|
|
|
|
|
2005-11-12 11:31:56 +00:00
|
|
|
static struct q3_common_prefs_s* get_pref_widgets_for_game(enum server_type type);
|
|
|
|
|
2002-10-29 11:14:04 +00:00
|
|
|
static void game_file_dialog(enum server_type type);
|
|
|
|
static void game_dir_dialog(enum server_type type);
|
|
|
|
static void game_file_activate_callback(enum server_type type);
|
|
|
|
static void sound_player_file_dialog();
|
|
|
|
static void sound_xqf_start_file_dialog();
|
|
|
|
static void sound_xqf_quit_file_dialog();
|
|
|
|
static void sound_update_done_file_dialog();
|
|
|
|
static void sound_refresh_done_file_dialog();
|
|
|
|
static void sound_stop_file_dialog();
|
|
|
|
static void sound_server_connect_file_dialog();
|
|
|
|
static void sound_redial_success_file_dialog();
|
|
|
|
|
2002-10-22 16:15:18 +00:00
|
|
|
static inline int compare_slist_strings (gconstpointer str1, gconstpointer str2) {
|
2014-10-16 02:04:09 +02:00
|
|
|
int res;
|
|
|
|
|
|
|
|
if (str1) {
|
|
|
|
if (str2) {
|
|
|
|
res = g_ascii_strcasecmp (str1, str2);
|
|
|
|
if (!res) {
|
|
|
|
res = strcmp (str1, str2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
res = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
res = (str2)? -1 : 0;
|
|
|
|
}
|
|
|
|
return res;
|
2002-10-22 16:15:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-05 20:40:48 +00:00
|
|
|
static void get_new_defaults_for_game (enum server_type type) {
|
2014-10-16 02:04:09 +02:00
|
|
|
struct game *g = &games[type];
|
|
|
|
struct generic_prefs *prefs = &genprefs[type];
|
|
|
|
char buf[256];
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "get_new_defaults_for_game(%d)",type);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->cmd_entry) {
|
|
|
|
if (g->cmd) g_free (g->cmd);
|
|
|
|
g->cmd = strdup_strip (gtk_entry_get_text (GTK_ENTRY (prefs->cmd_entry)));
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->dir_entry) {
|
|
|
|
if (g->dir) g_free (g->dir);
|
|
|
|
g->dir = strdup_strip (gtk_entry_get_text (GTK_ENTRY (prefs->dir_entry)));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->real_dir) g_free (g->real_dir);
|
|
|
|
g->real_dir = expand_tilde (g->dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->pref_dir) g_free (prefs->pref_dir);
|
|
|
|
prefs->pref_dir = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->real_dir) g_free (prefs->real_dir);
|
|
|
|
prefs->real_dir = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->cfg_combo) {
|
|
|
|
if (g->game_cfg) g_free (g->game_cfg);
|
|
|
|
g->game_cfg = strdup_strip (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (prefs->cfg_combo)->entry)));
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_snprintf (buf, sizeof(buf), "/" CONFIG_FILE "/Game: %s", type2id (type));
|
|
|
|
config_push_prefix (buf);
|
2001-10-03 15:13:07 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->cmd)
|
|
|
|
config_set_string ("cmd", g->cmd);
|
|
|
|
else
|
|
|
|
config_clean_key ("cmd");
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->dir)
|
|
|
|
config_set_string ("dir", g->dir);
|
|
|
|
else
|
|
|
|
config_clean_key ("dir");
|
2005-11-12 11:31:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->game_cfg)
|
|
|
|
config_set_string ("custom cfg", g->game_cfg);
|
|
|
|
else
|
|
|
|
config_clean_key ("custom cfg");
|
2005-11-12 11:31:56 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Set custom arguments
|
|
|
|
if (g->custom_args) {
|
|
|
|
g_slist_free (g->custom_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
g->custom_args = g_slist_sort (prefs->custom_args, compare_slist_strings);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
char *str = NULL;
|
|
|
|
int isdefault = FALSE;
|
|
|
|
GSList *list = g->custom_args;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0;list; list = g_slist_next(list), ++i) {
|
|
|
|
g_snprintf (buf, sizeof(buf), "custom_arg%d", i);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_set_string (buf, (char *) list->data);
|
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Clear remaining existing arguments
|
|
|
|
g_snprintf (buf, sizeof(buf), "custom_arg%d", i);
|
2004-05-08 21:11:20 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
str = config_get_string_with_default (buf,&isdefault);
|
|
|
|
while (!isdefault) {
|
|
|
|
config_clean_key (buf);
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
++i;
|
|
|
|
g_snprintf (buf, sizeof(buf), "custom_arg%d", i);
|
|
|
|
g_free(str);
|
|
|
|
str = config_get_string_with_default (buf,&isdefault);
|
|
|
|
}
|
|
|
|
}
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->update_prefs) {
|
|
|
|
g->update_prefs(g);
|
|
|
|
}
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
|
|
|
}
|
2005-10-07 12:55:15 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void load_game_defaults (enum server_type type) {
|
|
|
|
struct game *g = &games[type];
|
|
|
|
char str[256];
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
int isdefault = FALSE;
|
|
|
|
char *str2;
|
|
|
|
char conf[64];
|
|
|
|
int j;
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_snprintf (str, 256, "/" CONFIG_FILE "/Game: %s", type2id (type));
|
|
|
|
config_push_prefix (str);
|
2001-08-20 01:57:36 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free (g->cmd);
|
|
|
|
g->cmd = config_get_string ("cmd");
|
2006-04-08 08:00:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free (g->dir);
|
|
|
|
g->dir = config_get_string ("dir");
|
2004-08-07 18:34:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free (g->real_dir);
|
|
|
|
g->real_dir = expand_tilde (g->dir);
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free (g->game_cfg);
|
|
|
|
g->game_cfg = config_get_string ("custom cfg");
|
2005-01-12 21:23:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g->real_home = expand_tilde (g->default_home);
|
2005-10-07 12:55:15 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Load custom arguments
|
|
|
|
j = 0;
|
|
|
|
g_snprintf (conf, 64, "custom_arg%d", j);
|
|
|
|
str2 = config_get_string_with_default (conf,&isdefault);
|
|
|
|
while (!isdefault) {
|
|
|
|
g->custom_args = g_slist_append(g->custom_args, str2);
|
|
|
|
debug(2,"game: %s: %s=%s",type2id (type), conf,str2);
|
2003-04-24 19:51:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
++j;
|
|
|
|
g_snprintf (conf, sizeof(conf), "custom_arg%d", j);
|
|
|
|
str2 = config_get_string_with_default (conf,&isdefault);
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2005-01-12 21:23:11 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// verify Quake3 settings, return false if something's not ok
|
|
|
|
int verify_q3_settings (void) {
|
|
|
|
int com_hunkmegs = 0;
|
|
|
|
int com_zonemegs = 0;
|
|
|
|
int com_soundmegs = 0;
|
|
|
|
// int cg_precachedmodels = 0;
|
|
|
|
|
|
|
|
com_hunkmegs = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_hunkmegs_spinner));
|
|
|
|
com_soundmegs = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_soundmegs_spinner));
|
|
|
|
com_zonemegs = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_zonemegs_spinner));
|
|
|
|
// cg_precachedmodels = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(cg_precachedmodels_spinner));
|
|
|
|
|
|
|
|
if ( com_soundmegs + com_zonemegs >= com_hunkmegs ) {
|
|
|
|
dialog_ok (NULL, _("com_soundmegs and com_zonemegs must be lower than com_hunkmegs"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2005-01-12 21:23:11 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q1_update_prefs (struct game* g) {
|
|
|
|
char* str;
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q1_top_color != default_q1_top_color) {
|
|
|
|
config_set_int ("top", default_q1_top_color = pref_q1_top_color);
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q1_bottom_color != default_q1_bottom_color) {
|
|
|
|
config_set_int ("bottom", default_q1_bottom_color = pref_q1_bottom_color);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (name_q1_entry)));
|
|
|
|
if (str == NULL || default_q1_name == NULL || (default_q1_name && strcmp (str, default_q1_name))) {
|
|
|
|
if (default_q1_name) {
|
|
|
|
g_free (default_q1_name);
|
|
|
|
}
|
|
|
|
default_q1_name = str;
|
|
|
|
config_set_string ("player name", (str)? str : "");
|
|
|
|
}
|
|
|
|
str=NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* QuakeWorld (some network settings are used by Q2) */
|
|
|
|
void qw_update_prefs (struct game* g) {
|
|
|
|
char* str;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (name_qw_entry)));
|
|
|
|
if (str == NULL || default_qw_name == NULL || (default_qw_name && strcmp (str, default_qw_name))) {
|
|
|
|
if (default_qw_name) {
|
|
|
|
g_free (default_qw_name);
|
|
|
|
}
|
|
|
|
default_qw_name = str;
|
|
|
|
config_set_string ("player name", (str)? str : "");
|
|
|
|
}
|
|
|
|
str=NULL;
|
|
|
|
|
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (team_qw_entry)));
|
|
|
|
if (str == NULL || default_qw_team == NULL || (default_qw_team && strcmp (str, default_qw_team))) {
|
|
|
|
if (default_qw_team) {
|
|
|
|
g_free (default_qw_team);
|
|
|
|
}
|
|
|
|
default_qw_team = str;
|
|
|
|
config_set_string ("team", (str)? str : "");
|
|
|
|
}
|
|
|
|
str=NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_top_color != default_qw_top_color) {
|
|
|
|
config_set_int ("top", default_qw_top_color = pref_qw_top_color);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_bottom_color != default_qw_bottom_color) {
|
|
|
|
config_set_int ("bottom", default_qw_bottom_color = pref_qw_bottom_color);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_skin == NULL || (default_qw_skin && strcmp (pref_qw_skin, default_qw_skin))) {
|
|
|
|
if (default_qw_skin) {
|
|
|
|
g_free (default_qw_skin);
|
|
|
|
}
|
|
|
|
default_qw_skin = pref_qw_skin;
|
|
|
|
config_set_string ("skin", (pref_qw_skin)? pref_qw_skin : "");
|
|
|
|
}
|
|
|
|
pref_qw_skin = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rate_spinner[0]));
|
|
|
|
if (i != default_qw_rate) {
|
|
|
|
config_set_int ("rate", default_qw_rate = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (cl_nodelta_check_button[0])->active;
|
|
|
|
if (i != default_qw_cl_nodelta) {
|
|
|
|
config_set_int ("cl_nodelta", default_qw_cl_nodelta = i);
|
|
|
|
}
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = 1 - GTK_TOGGLE_BUTTON (cl_predict_check_button[0])->active;
|
|
|
|
if (i != default_qw_cl_predict) {
|
|
|
|
config_set_int ("cl_predict", default_qw_cl_predict = i);
|
|
|
|
}
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_noskins != default_qw_noskins) {
|
|
|
|
config_set_int ("noskins", default_qw_noskins = pref_qw_noskins);
|
|
|
|
}
|
2003-05-19 20:26:02 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (noaim_check_button)->active;
|
|
|
|
if (i != default_noaim) {
|
|
|
|
config_set_int ("noaim", default_noaim = i);
|
|
|
|
}
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
if (GTK_TOGGLE_BUTTON (pushlatency_mode_radio_buttons[i])->active) {
|
|
|
|
if (i != pushlatency_mode) {
|
|
|
|
config_set_int ("pushlatency mode", pushlatency_mode = i);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (
|
|
|
|
GTK_SPIN_BUTTON (pushlatency_value_spinner));
|
|
|
|
if (i != pushlatency_value) {
|
|
|
|
config_set_int ("pushlatency value", pushlatency_value = i);
|
|
|
|
}
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_b_switch != default_b_switch) {
|
|
|
|
config_set_int ("b_switch", default_b_switch = pref_b_switch);
|
|
|
|
}
|
2002-10-09 00:54:58 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_w_switch != default_w_switch) {
|
|
|
|
config_set_int ("w_switch", default_w_switch = pref_w_switch);
|
|
|
|
}
|
|
|
|
}
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q2_update_prefs (struct game* g) {
|
|
|
|
char* str;
|
|
|
|
int i;
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q2_skin == NULL ||
|
|
|
|
(default_q2_skin && strcmp (pref_q2_skin, default_q2_skin))) {
|
|
|
|
if (default_q2_skin) g_free (default_q2_skin);
|
|
|
|
default_q2_skin = pref_q2_skin;
|
|
|
|
config_set_string ("skin", (pref_q2_skin)? pref_q2_skin : "");
|
|
|
|
}
|
|
|
|
pref_q2_skin = NULL;
|
|
|
|
|
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (name_q2_entry)));
|
|
|
|
if (str == NULL || default_q2_name == NULL ||
|
|
|
|
(default_q2_name && strcmp (str, default_q2_name))) {
|
|
|
|
if (default_q2_name) g_free (default_q2_name);
|
|
|
|
default_q2_name = str;
|
|
|
|
config_set_string ("player name", (str)? str : "");
|
|
|
|
}
|
|
|
|
str=NULL;
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rate_spinner[1]));
|
|
|
|
if (i != default_q2_rate) {
|
|
|
|
config_set_int ("rate", default_q2_rate = i);
|
|
|
|
}
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (cl_nodelta_check_button[1])->active;
|
|
|
|
if (i != default_q2_cl_nodelta) {
|
|
|
|
config_set_int ("cl_nodelta", default_q2_cl_nodelta = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = 1 - GTK_TOGGLE_BUTTON (cl_predict_check_button[1])->active;
|
|
|
|
if (i != default_q2_cl_predict) {
|
|
|
|
config_set_int ("cl_predict", default_q2_cl_predict = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q2_noskins != default_q2_noskins) {
|
|
|
|
config_set_int ("noskins", default_q2_noskins = pref_q2_noskins);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q3_update_prefs_common (struct game* g) {
|
|
|
|
char* str, *str1;
|
|
|
|
const char* strold;
|
|
|
|
int i;
|
|
|
|
enum server_type type = g->type;
|
|
|
|
struct q3_common_prefs_s* w;
|
|
|
|
|
|
|
|
w = get_pref_widgets_for_game(type);
|
|
|
|
g_return_if_fail(w != NULL);
|
|
|
|
|
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (w->proto_entry)->entry)));
|
|
|
|
// locate first space and mark it as str's end
|
|
|
|
str1 = strchr(str,' ');
|
|
|
|
if (str1) *str1='\0';
|
|
|
|
|
|
|
|
strold = game_get_attribute(type,"masterprotocol");
|
|
|
|
if (strcmp(str, strold?strold:"")) {
|
|
|
|
game_set_attribute(type,"masterprotocol",strdup_strip(str));
|
|
|
|
config_set_string ("protocol", (str)? str : "");
|
|
|
|
}
|
|
|
|
g_free(str);
|
|
|
|
str=NULL;
|
|
|
|
|
|
|
|
if (w->setfs_gamebutton) {
|
|
|
|
int o;
|
|
|
|
i = GTK_TOGGLE_BUTTON (w->setfs_gamebutton)->active;
|
|
|
|
o = str2bool(game_get_attribute(type,"setfs_game"));
|
|
|
|
if (i != o) {
|
|
|
|
config_set_bool ("setfs_game", i);
|
|
|
|
game_set_attribute(type,"setfs_game",g_strdup(bool2str(i)));
|
|
|
|
}
|
|
|
|
}
|
2003-06-19 10:25:19 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (w->set_punkbusterbutton) {
|
|
|
|
int o;
|
|
|
|
i = GTK_TOGGLE_BUTTON (w->set_punkbusterbutton)->active;
|
|
|
|
o = str2bool(game_get_attribute(type,"set_punkbuster"));
|
|
|
|
if (i != o) {
|
|
|
|
config_set_bool ("set_punkbuster", i);
|
|
|
|
game_set_attribute(type,"set_punkbuster",g_strdup(bool2str(i)));
|
|
|
|
}
|
|
|
|
}
|
2001-01-01 05:40:32 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (w->console_button) {
|
|
|
|
int o;
|
|
|
|
i = GTK_TOGGLE_BUTTON (w->console_button)->active;
|
|
|
|
o = str2bool(game_get_attribute(type,"enable_console"));
|
|
|
|
if (i != o) {
|
|
|
|
config_set_bool ("enable_console", i);
|
|
|
|
game_set_attribute(type,"enable_console",g_strdup(bool2str(i)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q3_update_prefs (struct game* g) {
|
|
|
|
int i;
|
|
|
|
enum server_type type = g->type;
|
|
|
|
struct q3_common_prefs_s* w;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
w = get_pref_widgets_for_game(type);
|
|
|
|
g_return_if_fail(w != NULL);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q3_update_prefs_common(g);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (pass_memory_options_button)->active;
|
|
|
|
config_set_bool ("pass_memory_options", i);
|
|
|
|
game_set_attribute(type,"pass_memory_options",g_strdup(bool2str(i)));
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_hunkmegs_spinner));
|
|
|
|
config_set_int ("com_hunkmegs", i);
|
|
|
|
game_set_attribute(type,"com_hunkmegs",g_strdup_printf("%d",i));
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_soundmegs_spinner));
|
|
|
|
config_set_int ("com_soundmegs", i);
|
|
|
|
game_set_attribute(type,"com_soundmegs",g_strdup_printf("%d",i));
|
2004-06-19 18:24:07 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(com_zonemegs_spinner));
|
|
|
|
config_set_int ("com_zonemegs", i);
|
|
|
|
game_set_attribute(type,"com_zonemegs",g_strdup_printf("%d",i));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(cg_precachedmodels_spinner));
|
|
|
|
config_set_int ("cg_precachedmodels", i);
|
|
|
|
game_set_attribute(type,"cg_precachedmodels",g_strdup_printf("%d",i));
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void doom3_detect_version(struct game* g) {
|
|
|
|
FILE* f = NULL;
|
|
|
|
char* verinfo = NULL;
|
|
|
|
// const char* attrproto;
|
|
|
|
char line[64];
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug(3, "cmd: %s, dir: %s", g->cmd, g->real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// attrproto = game_get_attribute(g->type,"masterprotocol");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (g->real_home && *g->real_home) {
|
|
|
|
verinfo = file_in_dir (g->real_home, "version.info");
|
|
|
|
f = fopen(verinfo, "r");
|
|
|
|
}
|
2004-11-11 16:54:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!f) {
|
|
|
|
g_free(verinfo);
|
|
|
|
verinfo = file_in_dir (g->real_dir, "version.info");
|
|
|
|
f = fopen(verinfo, "r");
|
|
|
|
}
|
2004-11-11 16:54:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!f) {
|
|
|
|
goto out;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!fgets(line, sizeof(line), f)) {
|
|
|
|
goto out;
|
|
|
|
}
|
2002-10-04 18:57:29 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!fgets(line, sizeof(line), f)) {
|
|
|
|
goto out;
|
|
|
|
}
|
2002-10-04 18:57:29 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (strlen(line) && line[strlen(line)-1] == '\n') {
|
|
|
|
line[strlen(line)-1] = '\0';
|
|
|
|
}
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug(3, "detected %s protocol version %s", g->name, line);
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
game_set_attribute(g->type, "_masterprotocol", g_strdup(line));
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
out:
|
|
|
|
if (f) {
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
g_free(verinfo);
|
|
|
|
}
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void doom3_update_prefs (struct game* g) {
|
|
|
|
q3_update_prefs_common(g);
|
|
|
|
doom3_detect_version(g);
|
|
|
|
}
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void quake4_update_prefs (struct game* g) {
|
|
|
|
q3_update_prefs_common(g);
|
|
|
|
doom3_detect_version(g);
|
|
|
|
}
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void tribes2_update_prefs (struct game* g) {
|
|
|
|
char* str;
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
str = strdup_strip (gtk_entry_get_text (GTK_ENTRY (name_t2_entry)));
|
|
|
|
if (str == NULL || default_t2_name == NULL || (default_t2_name && strcmp (str, default_t2_name))) {
|
|
|
|
if (default_t2_name) {
|
|
|
|
g_free (default_t2_name);
|
|
|
|
}
|
|
|
|
default_t2_name = str;
|
|
|
|
config_set_string ("player name", (str)? str : "");
|
|
|
|
}
|
|
|
|
str=NULL;
|
|
|
|
}
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void ut2004_detect_cdkey(struct game* g) {
|
|
|
|
FILE* f = NULL;
|
|
|
|
char* keyfile = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug(2, "cmd: %s, dir: %s, home: %s", g->cmd, g->real_dir, g->real_home);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
keyfile = file_in_dir (g->real_home, "System/cdkey");
|
|
|
|
if (keyfile) {
|
|
|
|
f = fopen(keyfile, "r");
|
|
|
|
if (!f) {
|
|
|
|
g_free(keyfile);
|
|
|
|
keyfile = NULL;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!keyfile) {
|
|
|
|
if (f) {
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
keyfile = file_in_dir (g->real_dir, "System/cdkey");
|
|
|
|
if (keyfile) {
|
|
|
|
f = fopen(keyfile, "r");
|
|
|
|
if (!f) {
|
|
|
|
g_free(keyfile);
|
|
|
|
keyfile = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (keyfile || (!keyfile && game_get_attribute(g->type,"cdkey"))) {
|
|
|
|
game_set_attribute(g->type, "cdkey", keyfile);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (f) {
|
|
|
|
fclose(f);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void ut2004_update_prefs (struct game* g) {
|
|
|
|
ut2004_detect_cdkey(g);
|
2004-11-11 16:54:11 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void get_new_defaults (void) {
|
|
|
|
int i;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "get_new_defaults()");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Common part of games config */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Games Config");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (nosound_check_button)->active;
|
|
|
|
if (i != default_nosound) {
|
|
|
|
config_set_bool ("nosound", default_nosound = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (nocdaudio_check_button)->active;
|
|
|
|
if (i != default_nocdaudio) {
|
|
|
|
config_set_bool ("nocdaudio", default_nocdaudio = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
get_new_defaults_for_game (i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Appearance */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Appearance");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
if (GTK_TOGGLE_BUTTON (toolbar_style_radio_buttons[i])->active) {
|
|
|
|
if (i != default_toolbar_style) {
|
|
|
|
config_set_int ("toolbar style", default_toolbar_style = i);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (toolbar_tips_check_button)->active;
|
|
|
|
if (i != default_toolbar_tips) {
|
|
|
|
config_set_bool ("toolbar tips", default_toolbar_tips = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (countbots_check_button)->active;
|
|
|
|
if (i != serverlist_countbots) {
|
|
|
|
config_set_bool ("count bots", serverlist_countbots = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (refresh_sorts_check_button)->active;
|
|
|
|
if (i != default_refresh_sorts) {
|
|
|
|
config_set_bool ("sort on refresh", default_refresh_sorts = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (refresh_on_update_check_button)->active;
|
|
|
|
if (i != default_refresh_on_update) {
|
|
|
|
config_set_bool ("refresh on update", default_refresh_on_update = i);
|
|
|
|
}
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (resolve_on_update_check_button)->active;
|
|
|
|
if (i != default_resolve_on_update) {
|
|
|
|
config_set_bool ("resolve on update", default_resolve_on_update = i);
|
|
|
|
}
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (show_only_configured_games_check_button)->active;
|
|
|
|
if (i != default_show_only_configured_games) {
|
|
|
|
config_set_bool ("show only configured games", default_show_only_configured_games = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (use_custom_gtkrc_check_button)->active;
|
|
|
|
if (i != use_custom_gtkrc) {
|
|
|
|
config_set_bool ("use custom gtkrc", use_custom_gtkrc = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* General */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/General");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (terminate_check_button)->active;
|
|
|
|
if (i != default_terminate) {
|
|
|
|
config_set_bool ("terminate", default_terminate = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (iconify_check_button)->active;
|
|
|
|
if (i != default_iconify) {
|
|
|
|
config_set_bool ("iconify", default_iconify = i);
|
|
|
|
}
|
|
|
|
|
|
|
|
i = GTK_TOGGLE_BUTTON (launchinfo_check_button)->active;
|
|
|
|
if (i != default_launchinfo) {
|
|
|
|
config_set_bool ("launchinfo", default_launchinfo = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (stopxmms_check_button)->active;
|
|
|
|
if (i != default_stopxmms) {
|
|
|
|
config_set_bool ("stopxmms", default_stopxmms = i);
|
|
|
|
}
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (prelaunchexec_check_button)->active;
|
|
|
|
if (i != default_prelaunchexec) {
|
|
|
|
config_set_bool ("prelaunchexec", default_prelaunchexec = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (save_lists_check_button)->active;
|
|
|
|
if (i != default_save_lists) {
|
|
|
|
config_set_bool ("save lists", default_save_lists = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (save_srvinfo_check_button)->active;
|
|
|
|
if (i != default_save_srvinfo) {
|
|
|
|
config_set_bool ("save srvinfo", default_save_srvinfo = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (save_plrinfo_check_button)->active;
|
|
|
|
if (i != default_save_plrinfo) {
|
|
|
|
config_set_bool ("save players", default_save_plrinfo = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (auto_favorites_check_button)->active;
|
|
|
|
if (i != default_auto_favorites) {
|
|
|
|
config_set_bool ("refresh favorites", default_auto_favorites = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (show_splash_button)->active;
|
|
|
|
if (i != default_show_splash) {
|
|
|
|
config_set_bool ("splash screen", default_show_splash = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (auto_maps_check_button)->active;
|
|
|
|
if (i != default_auto_maps) {
|
|
|
|
config_set_bool ("search maps", default_auto_maps = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/*Tray icon*/
|
|
|
|
i = GTK_TOGGLE_BUTTON (tray_icon_check_button)->active;
|
|
|
|
if (i != default_show_tray_icon) {
|
|
|
|
config_set_bool ("showtray", default_show_tray_icon = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* QStat */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/QStat");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (maxretries_spinner));
|
|
|
|
if (i != maxretries) {
|
|
|
|
config_set_int ("maxretires", maxretries = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (maxsimultaneous_spinner));
|
|
|
|
if (i != maxsimultaneous) {
|
|
|
|
config_set_int ("maxsimultaneous", maxsimultaneous = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qstat_srcip_changed) {
|
|
|
|
if (qstat_srcip) {
|
|
|
|
config_set_string ("srcip", qstat_srcip);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
config_clean_key("srcip");
|
|
|
|
}
|
|
|
|
qstat_srcip_changed = FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qstat_srcport_changed) {
|
|
|
|
if (qstat_srcport_low) {
|
|
|
|
config_set_int ("port_low", qstat_srcport_low);
|
|
|
|
config_set_int ("port_high", qstat_srcport_high);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
config_clean_key("port_low");
|
|
|
|
config_clean_key("port_high");
|
|
|
|
}
|
|
|
|
qstat_srcport_changed = FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sounds */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Sounds");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = GTK_TOGGLE_BUTTON (sound_enable_check_button)->active;
|
|
|
|
if (i != sound_enable) {
|
|
|
|
config_set_bool ("sound_enable", sound_enable = i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_player = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_player_entry)));
|
|
|
|
config_set_string ("sound_player", (sound_player)? sound_player : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_xqf_start = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_xqf_start_entry)));
|
|
|
|
config_set_string ("sound_xqf_start", (sound_xqf_start)? sound_xqf_start : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_xqf_quit = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_xqf_quit_entry)));
|
|
|
|
config_set_string ("sound_xqf_quit", (sound_xqf_quit)? sound_xqf_quit : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_update_done = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_update_done_entry)));
|
|
|
|
config_set_string ("sound_update_done", (sound_update_done)? sound_update_done : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_refresh_done = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_refresh_done_entry)));
|
|
|
|
config_set_string ("sound_refresh_done", (sound_refresh_done)? sound_refresh_done : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_stop = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_stop_entry)));
|
|
|
|
config_set_string ("sound_stop", (sound_stop)? sound_stop : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_server_connect = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_server_connect_entry)));
|
|
|
|
config_set_string ("sound_server_connect", (sound_server_connect)? sound_server_connect : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_redial_success = strdup_strip (gtk_entry_get_text (GTK_ENTRY (sound_redial_success_entry)));
|
|
|
|
config_set_string ("sound_redial_success", (sound_redial_success)? sound_redial_success : "");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* These are set from chained calls to "activate" callbacks */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_check_menu_item_set_active (
|
|
|
|
GTK_CHECK_MENU_ITEM (view_hostnames_menu_item),
|
|
|
|
GTK_TOGGLE_BUTTON (show_hostnames_check_button)->active);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_check_menu_item_set_active (
|
|
|
|
GTK_CHECK_MENU_ITEM (view_defport_menu_item),
|
|
|
|
GTK_TOGGLE_BUTTON (show_defport_check_button)->active);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// i = gtk_notebook_get_current_page (GTK_NOTEBOOK (profile_notebook));
|
|
|
|
// config_set_string ("/" CONFIG_FILE "/Player Profile/game", type2id (i));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
i = gtk_notebook_get_current_page (GTK_NOTEBOOK (games_notebook));
|
|
|
|
config_set_string ("/" CONFIG_FILE "/Games Config/game", type2id (i));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_sync ();
|
|
|
|
rc_save ();
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static int check_qstat_source_port() {
|
|
|
|
unsigned short low, high;
|
|
|
|
const char* val;
|
|
|
|
struct in_addr in;
|
|
|
|
|
|
|
|
val = gtk_entry_get_text(GTK_ENTRY(qstat_srcport_entry_low));
|
|
|
|
low = atoi(val);
|
|
|
|
|
|
|
|
val = gtk_entry_get_text(GTK_ENTRY(qstat_srcport_entry_high));
|
|
|
|
high = atoi(val);
|
|
|
|
|
|
|
|
val = gtk_entry_get_text(GTK_ENTRY(qstat_srcip_entry));
|
|
|
|
if (val && *val) {
|
|
|
|
if (!inet_aton(val, &in)) {
|
|
|
|
dialog_ok(NULL, _("Invalid source IP address"));
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (pref_notebook), PREF_PAGE_QSTAT);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
val = inet_ntoa(in);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if ((low != 0 || high != 0) && (low < 1024 || high < 1024 || low > high)) {
|
|
|
|
dialog_ok(NULL, _("Invalid source port range"));
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (pref_notebook), PREF_PAGE_QSTAT);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (val && *val) {
|
|
|
|
if (!qstat_srcip || strcmp(qstat_srcip,val)) {
|
|
|
|
g_free(qstat_srcip);
|
|
|
|
qstat_srcip = g_strdup(val);
|
|
|
|
qstat_srcip_changed = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(qstat_srcip) {
|
|
|
|
g_free(qstat_srcip);
|
|
|
|
qstat_srcip = NULL;
|
|
|
|
qstat_srcip_changed = TRUE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qstat_srcport_low != low) {
|
|
|
|
qstat_srcport_low = low;
|
|
|
|
qstat_srcport_changed = TRUE;
|
|
|
|
}
|
|
|
|
if (qstat_srcport_high != high) {
|
|
|
|
qstat_srcport_high = high;
|
|
|
|
qstat_srcport_changed = TRUE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// call various verification fuctions, store settings and destroy preferences
|
|
|
|
// window if everything's fine
|
|
|
|
static void ok_callback (GtkWidget *widget, GtkWidget* window) {
|
|
|
|
if (!verify_q3_settings()) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!check_qstat_source_port()) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!check_script_prefs()) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
save_script_prefs();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
get_new_defaults();
|
|
|
|
gtk_widget_destroy(window);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Refresh list of sources on screen in case the 'Show only configured games'
|
|
|
|
// setting has changes, or a game command line has been added or removed.
|
|
|
|
refresh_source_list();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Enable / disable tooltips after config change
|
|
|
|
if (default_toolbar_tips) {
|
|
|
|
gtk_tooltips_enable(tooltips);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gtk_tooltips_disable(tooltips);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void update_q1_skin (void) {
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q1_skin_preview == NULL) {
|
|
|
|
return; /* no configuration window */
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q1_skin_data) {
|
|
|
|
g_free (q1_skin_data);
|
|
|
|
q1_skin_data = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Use QuakeWorld 'base' skin */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q1_skin_data = get_qw_skin ("base", genprefs[QW_SERVER].real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q1_skin_data || q1_skin_is_valid) {
|
|
|
|
draw_qw_skin (q1_skin_preview, q1_skin_data, pref_q1_top_color, pref_q1_bottom_color);
|
|
|
|
q1_skin_is_valid = (q1_skin_data)? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void update_qw_skins (char *initstr) {
|
|
|
|
GList *list;
|
|
|
|
char *str = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_preview == NULL) {
|
|
|
|
return; /* no configuration window */
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_data) {
|
|
|
|
g_free (qw_skin_data);
|
|
|
|
qw_skin_data = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
list = get_qw_skin_list (genprefs[QW_SERVER].real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (initstr) {
|
|
|
|
combo_set_vals (qw_skin_combo, list, initstr);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (qw_skin_combo)->entry)));
|
|
|
|
combo_set_vals (qw_skin_combo, list, str);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (list) {
|
|
|
|
qw_skin_data = get_qw_skin (pref_qw_skin, genprefs[QW_SERVER].real_dir);
|
|
|
|
g_list_foreach (list, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (list);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (str) {
|
|
|
|
g_free (str);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_data || qw_skin_is_valid) {
|
|
|
|
draw_qw_skin (qw_skin_preview, qw_skin_data, pref_qw_top_color, pref_qw_bottom_color);
|
|
|
|
qw_skin_is_valid = (qw_skin_data)? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void update_q2_skins (char *initstr) {
|
|
|
|
GList *list;
|
|
|
|
char *str = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_preview == NULL) {
|
|
|
|
return; /* no configuration window */
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_data) {
|
|
|
|
g_free (q2_skin_data);
|
|
|
|
q2_skin_data = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
list = get_q2_skin_list (genprefs[Q2_SERVER].real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (initstr) {
|
|
|
|
combo_set_vals (q2_skin_combo, list, initstr);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (q2_skin_combo)->entry)));
|
|
|
|
combo_set_vals (q2_skin_combo, list, str);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (list) {
|
|
|
|
q2_skin_data = get_q2_skin (pref_q2_skin, genprefs[Q2_SERVER].real_dir);
|
|
|
|
g_list_foreach (list, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (list);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (str)
|
|
|
|
g_free (str);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_data || q2_skin_is_valid) {
|
|
|
|
draw_q2_skin (q2_skin_preview, q2_skin_data, Q2_SKIN_SCALE);
|
|
|
|
q2_skin_is_valid = (q2_skin_data)? TRUE : FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void update_cfgs (enum server_type type, char *dir, char *initstr) {
|
|
|
|
struct generic_prefs *prefs = &genprefs[type];
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
GList *cfgs;
|
|
|
|
char *str = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "update_cfgs(%d,%s,%s)",type,dir,initstr);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!prefs->cfg_combo) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
cfgs = (*games[type].custom_cfgs) (&games[type], dir, NULL);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (initstr) {
|
|
|
|
combo_set_vals (prefs->cfg_combo, cfgs, initstr);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
str = g_strdup (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (prefs->cfg_combo)->entry)));
|
|
|
|
combo_set_vals (prefs->cfg_combo, cfgs, str);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (cfgs) {
|
|
|
|
g_list_foreach (cfgs, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (cfgs);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (str) {
|
|
|
|
g_free (str);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static gboolean dir_entry_activate_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
struct generic_prefs *prefs;
|
|
|
|
enum server_type type;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
prefs = &genprefs[type];
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (3, "type=%d",type);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (prefs->pref_dir) g_free (prefs->pref_dir);
|
|
|
|
prefs->pref_dir = strdup_strip (gtk_entry_get_text (GTK_ENTRY (prefs->dir_entry)));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free (prefs->real_dir);
|
|
|
|
prefs->real_dir = expand_tilde (prefs->pref_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (games[type].cmd_or_dir_changed) {
|
|
|
|
games[type].cmd_or_dir_changed(&games[type]);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
update_cfgs (type, prefs->real_dir, NULL);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void qw_skin_combo_changed_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
char *new_skin;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
new_skin = strdup_strip (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (qw_skin_combo)->entry)));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!pref_qw_skin && !new_skin) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_skin && new_skin) {
|
|
|
|
if (strcmp (pref_qw_skin, new_skin) == 0) {
|
|
|
|
g_free (new_skin);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_qw_skin) g_free (pref_qw_skin);
|
|
|
|
pref_qw_skin = new_skin;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_data) g_free (qw_skin_data);
|
|
|
|
qw_skin_data = get_qw_skin (pref_qw_skin, genprefs[QW_SERVER].real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_data || qw_skin_is_valid) {
|
|
|
|
draw_qw_skin (qw_skin_preview, qw_skin_data,
|
|
|
|
pref_qw_top_color, pref_qw_bottom_color);
|
|
|
|
qw_skin_is_valid = (qw_skin_data)? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *color_button_event_widget = NULL;
|
2001-10-01 16:24:55 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void set_player_color (GtkWidget *widget, int i) {
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_button_event_widget == qw_top_color_button) {
|
|
|
|
if (pref_qw_top_color != i) {
|
|
|
|
pref_qw_top_color = i;
|
|
|
|
set_bg_color (qw_top_color_button, pref_qw_top_color);
|
|
|
|
if (qw_skin_is_valid) {
|
|
|
|
draw_qw_skin (qw_skin_preview, qw_skin_data,
|
|
|
|
pref_qw_top_color, pref_qw_bottom_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_button_event_widget == qw_bottom_color_button) {
|
|
|
|
if (pref_qw_bottom_color != i) {
|
|
|
|
pref_qw_bottom_color = i;
|
|
|
|
set_bg_color (qw_bottom_color_button, pref_qw_bottom_color);
|
|
|
|
if (qw_skin_is_valid) {
|
|
|
|
draw_qw_skin (qw_skin_preview, qw_skin_data,
|
|
|
|
pref_qw_top_color, pref_qw_bottom_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_button_event_widget == q1_top_color_button) {
|
|
|
|
if (pref_q1_top_color != i) {
|
|
|
|
pref_q1_top_color = i;
|
|
|
|
set_bg_color (q1_top_color_button, pref_q1_top_color);
|
|
|
|
if (q1_skin_is_valid) {
|
|
|
|
draw_qw_skin (q1_skin_preview, q1_skin_data,
|
|
|
|
pref_q1_top_color, pref_q1_bottom_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_button_event_widget == q1_bottom_color_button) {
|
|
|
|
if (pref_q1_bottom_color != i) {
|
|
|
|
pref_q1_bottom_color = i;
|
|
|
|
set_bg_color (q1_bottom_color_button, pref_q1_bottom_color);
|
|
|
|
if (q1_skin_is_valid) {
|
|
|
|
draw_qw_skin (q1_skin_preview, q1_skin_data,
|
|
|
|
pref_q1_top_color, pref_q1_bottom_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static int color_button_event_callback (GtkWidget *widget, GdkEvent *event) {
|
|
|
|
GdkEventButton *bevent;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (event->type == GDK_BUTTON_PRESS) {
|
|
|
|
bevent = (GdkEventButton *) event;
|
|
|
|
color_button_event_widget = widget;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_menu == NULL) {
|
|
|
|
color_menu = create_color_menu (set_player_color);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_menu_popup (GTK_MENU (color_menu), NULL, NULL, NULL, NULL,
|
|
|
|
bevent->button, bevent->time);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *q1_skin_box_create (void) {
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* Top and Bottom Colors */
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), table, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
/* Top (Shirt) Color */
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Top"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
q1_top_color_button = gtk_button_new_with_label (" ");
|
|
|
|
gtk_widget_set_usize (q1_top_color_button, 40, -1);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (q1_top_color_button), "event",
|
|
|
|
GTK_SIGNAL_FUNC (color_button_event_callback), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), q1_top_color_button,
|
|
|
|
1, 2, 0, 1);
|
|
|
|
set_bg_color (q1_top_color_button, fix_qw_player_color (pref_q1_top_color));
|
|
|
|
gtk_widget_show (q1_top_color_button);
|
|
|
|
|
|
|
|
/* Bottom (Pants) Color */
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Bottom"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
q1_bottom_color_button = gtk_button_new_with_label (" ");
|
|
|
|
gtk_widget_set_usize (q1_bottom_color_button, 40, -1);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (q1_bottom_color_button), "event",
|
|
|
|
GTK_SIGNAL_FUNC (color_button_event_callback), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), q1_bottom_color_button,
|
|
|
|
1, 2, 1, 2);
|
|
|
|
set_bg_color (q1_bottom_color_button,
|
|
|
|
fix_qw_player_color (pref_q1_bottom_color));
|
|
|
|
gtk_widget_show (q1_bottom_color_button);
|
|
|
|
|
|
|
|
gtk_widget_show (table);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Skin Preview */
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q1_skin_preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (q1_skin_preview), 320, 200);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), q1_skin_preview);
|
|
|
|
gtk_widget_show (q1_skin_preview);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (alignment);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return vbox;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *qw_skin_box_create (void) {
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* QW Skin ComboBox */
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0, 0, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
qw_skin_combo = gtk_combo_new ();
|
|
|
|
gtk_entry_set_max_length (GTK_ENTRY (GTK_COMBO (qw_skin_combo)->entry), 256);
|
|
|
|
gtk_widget_set_usize (GTK_COMBO (qw_skin_combo)->entry, 112, -1);
|
|
|
|
gtk_combo_set_use_arrows_always (GTK_COMBO (qw_skin_combo), TRUE);
|
|
|
|
gtk_combo_set_case_sensitive (GTK_COMBO (qw_skin_combo), TRUE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (qw_skin_combo)->entry),
|
|
|
|
"changed", GTK_SIGNAL_FUNC (qw_skin_combo_changed_callback), NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), qw_skin_combo);
|
|
|
|
gtk_widget_show (qw_skin_combo);
|
|
|
|
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
/* Top and Bottom Colors */
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), table, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
/* Top (Shirt) Color */
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Top"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
qw_top_color_button = gtk_button_new_with_label (" ");
|
|
|
|
gtk_widget_set_usize (qw_top_color_button, 40, -1);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (qw_top_color_button), "event",
|
|
|
|
GTK_SIGNAL_FUNC (color_button_event_callback), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), qw_top_color_button,
|
|
|
|
1, 2, 0, 1);
|
|
|
|
set_bg_color (qw_top_color_button, fix_qw_player_color (pref_qw_top_color));
|
|
|
|
gtk_widget_show (qw_top_color_button);
|
|
|
|
|
|
|
|
/* Bottom (Pants) Color */
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Bottom"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
qw_bottom_color_button = gtk_button_new_with_label (" ");
|
|
|
|
gtk_widget_set_usize (qw_bottom_color_button, 40, -1);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (qw_bottom_color_button), "event", GTK_SIGNAL_FUNC (color_button_event_callback), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), qw_bottom_color_button, 1, 2, 1, 2);
|
|
|
|
set_bg_color (qw_bottom_color_button, fix_qw_player_color (pref_qw_bottom_color));
|
|
|
|
gtk_widget_show (qw_bottom_color_button);
|
|
|
|
|
|
|
|
gtk_widget_show (table);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Skin Preview */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
qw_skin_preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (qw_skin_preview), 320, 200);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), qw_skin_preview);
|
|
|
|
gtk_widget_show (qw_skin_preview);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (alignment);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return vbox;
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void q2_skin_combo_changed_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
char *new_skin;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
new_skin = strdup_strip (gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (q2_skin_combo)->entry)));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!pref_q2_skin && !new_skin) {
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q2_skin && new_skin) {
|
|
|
|
if (strcmp (pref_q2_skin, new_skin) == 0) {
|
|
|
|
g_free (new_skin);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (pref_q2_skin) g_free (pref_q2_skin);
|
|
|
|
pref_q2_skin = new_skin;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_data) g_free (q2_skin_data);
|
|
|
|
q2_skin_data = get_q2_skin (pref_q2_skin, genprefs[Q2_SERVER].real_dir);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_data || q2_skin_is_valid) {
|
|
|
|
draw_q2_skin (q2_skin_preview, q2_skin_data, Q2_SKIN_SCALE);
|
|
|
|
q2_skin_is_valid = (q2_skin_data)? TRUE : FALSE;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *q2_skin_box_create (void) {
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Skin Preview */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (0, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q2_skin_preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (q2_skin_preview), 32 * Q2_SKIN_SCALE, 32 * Q2_SKIN_SCALE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), q2_skin_preview);
|
|
|
|
gtk_widget_show (q2_skin_preview);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (alignment);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Q2 Skin ComboBox */
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (1.0, 0, 0, 0);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q2_skin_combo = gtk_combo_new ();
|
|
|
|
gtk_entry_set_max_length (GTK_ENTRY (GTK_COMBO (q2_skin_combo)->entry), 256);
|
|
|
|
gtk_widget_set_usize (GTK_COMBO (q2_skin_combo)->entry, 144, -1);
|
|
|
|
gtk_combo_set_use_arrows_always (GTK_COMBO (q2_skin_combo), TRUE);
|
|
|
|
gtk_combo_set_case_sensitive (GTK_COMBO (q2_skin_combo), TRUE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (q2_skin_combo)->entry), "changed", GTK_SIGNAL_FUNC (q2_skin_combo_changed_callback), NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), q2_skin_combo);
|
|
|
|
gtk_widget_show (q2_skin_combo);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (alignment);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return vbox;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *player_profile_q1_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *q1_skin;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 6);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (TRUE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Player Name
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Name"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
name_q1_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (name_q1_entry, 96, -1);
|
|
|
|
if (default_q1_name) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (name_q1_entry), default_q1_name);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (name_q1_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), name_q1_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (name_q1_entry);
|
|
|
|
gtk_widget_show (hbox2);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// /Player Name
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Q1 Colors */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), alignment, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("Colors"));
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q1_skin = q1_skin_box_create ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), q1_skin);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (alignment);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (page_vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *player_profile_t2_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *label;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 6);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (TRUE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Player Name
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Login name"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
name_t2_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (name_t2_entry, 96, -1);
|
|
|
|
if (default_t2_name) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (name_t2_entry), default_t2_name);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (name_t2_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), name_t2_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (name_t2_entry);
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
|
|
|
|
// /Player Name
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *player_profile_qw_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *qw_skin;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 6);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (TRUE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* QW Skin */
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), alignment, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (_("Skin/Colors"));
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
|
|
|
|
|
|
|
qw_skin = qw_skin_box_create ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), qw_skin);
|
|
|
|
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
// Player Name
|
|
|
|
|
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Name"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
name_qw_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (name_qw_entry, 96, -1);
|
|
|
|
if (default_qw_name) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (name_qw_entry), default_qw_name);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (name_qw_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), name_qw_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (name_qw_entry);
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
|
|
|
|
// /Player Name
|
|
|
|
|
|
|
|
/* QW Team */
|
|
|
|
|
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 4);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Team"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
team_qw_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (team_qw_entry, 96, -1);
|
|
|
|
if (default_qw_team) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (team_qw_entry), default_qw_team);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (team_qw_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), team_qw_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (team_qw_entry);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GtkWidget *player_profile_q2_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *q2_skin;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
// Player Name
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Name"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
name_q2_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (name_q2_entry, 96, -1);
|
|
|
|
if (default_q2_name) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (name_q2_entry), default_q2_name);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (name_q2_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), name_q2_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (name_q2_entry);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
// /Player Name
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), alignment, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (_("Model/Skin"));
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
|
|
|
|
|
|
|
q2_skin = q2_skin_box_create ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), q2_skin);
|
|
|
|
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static GtkWidget *player_profile_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *game_label;
|
|
|
|
char *typestr;
|
|
|
|
enum server_type type = QW_SERVER;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 8);
|
|
|
|
|
|
|
|
/* Player Name */
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Name"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
name_entry = gtk_entry_new_with_max_length (32);
|
|
|
|
gtk_widget_set_usize (name_entry, 96, -1);
|
|
|
|
if (default_name) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (name_entry), default_name);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (name_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), name_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (name_entry);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
profile_notebook = gtk_notebook_new ();
|
|
|
|
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (profile_notebook), GTK_POS_TOP);
|
|
|
|
gtk_notebook_set_tab_hborder (GTK_NOTEBOOK (profile_notebook), 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), profile_notebook, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
game_label = game_pixmap_with_label (Q1_SERVER);
|
|
|
|
|
|
|
|
page = player_profile_q1_page ();
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (profile_notebook), page, game_label);
|
|
|
|
|
|
|
|
game_label = game_pixmap_with_label (QW_SERVER);
|
|
|
|
|
|
|
|
page = player_profile_qw_page ();
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (profile_notebook), page, game_label);
|
|
|
|
|
|
|
|
game_label = game_pixmap_with_label (Q2_SERVER);
|
|
|
|
|
|
|
|
page = player_profile_q2_page ();
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (profile_notebook), page, game_label);
|
|
|
|
|
|
|
|
typestr = config_get_string ("/" CONFIG_FILE "/Player Profile/game");
|
|
|
|
if (typestr) {
|
|
|
|
type = id2type (typestr);
|
|
|
|
g_free (typestr);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (profile_notebook),
|
|
|
|
(type == Q2_SERVER)? 2 : (type == Q1_SERVER)? 0 : 1);
|
|
|
|
|
|
|
|
gtk_widget_show (profile_notebook);
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
#endif
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
static char *wb_switch_labels[9] = {
|
2014-10-16 02:04:09 +02:00
|
|
|
N_("--- Anything ---"),
|
|
|
|
N_("Axe"),
|
|
|
|
N_("Shotgun"),
|
|
|
|
N_("Super Shotgun"),
|
|
|
|
N_("Nailgun"),
|
|
|
|
N_("Super Nailgun"),
|
|
|
|
N_("Grenade Launcher"),
|
|
|
|
N_("Rocket Launcher"),
|
|
|
|
N_("ThunderBolt")
|
2000-11-05 20:40:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void set_w_switch_callback (GtkWidget *widget, int i) {
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_w_switch = i;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void set_b_switch_callback (GtkWidget *widget, int i) {
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_b_switch = i;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GtkWidget *create_wb_switch_menu (void (*callback) (GtkWidget *, int)) {
|
2014-10-16 02:04:09 +02:00
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
int i;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
menu = gtk_menu_new ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
menu_item = gtk_menu_item_new_with_label (_(wb_switch_labels[i]));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (callback), GINT_TO_POINTER(i));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
|
|
|
gtk_widget_show (menu_item);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return menu;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
static void qw_noskins_option_menu_callback (GtkWidget *widget, int i) {
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_qw_noskins = i;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
static void q2_noskins_option_menu_callback (GtkWidget *widget, int i) {
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_q2_noskins = i;
|
2001-10-01 16:24:55 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
static GtkWidget *create_noskins_menu (int qworq2) {
|
2014-10-16 02:04:09 +02:00
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
void (*callback)=qworq2?q2_noskins_option_menu_callback:qw_noskins_option_menu_callback;
|
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
|
|
|
|
menu_item = gtk_menu_item_new_with_label (_("Use skins"));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (callback), (gpointer) 0);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
|
|
|
gtk_widget_show (menu_item);
|
|
|
|
|
|
|
|
menu_item = gtk_menu_item_new_with_label (_("Don\'t use skins"));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (callback), (gpointer) 1);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
|
|
|
gtk_widget_show (menu_item);
|
|
|
|
|
|
|
|
menu_item = gtk_menu_item_new_with_label (_("Don\'t download new skins"));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (callback), (gpointer) 2);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
|
|
|
gtk_widget_show (menu_item);
|
|
|
|
|
|
|
|
return menu;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2002-10-29 19:07:16 +00:00
|
|
|
// fill working directory with result of the directory guess function for first
|
|
|
|
// token of command line if working directory is empty
|
2014-10-16 02:04:09 +02:00
|
|
|
static void pref_guess_dir(enum server_type type, const char* cmdline, gboolean interactive) {
|
|
|
|
const char* dir_entry = NULL;
|
|
|
|
|
|
|
|
dir_entry = gtk_entry_get_text (GTK_ENTRY (genprefs[type].dir_entry));
|
|
|
|
|
|
|
|
if (dir_entry && *dir_entry && !interactive) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmdline && *cmdline) { // if not empty
|
|
|
|
char *guessed_dir = NULL;
|
|
|
|
char** cmds = NULL;
|
|
|
|
|
|
|
|
cmds = g_strsplit(cmdline," ",2);
|
|
|
|
|
|
|
|
if (cmds && *cmds && **cmds) {
|
|
|
|
guessed_dir = resolve_path(*cmds);
|
|
|
|
if (guessed_dir) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (genprefs[type].dir_entry), guessed_dir);
|
|
|
|
}
|
|
|
|
g_free(guessed_dir);
|
|
|
|
g_strfreev(cmds);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev(cmds);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interactive) {
|
|
|
|
dialog_ok (NULL, _("You must configure a command line first"));
|
|
|
|
}
|
2002-10-28 23:57:47 +00:00
|
|
|
}
|
|
|
|
|
2002-10-29 02:15:47 +00:00
|
|
|
|
|
|
|
/**
|
2014-10-16 02:04:09 +02:00
|
|
|
* return true if game 'type' has commands to suggest
|
|
|
|
*/
|
|
|
|
static gboolean pref_can_suggest(enum server_type type) {
|
|
|
|
return (games[type].command != NULL);
|
2002-10-29 02:15:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-16 02:04:09 +02:00
|
|
|
* find game binary in path and fill in command entry
|
|
|
|
*/
|
|
|
|
static void pref_suggest_command(enum server_type type) {
|
|
|
|
char** files = NULL;
|
|
|
|
char* suggested_file = NULL;
|
|
|
|
const char* prevcmd = NULL;
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
files = games[type].command;
|
|
|
|
if (!files || !files[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// start suggestion based on last found binary
|
|
|
|
prevcmd = gtk_entry_get_text (GTK_ENTRY (genprefs[type].cmd_entry));
|
|
|
|
for (i = 0; prevcmd && files[i]; ++i ) {
|
|
|
|
if (files[i+1] && !strcmp(files[i], prevcmd)) {
|
|
|
|
files = files+i+1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
suggested_file = find_file_in_path_list_relative(files);
|
|
|
|
if (!suggested_file) {
|
|
|
|
dialog_ok(_("Game not found"),
|
|
|
|
// %s name of a game
|
|
|
|
_("%s not found"),
|
|
|
|
games[type].name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// gtk entry does the freeing? -- no
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (genprefs[type].cmd_entry), suggested_file);
|
|
|
|
|
|
|
|
pref_guess_dir (type, suggested_file, TRUE);
|
|
|
|
|
|
|
|
if (games[type].cmd_or_dir_changed) {
|
|
|
|
games[type].cmd_or_dir_changed(&games[type]);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free(suggested_file);
|
|
|
|
|
2002-10-29 02:15:47 +00:00
|
|
|
return;
|
2014-10-16 02:04:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#warning FIXME: memleak, use strchr instead
|
|
|
|
static int custom_args_compare_func (gconstpointer ptr1, gconstpointer ptr2) {
|
|
|
|
// ptr1 = entire string
|
|
|
|
// ptr2 = game
|
|
|
|
char *temp[2];
|
|
|
|
|
|
|
|
tokenize (g_strdup((char *)ptr1), temp, 2, ",");
|
|
|
|
|
|
|
|
if (strcasecmp (temp[0], ptr2) == 0) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_custom_args_defaults2 (char *str1, char *str2, enum server_type type, gpointer data) {
|
|
|
|
char *temp;
|
|
|
|
char *temp2[2];
|
|
|
|
|
|
|
|
temp = g_strconcat (str1, ",", str2, NULL);
|
|
|
|
|
|
|
|
temp2[0] = strdup_strip (str1);
|
|
|
|
temp2[1] = strdup_strip (str2);
|
|
|
|
|
|
|
|
if (str1 && str2) {
|
|
|
|
if (g_slist_find_custom (genprefs[type].custom_args, str1, custom_args_compare_func) == NULL ) {
|
|
|
|
genprefs[type].custom_args = g_slist_append(genprefs[type].custom_args, g_strdup(temp));
|
|
|
|
gtk_clist_append(GTK_CLIST ((GtkCList *) data), temp2);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog_ok (NULL, _("An entry already exists for the game %s.\n\n"
|
|
|
|
"A default entry for this game will not be added.\n\n"
|
|
|
|
"Delete the entry and try again."), str1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add default custom arguments
|
|
|
|
// TODO: implement a proper generic solution
|
|
|
|
static void add_custom_args_defaults (GtkWidget *widget, gpointer data) {
|
|
|
|
enum server_type type;
|
|
|
|
|
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
|
|
|
|
case UN_SERVER:
|
|
|
|
add_custom_args_defaults2("s_SWATGame","-ini=TacticalOps.ini",UN_SERVER, data);
|
|
|
|
add_custom_args_defaults2("SFTeamDM","-ini=StrikeForce.ini -userini=SFUser.ini",UN_SERVER, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UT2_SERVER:
|
|
|
|
add_custom_args_defaults2("DB_DeathBall",
|
|
|
|
"-USERLOGO=dbsplash.bmp -INI=DeathBall.ini -USERINI=DBUser.ini",UT2_SERVER, data);
|
|
|
|
add_custom_args_defaults2("FragOpsMission",
|
|
|
|
"-INI=FragOps.ini -USERINI=FOUser.ini",UT2_SERVER, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UT2004_SERVER:
|
|
|
|
add_custom_args_defaults2("ROTeamGame", "-mod=RedOrchestra -log=RedOrchestra.log",UT2004_SERVER, data);
|
|
|
|
add_custom_args_defaults2("TObjectiveGame", "-mod=Troopers -log=Troopers.log",UT2004_SERVER, data);
|
|
|
|
add_custom_args_defaults2("TTeamGame", "-mod=Troopers -log=Troopers.log",UT2004_SERVER, data);
|
|
|
|
add_custom_args_defaults2("TCTFGame", "-mod=Troopers -log=Troopers.log",UT2004_SERVER, data);
|
|
|
|
add_custom_args_defaults2("AoGameInfo", "-mod=AlienSwarm -log=AlienSwarm.log",UT2004_SERVER, data);
|
|
|
|
add_custom_args_defaults2("AoCampaignLobbyGame", "-mod=AlienSwarm -log=AlienSwarm.log",UT2004_SERVER, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HL2_SERVER:
|
|
|
|
add_custom_args_defaults2("cstrike", "-applaunch 240",HL2_SERVER, data);
|
|
|
|
add_custom_args_defaults2("dod", "-applaunch 300",HL2_SERVER, data);
|
|
|
|
add_custom_args_defaults2("hl2mp", "-applaunch 320",HL2_SERVER, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HL_SERVER:
|
|
|
|
add_custom_args_defaults2("cstrike", "-applaunch 10",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("tfc", "-applaunch 20",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("dod", "-applaunch 30",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("dmc", "-applaunch 40",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("op4", "-applaunch 50",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("ricochet", "-applaunch 60",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("valve", "-applaunch 70",HL_SERVER, data);
|
|
|
|
add_custom_args_defaults2("czero", "-applaunch 80",HL_SERVER, data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
dialog_ok (NULL, _("There are no defaults for this game"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void new_custom_args_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
|
|
|
|
enum server_type type;
|
|
|
|
|
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_game[type], TRUE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_args[type], TRUE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_add_button[type], TRUE);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_game[type]), "");
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_args[type]), "");
|
|
|
|
|
|
|
|
gtk_widget_grab_focus (GTK_WIDGET (custom_args_entry_game[type]));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_custom_args_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
GSList *link;
|
|
|
|
int row;
|
|
|
|
char *temp[2];
|
|
|
|
enum server_type type;
|
|
|
|
|
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
|
|
|
|
temp[0] = strdup_strip (gtk_entry_get_text (GTK_ENTRY (custom_args_entry_game[type])));
|
|
|
|
temp[1] = strdup_strip (gtk_entry_get_text (GTK_ENTRY (custom_args_entry_args[type])));
|
|
|
|
|
|
|
|
if (current_row > -1) {
|
|
|
|
row = current_row;
|
|
|
|
|
|
|
|
link = g_slist_nth (genprefs[type].custom_args, current_row);
|
|
|
|
|
|
|
|
genprefs[type].custom_args = g_slist_remove_link (genprefs[type].custom_args, link);
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
gtk_clist_remove (GTK_CLIST ((GtkCList *) data), row);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (temp[0] && temp[1]) {
|
|
|
|
if (g_slist_find_custom (genprefs[type].custom_args, temp[0], custom_args_compare_func) == NULL ) {
|
|
|
|
genprefs[type].custom_args = g_slist_append(genprefs[type].custom_args, g_strconcat(temp[0], ",",temp[1], NULL));
|
|
|
|
|
|
|
|
gtk_clist_append(GTK_CLIST ((GtkCList *) data), temp);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_game[type], FALSE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_args[type], FALSE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_add_button[type], FALSE);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_game[type]), "");
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_args[type]), "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
dialog_ok (NULL, _("There is already an entry for this game.\n\nTo modify it, select it from the list, "\
|
|
|
|
"modify it\nand then click Add/Update."));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
dialog_ok (NULL, _("You must enter both a game and at least one argument."));
|
|
|
|
|
|
|
|
g_free (temp[0]);
|
|
|
|
g_free (temp[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete_custom_args_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
GSList *link;
|
|
|
|
int row;
|
|
|
|
enum server_type type;
|
|
|
|
|
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
|
|
|
|
if (current_row < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
row = current_row;
|
|
|
|
|
|
|
|
link = g_slist_nth (genprefs[type].custom_args, current_row);
|
|
|
|
|
|
|
|
genprefs[type].custom_args = g_slist_remove_link (genprefs[type].custom_args, link);
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
gtk_clist_remove (GTK_CLIST ((GtkCList *) data), row);
|
|
|
|
|
|
|
|
current_row = -1;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_game[type], FALSE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_args[type], FALSE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_add_button[type], FALSE);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_game[type]), "");
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_args[type]), "");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void custom_args_clist_select_row_callback (GtkWidget *widget, int row, int column, GdkEventButton *event, GtkCList *clist) {
|
|
|
|
enum server_type type;
|
|
|
|
GSList* item;
|
|
|
|
char* argstr;
|
|
|
|
char* game_args[2] = {0} ;
|
|
|
|
|
|
|
|
type = GPOINTER_TO_INT(gtk_object_get_user_data (GTK_OBJECT (widget)));
|
|
|
|
|
|
|
|
current_row = row;
|
|
|
|
|
|
|
|
if (row<0) return;
|
|
|
|
|
|
|
|
item = g_slist_nth(genprefs[type].custom_args, row);
|
|
|
|
|
|
|
|
if (!item) return;
|
|
|
|
|
|
|
|
argstr = g_strdup(item->data);
|
|
|
|
tokenize (argstr, game_args, 2, ",");
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_game[type]), game_args[0]);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (custom_args_entry_args[type]), game_args[1]);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_game[type], TRUE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_args[type], TRUE);
|
|
|
|
gtk_widget_set_sensitive (custom_args_add_button[type], TRUE);
|
|
|
|
|
|
|
|
g_free(argstr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *generic_game_frame (enum server_type type) {
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *notebook;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *hbox2 = NULL;
|
|
|
|
struct generic_prefs *prefs = &genprefs[type];
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
|
|
|
|
label = gtk_label_new (_(games[type].name));
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), label);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
notebook = gtk_notebook_new ();
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Invoking"));
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), notebook, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
if ((games[type].flags & GAME_CONNECT) == 0) {
|
|
|
|
label = gtk_label_new (_("*** Not Implemented ***"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), custom_args_options_page(type), gtk_label_new (_("Custom Args")));
|
|
|
|
|
|
|
|
// call game specific function to add its options
|
|
|
|
if (genprefs[type].add_options_to_notebook) {
|
|
|
|
genprefs[type].add_options_to_notebook(notebook, type);
|
|
|
|
}
|
2002-10-29 02:15:47 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
|
|
|
|
table = gtk_table_new ((games[type].custom_cfgs)? 3 : 2, 2, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Command Line"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 0, 1);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
genprefs[type].cmd_entry = gtk_entry_new ();
|
|
|
|
if (games[type].cmd) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (genprefs[type].cmd_entry), games[type].cmd);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (genprefs[type].cmd_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (genprefs[type].cmd_entry), "activate", GTK_SIGNAL_FUNC (game_file_activate_callback), GINT_TO_POINTER(type));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),genprefs[type].cmd_entry , TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (genprefs[type].cmd_entry);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (game_file_dialog), GINT_TO_POINTER(type));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),button , FALSE, FALSE, 3);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
// translator: button for command suggestion
|
|
|
|
button = gtk_button_new_with_label (_("Suggest"));
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (pref_suggest_command), GINT_TO_POINTER(type));
|
|
|
|
gtk_widget_set_sensitive (button, pref_can_suggest(type));
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),button , FALSE, FALSE, 0);
|
|
|
|
gtk_tooltips_set_tip (tooltips, button, _("Searches the path for the game executable"), NULL);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
|
|
|
|
/////
|
|
|
|
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Working Directory"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 1, 2);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
genprefs[type].dir_entry = gtk_entry_new ();
|
|
|
|
if (genprefs[type].pref_dir) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (genprefs[type].dir_entry), genprefs[type].pref_dir);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (genprefs[type].dir_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),genprefs[type].dir_entry , TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (game_dir_dialog), (gpointer)type);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),button , FALSE, FALSE, 3);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
// translator: button for directory guess
|
|
|
|
button = gtk_button_new_with_label (_("Suggest"));
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (game_file_activate_callback), (gpointer)type);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),button , FALSE, FALSE, 0);
|
|
|
|
gtk_tooltips_set_tip (tooltips, button, _("Tries to guess the working directory based on the command line"), NULL);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
if (games[type].custom_cfgs) {
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (genprefs[type].dir_entry), (gpointer) type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (genprefs[type].dir_entry),
|
|
|
|
"activate",
|
|
|
|
GTK_SIGNAL_FUNC (dir_entry_activate_callback),
|
|
|
|
NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (genprefs[type].dir_entry),
|
|
|
|
"focus_out_event",
|
|
|
|
GTK_SIGNAL_FUNC (dir_entry_activate_callback),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
gtk_widget_show (genprefs[type].dir_entry);
|
|
|
|
|
|
|
|
if (games[type].custom_cfgs) {
|
|
|
|
label = gtk_label_new (_("Custom CFG"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
prefs->cfg_combo = gtk_combo_new ();
|
|
|
|
gtk_entry_set_max_length (GTK_ENTRY (GTK_COMBO (prefs->cfg_combo)->entry), 256);
|
|
|
|
gtk_combo_set_case_sensitive (GTK_COMBO (prefs->cfg_combo), TRUE);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), prefs->cfg_combo, 1, 2, 2, 3);
|
|
|
|
gtk_widget_show (prefs->cfg_combo);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Game specific notes
|
|
|
|
if (game_get_attribute(type,"game_notes")) {
|
|
|
|
|
|
|
|
hbox2 = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
|
|
|
|
label = gtk_label_new (game_get_attribute(type,"game_notes"));
|
|
|
|
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), 0);
|
|
|
|
|
|
|
|
gtk_widget_show (notebook);
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used by user_fix_defaults to add a custom arg
|
|
|
|
|
|
|
|
|
|
|
|
static GtkWidget *custom_args_options_page (enum server_type type) {
|
|
|
|
GtkWidget *hbox1;
|
|
|
|
GtkWidget *vbox1;
|
|
|
|
GtkWidget *scrolledwindow1;
|
|
|
|
GtkWidget *arguments_clist;
|
|
|
|
GtkWidget *game_label;
|
|
|
|
GtkWidget *arguments_label;
|
|
|
|
GtkWidget *frame1;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *vbuttonbox1;
|
|
|
|
GtkWidget *new_button;
|
|
|
|
GtkWidget *delete_button;
|
|
|
|
GtkWidget *defaults_button;
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
struct game *g;
|
|
|
|
int width;
|
|
|
|
|
|
|
|
//tooltips = gtk_tooltips_new ();
|
|
|
|
|
|
|
|
g = &games[type];
|
|
|
|
|
|
|
|
genprefs[type].custom_args = g_slist_copy (g->custom_args);
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
hbox1 = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_widget_ref (hbox1);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (hbox1);
|
|
|
|
gtk_container_add (GTK_CONTAINER (page_vbox), hbox1);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 3);
|
|
|
|
|
|
|
|
vbox1 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_widget_ref (vbox1);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (vbox1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);
|
|
|
|
|
|
|
|
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_widget_ref (scrolledwindow1);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (scrolledwindow1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow1), 2);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
arguments_clist = gtk_clist_new (2);
|
|
|
|
gtk_widget_ref (arguments_clist);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "arguments_clist", arguments_clist, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (arguments_clist);
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolledwindow1), arguments_clist);
|
|
|
|
gtk_clist_column_titles_show (GTK_CLIST (arguments_clist));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (arguments_clist), "select_row", GTK_SIGNAL_FUNC (custom_args_clist_select_row_callback), arguments_clist);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (arguments_clist), (gpointer) type);
|
|
|
|
|
|
|
|
game_label = gtk_label_new (_("Game"));
|
|
|
|
gtk_widget_ref (game_label);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "game_label", game_label, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (game_label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_widget_show (game_label);
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (arguments_clist), 0, game_label);
|
|
|
|
|
|
|
|
arguments_label = gtk_label_new (_("Arguments"));
|
|
|
|
gtk_widget_ref (arguments_label);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "arguments_label", arguments_label, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (arguments_label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_widget_show (arguments_label);
|
|
|
|
gtk_clist_set_column_widget (GTK_CLIST (arguments_clist), 1, arguments_label);
|
|
|
|
|
|
|
|
frame1 = gtk_frame_new (_("Game and Arguments"));
|
|
|
|
gtk_widget_ref (frame1);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "frame1", frame1, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (frame1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox1), frame1, FALSE, FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame1), 3);
|
|
|
|
|
|
|
|
hbox2 = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_widget_ref (hbox2);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "hbox2", hbox2, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame1), hbox2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 4);
|
|
|
|
|
|
|
|
custom_args_entry_game[type] = gtk_entry_new ();
|
|
|
|
gtk_widget_ref (custom_args_entry_game[type]);
|
|
|
|
gtk_widget_set_usize (custom_args_entry_game[type], 90, -2);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "custom_args_entry_game[type]",
|
|
|
|
custom_args_entry_game[type],
|
|
|
|
(GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (custom_args_entry_game[type]);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), custom_args_entry_game[type], FALSE, TRUE, 0);
|
|
|
|
gtk_tooltips_set_tip (tooltips, custom_args_entry_game[type], _("Enter the game name from the game column"), NULL);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_game[type], FALSE);
|
|
|
|
|
|
|
|
custom_args_entry_args[type] = gtk_entry_new ();
|
|
|
|
gtk_widget_ref (custom_args_entry_args[type]);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "custom_args_entry_args[type]",
|
|
|
|
custom_args_entry_args[type],
|
|
|
|
(GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (custom_args_entry_args[type]);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), custom_args_entry_args[type], TRUE, TRUE, 0);
|
|
|
|
gtk_tooltips_set_tip (tooltips, custom_args_entry_args[type], _("Enter the arguments separated by spaces"), NULL);
|
|
|
|
gtk_widget_set_sensitive (custom_args_entry_args[type], FALSE);
|
|
|
|
|
|
|
|
vbuttonbox1 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_widget_ref (vbuttonbox1);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "vbuttonbox1", vbuttonbox1, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (vbuttonbox1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox1), vbuttonbox1, FALSE, TRUE, 0);
|
|
|
|
|
|
|
|
new_button = gtk_button_new_with_label (_("New"));
|
|
|
|
gtk_widget_ref (new_button);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "new_button", new_button, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (new_button);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbuttonbox1), new_button, FALSE, FALSE, 5);
|
|
|
|
GTK_WIDGET_SET_FLAGS (new_button, GTK_CAN_DEFAULT);
|
|
|
|
|
|
|
|
delete_button = gtk_button_new_with_label (_("Delete"));
|
|
|
|
gtk_widget_ref (delete_button);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "delete_button", delete_button, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (delete_button);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbuttonbox1), delete_button, FALSE, FALSE, 5);
|
|
|
|
GTK_WIDGET_SET_FLAGS (delete_button, GTK_CAN_DEFAULT);
|
|
|
|
|
|
|
|
defaults_button = gtk_button_new_with_label (_("Add Defaults"));
|
|
|
|
gtk_widget_ref (defaults_button);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "defaults_button", defaults_button, (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (defaults_button);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbuttonbox1), defaults_button, FALSE, FALSE, 5);
|
|
|
|
GTK_WIDGET_SET_FLAGS (defaults_button, GTK_CAN_DEFAULT);
|
|
|
|
|
|
|
|
custom_args_add_button[type] = gtk_button_new_with_label (_("Add/Update"));
|
|
|
|
gtk_widget_ref (custom_args_add_button[type]);
|
|
|
|
gtk_object_set_data_full (GTK_OBJECT (page_vbox), "add_button", custom_args_add_button[type], (GtkDestroyNotify) gtk_widget_unref);
|
|
|
|
gtk_widget_show (custom_args_add_button[type]);
|
|
|
|
gtk_box_pack_end (GTK_BOX (vbuttonbox1), custom_args_add_button[type], FALSE, FALSE, 7);
|
|
|
|
gtk_widget_set_sensitive (custom_args_add_button[type], FALSE);
|
|
|
|
GTK_WIDGET_SET_FLAGS (custom_args_add_button[type], GTK_CAN_DEFAULT);
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (new_button), (gpointer) type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (new_button), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (new_custom_args_callback),
|
|
|
|
(gpointer) arguments_clist);
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (delete_button), (gpointer) type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (delete_button), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (delete_custom_args_callback),
|
|
|
|
(gpointer) arguments_clist);
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (defaults_button), (gpointer) type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (defaults_button), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (add_custom_args_defaults),
|
|
|
|
(gpointer) arguments_clist);
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (custom_args_add_button[type]), (gpointer) type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (custom_args_add_button[type]), "clicked",
|
|
|
|
GTK_SIGNAL_FUNC (add_custom_args_callback),
|
|
|
|
(gpointer) arguments_clist);
|
|
|
|
|
|
|
|
// Populate clist with custom_args from g_slist
|
2004-07-04 17:52:23 +00:00
|
|
|
{
|
2014-10-16 02:04:09 +02:00
|
|
|
GSList *list;
|
|
|
|
char *token[2];
|
|
|
|
|
|
|
|
list = genprefs[type].custom_args;
|
|
|
|
while (list) {
|
|
|
|
char* tmp = g_strdup((char *)list->data);
|
|
|
|
tokenize ( tmp, token, 2, ",");
|
|
|
|
gtk_clist_append(GTK_CLIST (arguments_clist), token);
|
|
|
|
g_free(tmp);
|
|
|
|
|
|
|
|
list = g_slist_next(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
width = gtk_clist_optimal_column_width (GTK_CLIST (arguments_clist), 0);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (arguments_clist), 0, width?width:60);
|
|
|
|
gtk_clist_set_column_width (GTK_CLIST (arguments_clist), 1, gtk_clist_optimal_column_width (GTK_CLIST (arguments_clist), 1));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void game_listitem_selected_callback (GtkItem *item, enum server_type type) {
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (games_notebook), type);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define GAMES_COLS 3
|
|
|
|
#define GAMES_ROWS ((GAMES_TOTAL + GAMES_COLS - 1) / GAMES_COLS)
|
|
|
|
|
|
|
|
// create dialog where commandline and working dir for all games are configured
|
|
|
|
static GtkWidget *games_config_page (int defgame) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *gtklist=NULL;
|
|
|
|
GtkWidget *scrollwin=NULL;
|
|
|
|
GtkWidget *games_hbox;
|
|
|
|
char *typestr;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
games_hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (games_hbox), 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), games_hbox, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
scrollwin = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
|
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
gtklist = gtk_list_new ();
|
|
|
|
|
|
|
|
gtk_widget_set_usize (gtklist, 136, -1);
|
|
|
|
|
|
|
|
// gtk_container_add (GTK_CONTAINER (scrollwin), gtklist);
|
|
|
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollwin), gtklist);
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
genprefs[i].game_button = gtk_list_item_new();
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (genprefs[i].game_button), game_pixmap_with_label (i));
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (genprefs[i].game_button), "select",
|
|
|
|
GTK_SIGNAL_FUNC (game_listitem_selected_callback), GINT_TO_POINTER(i));
|
|
|
|
|
|
|
|
gtk_widget_show(genprefs[i].game_button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gtklist), genprefs[i].game_button);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show(gtklist);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), scrollwin);
|
|
|
|
gtk_widget_show(scrollwin);
|
|
|
|
gtk_box_pack_start (GTK_BOX (games_hbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
games_notebook = gtk_notebook_new ();
|
|
|
|
// the tabs are hidden, so nobody will notice its a notebook
|
|
|
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (games_notebook), FALSE);
|
|
|
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (games_notebook), FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (games_hbox), games_notebook, FALSE, FALSE, 15);
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
page = generic_game_frame (i);
|
|
|
|
|
|
|
|
label = gtk_label_new (games[i].name);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (games_notebook), page, label);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defgame == UNKNOWN_SERVER) {
|
|
|
|
defgame = QW_SERVER;
|
|
|
|
typestr = config_get_string ("/" CONFIG_FILE "/Games Config/game");
|
|
|
|
if (typestr) {
|
|
|
|
defgame = id2type (typestr);
|
|
|
|
g_free (typestr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defgame >= GAMES_TOTAL) {
|
|
|
|
defgame = QW_SERVER;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (games_notebook), defgame);
|
|
|
|
|
|
|
|
gtk_list_item_select(GTK_LIST_ITEM(genprefs[defgame].game_button));
|
|
|
|
|
|
|
|
gtk_widget_show (games_notebook);
|
|
|
|
|
|
|
|
/* Common Options */
|
|
|
|
|
|
|
|
frame = gtk_frame_new (_("Common Options"));
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 15);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (TRUE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
|
|
|
|
/* Disable CD Audio */
|
|
|
|
|
|
|
|
nocdaudio_check_button = gtk_check_button_new_with_label (_("Disable CD Audio"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nocdaudio_check_button), default_nocdaudio);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), nocdaudio_check_button, TRUE, FALSE, 0);
|
|
|
|
gtk_widget_show (nocdaudio_check_button);
|
|
|
|
|
|
|
|
/* Disable Sound */
|
|
|
|
|
|
|
|
nosound_check_button = gtk_check_button_new_with_label (_("Disable Sound"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nosound_check_button), default_nosound);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), nosound_check_button, TRUE, FALSE, 0);
|
|
|
|
gtk_widget_show (nosound_check_button);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
gtk_widget_show (games_hbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
2002-10-29 02:15:47 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void add_pushlatency_options (GtkWidget *vbox) {
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkObject *adj;
|
|
|
|
GSList *group = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
static const char *pushlatency_modes[] = {
|
|
|
|
N_("Do not set (use game default)"),
|
|
|
|
N_("Automatically calculate from server ping time"),
|
|
|
|
N_("Fixed value")
|
|
|
|
};
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
pushlatency_mode_radio_buttons[i] = gtk_radio_button_new_with_label (group, _(pushlatency_modes[i]));
|
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (pushlatency_mode_radio_buttons[i]));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), pushlatency_mode_radio_buttons[i], FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (pushlatency_mode_radio_buttons[i]);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pushlatency_mode_radio_buttons[pushlatency_mode]), TRUE);
|
|
|
|
|
|
|
|
adj = gtk_adjustment_new (pushlatency_value, -1000.0, -10.0, 10.0, 50.0, 0.0);
|
|
|
|
|
|
|
|
pushlatency_value_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (pushlatency_value_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (pushlatency_value_spinner, 64, -1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), pushlatency_value_spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (pushlatency_value_spinner);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct q3_common_prefs_s* get_pref_widgets_for_game(enum server_type type) {
|
|
|
|
switch(type) {
|
|
|
|
case Q3_SERVER: return &q3_prefs;
|
|
|
|
case Q4_SERVER: return &q4_prefs;
|
|
|
|
case WO_SERVER: return &wo_prefs;
|
|
|
|
case WOET_SERVER: return &woet_prefs;
|
|
|
|
case ETL_SERVER: return &etl_prefs;
|
|
|
|
case DOOM3_SERVER: return &doom3_prefs;
|
|
|
|
case ETQW_SERVER: return &etqw_prefs;
|
|
|
|
case EF_SERVER: return &ef_prefs;
|
|
|
|
case SOF2S_SERVER: return &sof2_prefs;
|
|
|
|
case COD_SERVER: return &cod_prefs;
|
|
|
|
case JK2_SERVER: return &jk2_prefs;
|
|
|
|
case JK3_SERVER: return &jk3_prefs;
|
|
|
|
case NEXUIZ_SERVER: return &nexuiz_prefs;
|
|
|
|
case XONOTIC_SERVER: return &xonotic_prefs;
|
|
|
|
case WARSOW_SERVER: return &warsow_prefs;
|
|
|
|
case TREMULOUS_SERVER: return &tremulous_prefs;
|
|
|
|
case TREMULOUSGPP_SERVER: return &tremulousgpp_prefs;
|
|
|
|
case TREMFUSION_SERVER: return &tremfusion_prefs;
|
|
|
|
case UNVANQUISHED_SERVER: return &unvanquished_prefs;
|
|
|
|
case OPENARENA_SERVER: return &openarena_prefs;
|
|
|
|
case Q3RALLY_SERVER: return &q3rally_prefs;
|
|
|
|
case WOP_SERVER: return &wop_prefs;
|
|
|
|
case IOURT_SERVER: return &iourt_prefs;
|
|
|
|
case REACTION_SERVER: return &reaction_prefs;
|
|
|
|
case SMOKINGUNS_SERVER: return &smokinguns_prefs;
|
|
|
|
case ZEQ2LITE_SERVER: return &zeq2lite_prefs;
|
|
|
|
case TURTLEARENA_SERVER: return &turtlearena_prefs;
|
|
|
|
case ALIENARENA_SERVER: return &alienarena_prefs;
|
|
|
|
default: xqf_error("need to define preferences"); return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *q3_options_page (enum server_type type) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
struct q3_common_prefs_s* w = get_pref_widgets_for_game(type);
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
if (w->protocols) {
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Masterserver Protocol Version"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
w->proto_entry = gtk_combo_new ();
|
|
|
|
gtk_combo_set_use_arrows_always (GTK_COMBO (w->proto_entry), TRUE);
|
|
|
|
gtk_combo_set_popdown_strings(GTK_COMBO (w->proto_entry), createGListfromchar((char**)w->protocols));
|
|
|
|
gtk_list_set_selection_mode (GTK_LIST (GTK_COMBO (w->proto_entry)->list), GTK_SELECTION_BROWSE);
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (w->proto_entry)->entry), game_get_attribute(type,"masterprotocol"));
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), w->proto_entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (w->proto_entry);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->flags & Q3_PREF_SETFS_GAME) {
|
|
|
|
w->setfs_gamebutton = gtk_check_button_new_with_label (_("set fs_game on connect"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w->setfs_gamebutton), str2bool(game_get_attribute(type,"setfs_game")));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), w->setfs_gamebutton, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (w->setfs_gamebutton);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->flags & Q3_PREF_PB) {
|
|
|
|
w->set_punkbusterbutton = gtk_check_button_new_with_label (_("set cl_punkbuster on connect"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w->set_punkbusterbutton), str2bool(game_get_attribute(type,"set_punkbuster")));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), w->set_punkbusterbutton, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (w->set_punkbusterbutton);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->flags & Q3_PREF_CONSOLE) {
|
|
|
|
w->console_button = gtk_check_button_new_with_label (_("enable console"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w->console_button), str2bool(game_get_attribute(type,"enable_console")));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), w->console_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (w->console_button);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
|
|
|
|
|
|
|
return page_vbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void q3_set_memory_callback (GtkWidget *widget, int what) {
|
|
|
|
int com_hunkmegs = 56;
|
|
|
|
int com_zonemegs = 16;
|
|
|
|
int com_soundmegs = 8;
|
|
|
|
int cg_precachedmodels = 3;
|
|
|
|
|
|
|
|
if (what == 1) {
|
|
|
|
com_hunkmegs = 72;
|
|
|
|
com_zonemegs = 24;
|
|
|
|
com_soundmegs = 16;
|
|
|
|
cg_precachedmodels = 6;
|
|
|
|
}
|
|
|
|
else if(what == 2) {
|
|
|
|
com_hunkmegs = 96;
|
|
|
|
com_zonemegs = 24;
|
|
|
|
com_soundmegs = 16;
|
|
|
|
cg_precachedmodels = 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_adjustment_set_value(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(com_hunkmegs_spinner)), com_hunkmegs);
|
|
|
|
gtk_adjustment_set_value(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(com_zonemegs_spinner)), com_zonemegs);
|
|
|
|
gtk_adjustment_set_value(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(com_soundmegs_spinner)), com_soundmegs);
|
|
|
|
gtk_adjustment_set_value(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(cg_precachedmodels_spinner)), cg_precachedmodels);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *q3_mem_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkObject *adj;
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
int pass_memory_options = str2bool(game_get_attribute(Q3_SERVER,"pass_memory_options"));
|
|
|
|
int com_hunkmegs = atoi(game_get_attribute(Q3_SERVER,"com_hunkmegs"));
|
|
|
|
int com_zonemegs = atoi(game_get_attribute(Q3_SERVER,"com_zonemegs"));
|
|
|
|
int com_soundmegs = atoi(game_get_attribute(Q3_SERVER,"com_soundmegs"));
|
|
|
|
int cg_precachedmodels = atoi(game_get_attribute(Q3_SERVER,"cg_precachedmodels"));
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
|
|
|
|
|
|
|
pass_memory_options_button = gtk_check_button_new_with_label (_("Pass memory settings on command line"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pass_memory_options_button), pass_memory_options);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), pass_memory_options_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (pass_memory_options_button);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
adj = gtk_adjustment_new (com_hunkmegs, 32, 1024, 8, 32, 0);
|
|
|
|
com_hunkmegs_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (com_hunkmegs_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (com_hunkmegs_spinner, 64, -1);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), com_hunkmegs_spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (com_hunkmegs_spinner);
|
|
|
|
|
|
|
|
// Mega Byte
|
|
|
|
label = gtk_label_new (_("MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("com_hunkmegs"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
adj = gtk_adjustment_new (com_zonemegs, 16, 1024, 4, 8, 0);
|
|
|
|
com_zonemegs_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (com_zonemegs_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (com_zonemegs_spinner, 64, -1);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), com_zonemegs_spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (com_zonemegs_spinner);
|
|
|
|
|
|
|
|
// Mega Byte
|
|
|
|
label = gtk_label_new (_("MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("com_zonemegs"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
adj = gtk_adjustment_new (com_soundmegs, 16, 1024, 4, 8, 0);
|
|
|
|
com_soundmegs_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (com_soundmegs_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (com_soundmegs_spinner, 64, -1);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), com_soundmegs_spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (com_soundmegs_spinner);
|
|
|
|
|
|
|
|
// Mega Byte
|
|
|
|
label = gtk_label_new (_("MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("com_soundmegs"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
// value, lower, upper, step_increment, page_increment, page_size
|
|
|
|
adj = gtk_adjustment_new (cg_precachedmodels, 2, 32, 1, 4, 0);
|
|
|
|
cg_precachedmodels_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (cg_precachedmodels_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (cg_precachedmodels_spinner, 64, -1);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), cg_precachedmodels_spinner, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (cg_precachedmodels_spinner);
|
|
|
|
|
|
|
|
// Mega Byte
|
|
|
|
label = gtk_label_new (_("MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("cg_precachedmodels"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 8);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (_("Preset values"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
hbox2 = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(hbox2),8);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox2);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label(_("Default"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (q3_set_memory_callback), (gpointer) 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label(_("128MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (q3_set_memory_callback), (gpointer) 1);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label(_(">256MB"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (q3_set_memory_callback), (gpointer) 2);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox2);
|
|
|
|
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
gtk_widget_show (page_vbox);
|
2004-10-02 00:41:45 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
2002-10-29 02:15:47 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_q3_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), q3_options_page(type), gtk_label_new (_("Options")));
|
2002-10-29 02:15:47 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (type == Q3_SERVER) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), q3_mem_options_page(), gtk_label_new (_("Memory")));
|
|
|
|
}
|
2002-10-22 15:11:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_un_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
2002-10-23 16:16:55 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_ut2_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
}
|
2002-10-23 16:16:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *qw_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *frame2;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox2;
|
|
|
|
GtkWidget *option_menu;
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "qw_options_page()");
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* QW Specific Features */
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'w_switch' & 'b_switch' control */
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame2 = gtk_frame_new (_("The highest weapon that Quake should switch to..."));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame2, FALSE, FALSE, 0);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame2), vbox2);
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'w_switch' */
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("upon a weapon pickup"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
option_menu = gtk_option_menu_new ();
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), create_wb_switch_menu (set_w_switch_callback));
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), pref_w_switch);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), option_menu, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (option_menu);
|
2002-10-22 16:15:18 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2002-10-22 16:15:18 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'b_switch' */
|
2002-10-22 16:15:18 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
|
2002-10-24 10:37:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("upon a backpack pickup"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
option_menu = gtk_option_menu_new ();
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), create_wb_switch_menu (set_b_switch_callback));
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), pref_b_switch);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), option_menu, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (option_menu);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
gtk_widget_show (frame2);
|
2002-10-24 10:37:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'noaim' */
|
2002-10-24 10:37:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 10);
|
2002-10-24 15:44:05 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
noaim_check_button = gtk_check_button_new_with_label (_("Disable auto-aiming"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (noaim_check_button), default_noaim);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), noaim_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (noaim_check_button);
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2002-10-19 01:46:59 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2002-10-23 16:16:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
2002-10-23 16:16:55 +00:00
|
|
|
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// qworq2: 0=qw/1=q2
|
|
|
|
static GtkWidget *qw_q2_options_page (int qworq2) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *frame2;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *hbox2;
|
|
|
|
GtkWidget *vbox2;
|
|
|
|
GtkWidget *option_menu;
|
|
|
|
GtkObject *adj;
|
2002-10-22 01:55:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "qw_q2_options_page(%d)",qworq2);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 16);
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Skins */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Skins"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
option_menu = gtk_option_menu_new ();
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), create_noskins_menu (qworq2));
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), qworq2?pref_q2_noskins:pref_qw_noskins);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (option_menu);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox2);
|
2003-11-29 16:04:00 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Network Options */
|
2003-11-29 16:04:00 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Rate */
|
2003-11-29 16:04:00 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox2 = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
|
2003-11-29 16:04:00 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Rate"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
adj = gtk_adjustment_new (qworq2?default_q2_rate:default_qw_rate, 0.0, 25000.0, 500.0, 1000.0, 0.0);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
rate_spinner[qworq2] = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (rate_spinner[qworq2]), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (rate_spinner[qworq2], 64, -1);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox2), rate_spinner[qworq2], FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (rate_spinner[qworq2]);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox2);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* QW Specific Features */
|
|
|
|
if (qworq2 == 0) {
|
|
|
|
/* 'pushlatency' */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame2 = gtk_frame_new (_("pushlatency"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame2, FALSE, FALSE, 10);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox2 = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame2), vbox2);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
add_pushlatency_options (vbox2);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
gtk_widget_show (frame2);
|
|
|
|
}
|
2003-04-24 19:51:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Troubleshooting */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame2 = gtk_frame_new (_("Troubleshooting"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame2, FALSE, FALSE, 10);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame2), vbox2);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'cl_nodelta' */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
cl_nodelta_check_button[qworq2] = gtk_check_button_new_with_label (
|
|
|
|
_("Disable delta-compression (cl_nodelta)"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cl_nodelta_check_button[qworq2]),
|
|
|
|
qworq2?default_q2_cl_nodelta:default_qw_cl_nodelta);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), cl_nodelta_check_button[qworq2], FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (cl_nodelta_check_button[qworq2]);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* 'cl_predict_players' ('cl_predict' in Q2) */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
cl_predict_check_button[qworq2] = gtk_check_button_new_with_label (
|
|
|
|
_("Disable player/entity prediction (cl_predict_players)"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cl_predict_check_button[qworq2]),
|
|
|
|
1 - (qworq2?default_q2_cl_predict:default_qw_cl_predict));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), cl_predict_check_button[qworq2], FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (cl_predict_check_button[qworq2]);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
gtk_widget_show (frame2);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2001-09-28 21:36:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_qw_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), qw_options_page(), gtk_label_new (_("Weapons")));
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), qw_q2_options_page(0), gtk_label_new (_("Options")));
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), player_profile_qw_page(), gtk_label_new (_("Player Profile")));
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_q2_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), qw_q2_options_page(1), gtk_label_new (_("Options")));
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), player_profile_q2_page(), gtk_label_new (_("Player Profile")));
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_q1_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), player_profile_q1_page(), gtk_label_new (_("Player Profile")));
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void add_t2_options_to_notebook(GtkWidget *notebook, enum server_type type) {
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), player_profile_t2_page(), gtk_label_new (_("Player Profile")));
|
2001-10-01 16:24:55 +00:00
|
|
|
}
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void terminate_toggled_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = GTK_TOGGLE_BUTTON (terminate_check_button)->active;
|
|
|
|
gtk_widget_set_sensitive (iconify_check_button, TRUE - val);
|
2002-05-05 12:46:17 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void launchinfo_toggled_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
int val;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
val = GTK_TOGGLE_BUTTON (launchinfo_check_button)->active;
|
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void prelaunchexec_toggled_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
int val;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
val = GTK_TOGGLE_BUTTON (prelaunchexec_check_button)->active;
|
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/** make entries editable if yes == TRUE */
|
|
|
|
static void sound_set_widgets_sensitive(gboolean yes) {
|
|
|
|
gtk_widget_set_sensitive (sound_player_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_start_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_quit_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_update_done_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_refresh_done_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_stop_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_redial_success_entry, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_server_connect_entry, yes);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (sound_player_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_start_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_quit_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_update_done_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_refresh_done_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_stop_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_redial_success_file_dialog_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_server_connect_file_dialog_button, yes);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_start_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_xqf_quit_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_update_done_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_refresh_done_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_stop_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_redial_success_file_test_button, yes);
|
|
|
|
gtk_widget_set_sensitive (sound_server_connect_file_test_button, yes);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void sound_enable_toggled_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
gboolean val;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
val = GTK_TOGGLE_BUTTON (sound_enable_check_button)->active;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_set_widgets_sensitive(val);
|
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void save_srvinfo_toggled_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
int val;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
val = GTK_TOGGLE_BUTTON (save_srvinfo_check_button)->active;
|
|
|
|
gtk_widget_set_sensitive (save_plrinfo_check_button, val);
|
|
|
|
}
|
2002-05-05 12:46:17 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *appearance_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GSList *group = NULL;
|
|
|
|
static const char *toolbar_styles[] = { N_("Icons"), N_("Text"), N_("Both") };
|
|
|
|
int i;
|
|
|
|
|
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("Server List"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Lookup host names */
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
show_hostnames_check_button = gtk_check_button_new_with_label (_("Show host names"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_hostnames_check_button), show_hostnames);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), show_hostnames_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_tooltips_set_tip (tooltips, show_hostnames_check_button, _("Show hostnames instead of IP addresses if possible"), NULL);
|
|
|
|
gtk_widget_show (show_hostnames_check_button);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Show default port */
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
show_defport_check_button = gtk_check_button_new_with_label (_("Show default port"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_defport_check_button), show_default_port);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), show_defport_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (show_defport_check_button);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* show bots */
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2005-11-12 11:31:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
countbots_check_button = gtk_check_button_new_with_label (_("Do not count bots as players"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (countbots_check_button), serverlist_countbots);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), countbots_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (countbots_check_button);
|
2005-11-12 11:31:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2005-11-12 11:31:56 +00:00
|
|
|
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sort servers real-time during refresh */
|
2005-11-12 11:31:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
refresh_sorts_check_button = gtk_check_button_new_with_label (_("Sort servers real-time during refresh"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (refresh_sorts_check_button), default_refresh_sorts);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), refresh_sorts_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (refresh_sorts_check_button);
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2001-12-30 11:13:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Refresh on update */
|
2001-12-30 11:13:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
refresh_on_update_check_button =
|
|
|
|
gtk_check_button_new_with_label (_("Refresh on update"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (refresh_on_update_check_button), default_refresh_on_update);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), refresh_on_update_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (refresh_on_update_check_button);
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Resolve on update */
|
2002-11-07 12:54:28 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2001-08-20 01:57:36 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
resolve_on_update_check_button = gtk_check_button_new_with_label (_("Resolve hostnames on update"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (resolve_on_update_check_button), default_resolve_on_update);
|
|
|
|
gtk_tooltips_set_tip (tooltips, resolve_on_update_check_button, _("Enable or disable DNS resolution of IP addresses"), NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), resolve_on_update_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (resolve_on_update_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2003-04-25 21:15:46 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Show only configured games */
|
2003-04-25 21:15:46 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2003-04-25 21:15:46 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
show_only_configured_games_check_button = gtk_check_button_new_with_label (_("Show only configured games"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_only_configured_games_check_button), default_show_only_configured_games);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), show_only_configured_games_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (show_only_configured_games_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* gtkrc */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
use_custom_gtkrc_check_button = gtk_check_button_new_with_label (_("Use custom color settings"));
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_tooltips_set_tip (tooltips, use_custom_gtkrc_check_button, _("Use XQF's"
|
|
|
|
" color settings instead of the system ones. You need to restart XQF"
|
|
|
|
" for this setting to take effect. Note that you may need to install"
|
|
|
|
" the gtk-engines package."), NULL);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_custom_gtkrc_check_button), use_custom_gtkrc);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), use_custom_gtkrc_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (use_custom_gtkrc_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (frame);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Toolbar */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("Toolbar"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Toolbar Style */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
toolbar_style_radio_buttons[i] = gtk_radio_button_new_with_label (group, _(toolbar_styles[i]));
|
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toolbar_style_radio_buttons[i]));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toolbar_style_radio_buttons[i], FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toolbar_style_radio_buttons[i]);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toolbar_style_radio_buttons[default_toolbar_style]), TRUE);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Toolbar Tips */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
toolbar_tips_check_button = gtk_check_button_new_with_label (_("Tooltips"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toolbar_tips_check_button), default_toolbar_tips);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), toolbar_tips_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toolbar_tips_check_button);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (frame);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void scan_maps_callback (GtkWidget *widget, gpointer data) {
|
|
|
|
int i;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
create_splashscreen();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
scan_maps_for(i);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
destroy_splashscreen();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
server_clist_set_list (cur_server_list);
|
|
|
|
}
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *general_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *table;
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* On Startup */
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("On Startup"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Refresh Favorites */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
auto_favorites_check_button = gtk_check_button_new_with_label (_("Refresh Favorites"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_favorites_check_button), default_auto_favorites);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), auto_favorites_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (auto_favorites_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
show_splash_button = gtk_check_button_new_with_label (_("Show splash screen"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_splash_button), default_show_splash);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), show_splash_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (show_splash_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
auto_maps_check_button = gtk_check_button_new_with_label (_("Scan for maps"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_maps_check_button), default_auto_maps);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_tooltips_set_tip (tooltips, auto_maps_check_button,
|
|
|
|
_("Scan game directories for installed maps. xqf will"
|
|
|
|
" take longer to start up when enabled."), NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), auto_maps_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (auto_maps_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
{
|
|
|
|
GtkWidget* button = gtk_button_new_with_label(_("scan now"));
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_misc_set_padding(GTK_MISC(GTK_BIN(button)->child),4,0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (scan_maps_callback), NULL);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/*Tray icon*/
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2001-10-01 16:24:55 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
tray_icon_check_button = gtk_check_button_new_with_label (_("Minimize to system tray"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tray_icon_check_button), default_show_tray_icon);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_tooltips_set_tip (tooltips, tray_icon_check_button, _("Enable xqf tray icon. You need to restart xqf for this to take effect."), NULL);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), tray_icon_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (tray_icon_check_button);
|
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* On Exit */
|
2001-01-01 05:40:32 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("On Exit"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2001-01-01 05:40:32 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2002-11-03 16:45:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Save master lists */
|
2002-10-06 12:06:18 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2002-10-04 18:57:29 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
save_lists_check_button = gtk_check_button_new_with_label (_("Save server lists"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (save_lists_check_button), default_save_lists);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), save_lists_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (save_lists_check_button);
|
2002-10-04 18:57:29 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Save server information */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
save_srvinfo_check_button = gtk_check_button_new_with_label (_("Save server information"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), save_srvinfo_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (save_srvinfo_check_button), default_save_srvinfo);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (save_srvinfo_check_button), "toggled", GTK_SIGNAL_FUNC (save_srvinfo_toggled_callback), NULL);
|
|
|
|
gtk_widget_show (save_srvinfo_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Save player information */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
save_plrinfo_check_button = gtk_check_button_new_with_label (_("Save player information"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), save_plrinfo_check_button, FALSE, FALSE, 0);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (save_plrinfo_check_button), default_save_plrinfo);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!default_save_srvinfo) {
|
|
|
|
gtk_widget_set_sensitive (save_plrinfo_check_button, FALSE);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (save_plrinfo_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (frame);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* When launching a Game */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("When launching a game..."));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Terminate */
|
2003-05-19 20:26:02 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
table = gtk_table_new(3,2,TRUE);
|
2003-05-19 20:26:02 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
2003-05-19 20:26:02 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
terminate_check_button = gtk_check_button_new_with_label (_("Terminate XQF"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (terminate_check_button), default_terminate);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (terminate_check_button), "toggled", GTK_SIGNAL_FUNC (terminate_toggled_callback), NULL);
|
2003-05-19 20:26:02 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table),terminate_check_button, 0, 1, 0, 1);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (terminate_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Iconify */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
iconify_check_button = gtk_check_button_new_with_label (_("Iconify XQF window"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iconify_check_button), default_iconify);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (default_terminate) {
|
|
|
|
gtk_widget_set_sensitive (iconify_check_button, FALSE);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (iconify_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table),iconify_check_button, 1, 2, 0, 1);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Launchinfo */
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
launchinfo_check_button = gtk_check_button_new_with_label (_("Create LaunchInfo.txt"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (launchinfo_check_button), default_launchinfo);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (launchinfo_check_button), "toggled", GTK_SIGNAL_FUNC (launchinfo_toggled_callback), NULL);
|
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table),launchinfo_check_button, 0, 1, 1, 2);
|
|
|
|
gtk_tooltips_set_tip (tooltips, launchinfo_check_button, _("Creates the file ~/.qf/LaunchInfo.txt with: ping ip:port name map curplayers maxplayers"), NULL);
|
|
|
|
gtk_widget_show (launchinfo_check_button);
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Prelaunchinfo */
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
prelaunchexec_check_button = gtk_check_button_new_with_label (_("Execute prelaunch"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prelaunchexec_check_button), default_prelaunchexec);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (prelaunchexec_check_button), "toggled", GTK_SIGNAL_FUNC (prelaunchexec_toggled_callback), NULL);
|
|
|
|
gtk_tooltips_set_tip (tooltips, prelaunchexec_check_button, _("Executes ~/.qf/PreLaunch (if it exists) before launching the game"), NULL);
|
|
|
|
gtk_widget_show (prelaunchexec_check_button);
|
2003-06-19 19:58:30 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table),prelaunchexec_check_button, 1, 2, 1, 2);
|
2002-10-09 00:54:58 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Stop XMMS */
|
2002-10-09 00:54:58 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
stopxmms_check_button = gtk_check_button_new_with_label (_("Stop current song in XMMS"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stopxmms_check_button), default_stopxmms);
|
|
|
|
gtk_tooltips_set_tip (tooltips, stopxmms_check_button, _("Stopping XMMS will release /dev/dsp. "
|
|
|
|
"Activate this option if you use XMMS and have a cheap soundcard "
|
|
|
|
"that allows only one application to open /dev/dsp."), NULL);
|
|
|
|
gtk_widget_show (stopxmms_check_button);
|
2005-10-26 17:56:55 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table),stopxmms_check_button, 0, 1, 2, 3);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show(table);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (vbox);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_widget_show (frame);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2002-10-09 00:54:58 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *qstat_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkObject *adj;
|
|
|
|
GtkWidget* alignment;
|
|
|
|
GtkWidget* hbox;
|
|
|
|
unsigned row = 0;
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* QStat preferences -- maxsimultaneous & maxretries */
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("QStat Options"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* maxsimultaneous */
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Number of simultaneous servers to query"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row+1);
|
|
|
|
gtk_widget_show (label);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
adj = gtk_adjustment_new (maxsimultaneous, 1.0, FD_SETSIZE, 1.0, 5.0, 0.0);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
maxsimultaneous_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (maxsimultaneous_spinner), GTK_UPDATE_ALWAYS);
|
|
|
|
gtk_widget_set_usize (maxsimultaneous_spinner, 48, -1);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (1, 0.5, 0, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), maxsimultaneous_spinner);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), alignment, 1, 2, row, row+1);
|
|
|
|
gtk_widget_show (maxsimultaneous_spinner);
|
|
|
|
gtk_widget_show(alignment);
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
++row;
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* maxretries */
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Number of retries"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row+1);
|
|
|
|
gtk_widget_show (label);
|
2004-11-11 16:54:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
adj = gtk_adjustment_new (maxretries, 1.0, MAX_RETRIES, 1.0, 1.0, 0.0);
|
|
|
|
maxretries_spinner = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 0, 0);
|
|
|
|
gtk_widget_set_usize (maxretries_spinner, 48, -1);
|
2002-12-25 15:17:14 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (1, 0.5, 0, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), maxretries_spinner);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), alignment, 1, 2, row, row+1);
|
|
|
|
gtk_widget_show (maxretries_spinner);
|
|
|
|
gtk_widget_show(alignment);
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
++row;
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* srcip */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Source IP Address"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row+1);
|
|
|
|
gtk_widget_show (label);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
qstat_srcip_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_max_length(GTK_ENTRY(qstat_srcip_entry), 15);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (qstat_srcip_entry), qstat_srcip?qstat_srcip:"");
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
alignment = gtk_alignment_new (1, 0.5, 0, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), qstat_srcip_entry);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), alignment, 1, 2, row, row+1);
|
|
|
|
gtk_widget_show (qstat_srcip_entry);
|
|
|
|
gtk_widget_show (alignment);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
++row;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* srcport */
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
{
|
|
|
|
char buf[6];
|
|
|
|
label = gtk_label_new (_("Source Port Range"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, row, row+1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
|
|
|
|
if (qstat_srcport_low) {
|
|
|
|
snprintf(buf, sizeof(buf), "%hu", qstat_srcport_low);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*buf = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
qstat_srcport_entry_low = gtk_entry_new ();
|
|
|
|
gtk_entry_set_max_length(GTK_ENTRY(qstat_srcport_entry_low), 5);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (qstat_srcport_entry_low), buf);
|
|
|
|
gtk_box_pack_start(GTK_BOX(hbox), qstat_srcport_entry_low, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_set_usize (qstat_srcport_entry_low, 70, -1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("-");
|
|
|
|
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
if (qstat_srcport_high) {
|
|
|
|
snprintf(buf, sizeof(buf), "%hu", qstat_srcport_high);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*buf = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
qstat_srcport_entry_high = gtk_entry_new ();
|
|
|
|
gtk_entry_set_max_length(GTK_ENTRY(qstat_srcport_entry_high), 5);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (qstat_srcport_entry_high), buf);
|
|
|
|
gtk_box_pack_start(GTK_BOX(hbox), qstat_srcport_entry_high, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_set_usize (qstat_srcport_entry_high, 70, -1);
|
|
|
|
|
|
|
|
alignment = gtk_alignment_new (1, 0.5, 0, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), hbox);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), alignment, 1, 2, row, row+1);
|
|
|
|
gtk_widget_show (qstat_srcport_entry_low);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (qstat_srcport_entry_high);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
++row;
|
|
|
|
}
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (table);
|
|
|
|
gtk_widget_show (frame);
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
|
|
|
}
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void play_sound_pref (GtkWidget *sound_entry) {
|
|
|
|
const char* file = gtk_entry_get_text (GTK_ENTRY (sound_entry));
|
|
|
|
const char* player = gtk_entry_get_text (GTK_ENTRY (sound_player_entry));
|
|
|
|
play_sound_with (player, file, 1);
|
|
|
|
}
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// create a button with label "Test", set padding to make it look nice
|
|
|
|
static inline GtkWidget* sound_test_button_new() {
|
|
|
|
// Translator: sound test button
|
|
|
|
GtkWidget* button = gtk_button_new_with_label (_("Test"));
|
|
|
|
gtk_misc_set_padding(GTK_MISC(GTK_BIN(button)->child),4,0);
|
|
|
|
return button;
|
|
|
|
}
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static GtkWidget *sound_options_page (void) {
|
|
|
|
GtkWidget *page_vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Enable / Disable frame */
|
|
|
|
/* Sounds Enable / Disable */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("Sound Enable / Disable"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (table);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Enable */
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_enable_check_button = gtk_check_button_new_with_label (_("Enable Sound"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sound_enable_check_button), sound_enable);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (sound_enable_check_button), "toggled", GTK_SIGNAL_FUNC (sound_enable_toggled_callback), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_enable_check_button, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (sound_enable_check_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Player */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Player program"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2002-10-10 22:44:42 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_player_entry = gtk_entry_new ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_player) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_player_entry), sound_player);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_player_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_player_entry, 1, 2, 1, 2);
|
|
|
|
gtk_widget_show (sound_player_entry);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_player_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_player_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_player_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_player_file_dialog_button, 2, 3, 1, 2, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_player_file_dialog_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (frame);
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Files frame */
|
|
|
|
/* Sounds preferences -- player and various sounds */
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
frame = gtk_frame_new (_("Sound Files"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (page_vbox), frame, FALSE, FALSE, 0);
|
2000-11-05 21:05:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
table = gtk_table_new (2, 3, FALSE);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
2001-01-01 05:40:32 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound XQF Start */
|
2002-10-10 22:44:42 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("XQF Start"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2003-06-19 10:25:19 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_xqf_start_entry = gtk_entry_new ();
|
2003-06-19 10:25:19 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_xqf_start) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_xqf_start_entry), sound_xqf_start);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_xqf_start_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_xqf_start_entry, 1, 2, 0, 1);
|
|
|
|
gtk_widget_show (sound_xqf_start_entry);
|
2003-06-19 10:25:19 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_xqf_start_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_xqf_start_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_xqf_start_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_xqf_start_file_dialog_button, 2, 3, 0, 1, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_xqf_start_file_dialog_button);
|
2003-06-19 10:25:19 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_xqf_start_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_xqf_start_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_xqf_start_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_xqf_start_file_test_button, 3, 4, 0, 1, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_xqf_start_file_test_button);
|
2002-10-10 22:44:42 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound XQF Quit */
|
2001-01-01 05:40:32 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("XQF Quit"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_xqf_quit_entry = gtk_entry_new ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_xqf_quit) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_xqf_quit_entry), sound_xqf_quit);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_xqf_quit_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_xqf_quit_entry, 1, 2, 1, 2);
|
|
|
|
gtk_widget_show (sound_xqf_quit_entry);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_xqf_quit_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_xqf_quit_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_xqf_quit_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_xqf_quit_file_dialog_button, 2, 3, 1, 2, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_xqf_quit_file_dialog_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_xqf_quit_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_xqf_quit_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_xqf_quit_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_xqf_quit_file_test_button, 3, 4, 1, 2, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_xqf_quit_file_test_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Update Done */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Update Done"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_update_done_entry = gtk_entry_new ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_update_done) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_update_done_entry), sound_update_done);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_update_done_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_update_done_entry, 1, 2, 2, 3);
|
|
|
|
gtk_widget_show (sound_update_done_entry);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_update_done_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_update_done_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_update_done_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_update_done_file_dialog_button, 2, 3, 2, 3, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_update_done_file_dialog_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_update_done_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_update_done_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_update_done_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_update_done_file_test_button, 3, 4, 2, 3, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_update_done_file_test_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Refresh Done */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Refresh Done"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_refresh_done_entry = gtk_entry_new ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_refresh_done) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_refresh_done_entry), sound_refresh_done);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_refresh_done_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_refresh_done_entry, 1, 2, 3, 4);
|
|
|
|
gtk_widget_show (sound_refresh_done_entry);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_refresh_done_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_refresh_done_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_refresh_done_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_refresh_done_file_dialog_button, 2, 3, 3, 4, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_refresh_done_file_dialog_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_refresh_done_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_refresh_done_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_refresh_done_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_refresh_done_file_test_button, 3, 4, 3, 4, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_refresh_done_file_test_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Stop */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Stop"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_stop_entry = gtk_entry_new ();
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_stop) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_stop_entry), sound_stop);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_stop_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_stop_entry, 1, 2, 4, 5);
|
|
|
|
gtk_widget_show (sound_stop_entry);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_stop_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_stop_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_stop_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_stop_file_dialog_button, 2, 3, 4, 5, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_stop_file_dialog_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_stop_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_stop_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_stop_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_stop_file_test_button, 3, 4, 4, 5, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_stop_file_test_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Server Connect */
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Server Connect"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_server_connect_entry = gtk_entry_new ();
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_server_connect) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_server_connect_entry), sound_server_connect);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_server_connect_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_server_connect_entry, 1, 2, 5, 6);
|
|
|
|
gtk_widget_show (sound_server_connect_entry);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_server_connect_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_server_connect_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_server_connect_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_server_connect_file_dialog_button, 2, 3, 5, 6, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_server_connect_file_dialog_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_server_connect_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_server_connect_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_server_connect_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_server_connect_file_test_button, 3, 4, 5, 6, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_server_connect_file_test_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Sound Redial Success Start */
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
label = gtk_label_new (_("Redial Success"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7, GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_redial_success_entry = gtk_entry_new ();
|
2004-11-11 16:54:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (sound_redial_success) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (sound_redial_success_entry), sound_redial_success);
|
|
|
|
gtk_entry_set_position (GTK_ENTRY (sound_redial_success_entry), 0);
|
|
|
|
}
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), sound_redial_success_entry, 1, 2, 6, 7);
|
|
|
|
gtk_widget_show (sound_redial_success_entry);
|
2004-11-11 16:54:11 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// File selection dialog
|
|
|
|
sound_redial_success_file_dialog_button = gtk_button_new_with_label ("...");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_redial_success_file_dialog_button), "clicked", GTK_SIGNAL_FUNC (sound_redial_success_file_dialog), NULL);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_redial_success_file_dialog_button, 2, 3, 6, 7, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_redial_success_file_dialog_button);
|
2004-11-01 12:42:23 +00:00
|
|
|
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
// Test button
|
|
|
|
sound_redial_success_file_test_button = sound_test_button_new();
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (sound_redial_success_file_test_button), "clicked", GTK_SIGNAL_FUNC (play_sound_pref), (gpointer)sound_redial_success_entry);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), sound_redial_success_file_test_button, 3, 4, 6, 7, 0, 0, 0, 0);
|
|
|
|
gtk_widget_show (sound_redial_success_file_test_button);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
sound_set_widgets_sensitive(sound_enable);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (table);
|
|
|
|
gtk_widget_show (frame);
|
2002-11-03 16:45:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (page_vbox);
|
2002-11-03 16:45:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return page_vbox;
|
2002-10-03 19:42:52 +00:00
|
|
|
}
|
|
|
|
|
2002-05-05 12:46:17 +00:00
|
|
|
// constructor for generic_prefs
|
|
|
|
static struct generic_prefs* new_generic_prefs (void) {
|
2014-10-16 02:04:09 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
struct generic_prefs* new_genprefs;
|
|
|
|
|
|
|
|
new_genprefs = g_malloc0 (sizeof (struct generic_prefs) * GAMES_TOTAL);
|
|
|
|
|
|
|
|
pref_q1_top_color = default_q1_top_color;
|
|
|
|
pref_q1_bottom_color = default_q1_bottom_color;
|
|
|
|
|
|
|
|
pref_qw_top_color = default_qw_top_color;
|
|
|
|
pref_qw_bottom_color = default_qw_bottom_color;
|
|
|
|
|
|
|
|
pref_b_switch = default_b_switch;
|
|
|
|
pref_w_switch = default_w_switch;
|
|
|
|
pref_qw_noskins = default_qw_noskins;
|
|
|
|
pref_q2_noskins = default_q2_noskins;
|
|
|
|
|
|
|
|
pref_qw_skin = g_strdup (default_qw_skin);
|
|
|
|
pref_q2_skin = g_strdup (default_q2_skin);
|
|
|
|
|
|
|
|
new_genprefs[Q1_SERVER].add_options_to_notebook = add_q1_options_to_notebook;
|
|
|
|
new_genprefs[QW_SERVER].add_options_to_notebook = add_qw_options_to_notebook;
|
|
|
|
new_genprefs[Q2_SERVER].add_options_to_notebook = add_q2_options_to_notebook;
|
|
|
|
new_genprefs[Q3_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[UN_SERVER].add_options_to_notebook = add_un_options_to_notebook;
|
|
|
|
new_genprefs[UT2_SERVER].add_options_to_notebook = add_ut2_options_to_notebook;
|
|
|
|
new_genprefs[WO_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[WOET_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[ETL_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[DOOM3_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[Q4_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[ETQW_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[COD_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[JK2_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[JK3_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[SOF2S_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[T2_SERVER].add_options_to_notebook = add_t2_options_to_notebook;
|
|
|
|
new_genprefs[EF_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[NEXUIZ_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[XONOTIC_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[WARSOW_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[TREMULOUS_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[TREMULOUSGPP_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[TREMFUSION_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[UNVANQUISHED_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[OPENARENA_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[Q3RALLY_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[WOP_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[IOURT_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[REACTION_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[SMOKINGUNS_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[ZEQ2LITE_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[TURTLEARENA_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
new_genprefs[ALIENARENA_SERVER].add_options_to_notebook = add_q3_options_to_notebook;
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
new_genprefs[i].pref_dir = g_strdup (games[i].dir);
|
|
|
|
new_genprefs[i].real_dir = g_strdup (games[i].real_dir);
|
|
|
|
g_datalist_init(&new_genprefs[i].games_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return new_genprefs;
|
2002-05-05 12:46:17 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void generic_prefs_free(struct generic_prefs* prefs) {
|
|
|
|
int i;
|
|
|
|
if (!prefs) return;
|
|
|
|
|
|
|
|
g_free(pref_qw_skin);
|
|
|
|
g_free(pref_q2_skin);
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
g_free(prefs[i].pref_dir);
|
|
|
|
g_free(prefs[i].real_dir);
|
|
|
|
g_datalist_clear(&prefs[i].games_data);
|
|
|
|
}
|
|
|
|
g_free(prefs);
|
2001-10-01 16:24:55 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
void preferences_dialog (int page_num) {
|
2014-10-16 02:04:09 +02:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *page;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *window;
|
|
|
|
int game_num;
|
|
|
|
int i;
|
2001-09-09 17:54:26 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
debug (5, "preferences_dialog()");
|
|
|
|
|
|
|
|
game_num = page_num / 256;
|
|
|
|
page_num = page_num % 256;
|
|
|
|
|
|
|
|
genprefs = new_generic_prefs ();
|
|
|
|
|
|
|
|
window = dialog_create_modal_transient_window (_("XQF: Preferences"), TRUE, FALSE, NULL);
|
|
|
|
if (!GTK_WIDGET_REALIZED (window)) {
|
|
|
|
gtk_widget_realize (window);
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
allocate_quake_player_colors (window->window);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
vbox = gtk_vbox_new (FALSE, 8);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/*
|
|
|
|
* Notebook
|
|
|
|
*/
|
2002-10-03 19:42:52 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_notebook = gtk_notebook_new ();
|
|
|
|
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (pref_notebook), GTK_POS_TOP);
|
|
|
|
gtk_notebook_set_tab_hborder (GTK_NOTEBOOK (pref_notebook), 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), pref_notebook, FALSE, FALSE, 0);
|
2005-07-03 17:51:08 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = general_options_page ();
|
|
|
|
label = gtk_label_new (_("General"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2005-07-03 17:51:08 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/*
|
|
|
|
page = player_profile_page ();
|
|
|
|
label = gtk_label_new (_("Player Profile"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
|
|
|
*/
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = games_config_page (game_num);
|
|
|
|
label = gtk_label_new (_("Games"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = appearance_options_page ();
|
|
|
|
label = gtk_label_new (_("Appearance"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = qstat_options_page ();
|
|
|
|
label = gtk_label_new (_("QStat"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = sound_options_page ();
|
|
|
|
label = gtk_label_new (_("Sounds"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
page = scripts_config_page ();
|
|
|
|
label = gtk_label_new (_("Scripts"));
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (pref_notebook), page, label);
|
2001-09-30 13:13:31 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_notebook_set_page (GTK_NOTEBOOK (pref_notebook), page_num);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Initialize skins and custom cfgs */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q1_skin_is_valid = TRUE;
|
|
|
|
update_q1_skin ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
qw_skin_is_valid = TRUE;
|
|
|
|
update_qw_skins (pref_qw_skin);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
q2_skin_is_valid = TRUE;
|
|
|
|
update_q2_skins (pref_q2_skin);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
update_cfgs (i, genprefs[i].real_dir, games[i].game_cfg);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show (pref_notebook);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Buttons at the bottom
|
|
|
|
*/
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 8);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label (_("Cancel"));
|
|
|
|
gtk_widget_set_usize (button, 80, -1);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window));
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label (_("OK"));
|
|
|
|
gtk_widget_set_usize (button, 80, -1);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (ok_callback), GTK_OBJECT(window));
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
|
|
|
gtk_widget_grab_default (button);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (vbox);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_widget_show (window);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
gtk_main ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
unregister_window (window);
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* clean up */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
generic_prefs_free(genprefs);
|
|
|
|
genprefs=NULL;
|
2002-05-05 12:46:17 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (color_menu) {
|
|
|
|
gtk_widget_destroy (color_menu);
|
|
|
|
color_menu = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
qw_skin_preview = NULL;
|
|
|
|
q2_skin_preview = NULL;
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q1_skin_data) {
|
|
|
|
g_free(q1_skin_data);
|
|
|
|
q1_skin_data=NULL;
|
|
|
|
}
|
2002-12-25 15:17:14 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (qw_skin_data) {
|
|
|
|
g_free (qw_skin_data);
|
|
|
|
qw_skin_data = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (q2_skin_data) {
|
|
|
|
g_free (q2_skin_data);
|
|
|
|
q2_skin_data = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2002-10-23 02:02:48 +00:00
|
|
|
|
2001-10-07 15:59:08 +00:00
|
|
|
// set some defaults when xqf is called the first time
|
2014-10-16 02:04:09 +02:00
|
|
|
static void user_fix_defaults (void) {
|
|
|
|
char** files = NULL;
|
|
|
|
char* suggested_file = NULL;
|
|
|
|
char* guessed_dir = NULL;
|
|
|
|
char str[256];
|
|
|
|
int i;
|
|
|
|
int j = 0;
|
|
|
|
|
|
|
|
debug(1, "Setting defaults");
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
files = games[i].command;
|
|
|
|
if (!files) continue;
|
|
|
|
suggested_file = find_file_in_path_list_relative(files);
|
|
|
|
if (!suggested_file) continue;
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
g_snprintf (str, 256, "/" CONFIG_FILE "/Game: %s/cmd", type2id (games[i].type));
|
|
|
|
config_set_string (str, suggested_file);
|
|
|
|
debug(1,"set command %s for %s",suggested_file,games[i].name);
|
|
|
|
|
|
|
|
guessed_dir = resolve_path(suggested_file);
|
|
|
|
if (!guessed_dir) continue;
|
|
|
|
|
|
|
|
g_snprintf (str, 256, "/" CONFIG_FILE "/Game: %s/dir", type2id (games[i].type));
|
|
|
|
config_set_string (str, guessed_dir);
|
|
|
|
debug(1,"set command %s for %s",guessed_dir,games[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j) {
|
|
|
|
config_set_string ("/" CONFIG_FILE "/Appearance/show only configured games","true");
|
|
|
|
debug(2,"%d games found, set 'show only configured games' to true", j);
|
|
|
|
}
|
|
|
|
|
|
|
|
config_set_string ("/" CONFIG_FILE "/Games Config/player name", g_get_user_name ());
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int fix_qw_player_color (int color) {
|
2014-10-16 02:04:09 +02:00
|
|
|
color = color % 16;
|
|
|
|
if (color > 13) {
|
|
|
|
color = 13;
|
|
|
|
}
|
|
|
|
return color;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int init_user_info (void) {
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!g_get_user_name () || !g_get_home_dir () || !g_get_tmp_dir () || !g_get_user_config_dir ()) {
|
|
|
|
xqf_error(_("Unable to get user name/home directory/XDG config directory/tmp directory"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
user_rcdir = file_in_dir (g_get_user_config_dir (), XDG_RC_DIR);
|
|
|
|
return TRUE;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void free_user_info (void) {
|
2014-10-16 02:04:09 +02:00
|
|
|
if (user_rcdir) {
|
|
|
|
g_free (user_rcdir);
|
|
|
|
user_rcdir = NULL;
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2005-02-19 18:15:37 +00:00
|
|
|
#define XQF_GTKRCNAME "gtkrc-2.0"
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void set_style() {
|
|
|
|
char path[PATH_MAX];
|
|
|
|
int deflt = 0;
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
use_custom_gtkrc = config_get_bool_with_default("use custom gtkrc=true", &deflt);
|
2005-02-19 18:15:37 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/** do not apply custom colors in GTK2 by default */
|
|
|
|
if (deflt) {
|
|
|
|
use_custom_gtkrc = FALSE;
|
|
|
|
}
|
2005-02-20 20:50:07 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (use_custom_gtkrc) {
|
|
|
|
if (default_icontheme) {
|
|
|
|
snprintf(path, sizeof(path), "%s/%s/" XQF_GTKRCNAME, default_icontheme, xqf_PACKAGE_DATA_DIR);
|
|
|
|
|
|
|
|
if (access(path, R_OK) != 0) {
|
|
|
|
path[0] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
path[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!*path) {
|
|
|
|
snprintf(path, sizeof(path), "%s/default/" XQF_GTKRCNAME, xqf_PACKAGE_DATA_DIR);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (access(path, R_OK) == 0) {
|
|
|
|
gtk_rc_parse(path);
|
|
|
|
}
|
|
|
|
}
|
2005-02-19 18:15:37 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void prefs_load_for_game(enum server_type type) {
|
|
|
|
char buf[256];
|
|
|
|
struct game *g = &games[type];
|
2003-05-02 10:30:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (!g->prefs_load) {
|
|
|
|
return;
|
|
|
|
}
|
2003-05-02 10:30:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_snprintf (buf, sizeof(buf), "/" CONFIG_FILE "/Game: %s", type2id (type));
|
|
|
|
config_push_prefix (buf);
|
2003-05-02 10:30:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g->prefs_load(g);
|
2003-05-02 10:30:27 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
config_pop_prefix ();
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q1_prefs_load(struct game* g) {
|
|
|
|
default_q1_name = config_get_string ("player name");
|
|
|
|
default_q1_top_color = config_get_int ("top=0");
|
|
|
|
default_q1_bottom_color = config_get_int ("bottom=0");
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void qw_prefs_load(struct game* g) {
|
|
|
|
default_qw_name = config_get_string ("player name");
|
|
|
|
default_qw_team = config_get_string ("team");
|
|
|
|
default_qw_skin = config_get_string ("skin");
|
|
|
|
default_qw_top_color = config_get_int ("top=0");
|
|
|
|
default_qw_bottom_color = config_get_int ("bottom=0");
|
|
|
|
|
|
|
|
default_qw_rate = config_get_int ("rate=2500");
|
|
|
|
default_qw_cl_nodelta = config_get_int ("cl_nodelta=0");
|
|
|
|
default_qw_cl_predict = config_get_int ("cl_predict=1");
|
|
|
|
default_qw_noskins = config_get_int ("noskins=0");
|
|
|
|
default_noaim = config_get_int ("noaim=0");
|
|
|
|
default_b_switch = config_get_int ("b_switch=0");
|
|
|
|
default_w_switch = config_get_int ("w_switch=0");
|
|
|
|
pushlatency_mode = config_get_int ("pushlatency mode=1");
|
|
|
|
pushlatency_value = config_get_int ("pushlatency value=-50");
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q2_prefs_load(struct game* g) {
|
|
|
|
default_q2_name = config_get_string ("player name");
|
|
|
|
default_q2_skin = config_get_string ("skin");
|
|
|
|
default_q2_rate = config_get_int ("rate=2500");
|
|
|
|
default_q2_cl_nodelta = config_get_int ("cl_nodelta=0");
|
|
|
|
default_q2_cl_predict = config_get_int ("cl_predict=1");
|
|
|
|
default_q2_noskins = config_get_int ("noskins=0");
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q3_prefs_load_common(struct game* g) {
|
|
|
|
char* tmp;
|
|
|
|
enum server_type type = g->type;
|
|
|
|
struct q3_common_prefs_s* w;
|
|
|
|
char buf[256];
|
2001-09-27 10:10:34 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
w = get_pref_widgets_for_game(type);
|
|
|
|
g_return_if_fail(w->defproto != NULL);
|
2001-08-20 01:57:36 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_snprintf (buf, sizeof(buf), "protocol=%s", w->defproto);
|
2001-08-20 01:57:36 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
tmp = config_get_string (buf);
|
|
|
|
if ( strlen( tmp ) == 0 ) {
|
|
|
|
g_free(tmp);
|
|
|
|
tmp = NULL;
|
|
|
|
}
|
|
|
|
game_set_attribute(type,"masterprotocol",tmp);
|
2003-04-24 19:51:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (w->flags & Q3_PREF_SETFS_GAME) {
|
|
|
|
game_set_attribute(type,"setfs_game",config_get_string ("setfs_game=true"));
|
|
|
|
}
|
2003-04-24 19:51:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (w->flags & Q3_PREF_PB) {
|
|
|
|
game_set_attribute(type,"set_punkbuster",config_get_string ("set_punkbuster=true"));
|
|
|
|
}
|
2003-04-24 19:51:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (w->flags & Q3_PREF_CONSOLE) {
|
|
|
|
game_set_attribute(type,"enable_console",config_get_string ("enable_console=true"));
|
|
|
|
}
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2014-10-16 02:04:09 +02:00
|
|
|
|
|
|
|
void q3_prefs_load(struct game* g) {
|
|
|
|
enum server_type type = g->type;
|
|
|
|
|
|
|
|
q3_prefs_load_common(g);
|
|
|
|
|
|
|
|
game_set_attribute(type,"pass_memory_options",config_get_string("pass_memory_options=false"));
|
|
|
|
game_set_attribute(type,"com_hunkmegs",config_get_string("com_hunkmegs=54"));
|
|
|
|
game_set_attribute(type,"com_zonemegs",config_get_string("com_zonemegs=16"));
|
|
|
|
game_set_attribute(type,"com_soundmegs",config_get_string("com_soundmegs=8"));
|
|
|
|
game_set_attribute(type,"cg_precachedmodels",config_get_string("cg_precachedmodels=3"));
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2005-10-07 12:55:15 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void tribes2_prefs_load(struct game* g) {
|
|
|
|
default_t2_name = config_get_string ("player name");
|
2005-11-12 11:31:56 +00:00
|
|
|
}
|
2005-10-07 12:55:15 +00:00
|
|
|
|
2005-11-12 11:31:56 +00:00
|
|
|
int prefs_load (void) {
|
2014-10-16 02:04:09 +02:00
|
|
|
char *oldversion;
|
|
|
|
int i;
|
|
|
|
int old_rc_loaded;
|
|
|
|
int newversion = FALSE;
|
|
|
|
|
|
|
|
oldversion = config_get_string ("/" CONFIG_FILE "/Program/version");
|
|
|
|
|
|
|
|
old_rc_loaded = rc_parse ();
|
|
|
|
if (old_rc_loaded == 0) {
|
|
|
|
rc_save ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldversion) {
|
|
|
|
newversion = g_ascii_strcasecmp (oldversion, XQF_VERSION);
|
|
|
|
g_free (oldversion);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newversion = TRUE;
|
|
|
|
if (old_rc_loaded == -1) {
|
|
|
|
user_fix_defaults ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
int def = 0;
|
|
|
|
struct rlimit rlim;
|
|
|
|
char* coresize = NULL;
|
|
|
|
|
|
|
|
if (getrlimit(RLIMIT_CORE, &rlim)) break;
|
|
|
|
|
|
|
|
coresize = config_get_string_with_default ("/" CONFIG_FILE "/Program/coresize=0",&def);
|
|
|
|
if (def || !coresize) break;
|
|
|
|
|
|
|
|
if (!strcmp(coresize,"unlimited")) {
|
|
|
|
rlim.rlim_cur = RLIM_INFINITY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
char* endptr = NULL;
|
|
|
|
long int size = strtol(coresize,&endptr,10);
|
|
|
|
if (endptr==coresize || size < 0) break;
|
|
|
|
rlim.rlim_cur = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rlim.rlim_cur > rlim.rlim_max) {
|
|
|
|
rlim.rlim_max = rlim.rlim_cur;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (setrlimit(RLIMIT_CORE,&rlim)) {
|
|
|
|
xqf_warning("could not set core size %lu: %s",rlim.rlim_cur,strerror(errno));
|
|
|
|
}
|
|
|
|
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
prefs_load_for_game (i);
|
|
|
|
}
|
|
|
|
|
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Games Config");
|
|
|
|
|
|
|
|
default_nosound = config_get_bool ("nosound=false");
|
|
|
|
default_nocdaudio = config_get_bool ("nocdaudio=false");
|
|
|
|
|
|
|
|
config_pop_prefix ();
|
|
|
|
|
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Appearance");
|
|
|
|
|
|
|
|
show_hostnames = config_get_bool ("show hostnames=true");
|
|
|
|
show_default_port = config_get_bool ("show default port=true");
|
|
|
|
serverlist_countbots = config_get_bool ("count bots=true");
|
|
|
|
default_toolbar_style = config_get_int ("toolbar style=2");
|
|
|
|
default_toolbar_tips = config_get_bool ("toolbar tips=true");
|
|
|
|
default_refresh_sorts = config_get_bool ("sort on refresh=true");
|
|
|
|
default_refresh_on_update = config_get_bool ("refresh on update=true");
|
|
|
|
default_resolve_on_update = config_get_bool ("resolve on update=false");
|
|
|
|
default_show_only_configured_games = config_get_bool ("show only configured games=false");
|
|
|
|
default_icontheme = config_get_string ("icontheme");
|
|
|
|
|
|
|
|
set_style();
|
|
|
|
|
|
|
|
config_pop_prefix ();
|
|
|
|
|
|
|
|
config_push_prefix ("/" CONFIG_FILE "/General");
|
|
|
|
|
|
|
|
default_terminate = config_get_bool ("terminate=false");
|
|
|
|
default_iconify = config_get_bool ("iconify=false");
|
|
|
|
default_launchinfo = config_get_bool ("launchinfo=true");
|
|
|
|
default_stopxmms = config_get_bool ("stopxmms=false");
|
|
|
|
default_prelaunchexec = config_get_bool ("prelaunchexec=false");
|
|
|
|
default_save_lists = config_get_bool ("save lists=true");
|
|
|
|
default_save_srvinfo = config_get_bool ("save srvinfo=true");
|
|
|
|
default_save_plrinfo = config_get_bool ("save players=false");
|
|
|
|
default_auto_favorites = config_get_bool ("refresh favorites=false");
|
|
|
|
default_show_splash = config_get_bool ("splash screen=true");
|
|
|
|
default_auto_maps = config_get_bool ("search maps=false");
|
|
|
|
default_show_tray_icon = config_get_bool ("showtray=false");
|
|
|
|
|
|
|
|
config_pop_prefix ();
|
|
|
|
|
|
|
|
config_push_prefix ("/" CONFIG_FILE "/QStat");
|
|
|
|
|
|
|
|
maxretries = config_get_int ("maxretires=3");
|
|
|
|
maxsimultaneous = config_get_int ("maxsimultaneous=20");
|
|
|
|
qstat_srcport_low = config_get_int ("port_low=0");
|
|
|
|
qstat_srcport_high = config_get_int ("port_high=0");
|
|
|
|
qstat_srcport_changed = FALSE;
|
|
|
|
qstat_srcip = config_get_string ("srcip");
|
|
|
|
qstat_srcip_changed = FALSE;
|
|
|
|
|
|
|
|
config_pop_prefix ();
|
|
|
|
|
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Sounds");
|
|
|
|
|
|
|
|
sound_enable = config_get_bool ("sound_enable=false");
|
|
|
|
sound_player = config_get_string ("sound_player");
|
|
|
|
sound_xqf_start = config_get_string ("sound_xqf_start");
|
|
|
|
sound_xqf_quit = config_get_string ("sound_xqf_quit");
|
|
|
|
sound_update_done = config_get_string ("sound_update_done");
|
|
|
|
sound_refresh_done = config_get_string ("sound_refresh_done");
|
|
|
|
sound_stop = config_get_string ("sound_stop");
|
|
|
|
sound_server_connect = config_get_string ("sound_server_connect");
|
|
|
|
sound_redial_success = config_get_string ("sound_redial_success");
|
|
|
|
|
|
|
|
config_pop_prefix ();
|
|
|
|
|
|
|
|
config_set_string ("/" CONFIG_FILE "/Program/version", XQF_VERSION);
|
|
|
|
config_sync ();
|
2000-11-05 20:40:48 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2014-10-16 02:04:09 +02:00
|
|
|
fprintf (stderr, "prefs_load(): program version %s\n", (newversion)? "changed" : "not changed");
|
2000-11-05 20:40:48 +00:00
|
|
|
#endif
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
create_splashscreen ();
|
2003-01-19 23:35:39 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
/* Convert "dir" -> "real_dir" for all game types */
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
for (i = 0; i < GAMES_TOTAL; i++) {
|
|
|
|
load_game_defaults (i);
|
2002-12-07 18:38:23 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (default_auto_maps && !skip_startup_mapscan) {
|
|
|
|
scan_maps_for(i);
|
|
|
|
}
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
if (games[i].cmd_or_dir_changed) {
|
|
|
|
games[i].cmd_or_dir_changed(&games[i]);
|
|
|
|
}
|
|
|
|
}
|
2000-11-05 20:40:48 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
return newversion;
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
static void scan_maps_for(enum server_type type) {
|
|
|
|
// translator: %s = game name, e.g. Quake 3 Arena
|
|
|
|
char* msg = g_strdup_printf(_("Searching for %s maps"),games[type].name);
|
|
|
|
guint per = 100/GAMES_TOTAL;
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
splash_increase_progress(msg,per);
|
|
|
|
if (games[type].init_maps) {
|
|
|
|
games[type].init_maps(games[type].type);
|
|
|
|
}
|
2004-11-06 23:01:41 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
g_free(msg);
|
2004-11-06 23:01:41 +00:00
|
|
|
}
|
|
|
|
|
2000-11-05 20:40:48 +00:00
|
|
|
/*
|
|
|
|
void prefs_save (void) {
|
2014-10-13 00:36:39 +02:00
|
|
|
config_push_prefix ("/" CONFIG_FILE "/Preferences");
|
|
|
|
config_set_bool ("show hostnames", show_hostnames);
|
|
|
|
config_set_bool ("show default port", show_default_port);
|
|
|
|
config_pop_prefix ();
|
|
|
|
config_sync ();
|
2000-11-05 20:40:48 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void game_file_dialog_ok_callback (GtkWidget *ok_button, gpointer data) {
|
|
|
|
enum server_type type;
|
|
|
|
const char *filename = NULL;
|
|
|
|
GtkWidget* filesel = topmost_parent(ok_button);
|
|
|
|
|
|
|
|
if (!filesel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
type = (enum server_type) GPOINTER_TO_INT(data);
|
|
|
|
|
|
|
|
if (type >= UNKNOWN_SERVER) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
|
|
|
|
|
|
|
|
if (filename) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (genprefs[type].cmd_entry), filename);
|
|
|
|
pref_guess_dir (type, filename, TRUE);
|
|
|
|
}
|
2002-10-23 19:04:55 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void game_file_activate_callback (enum server_type type) {
|
|
|
|
const char* file = gtk_entry_get_text (GTK_ENTRY (genprefs[type].cmd_entry));
|
2002-10-30 16:16:24 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
pref_guess_dir (type, file, TRUE);
|
2002-10-29 01:20:01 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void game_file_dialog(enum server_type type) {
|
|
|
|
file_dialog(_("Game Command Selection"), GTK_SIGNAL_FUNC(game_file_dialog_ok_callback), GINT_TO_POINTER(type));
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void game_dir_dialog(enum server_type type) {
|
|
|
|
if (type >= UNKNOWN_SERVER) {
|
|
|
|
return;
|
|
|
|
}
|
2002-10-26 14:13:51 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
file_dialog_textentry(_("Game Directory Selection"), genprefs[type].dir_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_player_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Sound Player Selection"), sound_player_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_xqf_start_file_dialog() {
|
|
|
|
file_dialog_textentry(_("XQF Start Sound Selection"), sound_xqf_start_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_xqf_quit_file_dialog() {
|
|
|
|
file_dialog_textentry(_("XQF Quit Sound Selection"), sound_xqf_quit_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_update_done_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Update Done Sound Selection"), sound_update_done_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_refresh_done_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Refresh Done Sound Selection"), sound_refresh_done_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_stop_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Stop Sound Selection"), sound_stop_entry);
|
2002-10-23 19:04:55 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_server_connect_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Server Connect Sound Selection"), sound_server_connect_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void sound_redial_success_file_dialog() {
|
|
|
|
file_dialog_textentry(_("Redial Success Sound Selection"), sound_redial_success_entry);
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
|
|
|
|
2004-07-04 17:52:23 +00:00
|
|
|
/*
|
2014-10-16 02:04:09 +02:00
|
|
|
void file_dialog_destroy_callback (GtkWidget *widget, gpointer data) {
|
2002-10-26 14:13:51 +00:00
|
|
|
}
|
2004-07-04 17:52:23 +00:00
|
|
|
*/
|
2002-10-26 14:13:51 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q1_cmd_or_dir_changed(struct game* g) {
|
|
|
|
update_q1_skin();
|
2004-10-02 00:41:45 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void qw_cmd_or_dir_changed(struct game* g) {
|
|
|
|
update_qw_skins (NULL);
|
2004-10-02 00:41:45 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void q2_cmd_or_dir_changed(struct game* g) {
|
|
|
|
update_q2_skins (NULL);
|
2004-10-02 00:41:45 +00:00
|
|
|
}
|
2005-02-22 20:03:25 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void ut2004_cmd_or_dir_changed(struct game* g) {
|
|
|
|
ut2004_detect_cdkey(g);
|
2005-02-22 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void doom3_cmd_or_dir_changed(struct game* g) {
|
|
|
|
doom3_detect_version(g);
|
2005-02-22 20:03:25 +00:00
|
|
|
}
|
2006-04-08 08:00:56 +00:00
|
|
|
|
2014-10-16 02:04:09 +02:00
|
|
|
void tremulous_cmd_or_dir_changed(struct game* g) {
|
|
|
|
doom3_detect_version(g);
|
2006-04-08 08:00:56 +00:00
|
|
|
}
|