- added button to scan for maps without restarting xqf
- fixed some minor memleaks git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@424 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
parent
e3ffb7a8f7
commit
7c1cbeb10e
@ -1,3 +1,7 @@
|
||||
Dec 25, 2002: Ludwig Nussel <l-n@users.sourceforge.net>
|
||||
- added button to scan for maps without restarting xqf
|
||||
- fixed some minor memleaks
|
||||
|
||||
Dec 19, 2002: Alex Burger <alex_b@users.sourceforge.net>
|
||||
- Changed version to 0.9.11.1
|
||||
|
||||
|
@ -103,7 +103,7 @@ AC_ARG_ENABLE(bzip2,[ --enable-bzip2 use bzip2 for data compression],C
|
||||
AC_SUBST(COMPRESSION)
|
||||
|
||||
dnl check if user wants debug
|
||||
AC_ARG_ENABLE(debug,[ --enable-debug turn on debugging ],DEBUG="-g -DDEBUG", DEBUG="")
|
||||
AC_ARG_ENABLE(debug,[ --enable-debug turn on debugging ],DEBUG="-DDEBUG" CFLAGS="-g -O0", DEBUG="")
|
||||
AC_SUBST(DEBUG)
|
||||
|
||||
AC_SUBST(VERSION)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "debug.h"
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@ -64,6 +65,12 @@ static void dump_base (void) {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* lookup keyname in secname in filename (secname and keyname can be NULL).
|
||||
* When create is set, appropriate entries will be created if they don't
|
||||
* already exist. When file1, section1 and key1 are not NULL (all three are
|
||||
* independent), pointers to the found/created structs are stored there.
|
||||
**/
|
||||
static void find_key (const char *filename,
|
||||
const char *secname,
|
||||
const char *keyname,
|
||||
@ -81,12 +88,14 @@ static void find_key (const char *filename,
|
||||
if (section1) *section1 = NULL;
|
||||
if (key1) *key1 = NULL;
|
||||
|
||||
// look if file is already known
|
||||
for (list = files; list; list = list->next) {
|
||||
file = (struct config_file *) list->data;
|
||||
if (strcmp (filename, file->filename) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise create one
|
||||
if (!list) {
|
||||
|
||||
if (!create)
|
||||
@ -101,12 +110,14 @@ static void find_key (const char *filename,
|
||||
*file1 = file;
|
||||
|
||||
if (secname) {
|
||||
// see if section is alreay known in file
|
||||
for (list = file->sections; list; list = list->next) {
|
||||
section = (struct config_section *) list->data;
|
||||
if (g_strcasecmp (secname, section->name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise create one
|
||||
if (!list) {
|
||||
|
||||
if (!create)
|
||||
@ -122,12 +133,14 @@ static void find_key (const char *filename,
|
||||
}
|
||||
|
||||
if (secname && keyname) {
|
||||
// see if key is already in section
|
||||
for (list = section->keys; list; list = list->next) {
|
||||
key = (struct config_key *) list->data;
|
||||
if (g_strcasecmp (keyname, key->name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise create one
|
||||
if (!list) {
|
||||
|
||||
if (!create)
|
||||
@ -143,7 +156,10 @@ static void find_key (const char *filename,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lookup keyname in section, if not found create a new config_key.
|
||||
* returns pointer to found or created key
|
||||
*/
|
||||
static struct config_key *key_in_section (struct config_section *section,
|
||||
char *keyname) {
|
||||
struct config_key *key;
|
||||
@ -179,7 +195,7 @@ static void load_file (const char *filename) {
|
||||
|
||||
fn = file_in_dir (basedir, filename);
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "config.c: load_file (%s)\n", fn);
|
||||
debug (0, "%s", fn);
|
||||
#endif
|
||||
f = fopen (fn, "r");
|
||||
g_free (fn);
|
||||
@ -608,16 +624,22 @@ static void drop_file (struct config_file *file) {
|
||||
key = (struct config_key *) kptr->data;
|
||||
g_free (key->name);
|
||||
g_free (key->value);
|
||||
g_free(key);
|
||||
key=NULL;
|
||||
}
|
||||
|
||||
g_list_free (section->keys);
|
||||
g_free (section->name);
|
||||
g_free(section);
|
||||
section=NULL;
|
||||
}
|
||||
|
||||
g_list_free (file->sections);
|
||||
g_free (file->filename);
|
||||
|
||||
files = g_list_remove (files, file);
|
||||
|
||||
g_free(file);
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,6 +80,8 @@ void history_free (struct history *h) {
|
||||
char key[128];
|
||||
int i;
|
||||
|
||||
if(!h) return;
|
||||
|
||||
g_snprintf (fmt, 128, "/" CONFIG_FILE "/History: %s/%%i", h->id);
|
||||
|
||||
for (i = 0, list = h->items; list; i++, list = list->next) {
|
||||
@ -87,7 +89,7 @@ void history_free (struct history *h) {
|
||||
config_set_string (key, (char *) list->data);
|
||||
}
|
||||
|
||||
if (!h) {
|
||||
if (h) {
|
||||
if (h->items) {
|
||||
g_list_foreach (h->items, (GFunc) g_free, NULL);
|
||||
g_list_free (h->items);
|
||||
|
@ -391,6 +391,7 @@ static void get_new_defaults_for_game (enum server_type type) {
|
||||
|
||||
j++;
|
||||
g_snprintf (conf, 64, "custom_arg%d", j);
|
||||
g_free(str2);
|
||||
str2 = config_get_string_with_default (conf,&isdefault);
|
||||
}
|
||||
|
||||
@ -3563,6 +3564,19 @@ static GtkWidget *appearance_options_page (void) {
|
||||
return page_vbox;
|
||||
}
|
||||
|
||||
static void scan_maps_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < GAMES_TOTAL; i++)
|
||||
{
|
||||
if(games[i].init_maps)
|
||||
{
|
||||
debug(0,"Searching for %s maps",games[i].name);
|
||||
games[i].init_maps();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *general_options_page (void) {
|
||||
GtkWidget *page_vbox;
|
||||
GtkWidget *frame;
|
||||
@ -3612,6 +3626,15 @@ static GtkWidget *general_options_page (void) {
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (auto_maps_check_button);
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
@ -4203,6 +4226,9 @@ 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++)
|
||||
{
|
||||
@ -4358,6 +4384,12 @@ void preferences_dialog (int page_num) {
|
||||
qw_skin_preview = NULL;
|
||||
q2_skin_preview = NULL;
|
||||
|
||||
if(q1_skin_data)
|
||||
{
|
||||
g_free(q1_skin_data);
|
||||
q1_skin_data=NULL;
|
||||
}
|
||||
|
||||
if (qw_skin_data) {
|
||||
g_free (qw_skin_data);
|
||||
qw_skin_data = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user