|
|
|
|
@ -212,19 +212,6 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void on_column_resize(GtkTreeVieolumn *self,GParamSpec *pspec,GtkCellRenderer *renderer){
|
|
|
|
|
// GtkWidget *tree = gtk_tree_view_column_get_tree_view(self);
|
|
|
|
|
// GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
|
|
|
|
|
// // g_object_ref(model);
|
|
|
|
|
// // gtk_tree_view_set_model(GTK_TREE_VIEW(tree),NULL);
|
|
|
|
|
// int width = gtk_tree_view_column_get_width(self);
|
|
|
|
|
// GValue *val=g_malloc0(sizeof(GValue));
|
|
|
|
|
// g_object_get_property(G_OBJECT(renderer),"wrap-width",val);
|
|
|
|
|
// g_value_set_int(val,width);
|
|
|
|
|
// g_object_set_property(G_OBJECT(renderer),"wrap-width",val);
|
|
|
|
|
// gtk_tree_view_set_model(GTK_TREE_VIEW(tree),model);wC
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
if (((type==YON_CONFIG_LOCAL&& template_config->load_mode==1)||(type==YON_CONFIG_GLOBAL&& template_config->load_mode==0))){
|
|
|
|
|
yon_config_save_registered(path);
|
|
|
|
|
@ -279,18 +266,23 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
if (!yon_char_is_empty(str)&& strcmp(str,"(null)\n")!=0)
|
|
|
|
|
{
|
|
|
|
|
char *final_str = yon_char_new(str);
|
|
|
|
|
char *key =yon_char_divide_search(final_str,"=",-1);
|
|
|
|
|
if (final_str[strlen(final_str)-1]=='\n')final_str[strlen(final_str)-1]='\0';
|
|
|
|
|
char *key = yon_char_divide_search(final_str,"=",-1);
|
|
|
|
|
final_str=yon_char_divide_search(final_str,"\n",-1);
|
|
|
|
|
if ((final_str[0]=='\''&&final_str[strlen(final_str)-1]=='\'')||(final_str[0]=='\"'&&final_str[strlen(final_str)-1]=='\"')){
|
|
|
|
|
final_str[strlen(final_str)-1] = '\0';
|
|
|
|
|
free(yon_char_divide(final_str,0));
|
|
|
|
|
}
|
|
|
|
|
char *str_copy = yon_char_unite(key,"=",final_str,NULL);
|
|
|
|
|
dictionary *found=NULL;
|
|
|
|
|
if (!(found=yon_dictionary_get(&loaded.dict,key))){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,NULL,yon_char_new(dct->key));
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,key,yon_char_new(final_str));
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str));
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str_copy));
|
|
|
|
|
} else{
|
|
|
|
|
int element = yon_char_parsed_check_exist(config_compare,compare_size,(char*)loaded.dict->data);
|
|
|
|
|
if (element>-1){
|
|
|
|
|
free(config_compare[element]);
|
|
|
|
|
config_compare[element]=yon_char_new(str);
|
|
|
|
|
config_compare[element]=yon_char_new(str_copy);
|
|
|
|
|
loaded.dict->data = yon_char_new(final_str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -312,6 +304,17 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
window->OldValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"OldValueCell"));
|
|
|
|
|
window->NewValueColumn = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder,"NewValueColumn"));
|
|
|
|
|
window->NewValueCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"NewValueCell"));
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
if (type==YON_CONFIG_BOTH){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
} else if (type==YON_CONFIG_GLOBAL){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_GLOBAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
|
|
|
|
|
} else if (type==YON_CONFIG_LOCAL){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"savingTarget",SAVING_LOCAL_STATE_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
textdomain(template_app_information.app_locale);
|
|
|
|
|
window->type=type;
|
|
|
|
|
window->filteredModel = GTK_TREE_MODEL(gtk_builder_get_object(builder,"listfilter1"));
|
|
|
|
|
gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(window->filteredModel),5);
|
|
|
|
|
@ -375,7 +378,9 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&name,2,&value,-1);
|
|
|
|
|
if (!yon_char_is_empty(name)&&!strcmp(name,config_keys[i])){
|
|
|
|
|
if (!yon_config_check_ignore(name)){
|
|
|
|
|
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1);
|
|
|
|
|
char *combined = yon_char_unite("<s>",value,"</s>\n",compare_value,NULL);
|
|
|
|
|
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,7,combined,-1);
|
|
|
|
|
free(combined);
|
|
|
|
|
if ((value&&!strcmp(value,compare_value))){ //||yon_char_is_empty(compare_value)
|
|
|
|
|
gtk_list_store_set(window->list,&iter,0,0,3,value,5,0,-1);
|
|
|
|
|
} else {
|
|
|
|
|
@ -390,14 +395,22 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
if (!yon_config_check_ignore(compare_name)&&!yon_char_is_empty(compare_value)){
|
|
|
|
|
GtkTreeIter itar;
|
|
|
|
|
gtk_list_store_append(window->list,&itar);
|
|
|
|
|
gtk_list_store_set(window->list,&itar,0,1,1,compare_name,3,compare_value,5,1,6,section,-1);
|
|
|
|
|
char *combined = yon_char_append("\n",compare_value);
|
|
|
|
|
gtk_list_store_set(window->list,&itar,0,1,1,compare_name,3,compare_value,5,1,6,section,7,combined,-1);
|
|
|
|
|
free(combined);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free(compare_value);
|
|
|
|
|
free(compare_name);
|
|
|
|
|
}
|
|
|
|
|
free(rgba_string);
|
|
|
|
|
|
|
|
|
|
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->filteredModel),&iter)){
|
|
|
|
|
gtk_widget_destroy(window->Window);
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
yon_ubl_status_box_render(NOTHING_TO_SAVE_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
textdomain(template_app_information.app_locale);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),window->filteredModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -410,7 +423,9 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){
|
|
|
|
|
textdomain(template_ui_LocaleName);
|
|
|
|
|
GtkWidget *dialog = gtk_dialog_new_with_buttons(template_app_information.app_title,GTK_WINDOW(gtk_widget_get_toplevel(self)),GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
|
|
|
|
|
textdomain(template_app_information.app_locale);
|
|
|
|
|
gtk_window_set_modal(GTK_WINDOW(dialog),1);
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog),template_app_information.app_title);
|
|
|
|
|
@ -443,6 +458,7 @@ int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data)
|
|
|
|
|
gtk_widget_set_margin_top(image,20);
|
|
|
|
|
|
|
|
|
|
GtkWidget *label = gtk_label_new(data->action_text);
|
|
|
|
|
gtk_widget_set_margin_end(label,20);
|
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
@ -505,6 +521,22 @@ template_main_window *setup_window(){
|
|
|
|
|
|
|
|
|
|
widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL);
|
|
|
|
|
widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (template_config->lock_load_global == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0);
|
|
|
|
|
}
|
|
|
|
|
if (template_config->lock_save_global == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveGlobalMenuItem,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
|
|
|
|
|
}
|
|
|
|
|
if (template_config->lock_save_local == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
|
|
|
|
|
}
|
|
|
|
|
if (template_config->lock_load_system == 1){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->LoadLocalMenuItem,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(widgets->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(HeadImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
|
|
|
|
|
@ -571,6 +603,91 @@ int yon_ubl_window_init(char *app_title, char *app_description, char *locale, ch
|
|
|
|
|
template_app_information.app_locale=locale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments, int *arguments_size, char *additional_options_output){
|
|
|
|
|
(*arguments_size)=0;
|
|
|
|
|
int option_index=0;
|
|
|
|
|
int show_help=0;
|
|
|
|
|
int debug_mode=0;
|
|
|
|
|
{
|
|
|
|
|
struct option long_options[] = {
|
|
|
|
|
{"help", 0, 0, 'h'},
|
|
|
|
|
{"version", 0, 0, 'V'},
|
|
|
|
|
{"lock-help", 0,0, 1},
|
|
|
|
|
{"lock-save", 0,0, 2},
|
|
|
|
|
{"lock-save-local", 0,0, 3},
|
|
|
|
|
{"lock-save-global", 0,0, 4},
|
|
|
|
|
{"lock-load-global", 0,0, 5},
|
|
|
|
|
{"lock-load-local", 0,0, 6},
|
|
|
|
|
{"socket-id", 1, 0, 's'},
|
|
|
|
|
{"socket-ext-id", 1,0, 'e'},
|
|
|
|
|
{"socket-trd-id", 1,0, 't'},
|
|
|
|
|
{"clear-config", 0,0, 'c'},
|
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
config_str unregistered_arguments=NULL;
|
|
|
|
|
for (int i=1;i<argc;i++){
|
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:c",long_options,&option_index);
|
|
|
|
|
switch(argument){
|
|
|
|
|
case 'h':
|
|
|
|
|
show_help=1;
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
case 'V':
|
|
|
|
|
printf("%s\n",VERSION_LABEL);
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'e':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->save_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->load_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'c': if (system(remove_config_dir_command)){};
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
template_config->lock_help=1;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
template_config->lock_load_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
template_config->lock_load_system=1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
char *unfound = optarg;
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(unregistered_arguments,arguments_size,yon_char_unite(argv[i],!yon_char_is_empty(unfound)?"=":"",!yon_char_is_empty(unfound)?unfound:"",NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
(*unfound_arguments)=unregistered_arguments;
|
|
|
|
|
if (show_help&&!template_config->lock_help){
|
|
|
|
|
printf("%s\n",HELP_LABEL(additional_options_output));
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (getuid()!=0){
|
|
|
|
|
template_config->lock_load_global=1;
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template_main_window *yon_ubl_window_setup(){
|
|
|
|
|
textdomain (template_ui_LocaleName);
|
|
|
|
|
setlocale(LC_ALL,"");
|
|
|
|
|
|