|
|
@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
// dictionary functions
|
|
|
|
// dictionary functions
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_dictionary_create_empty():
|
|
|
|
/**yon_dictionary_new():
|
|
|
|
* [EN]
|
|
|
|
* [EN]
|
|
|
|
* Creates and returns empty dictionary
|
|
|
|
* Creates and returns empty dictionary
|
|
|
|
* [RU]
|
|
|
|
* [RU]
|
|
|
@ -29,6 +29,7 @@ dictionary *yon_dictionary_new()
|
|
|
|
dictionary *yon_dictinoary_copy(dictionary *dict){
|
|
|
|
dictionary *yon_dictinoary_copy(dictionary *dict){
|
|
|
|
dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data);
|
|
|
|
dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data);
|
|
|
|
dct->data_type= dict->data_type;
|
|
|
|
dct->data_type= dict->data_type;
|
|
|
|
|
|
|
|
return dct;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_dictionary_copy_deep(dictionary *dict)
|
|
|
|
/**yon_dictionary_copy_deep(dictionary *dict)
|
|
|
@ -65,6 +66,7 @@ int yon_dictionary_set_data(dictionary *dict, void *data){
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int yon_dictionary_set_key(dictionary *dict, char *key){
|
|
|
|
int yon_dictionary_set_key(dictionary *dict, char *key){
|
|
|
|
dict->key=key;
|
|
|
|
dict->key=key;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** int yon_dictionary_set(dictionary *dict, char *key, void *data)
|
|
|
|
/** int yon_dictionary_set(dictionary *dict, char *key, void *data)
|
|
|
@ -76,6 +78,7 @@ int yon_dictionary_set_key(dictionary *dict, char *key){
|
|
|
|
int yon_dictionary_set(dictionary *dict, char *key, void *data){
|
|
|
|
int yon_dictionary_set(dictionary *dict, char *key, void *data){
|
|
|
|
dict->key=key;
|
|
|
|
dict->key=key;
|
|
|
|
dict->data=data;
|
|
|
|
dict->data=data;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**int yon_dictionary_empty(dictionary *dict)
|
|
|
|
/**int yon_dictionary_empty(dictionary *dict)
|
|
|
@ -87,6 +90,7 @@ int yon_dictionary_set(dictionary *dict, char *key, void *data){
|
|
|
|
int yon_dictionary_empty(dictionary *dict){
|
|
|
|
int yon_dictionary_empty(dictionary *dict){
|
|
|
|
dict->data=NULL;
|
|
|
|
dict->data=NULL;
|
|
|
|
dict->data_type=DICTIONARY_OTHER_TYPE;
|
|
|
|
dict->data_type=DICTIONARY_OTHER_TYPE;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_dictionary_switch_to_last(dictionary **dict)
|
|
|
|
/**yon_dictionary_switch_to_last(dictionary **dict)
|
|
|
@ -433,6 +437,13 @@ dictionary *yon_dictionary_get_nth(dictionary *dict, int place)
|
|
|
|
|
|
|
|
|
|
|
|
// char functions
|
|
|
|
// char functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_char_find_last(char *source, char find){
|
|
|
|
|
|
|
|
int size = strlen(source);
|
|
|
|
|
|
|
|
int i=size;
|
|
|
|
|
|
|
|
for (;source[i]!=find&&i>0;i--);
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**[EN]
|
|
|
|
/**[EN]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* creates new char string by combining two char strings.
|
|
|
|
* creates new char string by combining two char strings.
|
|
|
@ -568,9 +579,8 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider)
|
|
|
|
cut = yon_char_divide(source, leng);
|
|
|
|
cut = yon_char_divide(source, leng);
|
|
|
|
return cut;
|
|
|
|
return cut;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
return source;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_char_from_int(int int_to_convert)
|
|
|
|
/**yon_char_from_int(int int_to_convert)
|
|
|
@ -595,26 +605,30 @@ char *yon_char_from_int(int int_to_convert)
|
|
|
|
return ch;
|
|
|
|
return ch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_char_replace(char *source, char *find, char*replace)
|
|
|
|
/**yon_char_replace(char *source, char *find, char*replace)
|
|
|
|
* [EN]
|
|
|
|
* [EN]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* [RU]
|
|
|
|
* [RU]
|
|
|
|
* Заменяет в строке [source] все вхождения строки [find] на [replace]
|
|
|
|
* Заменяет в строке [source] все вхождения строки [find] на [replace]
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
char *final=NULL;
|
|
|
|
if (!strstr(replace,find)){
|
|
|
|
char *temp=NULL;
|
|
|
|
|
|
|
|
if(!strstr(replace,find)){
|
|
|
|
|
|
|
|
while ((final=strstr(source,find))){
|
|
|
|
char *final=NULL;
|
|
|
|
temp=malloc(strlen(source)-strlen(final));
|
|
|
|
char *temp=NULL;
|
|
|
|
memset(temp,0,strlen(source)-strlen(final)+strlen(replace));
|
|
|
|
if(!strstr(replace,find)){
|
|
|
|
memcpy(temp,source,strlen(source)-strlen(final));
|
|
|
|
while ((final=strstr(source,find))){
|
|
|
|
temp=yon_char_append(temp,replace);
|
|
|
|
temp=malloc(strlen(source)-strlen(final));
|
|
|
|
source=yon_char_append(temp,final+1);
|
|
|
|
memset(temp,0,strlen(source)-strlen(final)+strlen(replace));
|
|
|
|
|
|
|
|
memcpy(temp,source,strlen(source)-strlen(final));
|
|
|
|
|
|
|
|
temp=yon_char_append(temp,replace);
|
|
|
|
|
|
|
|
source=yon_char_append(temp,final+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return source;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_char_parse(char *parameters, int *size, char *divider)
|
|
|
|
/**yon_char_parse(char *parameters, int *size, char *divider)
|
|
|
@ -625,18 +639,15 @@ char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
char **yon_char_parse(char *parameters, int *size, char *divider){
|
|
|
|
char **yon_char_parse(char *parameters, int *size, char *divider){
|
|
|
|
char **string=NULL;
|
|
|
|
char **string=NULL;
|
|
|
|
if (!strstr(parameters, divider)) {
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int i=1;
|
|
|
|
int i=1;
|
|
|
|
string=malloc(sizeof(char*));
|
|
|
|
string=malloc(sizeof(char*));
|
|
|
|
char *paramline=yon_char_new(parameters);
|
|
|
|
char *paramline=yon_char_new(parameters);
|
|
|
|
char *param;
|
|
|
|
char *param;
|
|
|
|
while ((param=yon_char_divide_search(paramline,divider,1))){
|
|
|
|
while ((param=yon_char_divide_search(paramline,divider,1))){
|
|
|
|
if (strcmp(param,paramline)==0) break;
|
|
|
|
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
string[i-1]=yon_char_new(param);
|
|
|
|
string[i-1]=yon_char_new(param);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
|
|
|
|
if (strcmp(param,paramline)==0) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
string[i-1]=yon_char_new(paramline);
|
|
|
|
string[i-1]=yon_char_new(paramline);
|
|
|
@ -803,6 +814,14 @@ char *yon_ubl_root_user_get(){
|
|
|
|
return getlogin();
|
|
|
|
return getlogin();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_ubl_user_get_home_directory(){
|
|
|
|
|
|
|
|
FILE *path = popen(get_home_dir_command,"r");
|
|
|
|
|
|
|
|
char *ret = g_malloc(4096);
|
|
|
|
|
|
|
|
fgets(ret,4096,path);
|
|
|
|
|
|
|
|
ret=yon_char_divide_search(ret,"\n",-1);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// parsing functions
|
|
|
|
// parsing functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1368,30 +1387,89 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
|
|
|
|
|
|
|
#define check_window_config_setup if(__yon_window_config_target_window)
|
|
|
|
#define check_window_config_setup if(__yon_window_config_target_window)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
char *parameter_name;
|
|
|
|
|
|
|
|
enum YON_TYPE containing_type;
|
|
|
|
|
|
|
|
GtkWidget *track_widget;
|
|
|
|
|
|
|
|
char *property_name;
|
|
|
|
|
|
|
|
} __yon_listener_parameter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
char *parameter_name;
|
|
|
|
|
|
|
|
char *section;
|
|
|
|
|
|
|
|
enum YON_TYPE containing_type;
|
|
|
|
|
|
|
|
void *property;
|
|
|
|
|
|
|
|
} __yon_custom_parameter;
|
|
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int height;
|
|
|
|
int fullscreen;
|
|
|
|
int fullscreen;
|
|
|
|
|
|
|
|
dictionary *custom_listeners;
|
|
|
|
|
|
|
|
dictionary *custom_parameters;
|
|
|
|
|
|
|
|
dictionary *deleted_parameters;
|
|
|
|
} __yon_main_window_config;
|
|
|
|
} __yon_main_window_config;
|
|
|
|
|
|
|
|
|
|
|
|
static GtkWindow *__yon_window_config_target_window = NULL;
|
|
|
|
static GtkWindow *__yon_window_config_target_window = NULL;
|
|
|
|
static GKeyFile *__yon_window_config_file = NULL;
|
|
|
|
static GKeyFile *__yon_window_config_file = NULL;
|
|
|
|
static char *__yon_window_config_path = NULL;
|
|
|
|
static char *__yon_window_config_path = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
void yon_window_config_save(){
|
|
|
|
void yon_window_config_save(){
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x);
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x);
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y);
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y);
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width);
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width);
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (__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*);
|
|
|
|
|
|
|
|
GValue *val = g_malloc0(sizeof(GValue));
|
|
|
|
|
|
|
|
g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
|
|
|
|
|
|
|
|
switch(param->containing_type){
|
|
|
|
|
|
|
|
case YON_TYPE_STRING:
|
|
|
|
|
|
|
|
g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_INT:
|
|
|
|
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_BOOLEAN:
|
|
|
|
|
|
|
|
g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__yon_main_window_config.custom_parameters)
|
|
|
|
|
|
|
|
for_dictionaries(dict,__yon_main_window_config.custom_parameters){
|
|
|
|
|
|
|
|
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*);
|
|
|
|
|
|
|
|
switch (param->containing_type){
|
|
|
|
|
|
|
|
case YON_TYPE_STRING:
|
|
|
|
|
|
|
|
g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_INT:
|
|
|
|
|
|
|
|
g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_BOOLEAN:
|
|
|
|
|
|
|
|
g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_get_is_fullscreen(){
|
|
|
|
void yon_get_is_fullscreen(){
|
|
|
|
gtk_window_is_maximized(__yon_window_config_target_window);
|
|
|
|
gtk_window_is_maximized(__yon_window_config_target_window);
|
|
|
|
__yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window);
|
|
|
|
__yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window);
|
|
|
|
|
|
|
|
if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
|
|
|
|
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
|
|
|
@ -1461,6 +1539,27 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
__yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL);
|
|
|
|
__yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL);
|
|
|
|
__yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL);
|
|
|
|
__yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL);
|
|
|
|
__yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL);
|
|
|
|
__yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL);
|
|
|
|
|
|
|
|
dictionary *dict=NULL;
|
|
|
|
|
|
|
|
if (__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*);
|
|
|
|
|
|
|
|
GValue *val = g_malloc0(sizeof(GValue));
|
|
|
|
|
|
|
|
g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
|
|
|
|
|
|
|
|
switch(param->containing_type){
|
|
|
|
|
|
|
|
case YON_TYPE_STRING:
|
|
|
|
|
|
|
|
g_value_set_string(val,g_key_file_get_string(__yon_window_config_file,"window",param->parameter_name, NULL));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_INT:
|
|
|
|
|
|
|
|
g_value_set_int(val,g_key_file_get_integer(__yon_window_config_file,"window",param->parameter_name, NULL));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_BOOLEAN:
|
|
|
|
|
|
|
|
gboolean res = g_key_file_get_boolean(__yon_window_config_file,"window",param->parameter_name, NULL);
|
|
|
|
|
|
|
|
g_value_set_boolean(val,res);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:printf("\033[0;31mCannot load %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_set_property(G_OBJECT(param->track_widget),param->property_name,val);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (__yon_main_window_config.width==0) __yon_main_window_config.width=800;
|
|
|
|
if (__yon_main_window_config.width==0) __yon_main_window_config.width=800;
|
|
|
|
if (__yon_main_window_config.height==0) __yon_main_window_config.height=600;
|
|
|
|
if (__yon_main_window_config.height==0) __yon_main_window_config.height=600;
|
|
|
|
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
|
|
|
|
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
|
|
|
@ -1476,6 +1575,70 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
|
|
|
|
gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_window_config_get_section(char *section, gsize *size){
|
|
|
|
|
|
|
|
config_str key = g_key_file_get_keys(__yon_window_config_file,section,size,NULL);
|
|
|
|
|
|
|
|
return key;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type)
|
|
|
|
|
|
|
|
* [EN]
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* [RU]
|
|
|
|
|
|
|
|
* Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name].
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type){
|
|
|
|
|
|
|
|
__yon_listener_parameter *param = NULL;
|
|
|
|
|
|
|
|
param = yon_remalloc(param,sizeof(__yon_listener_parameter));
|
|
|
|
|
|
|
|
param->parameter_name = yon_char_new(param_name);
|
|
|
|
|
|
|
|
param->track_widget = widget;
|
|
|
|
|
|
|
|
param->property_name = yon_char_new(widget_property);
|
|
|
|
|
|
|
|
param->containing_type = val_type;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_listeners,param->parameter_name,param);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type){
|
|
|
|
|
|
|
|
__yon_custom_parameter *param = NULL;
|
|
|
|
|
|
|
|
param = yon_remalloc(param,sizeof(__yon_custom_parameter));
|
|
|
|
|
|
|
|
param->parameter_name = yon_char_new(param_name);
|
|
|
|
|
|
|
|
param->section=section;
|
|
|
|
|
|
|
|
param->property = tracked_value;
|
|
|
|
|
|
|
|
param->containing_type = val_type;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_parameters,param->parameter_name,param);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_window_config_erase_custom_parameter(char *param_name, char *section){
|
|
|
|
|
|
|
|
__yon_custom_parameter *param = NULL;
|
|
|
|
|
|
|
|
param = yon_remalloc(param,sizeof(__yon_custom_parameter));
|
|
|
|
|
|
|
|
param->parameter_name=param_name;
|
|
|
|
|
|
|
|
param->section=section;
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){
|
|
|
|
|
|
|
|
GError *err=NULL;
|
|
|
|
|
|
|
|
switch (type){
|
|
|
|
|
|
|
|
case YON_TYPE_BOOLEAN:
|
|
|
|
|
|
|
|
*((int*)return_value) = g_key_file_get_boolean(__yon_window_config_file,section,config_parameter,&err);
|
|
|
|
|
|
|
|
if (err) return 0; else return 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_INT:
|
|
|
|
|
|
|
|
*((int*)return_value) = g_key_file_get_integer(__yon_window_config_file,section,config_parameter,&err);
|
|
|
|
|
|
|
|
if (err) return 0; else return 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_STRING:
|
|
|
|
|
|
|
|
*((char**)return_value) = g_key_file_get_string(__yon_window_config_file,section,config_parameter,&err);
|
|
|
|
|
|
|
|
if (err) return 0; else return 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case YON_TYPE_STRING_LIST:
|
|
|
|
|
|
|
|
gsize size=0;
|
|
|
|
|
|
|
|
*((char***)return_value) = g_key_file_get_string_list(__yon_window_config_file,section,config_parameter,&size,&err);
|
|
|
|
|
|
|
|
*((char***)return_value)=yon_remalloc(return_value,size+1);
|
|
|
|
|
|
|
|
*((char***)return_value)[size]=NULL;
|
|
|
|
|
|
|
|
if (err) return 0; else return 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
@ -1754,8 +1917,8 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name){
|
|
|
|
if (!user)
|
|
|
|
if (!user)
|
|
|
|
user=getlogin();
|
|
|
|
user=getlogin();
|
|
|
|
char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL);
|
|
|
|
char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL);
|
|
|
|
yon_launch(command);
|
|
|
|
yon_launch_app(command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|