@ -622,8 +622,8 @@ char *yon_char_from_float(float int_to_convert)
{
{
convert_check = convert_check / 10 ;
convert_check = convert_check / 10 ;
}
}
char * ch = g_malloc0 ( i * sizeof ( char ) + 1 ) ;
char * ch = g_malloc0 ( ( i + 9 ) * sizeof ( char ) ) ;
sprintf ( ch , " % f" , int_to_convert ) ;
sprintf ( ch , " % .2 f" , int_to_convert ) ;
return ch ;
return ch ;
}
}
@ -680,24 +680,22 @@ char *yon_char_replace(char *source, char *find, char*replace){
* size of returned array
* size of returned array
*/
*/
char * * yon_char_parse ( char * parameters , int * size , char * divider ) {
char * * yon_char_parse ( char * parameters , int * size , char * divider ) {
char * * string = NULL ;
if ( parameters ) {
int i = 1 ;
char * * string = NULL ;
string = malloc ( sizeof ( char * ) ) ;
* size = 0 ;
char * paramline = yon_char_new ( parameters ) ;
char * paramline = yon_char_new ( parameters ) ;
char * param ;
char * param = strstr ( paramline , divider ) ;
while ( ( param = yon_char_divide_search ( paramline , divider , 1 ) ) ) {
for ( ; param ; param = strstr ( paramline , divider ) ) {
string = realloc ( string , sizeof ( char * ) * i ) ;
string = yon_remalloc ( string , sizeof ( char * ) * ( ( * size ) + 1 ) ) ;
string [ i - 1 ] = yon_char_new ( param ) ;
string [ ( * size ) ] = yon_char_divide ( paramline , strlen ( paramline ) - strlen ( param ) ) ;
i + + ;
* size = ( * size ) + 1 ;
if ( strcmp ( param , paramline ) = = 0 ) break ;
}
}
string = yon_remalloc ( string , sizeof ( char * ) * ( ( * size ) + 1 ) ) ;
// string=realloc(string,sizeof(char*)*i);
string [ ( * size ) ] = paramline ;
// string[i-1]=yon_char_new(paramline);
( * size ) + = 1 ;
// i++;
return string ;
// printf("%d\n",i);
}
* size = i - 1 ;
return NULL ;
return string ;
}
}
/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete)
/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete)
@ -746,6 +744,30 @@ int yon_char_parsed_check_exist(char **parameters, int size, char *param){
return - 1 ;
return - 1 ;
}
}
/**yon_char_parsed_check_repeats(char **parameters, int size)
* [ EN ]
* Checks if [ parameters ] string array of length [ size ]
* has repeated elements ;
* [ RU ]
* П р о в е р я е т е с т ь л и в м а с с и в е с т р о к [ parameters ] , р а з м е р а [ size ]
* п о в т о р е н и я
*/
int yon_char_parsed_check_repeats ( char * * parameters , int size , int * first_overlap , int * second_overlap ) {
if ( parameters ) {
* first_overlap = 0 ;
* second_overlap = 0 ;
for ( ( * first_overlap ) = 0 ; ( * first_overlap ) < size ; ( * first_overlap ) + + ) {
for ( ( * second_overlap ) = 0 ; ( * second_overlap ) < size ; ( * second_overlap ) + + ) {
if ( parameters [ ( * first_overlap ) ] & & parameters [ ( * second_overlap ) ] ) {
if ( ! strcmp ( parameters [ ( * first_overlap ) ] , parameters [ ( * second_overlap ) ] ) & & ( * first_overlap ) ! = ( * second_overlap ) )
return 1 ;
}
}
}
}
return 0 ;
}
/**yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size)
/**yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size)
* [ EN ]
* [ EN ]
*
*
@ -1192,7 +1214,7 @@ void *yon_config_get_by_key(char *key){
check_config {
check_config {
dictionary * dict = NULL ;
dictionary * dict = NULL ;
for_dictionaries ( dict , ( dictionary * ) __yon__config__strings ) {
for_dictionaries ( dict , ( dictionary * ) __yon__config__strings ) {
if ( strcmp ( dict - > key , key ) = = 0 ) {
if ( strcmp ( dict - > key , key ) = = 0 & & ( ( yon_config_parameter * ) dict ) - > flag1 ! = - 1 ) {
return dict - > data ;
return dict - > data ;
}
}
}
}
@ -1205,7 +1227,7 @@ void *yon_config_get_all_by_key(char *key, int *size){
config_str ret_data = NULL ;
config_str ret_data = NULL ;
dictionary * dict = NULL ;
dictionary * dict = NULL ;
for_dictionaries ( dict , ( dictionary * ) __yon__config__strings ) {
for_dictionaries ( dict , ( dictionary * ) __yon__config__strings ) {
if ( strstr ( dict - > key , key ) ) {
if ( strstr ( dict - > key , key ) & & ( ( yon_config_parameter * ) dict ) - > flag1 ! = - 1 ) {
char * ret_string = yon_char_unite ( dict - > key , " = " , ( char * ) dict - > data , NULL ) ;
char * ret_string = yon_char_unite ( dict - > key , " = " , ( char * ) dict - > data , NULL ) ;
if ( ret_data ) ret_data = yon_char_parsed_append ( ret_data , size , ret_string ) ;
if ( ret_data ) ret_data = yon_char_parsed_append ( ret_data , size , ret_string ) ;
else ret_data = yon_char_parsed_new ( size , ret_string , NULL ) ;
else ret_data = yon_char_parsed_new ( size , ret_string , NULL ) ;
@ -1334,12 +1356,17 @@ config_str yon_config_load(char *command, int *str_len){
}
}
}
}
/**int yon_config_save_registered(char *path , char *section )
/**int yon_config_save_registered(char *path )
* [ EN ]
* [ EN ]
* Saves config with [ command ]
* Saves config at [ path ] config .
* [ path ] can be :
* system
* global
* [ RU ]
* [ RU ]
* В ы п о л н я е т к о м а н д у [ command ] , д о б а в л я я в к о н е ц в с е з а п и с и к о н ф и г а в т а к о м в и д е :
* С о х р а н я е т к о н ф и г у р а ц и ю в [ path ] к о н ф и г .
* [ П А Р А М Е Т Р 1 ] = " [зна че ния1] " [ П А Р А М Е Т Р 2 ] = " [зна че ния2] "
* [ path ] м о ж е т б ы т ь
* system - л о к а л ь н ы й к о н ф и г
* global - г л о б а л ь н ы й к о н ф и г
*/
*/
int yon_config_save_registered ( char * path ) {
int yon_config_save_registered ( char * path ) {
check_config {
check_config {
@ -1350,7 +1377,7 @@ int yon_config_save_registered(char *path){
if ( dct - > data & & strcmp ( yon_dictionary_get_data ( dct , char * ) , " " ) ! = 0 ) {
if ( dct - > data & & strcmp ( yon_dictionary_get_data ( dct , char * ) , " " ) ! = 0 ) {
if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = 1 ) {
if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = 1 ) {
( ( yon_config_parameter * ) dct ) - > flag1 = 0 ;
( ( yon_config_parameter * ) dct ) - > flag1 = 0 ;
if ( sections_add & & yon_dictionary_get ( & sections_add , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_add - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_add , char * ) , " " , dct - > key , " = " , yon_dictionary_get_data ( dct , char * ) , NULL ) ;
if ( sections_add & & yon_dictionary_get ( & sections_add , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_add - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_add , char * ) , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ;
else yon_dictionary_add_or_create_if_exists_with_data ( sections_add , ( ( yon_config_parameter * ) dct ) - > section , yon_char_unite ( ubconfig_save_command , path ? yon_char_append ( " --target " , path ) : " " , " set " , ( ( yon_config_parameter * ) dct ) - > section , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ) ;
else yon_dictionary_add_or_create_if_exists_with_data ( sections_add , ( ( yon_config_parameter * ) dct ) - > section , yon_char_unite ( ubconfig_save_command , path ? yon_char_append ( " --target " , path ) : " " , " set " , ( ( yon_config_parameter * ) dct ) - > section , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ) ;
} else if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = - 1 ) {
} else if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = - 1 ) {
( ( yon_config_parameter * ) dct ) - > flag1 = 0 ;
( ( yon_config_parameter * ) dct ) - > flag1 = 0 ;
@ -1376,10 +1403,15 @@ int yon_config_save_registered(char *path){
/**int yon_config_force_save_registered(char *path, char *section)
/**int yon_config_force_save_registered(char *path, char *section)
* [ EN ]
* [ EN ]
* Saves config with [ command ]
* Force config to save at [ path ] config ignoring parameter save status .
* [ path ] can be :
* system
* global
* [ RU ]
* [ RU ]
* В ы п о л н я е т к о м а н д у [ command ] , д о б а в л я я в к о н е ц в с е з а п и с и к о н ф и г а в т а к о м в и д е :
* П р и н у д и т е л ь н о с о х р а н я е т к о н ф и г у р а ц и ю в [ path ] к о н ф и г и г н о р и р у я с т а т у с п а р а м е т р а .
* [ П А Р А М Е Т Р 1 ] = " [зна че ния1] " [ П А Р А М Е Т Р 2 ] = " [зна че ния2] "
* [ path ] м о ж е т б ы т ь
* system - л о к а л ь н ы й к о н ф и г
* global - г л о б а л ь н ы й к о н ф и г
*/
*/
int yon_config_force_save_registered ( char * path ) {
int yon_config_force_save_registered ( char * path ) {
check_config {
check_config {
@ -1389,7 +1421,7 @@ int yon_config_force_save_registered(char *path){
for_dictionaries ( dct , ( dictionary * ) __yon__config__strings ) {
for_dictionaries ( dct , ( dictionary * ) __yon__config__strings ) {
if ( dct - > data & & strcmp ( yon_dictionary_get_data ( dct , char * ) , " " ) ! = 0 ) {
if ( dct - > data & & strcmp ( yon_dictionary_get_data ( dct , char * ) , " " ) ! = 0 ) {
if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = 1 | | ( ( yon_config_parameter * ) dct ) - > flag1 = = 0 ) {
if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = 1 | | ( ( yon_config_parameter * ) dct ) - > flag1 = = 0 ) {
if ( sections_add & & yon_dictionary_get ( & sections_add , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_add - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_add , char * ) , " " , dct - > key , " = " , yon_dictionary_get_data ( dct , char * ) , NULL ) ;
if ( sections_add & & yon_dictionary_get ( & sections_add , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_add - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_add , char * ) , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ;
else yon_dictionary_add_or_create_if_exists_with_data ( sections_add , ( ( yon_config_parameter * ) dct ) - > section , yon_char_unite ( ubconfig_save_command , path ? yon_char_append ( " --target " , path ) : " " , " set " , ( ( yon_config_parameter * ) dct ) - > section , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ) ;
else yon_dictionary_add_or_create_if_exists_with_data ( sections_add , ( ( yon_config_parameter * ) dct ) - > section , yon_char_unite ( ubconfig_save_command , path ? yon_char_append ( " --target " , path ) : " " , " set " , ( ( yon_config_parameter * ) dct ) - > section , " " , dct - > key , " = \" " , yon_dictionary_get_data ( dct , char * ) , " \" " , NULL ) ) ;
} else if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = - 1 ) {
} else if ( ( ( yon_config_parameter * ) dct ) - > flag1 = = - 1 ) {
if ( sections_remove & & yon_dictionary_get ( & sections_remove , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_remove - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_remove , char * ) , " " , dct - > key , NULL ) ;
if ( sections_remove & & yon_dictionary_get ( & sections_remove , ( ( yon_config_parameter * ) dct ) - > section ) ) sections_remove - > data = ( void * ) yon_char_unite ( yon_dictionary_get_data ( sections_remove , char * ) , " " , dct - > key , NULL ) ;
@ -1481,7 +1513,60 @@ config_str yon_file_open(char *file_path, int *size){
}
}
return final_string ;
return final_string ;
}
}
}
}
/**yon_file_create(char *path, char *name, int rules)
* [ EN ]
*
* [ RU ]
* С о з д а т ь ф а й л с н а з в а н и е м [ name ] , н а х о д я щ и м с я п о п у т и [ path ]
* С п р а в а м и д о с т у п а [ rules ] ( о т 0000 д о 0777 )
*/
int yon_file_create ( char * path , char * name , int rules ) {
if ( path & & name ) {
char * full_path = yon_char_unite ( path , " / " , name , NULL ) ;
if ( access ( full_path , F_OK ) ) {
FILE * fl = fopen ( full_path , " w " ) ;
if ( fl ) {
chmod ( full_path , rules ) ;
fclose ( fl ) ;
return 1 ;
} else {
return 0 ;
}
} else {
return - 1 ;
}
} else {
return 0 ;
}
}
/**yon_file_create_full_path(char *path, char *name, int rules)
* [ EN ]
*
* [ RU ]
* С о з д а т ь ф а й л п о п у т и [ path ]
* С п р а в а м и д о с т у п а [ rules ] ( о т 0000 д о 0777 )
*/
int yon_file_create_full_path ( char * path , int rules ) {
if ( path ) {
if ( access ( path , F_OK ) ) {
FILE * fl = fopen ( path , " w " ) ;
if ( fl ) {
chmod ( path , rules ) ;
fclose ( fl ) ;
return 1 ;
} else {
return 0 ;
}
} else {
return - 1 ;
}
} else {
return 0 ;
}
}
// terminal-using functions
// terminal-using functions
@ -1552,8 +1637,7 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi
VtePty * pty = vte_pty_new_sync ( VTE_PTY_DEFAULT , NULL , NULL ) ;
VtePty * pty = vte_pty_new_sync ( VTE_PTY_DEFAULT , NULL , NULL ) ;
vte_terminal_set_pty ( VTE_TERMINAL ( terminal ) , pty ) ;
vte_terminal_set_pty ( VTE_TERMINAL ( terminal ) , pty ) ;
gtk_container_add ( GTK_CONTAINER ( place_to_show ) , terminal ) ;
gtk_container_add ( GTK_CONTAINER ( place_to_show ) , terminal ) ;
char * install_command = yon_char_unite ( " tput cup 0 0 && tput ed; " , command , " ; sleep 5;exit 0 " , " \n " , NULL ) ;
char * install_command = yon_char_unite ( " clear;tput cup 0 0 && tput ed; " , command , " ; sleep 5;exit 0 " , " \n " , NULL ) ;
printf ( " %s \n " , install_command ) ;
if ( endwork_function )
if ( endwork_function )
g_signal_connect ( G_OBJECT ( terminal ) , " child-exited " , G_CALLBACK ( endwork_function ) , endwork_function_argument ) ;
g_signal_connect ( G_OBJECT ( terminal ) , " child-exited " , G_CALLBACK ( endwork_function ) , endwork_function_argument ) ;
vte_terminal_spawn_async ( VTE_TERMINAL ( terminal ) ,
vte_terminal_spawn_async ( VTE_TERMINAL ( terminal ) ,
@ -1606,7 +1690,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
vte_terminal_set_size ( VTE_TERMINAL ( terminal ) , 10 , 15 ) ;
vte_terminal_set_size ( VTE_TERMINAL ( terminal ) , 10 , 15 ) ;
VtePty * pty = vte_pty_new_sync ( VTE_PTY_DEFAULT , NULL , NULL ) ;
VtePty * pty = vte_pty_new_sync ( VTE_PTY_DEFAULT , NULL , NULL ) ;
vte_terminal_set_pty ( VTE_TERMINAL ( terminal ) , pty ) ;
vte_terminal_set_pty ( VTE_TERMINAL ( terminal ) , pty ) ;
char * install_command = yon_char_unite ( " tput cup 0 0 && tput ed; " , command , " ; sleep 5; exit 0 " , " \n " , NULL ) ;
char * install_command = yon_char_unite ( " clear; tput cup 0 0 && tput ed; " , command , " ; sleep 5; stty -echo; unset PS1 " , " \n " , NULL ) ;
if ( endwork_function )
if ( endwork_function )
g_signal_connect ( G_OBJECT ( terminal ) , " child-exited " , G_CALLBACK ( endwork_function ) , endwork_function_argument ) ;
g_signal_connect ( G_OBJECT ( terminal ) , " child-exited " , G_CALLBACK ( endwork_function ) , endwork_function_argument ) ;
vte_terminal_spawn_async ( VTE_TERMINAL ( terminal ) ,
vte_terminal_spawn_async ( VTE_TERMINAL ( terminal ) ,
@ -1679,6 +1763,11 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
g_key_file_set_integer ( __yon_window_config_file , " window " , " WindowHeight " , __yon_main_window_config . height ) ;
g_key_file_set_integer ( __yon_window_config_file , " window " , " WindowHeight " , __yon_main_window_config . height ) ;
g_key_file_set_integer ( __yon_window_config_file , " window " , " fullscreen " , __yon_main_window_config . fullscreen ) ;
g_key_file_set_integer ( __yon_window_config_file , " window " , " fullscreen " , __yon_main_window_config . fullscreen ) ;
dictionary * dict = NULL ;
dictionary * dict = NULL ;
if ( __yon_main_window_config . deleted_parameters )
for_dictionaries ( dict , __yon_main_window_config . deleted_parameters ) {
__yon_custom_parameter * param = yon_dictionary_get_data ( dict , __yon_custom_parameter * ) ;
g_key_file_remove_key ( __yon_window_config_file , param - > section , param - > parameter_name , NULL ) ;
}
if ( __yon_main_window_config . custom_listeners )
if ( __yon_main_window_config . custom_listeners )
for_dictionaries ( dict , __yon_main_window_config . custom_listeners ) {
for_dictionaries ( dict , __yon_main_window_config . custom_listeners ) {
__yon_listener_parameter * param = yon_dictionary_get_data ( dict , __yon_listener_parameter * ) ;
__yon_listener_parameter * param = yon_dictionary_get_data ( dict , __yon_listener_parameter * ) ;
@ -1714,11 +1803,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
break ;
break ;
}
}
}
}
if ( __yon_main_window_config . deleted_parameters )
for_dictionaries ( dict , __yon_main_window_config . deleted_parameters ) {
__yon_custom_parameter * param = yon_dictionary_get_data ( dict , __yon_custom_parameter * ) ;
g_key_file_remove_key ( __yon_window_config_file , param - > section , param - > parameter_name , NULL ) ;
}
g_key_file_save_to_file ( __yon_window_config_file , __yon_window_config_path , NULL ) ;
g_key_file_save_to_file ( __yon_window_config_file , __yon_window_config_path , NULL ) ;
}
}
@ -1787,6 +1872,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
}
}
FILE * fp ;
FILE * fp ;
fp = fopen ( __yon_window_config_path , " w " ) ;
fp = fopen ( __yon_window_config_path , " w " ) ;
chmod ( __yon_window_config_path , 0777 ) ;
fclose ( fp ) ;
fclose ( fp ) ;
g_key_file_load_from_file ( __yon_window_config_file , __yon_window_config_path , G_KEY_FILE_NONE , NULL ) ;
g_key_file_load_from_file ( __yon_window_config_file , __yon_window_config_path , G_KEY_FILE_NONE , NULL ) ;
}
}
@ -1868,6 +1954,17 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
}
}
}
}
void yon_window_config_add_instant_parameter ( char * param_name , char * section , void * tracked_value , enum YON_TYPE val_type ) {
switch ( val_type ) {
case YON_TYPE_BOOLEAN : g_key_file_set_boolean ( __yon_window_config_file , section , param_name , * ( ( gboolean * ) tracked_value ) ) ;
break ;
case YON_TYPE_INT : g_key_file_set_integer ( __yon_window_config_file , section , param_name , * ( ( int * ) tracked_value ) ) ;
break ;
case YON_TYPE_STRING : g_key_file_set_string ( __yon_window_config_file , section , param_name , ( char * ) tracked_value ) ;
break ;
}
}
void yon_window_config_erase_custom_parameter ( char * param_name , char * section ) {
void yon_window_config_erase_custom_parameter ( char * param_name , char * section ) {
__yon_custom_parameter * param = NULL ;
__yon_custom_parameter * param = NULL ;
param = yon_remalloc ( param , sizeof ( __yon_custom_parameter ) ) ;
param = yon_remalloc ( param , sizeof ( __yon_custom_parameter ) ) ;
@ -1901,6 +1998,81 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
}
}
}
}
void yon_on_window_config_custom_window_destroy ( GtkWindow * window , char * window_name ) {
if ( ! gtk_window_is_maximized ( window ) ) {
int height = 0 ;
int width = 0 ;
int X = 0 ;
int Y = 0 ;
gtk_window_get_position ( window , & X , & Y ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosX " ) , " window " , & X , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosY " ) , " window " , & Y , YON_TYPE_INT ) ;
}
}
void yon_on_window_config_custom_window_resize ( GtkWindow * window , char * window_name ) {
if ( ! gtk_window_is_maximized ( window ) ) {
int height = 0 ;
int width = 0 ;
int X = 0 ;
int Y = 0 ;
gtk_window_get_size ( window , & width , & height ) ;
gtk_window_get_position ( window , & X , & Y ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " Width " ) , " window " , & width , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " Height " ) , " window " , & height , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosX " ) , " window " , & X , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosY " ) , " window " , & Y , YON_TYPE_INT ) ;
}
}
void yon_window_config_custom_window_setup ( GtkWindow * window , char * window_name ) {
int height = 0 ;
int width = 0 ;
int X = 0 ;
int Y = 0 ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " Width " ) , & width , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " Height " ) , & height , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " PosX " ) , & X , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " PosY " ) , & Y , YON_TYPE_INT ) ;
if ( width & & height )
gtk_window_resize ( window , width , height ) ;
if ( X & & Y )
gtk_window_move ( window , X , Y ) ;
char * signals_window_name = yon_char_new ( window_name ) ;
g_signal_connect ( G_OBJECT ( window ) , " check-resize " , G_CALLBACK ( yon_on_window_config_custom_window_resize ) , signals_window_name ) ;
g_signal_connect ( G_OBJECT ( window ) , " delete-event " , G_CALLBACK ( yon_on_window_config_custom_window_destroy ) , signals_window_name ) ;
}
void yon_window_config_custom_window_get ( GtkWindow * window , char * window_name ) {
int height = 0 ;
int width = 0 ;
int X = 0 ;
int Y = 0 ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " Width " ) , & width , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " Height " ) , & height , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " PosX " ) , & X , YON_TYPE_INT ) ;
yon_window_config_get_parameter ( " window " , yon_char_append ( window_name , " PosY " ) , & Y , YON_TYPE_INT ) ;
if ( width & & height )
gtk_window_resize ( window , width , height ) ;
if ( X & & Y )
gtk_window_move ( window , X , Y ) ;
}
void yon_window_config_custom_window_set ( GtkWindow * window , char * window_name ) {
int height = 0 ;
int width = 0 ;
int X = 0 ;
int Y = 0 ;
gtk_window_get_size ( window , & width , & height ) ;
gtk_window_get_position ( window , & X , & Y ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " Width " ) , " window " , & width , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " Height " ) , " window " , & height , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosX " ) , " window " , & X , YON_TYPE_INT ) ;
yon_window_config_add_instant_parameter ( yon_char_append ( window_name , " PosY " ) , " window " , & Y , YON_TYPE_INT ) ;
}
GtkWidget * yon_ubl_menu_item_about_new ( char * buttonname ) {
GtkWidget * yon_ubl_menu_item_about_new ( char * buttonname ) {
GtkWidget * menu_item = gtk_menu_item_new ( ) ;
GtkWidget * menu_item = gtk_menu_item_new ( ) ;
gtk_style_context_add_class ( gtk_widget_get_style_context ( menu_item ) , " menuitembottom " ) ;
gtk_style_context_add_class ( gtk_widget_get_style_context ( menu_item ) , " menuitembottom " ) ;
@ -2092,6 +2264,30 @@ void yon_ubl_status_highlight_incorrect(GtkWidget *widget){
GThread * thread = g_thread_new ( NULL , ( GThreadFunc ) _yon_ubl_status_highlight_incorrect , widget ) ;
GThread * thread = g_thread_new ( NULL , ( GThreadFunc ) _yon_ubl_status_highlight_incorrect , widget ) ;
}
}
void _yon_ubl_status_list_store_highlight_incorrect ( GtkWidget * * widget_pack ) {
GtkListStore * list = ( GtkListStore * ) widget_pack [ 0 ] ;
GtkTreeIter * iter = ( GtkTreeIter * ) widget_pack [ 1 ] ;
GdkRGBA rgba , rgba2 ;
rgba . alpha = 1 ;
rgba . blue = 153.0 / 255.0 ;
rgba . green = 153.0 / 255.0 ;
rgba . red = 234.0 / 255.0 ;
rgba2 . alpha = 1 ;
rgba2 . blue = 0 ;
rgba2 . green = 0 ;
rgba2 . red = 0 ;
gtk_list_store_set ( list , iter , 1 , gdk_rgba_to_string ( & rgba2 ) , 2 , gdk_rgba_to_string ( & rgba ) , - 1 ) ;
sleep ( 5 ) ;
gtk_list_store_set ( list , iter , 1 , NULL , 2 , NULL , - 1 ) ;
}
void yon_ubl_status_list_store_highlight_incorrect ( GtkListStore * list , GtkTreeIter * iter ) {
GtkWidget * * pack = malloc ( sizeof ( GtkWidget * ) * 2 ) ;
pack [ 0 ] = ( GtkWidget * ) list ;
pack [ 1 ] = ( GtkWidget * ) iter ;
GThread * thread = g_thread_new ( NULL , ( GThreadFunc ) _yon_ubl_status_list_store_highlight_incorrect , pack ) ;
}
struct temp_statusbox {
struct temp_statusbox {
int times ;
int times ;
GtkWidget * revealer ;
GtkWidget * revealer ;
@ -2099,7 +2295,7 @@ struct temp_statusbox {
void _yon_ubl_status_box_timed_remove ( struct temp_statusbox * statusstruct ) {
void _yon_ubl_status_box_timed_remove ( struct temp_statusbox * statusstruct ) {
sleep ( statusstruct - > times ) ;
sleep ( statusstruct - > times ) ;
if ( status struct- > revealer ) {
if ( status _thread_busy ) {
gtk_revealer_set_reveal_child ( GTK_REVEALER ( statusstruct - > revealer ) , 0 ) ;
gtk_revealer_set_reveal_child ( GTK_REVEALER ( statusstruct - > revealer ) , 0 ) ;
sleep ( 1 ) ;
sleep ( 1 ) ;
gtk_widget_destroy ( statusstruct - > revealer ) ;
gtk_widget_destroy ( statusstruct - > revealer ) ;
@ -2108,6 +2304,10 @@ void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){
status_thread_busy = 0 ;
status_thread_busy = 0 ;
}
}
void __yon_ubl_status_box_destroyed ( ) {
status_thread_busy = 0 ;
}
void yon_ubl_status_box_spawn ( GtkContainer * container , char * display_text , int timeout , BACKGROUND_IMAGE_TYPE type ) {
void yon_ubl_status_box_spawn ( GtkContainer * container , char * display_text , int timeout , BACKGROUND_IMAGE_TYPE type ) {
if ( ! status_thread_busy ) {
if ( ! status_thread_busy ) {
GtkWidget * box = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL , 5 ) ;
GtkWidget * box = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL , 5 ) ;
@ -2121,6 +2321,7 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
gtk_widget_show_all ( revealer ) ;
gtk_widget_show_all ( revealer ) ;
gtk_revealer_set_reveal_child ( GTK_REVEALER ( revealer ) , 1 ) ;
gtk_revealer_set_reveal_child ( GTK_REVEALER ( revealer ) , 1 ) ;
g_signal_connect ( G_OBJECT ( revealer ) , " destroy " , G_CALLBACK ( __yon_ubl_status_box_destroyed ) , NULL ) ;
gtk_widget_set_margin_bottom ( label , 9 ) ;
gtk_widget_set_margin_bottom ( label , 9 ) ;
gtk_widget_set_margin_top ( label , 9 ) ;
gtk_widget_set_margin_top ( label , 9 ) ;