Fixed crash when can't find config path #20

Merged
asmeron merged 1 commits from YanTheKaller/libublsettings-gtk3:master into master 1 year ago

@ -251,13 +251,16 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
*/ */
void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){ void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){
check_window_config_setup{ check_window_config_setup{
if (__yon_window_config_path){
yon_get_is_fullscreen(); yon_get_is_fullscreen();
yon_window_config_save(); yon_window_config_save();
} }
}
gtk_main_quit(); gtk_main_quit();
} }
void __yon_window_config_on_resize(){ void __yon_window_config_on_resize(){
if (__yon_window_config_path){
int max=0; int max=0;
max=gtk_window_is_maximized(__yon_window_config_target_window); max=gtk_window_is_maximized(__yon_window_config_target_window);
if(max==0){ if(max==0){
@ -265,6 +268,7 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
} }
} }
}
void yon_window_config_setup(GtkWindow *window){ void yon_window_config_setup(GtkWindow *window){
__yon_window_config_target_window = window; __yon_window_config_target_window = window;
@ -278,6 +282,7 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
} }
int yon_window_config_load(char *path){ int yon_window_config_load(char *path){
if (!access(path,0)){
__yon_window_config_file = g_key_file_new(); __yon_window_config_file = g_key_file_new();
__yon_window_config_path=yon_char_new(path); __yon_window_config_path=yon_char_new(path);
if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){
@ -329,6 +334,9 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
pthread_t tid; pthread_t tid;
pthread_create(&tid,NULL,(void *)_yon_maximize,NULL); pthread_create(&tid,NULL,(void *)_yon_maximize,NULL);
return 1; return 1;
} else {
return 0;
}
} }
void yon_window_config_apply(){ void yon_window_config_apply(){

Loading…
Cancel
Save