|
|
|
@ -1,17 +1,37 @@
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
|
|
|
|
|
|
|
|
void on_source_changed(GtkComboBox *self){
|
|
|
|
void on_source_changed(GtkComboBox *self){
|
|
|
|
GtkWidget *devices_combo = g_object_get_data(G_OBJECT(self),"target");
|
|
|
|
source_element *element = g_object_get_data(G_OBJECT(self),"source_element");
|
|
|
|
GtkWidget *path_button = g_object_get_data(G_OBJECT(self),"button");
|
|
|
|
|
|
|
|
GtkWidget *path_combo = g_object_get_data(G_OBJECT(self),"combo");
|
|
|
|
|
|
|
|
if (gtk_combo_box_get_active(self)){
|
|
|
|
if (gtk_combo_box_get_active(self)){
|
|
|
|
gtk_widget_show(path_button);
|
|
|
|
gtk_widget_show(element->PathButton);
|
|
|
|
gtk_widget_show(path_combo);
|
|
|
|
gtk_widget_show(element->PathEntry);
|
|
|
|
gtk_widget_hide(devices_combo);
|
|
|
|
gtk_widget_hide(element->DeviceCombo);
|
|
|
|
} else{
|
|
|
|
} else{
|
|
|
|
gtk_widget_hide(path_button);
|
|
|
|
gtk_widget_hide(element->PathButton);
|
|
|
|
gtk_widget_hide(path_combo);
|
|
|
|
gtk_widget_hide(element->PathEntry);
|
|
|
|
gtk_widget_show(devices_combo);
|
|
|
|
gtk_widget_show(element->DeviceCombo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_source_update(source_window *window){
|
|
|
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(window->AddBox));
|
|
|
|
|
|
|
|
GList *iter;
|
|
|
|
|
|
|
|
for (iter = list; iter; iter = iter->next){
|
|
|
|
|
|
|
|
source_element *element = (source_element*)g_object_get_data(G_OBJECT(iter->data),"source_element");
|
|
|
|
|
|
|
|
if (!iter->next){
|
|
|
|
|
|
|
|
GtkWidget *button = gtk_button_new_from_icon_name(add_icon_path,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(on_source_add),window);
|
|
|
|
|
|
|
|
gtk_box_pack_end(GTK_BOX(element->MainBox),button,0,0,0);
|
|
|
|
|
|
|
|
element->AddButton = button;
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(button),"thin");
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(button),"instant");
|
|
|
|
|
|
|
|
gtk_widget_show(button);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (element->AddButton) {
|
|
|
|
|
|
|
|
gtk_widget_destroy(element->AddButton);
|
|
|
|
|
|
|
|
element->AddButton = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -25,22 +45,21 @@ source_element *yon_source_element_new(){
|
|
|
|
element->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo");
|
|
|
|
element->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo");
|
|
|
|
element->PathButton = yon_gtk_builder_get_widget(builder,"PathButton");
|
|
|
|
element->PathButton = yon_gtk_builder_get_widget(builder,"PathButton");
|
|
|
|
element->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton");
|
|
|
|
element->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton");
|
|
|
|
|
|
|
|
element->AddButton = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
yon_gtk_combo_box_block_scroll(GTK_COMBO_BOX(element->DeviceCombo));
|
|
|
|
yon_gtk_combo_box_block_scroll(GTK_COMBO_BOX(element->DeviceCombo));
|
|
|
|
yon_gtk_combo_box_block_scroll(GTK_COMBO_BOX(element->TypeCombo));
|
|
|
|
yon_gtk_combo_box_block_scroll(GTK_COMBO_BOX(element->TypeCombo));
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(element->RemoveButton),"clicked",G_CALLBACK(on_source_remove),element);
|
|
|
|
g_signal_connect(G_OBJECT(element->RemoveButton),"clicked",G_CALLBACK(on_source_remove),element);
|
|
|
|
g_signal_connect(G_OBJECT(element->PathButton),"clicked",G_CALLBACK(on_source_choose),element);
|
|
|
|
g_signal_connect(G_OBJECT(element->PathButton),"clicked",G_CALLBACK(on_source_choose),element);
|
|
|
|
g_signal_connect(G_OBJECT(element->TypeCombo),"changed",G_CALLBACK(on_source_changed),element);
|
|
|
|
g_signal_connect(G_OBJECT(element->TypeCombo),"changed",G_CALLBACK(on_source_changed),element);
|
|
|
|
g_object_set_data(G_OBJECT(element->PathButton),"combo",element->TypeCombo);
|
|
|
|
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->PathButton),"source_element",element);
|
|
|
|
g_object_set_data(G_OBJECT(element->MainBox),"source_element",element);
|
|
|
|
g_object_set_data(G_OBJECT(element->MainBox),"source_element",element);
|
|
|
|
g_object_set_data(G_OBJECT(element->PathButton),"target_combo",element->TypeCombo);
|
|
|
|
g_object_set_data(G_OBJECT(element->TypeCombo),"source_element",element);
|
|
|
|
g_object_set_data(G_OBJECT(element->TypeCombo),"target",element->DeviceCombo);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->TypeCombo),"button",element->PathButton);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->TypeCombo),"combo",element->PathEntry);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(element->DeviceCombo,0);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(element->TypeCombo,0);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(element->PathEntry,0);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(element->PathButton,0);
|
|
|
|
|
|
|
|
gtk_widget_hide(element->PathButton);
|
|
|
|
gtk_widget_hide(element->PathButton);
|
|
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str parts = yon_config_load(get_parts_and_devices_command, &size);
|
|
|
|
config_str parts = yon_config_load(get_parts_and_devices_command, &size);
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
@ -59,6 +78,11 @@ source_element *yon_source_element_new(){
|
|
|
|
|
|
|
|
|
|
|
|
void yon_source_element_add(char *key,void*,source_window *window){
|
|
|
|
void yon_source_element_add(char *key,void*,source_window *window){
|
|
|
|
source_element *element = yon_source_element_new();
|
|
|
|
source_element *element = yon_source_element_new();
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->AddBox),element->MainBox,0,0,0);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->MainBox),"window",window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(key)) return;
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_check_begins_with(key,"/dev/")){
|
|
|
|
if (yon_char_check_begins_with(key,"/dev/")){
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(element->DeviceCombo),key);
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(element->DeviceCombo),key);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),0);
|
|
|
|
@ -69,61 +93,27 @@ void yon_source_element_add(char *key,void*,source_window *window){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),1);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(element->TypeCombo),1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_box_pack_start(GTK_BOX(window->AddBox),element->MainBox,0,0,0);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->MainBox),"window",window);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(element->PathButton),"target",window->PathEntry);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_source_update(source_window *window){
|
|
|
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(window->AddBox));
|
|
|
|
|
|
|
|
GList *iter;
|
|
|
|
|
|
|
|
for (iter=list;iter;iter=iter->next){
|
|
|
|
|
|
|
|
gtk_widget_destroy(GTK_WIDGET(iter->data));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dictionary *dict;
|
|
|
|
|
|
|
|
if (!window->sources) return;
|
|
|
|
|
|
|
|
for_dictionaries(dict,window->sources){
|
|
|
|
|
|
|
|
yon_source_element_add(dict->key,NULL,window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_source_add(GtkWidget *,source_window *window){
|
|
|
|
void on_source_add(GtkWidget *,source_window *window){
|
|
|
|
const char *path = gtk_widget_get_visible(window->PathEntry)?gtk_entry_get_text(GTK_ENTRY(window->PathEntry)):gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->DeviceCombo));
|
|
|
|
yon_source_element_add(NULL,NULL,window);
|
|
|
|
if (yon_char_is_empty(path)){
|
|
|
|
yon_source_update(window);
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_visible(window->PathEntry)?window->PathEntry:window->DeviceCombo);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!yon_dictionary_get(&window->sources,(char*)path)){
|
|
|
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->sources,yon_char_new(path),NULL);
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(window->PathEntry),"");
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceCombo),0);
|
|
|
|
|
|
|
|
yon_source_update(window);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),VALUE_REPEAT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_source_remove(GtkWidget *,source_element *element){
|
|
|
|
void on_source_remove(GtkWidget *,source_element *element){
|
|
|
|
source_window *window = g_object_get_data(G_OBJECT(element->MainBox),"window");
|
|
|
|
source_window *window = g_object_get_data(G_OBJECT(element->MainBox),"window");
|
|
|
|
const char *path = gtk_widget_get_visible(element->PathEntry)?gtk_entry_get_text(GTK_ENTRY(element->PathEntry)):gtk_combo_box_get_active_id(GTK_COMBO_BOX(element->DeviceCombo));
|
|
|
|
gtk_widget_destroy(element->MainBox);
|
|
|
|
dictionary *dict = yon_dictionary_get(&window->sources,(char*)path);
|
|
|
|
yon_source_update(window);
|
|
|
|
if (dict){
|
|
|
|
|
|
|
|
window->sources = yon_dictionary_rip(dict);
|
|
|
|
|
|
|
|
yon_source_update(window);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_source_choose(GtkWidget *self){
|
|
|
|
void on_source_choose(GtkWidget *self){
|
|
|
|
GtkWidget *target_entry = g_object_get_data(G_OBJECT(self),"target");
|
|
|
|
source_element *element = g_object_get_data(G_OBJECT(self),"source_element");
|
|
|
|
GtkWidget *target_mode = g_object_get_data(G_OBJECT(self),"combo");
|
|
|
|
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(element->TypeCombo))){
|
|
|
|
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(target_mode))){
|
|
|
|
|
|
|
|
case 1:{
|
|
|
|
case 1:{
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(dialog->Window),OPEN_LABEL,icon_path,"filechooser_window");
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(dialog->Window),OPEN_LABEL,icon_path,"filechooser_window");
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target_entry),dialog->last_success_selection);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(element->PathEntry),dialog->last_success_selection);
|
|
|
|
free(dialog);
|
|
|
|
free(dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -137,7 +127,7 @@ void on_source_choose(GtkWidget *self){
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target_entry),dialog->last_success_selection);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(element->PathEntry),dialog->last_success_selection);
|
|
|
|
free(dialog);
|
|
|
|
free(dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -151,10 +141,6 @@ void on_source_accept(GtkWidget *,source_window *window){
|
|
|
|
on_subwindow_close(window->Window);
|
|
|
|
on_subwindow_close(window->Window);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const char *creation_path = gtk_widget_get_visible(window->PathEntry)? gtk_entry_get_text(GTK_ENTRY(window->PathEntry)):NULL;
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(creation_path)){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),SOURCE_CREATE_ONGOING_ERROR_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *sources_list = NULL;
|
|
|
|
char *sources_list = NULL;
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(window->AddBox));
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(window->AddBox));
|
|
|
|
GList *iter;
|
|
|
|
GList *iter;
|
|
|
|
@ -207,26 +193,6 @@ void on_source_accept(GtkWidget *,source_window *window){
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key(source_parameter);
|
|
|
|
yon_config_remove_by_key(source_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str paths = NULL;
|
|
|
|
|
|
|
|
dictionary *dict;
|
|
|
|
|
|
|
|
if (window->sources){
|
|
|
|
|
|
|
|
for_dictionaries(dict,window->sources){
|
|
|
|
|
|
|
|
if (yon_char_parsed_check_exist(paths,size,dict->key)>-1){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),VALUE_REPEAT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(paths,&size,dict->key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!size){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
|
|
|
yon_ubl_status_highlight_incorrect(window->PathEntry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char *parameter_string = yon_char_parsed_to_string(paths,(int)size,",");
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(parameter_string)) free(parameter_string);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!main_config.configure_mode){
|
|
|
|
if (!main_config.configure_mode){
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str parameters = yon_config_get_save_parameters_by_key(&size,locale_parameter,lang_parameter,zone_parameter,NULL);
|
|
|
|
config_str parameters = yon_config_get_save_parameters_by_key(&size,locale_parameter,lang_parameter,zone_parameter,NULL);
|
|
|
|
@ -238,7 +204,6 @@ void on_source_accept(GtkWidget *,source_window *window){
|
|
|
|
yon_char_parsed_free(parameters,size);
|
|
|
|
yon_char_parsed_free(parameters,size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_dictionary_free_all(window->sources,NULL);
|
|
|
|
|
|
|
|
on_subwindow_close(window->Window);
|
|
|
|
on_subwindow_close(window->Window);
|
|
|
|
free(window);
|
|
|
|
free(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -252,54 +217,27 @@ source_window *yon_source_window_new(){
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
|
|
|
|
window->AutoSwitch = yon_gtk_builder_get_widget(builder,"AutoSwitch");
|
|
|
|
window->AutoSwitch = yon_gtk_builder_get_widget(builder,"AutoSwitch");
|
|
|
|
window->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
|
|
|
|
|
|
|
|
window->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry");
|
|
|
|
|
|
|
|
window->DeviceCombo = yon_gtk_builder_get_widget(builder,"DeviceCombo");
|
|
|
|
|
|
|
|
window->PathButton = yon_gtk_builder_get_widget(builder,"PathButton");
|
|
|
|
|
|
|
|
window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
|
|
|
|
|
|
|
|
window->AddBox = yon_gtk_builder_get_widget(builder,"AddBox");
|
|
|
|
window->AddBox = yon_gtk_builder_get_widget(builder,"AddBox");
|
|
|
|
window->sources = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_source_accept),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_source_accept),window);
|
|
|
|
g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_source_add),window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_source_choose),window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->TypeCombo),"changed",G_CALLBACK(on_source_changed),window);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),gtk_widget_get_parent(gtk_widget_get_parent(window->AddBox)));
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),gtk_widget_get_parent(gtk_widget_get_parent(window->AddBox)));
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->TypeCombo);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->DeviceCombo);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathButton);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathEntry);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->AddButton);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(window->PathButton),"combo",window->TypeCombo);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(window->PathButton),"target",window->PathEntry);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(window->TypeCombo),"target",window->DeviceCombo);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(window->TypeCombo),"button",window->PathButton);
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(window->TypeCombo),"combo",window->PathEntry);
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *config_parameter = config(source_parameter);
|
|
|
|
char *config_parameter = config(source_parameter);
|
|
|
|
if (window->sources){
|
|
|
|
if (!yon_char_is_empty(config_parameter)){
|
|
|
|
yon_dictionary_free_all(window->sources,NULL);
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(window->AutoSwitch),0);
|
|
|
|
}
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str parsed = yon_char_parse(config_parameter,&size,",");
|
|
|
|
config_str parsed = yon_char_parse(config_parameter,&size,",");
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
yon_source_element_add(parsed[i],NULL,window);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->sources,parsed[i],NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
yon_source_element_add(NULL,NULL,window);
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str parts = yon_config_load(get_parts_and_devices_command, &size);
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(parts[i],&parsed_size,";");
|
|
|
|
|
|
|
|
if (!strcmp(parsed[0],"part")){
|
|
|
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->DeviceCombo),parsed[1],parsed[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DeviceCombo),0);
|
|
|
|
|
|
|
|
yon_char_parsed_free(parts,size);
|
|
|
|
|
|
|
|
return window;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|