|
|
|
@ -540,15 +540,16 @@ char *yon_char_divide(char *source, int dividepos)
|
|
|
|
|
* Считает количество символов [find] в строке [source]
|
|
|
|
|
*/
|
|
|
|
|
int yon_char_find_count(char *source, char *find){
|
|
|
|
|
char *working_string=source;
|
|
|
|
|
char *working_string=yon_char_new(source);
|
|
|
|
|
int i=0;
|
|
|
|
|
int size=0;
|
|
|
|
|
while ((working_string = strstr(working_string, find))) {
|
|
|
|
|
if (working_string) {
|
|
|
|
|
working_string++;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
int pos=0;
|
|
|
|
|
config_str rtn = yon_char_parse(working_string,&size,"\n");
|
|
|
|
|
for (int j=0;j<size;j++){
|
|
|
|
|
if(strstr(rtn[j],find))
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return size;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**yon_char_divide_search(char *source, char *dividepos, int delete_divider)
|
|
|
|
@ -582,6 +583,7 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider)
|
|
|
|
|
}
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**yon_char_from_int(int int_to_convert)
|
|
|
|
|
* [EN]
|
|
|
|
|
* char *yon_char_from_int(int int_to_convert)
|
|
|
|
@ -638,15 +640,13 @@ char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
|
*/
|
|
|
|
|
char **yon_char_parse(char *parameters, int *size, char *divider){
|
|
|
|
|
char **string=NULL;
|
|
|
|
|
if (!strstr(parameters, divider)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
int i=1;
|
|
|
|
|
string=malloc(sizeof(char*));
|
|
|
|
|
char *paramline=yon_char_new(parameters);
|
|
|
|
|
char *param;
|
|
|
|
|
if (!strstr(parameters,divider)) return NULL;
|
|
|
|
|
while ((param=yon_char_divide_search(paramline,divider,1))){
|
|
|
|
|
if (strcmp(param,paramline)==0) break;
|
|
|
|
|
if (strcmp(param,paramline)==0||param[0]=='\0') break;
|
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
|
string[i-1]=yon_char_new(param);
|
|
|
|
|
i++;
|
|
|
|
@ -654,10 +654,8 @@ char **yon_char_parse(char *parameters, int *size, char *divider){
|
|
|
|
|
string=realloc(string,sizeof(char*)*i);
|
|
|
|
|
string[i-1]=yon_char_new(paramline);
|
|
|
|
|
i++;
|
|
|
|
|
// printf("%d\n",i);
|
|
|
|
|
*size=i-1;
|
|
|
|
|
return string;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete)
|
|
|
|
@ -1137,7 +1135,6 @@ config_str yon_config_load(char *command, int *str_len){
|
|
|
|
|
if (strcmp(str, "") != 0)
|
|
|
|
|
{
|
|
|
|
|
output_strings = realloc(output_strings, sizeof(char *) * (i + 1));
|
|
|
|
|
// printf("%s\n", str);
|
|
|
|
|
output_strings[i] = NULL;
|
|
|
|
|
output_strings[i] = yon_char_new(str);
|
|
|
|
|
memset(str, 0, 4096);
|
|
|
|
@ -1299,7 +1296,6 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi
|
|
|
|
|
vte_terminal_set_pty(VTE_TERMINAL(terminal),pty);
|
|
|
|
|
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);
|
|
|
|
|
printf("%s\n",install_command);
|
|
|
|
|
if(endwork_function)
|
|
|
|
|
g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument);
|
|
|
|
|
vte_terminal_spawn_async(VTE_TERMINAL(terminal),
|
|
|
|
@ -1526,8 +1522,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){
|
|
|
|
|
struct stat st;
|
|
|
|
|
int size;
|
|
|
|
|
config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,"/");
|
|
|
|
|
char *path = yon_char_unite(conf[0],"/",conf[1],"/",conf[2],"/",conf[3],"/",conf[4],"/",NULL);
|
|
|
|
|
char *path = yon_char_divide(yon_char_new(__yon_window_config_path),yon_char_find_last(__yon_window_config_path,'/'));
|
|
|
|
|
if (stat(path, &st) == -1) {
|
|
|
|
|
mkdir(path, 0777);
|
|
|
|
|
}
|
|
|
|
@ -1562,10 +1557,10 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
}
|
|
|
|
|
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.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_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
|
|
|
|
|
if (__yon_main_window_config.width!=0&&__yon_main_window_config.height!=0) gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
|
|
|
|
|
if (__yon_main_window_config.x!=0&&__yon_main_window_config.y!=0) gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pthread_t tid;
|
|
|
|
|
pthread_create(&tid,NULL,(void *)_yon_maximize,NULL);
|
|
|
|
|
return 1;
|
|
|
|
@ -1582,7 +1577,7 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**yon_window_config_add_custom_parameter(GtkWidget *widget, char *param_name, char *widget_property)
|
|
|
|
|
/**yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type)
|
|
|
|
|
* [EN]
|
|
|
|
|
*
|
|
|
|
|
* [RU]
|
|
|
|
@ -1616,6 +1611,31 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
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 *menu_item = gtk_menu_item_new();
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom");
|
|
|
|
|