Fix nasty bug whith skin management.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1210 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
c39f643808
commit
63191fec2f
7
init.c
7
init.c
@ -2582,8 +2582,11 @@ void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
|
|||||||
Gfx = gfx;
|
Gfx = gfx;
|
||||||
|
|
||||||
// Change config
|
// Change config
|
||||||
free(Config.Skin_file);
|
if(Config.Skin_file != skinfile) // Happens when loading the initial skin
|
||||||
Config.Skin_file = strdup(skinfile);
|
{
|
||||||
|
free(Config.Skin_file);
|
||||||
|
Config.Skin_file = strdup(skinfile);
|
||||||
|
}
|
||||||
|
|
||||||
Config.Fav_menu_colors[0] = gfx->Default_palette[gfx->Color_black];
|
Config.Fav_menu_colors[0] = gfx->Default_palette[gfx->Color_black];
|
||||||
Config.Fav_menu_colors[1] = gfx->Default_palette[gfx->Color_dark];
|
Config.Fav_menu_colors[1] = gfx->Default_palette[gfx->Color_dark];
|
||||||
|
|||||||
5
main.c
5
main.c
@ -306,12 +306,10 @@ void Analyze_command_line(int argc, char * argv[])
|
|||||||
// Separate path from filename
|
// Separate path from filename
|
||||||
Extract_path(Main_file_directory, buffer);
|
Extract_path(Main_file_directory, buffer);
|
||||||
Extract_filename(Main_filename, buffer);
|
Extract_filename(Main_filename, buffer);
|
||||||
DEBUG(Main_filename, 0);
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
} else {
|
} else {
|
||||||
Extract_path(Spare_file_directory, buffer);
|
Extract_path(Spare_file_directory, buffer);
|
||||||
Extract_filename(Spare_filename, buffer);
|
Extract_filename(Spare_filename, buffer);
|
||||||
DEBUG(Spare_filename, 1);
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,7 +742,7 @@ void Program_shutdown(void)
|
|||||||
free(Gfx);
|
free(Gfx);
|
||||||
Gfx=NULL;
|
Gfx=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On prend bien soin de passer dans le répertoire initial:
|
// On prend bien soin de passer dans le répertoire initial:
|
||||||
if (chdir(Initial_directory)!=-1)
|
if (chdir(Initial_directory)!=-1)
|
||||||
{
|
{
|
||||||
@ -835,6 +833,7 @@ int main(int argc,char * argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Main_handler();
|
Main_handler();
|
||||||
|
|
||||||
Program_shutdown();
|
Program_shutdown();
|
||||||
|
|||||||
10
readini.c
10
readini.c
@ -24,7 +24,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
#include "errors.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "readini.h"
|
#include "readini.h"
|
||||||
@ -175,7 +177,7 @@ int Load_INI_get_string(FILE * file,char * buffer,char * option_name,char * retu
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
// On lit une ligne dans le fichier:
|
// On lit une ligne dans le fichier:
|
||||||
if (fgets(buffer,1024,file)==0)
|
if (fgets(buffer,1024,file)==NULL)
|
||||||
{
|
{
|
||||||
free(upper_buffer);
|
free(upper_buffer);
|
||||||
free(option_upper);
|
free(option_upper);
|
||||||
@ -435,13 +437,13 @@ int Load_INI(T_Config * conf)
|
|||||||
strcpy(filename,Config_directory);
|
strcpy(filename,Config_directory);
|
||||||
strcat(filename,"gfx2.ini");
|
strcat(filename,"gfx2.ini");
|
||||||
|
|
||||||
file=fopen(filename,"rb");
|
file=fopen(filename,"r");
|
||||||
if (file==0)
|
if (file==0)
|
||||||
{
|
{
|
||||||
// Si le fichier ini est absent on le relit depuis gfx2def.ini
|
// Si le fichier ini est absent on le relit depuis gfx2def.ini
|
||||||
strcpy(filename,Data_directory);
|
strcpy(filename,Data_directory);
|
||||||
strcat(filename,"gfx2def.ini");
|
strcat(filename,"gfx2def.ini");
|
||||||
file=fopen(filename,"rb");
|
file=fopen(filename,"r");
|
||||||
if (file == 0)
|
if (file == 0)
|
||||||
{
|
{
|
||||||
free(filename);
|
free(filename);
|
||||||
@ -818,7 +820,9 @@ int Load_INI(T_Config * conf)
|
|||||||
|
|
||||||
// Optional, name of skin file. (>2.0)
|
// Optional, name of skin file. (>2.0)
|
||||||
if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
|
if(!Load_INI_get_string(file,buffer,"Skin_file",value_label,1))
|
||||||
|
{
|
||||||
conf->Skin_file = strdup(value_label);
|
conf->Skin_file = strdup(value_label);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
conf->Skin_file = strdup("skin_modern.png");
|
conf->Skin_file = strdup("skin_modern.png");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user