|
|
|
|
@ -36,6 +36,7 @@ typedef struct yon_configuration_parameters {
|
|
|
|
|
dictionary_fields(yon_configuration_parameters);
|
|
|
|
|
char *label;
|
|
|
|
|
char *value;
|
|
|
|
|
GCallback func;
|
|
|
|
|
enum CONFIGURATION_PARAMETER_TYPE type;
|
|
|
|
|
} yon_configuration_parameters;
|
|
|
|
|
|
|
|
|
|
@ -51,6 +52,8 @@ yon_configuration_entry_parameter *yon_configuration_entry_parameter_new(char *i
|
|
|
|
|
return parameter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_configuration_parameters *__yon_settings_parameters = NULL;
|
|
|
|
|
|
|
|
|
|
yon_configuration_combo_parameter *yon_configuration_combo_box_parameter_new(char *id, char *label_text, config_str parameters){
|
|
|
|
|
yon_configuration_combo_parameter *parameter = malloc(sizeof(yon_configuration_combo_parameter));
|
|
|
|
|
parameter->Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
@ -70,6 +73,12 @@ yon_configuration_combo_parameter *yon_configuration_combo_box_parameter_new(cha
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(parameter->ComboBox),0);
|
|
|
|
|
}
|
|
|
|
|
g_signal_connect(G_OBJECT(parameter->ComboBox),"changed",G_CALLBACK(on_confuguration_combo_box_changed),id);
|
|
|
|
|
yon_configuration_parameters *target = (yon_configuration_parameters*)yon_dictionary_get((dictionary**)&__yon_settings_parameters,id);
|
|
|
|
|
if (target){
|
|
|
|
|
if (target->func){
|
|
|
|
|
g_signal_connect(G_OBJECT(parameter->ComboBox),"changed",G_CALLBACK(target->func),target->value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_widget_show_all(parameter->Box);
|
|
|
|
|
return parameter;
|
|
|
|
|
}
|
|
|
|
|
@ -84,8 +93,6 @@ ubl_settings_window *yon_ubl_settings_window_new(){
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_configuration_parameters *__yon_settings_parameters = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yon_configuration_boolean_parameter *__yon_configuration_boolean_parameter_new(char *id, char *label_text){
|
|
|
|
|
yon_configuration_boolean_parameter *parameter = malloc(sizeof(yon_configuration_boolean_parameter));
|
|
|
|
|
@ -109,6 +116,7 @@ yon_configuration_parameters *yon_configuration_parameter_new()
|
|
|
|
|
dict->prev = NULL;
|
|
|
|
|
dict->data = NULL;
|
|
|
|
|
dict->value = NULL;
|
|
|
|
|
dict->func = NULL;
|
|
|
|
|
dict->first = (struct yon_configuration_parameters*)dict;
|
|
|
|
|
dict->data_type = DICTIONARY_OTHER_TYPE;
|
|
|
|
|
return dict;
|
|
|
|
|
@ -123,6 +131,7 @@ yon_configuration_parameters *yon_configuration_parameter_append(yon_configurati
|
|
|
|
|
targetdict->next->data_type = DICTIONARY_OTHER_TYPE;
|
|
|
|
|
targetdict->next->data = NULL;
|
|
|
|
|
targetdict->next->value = NULL;
|
|
|
|
|
targetdict->next->func = NULL;
|
|
|
|
|
return targetdict->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -202,19 +211,19 @@ void __yon_on_boolean_parameter_toggled(GtkToggleButton *self ,char *id){
|
|
|
|
|
void on_confuguration_combo_box_changed(GtkComboBox *self, char *id){
|
|
|
|
|
yon_configuration_parameters *cur = (yon_configuration_parameters*)yon_dictionary_get((dictionary**)&__yon_settings_parameters,id);
|
|
|
|
|
if (cur){
|
|
|
|
|
cur->value = yon_char_new((char*)gtk_combo_box_get_active_id(self));
|
|
|
|
|
char *cur_value = yon_char_new((char*)gtk_combo_box_get_active_id(self));
|
|
|
|
|
if (yon_window_config_check_init()){
|
|
|
|
|
yon_window_config_add_instant_parameter(id,"settings",cur->value,YON_TYPE_STRING);
|
|
|
|
|
yon_window_config_add_instant_parameter(id,"settings",cur_value,YON_TYPE_STRING);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//init section
|
|
|
|
|
|
|
|
|
|
void yon_configuration_window_add_combo_box_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label,...){
|
|
|
|
|
void yon_configuration_window_add_combo_box_parameter(enum CONFIGURATION_PARAMETER_TYPE type, char *id, char *label, GCallback func, gpointer data,...){
|
|
|
|
|
yon_configuration_parameter_add_or_create_if_exists_with_data(__yon_settings_parameters,id,label);
|
|
|
|
|
va_list args;
|
|
|
|
|
va_start(args,label);
|
|
|
|
|
va_start(args,data);
|
|
|
|
|
char *cur=NULL;
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str variants = NULL;
|
|
|
|
|
@ -234,6 +243,8 @@ void yon_configuration_window_add_combo_box_parameter(enum CONFIGURATION_PARAMET
|
|
|
|
|
|
|
|
|
|
parameter->data = (void*)variants;
|
|
|
|
|
parameter->type = CONFIGURATION_PARAMETER_COMBO_BOX;
|
|
|
|
|
parameter->func = func;
|
|
|
|
|
parameter->value = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|