|
|
|
@ -8,6 +8,7 @@ gboolean yon_interface_update(main_window *widgets){
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->OptionsEditButton),G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->OptionsEditButton),G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->NumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->NumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->LayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->LayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->TTYLayoutCombo),G_CALLBACK(on_tty_changed),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NumLockCombo),0);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NumLockCombo),0);
|
|
|
|
@ -27,12 +28,35 @@ gboolean yon_interface_update(main_window *widgets){
|
|
|
|
for(int i=0;i<layouts_parsed_size;i++){
|
|
|
|
for(int i=0;i<layouts_parsed_size;i++){
|
|
|
|
yon_layout_load(layouts_parsed[i],widgets);
|
|
|
|
yon_layout_load(layouts_parsed[i],widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_is_empty(layouts)||yon_config_check_ignore(keyboard_layout_parameter)){
|
|
|
|
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(widgets->DefaultLayoutsSwitch),1);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(widgets->DefaultLayoutsSwitch),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(layouts)){
|
|
|
|
|
|
|
|
char *element = yon_char_parsed_check_exist_begins_with(main_config.layouts_list,main_config.layouts_size,"us|");
|
|
|
|
|
|
|
|
if (element){
|
|
|
|
|
|
|
|
int parsed_size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(element,&parsed_size,"|");
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
gtk_list_store_append(widgets->LayoutsList,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(widgets->LayoutsList,&iter,0,parsed[0],2,_(parsed[1]),-1);
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *tty_keymap = config(console_keymap_parameter);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(tty_keymap)){
|
|
|
|
|
|
|
|
gtk_combo_box_set_active_id(GTK_COMBO_BOX(widgets->TTYLayoutCombo),tty_keymap);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->TTYLayoutCombo),0);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gtk_list_store_clear(widgets->OptionsList);
|
|
|
|
gtk_list_store_clear(widgets->OptionsList);
|
|
|
|
char *options = config(options_parameter);
|
|
|
|
char *options = config(options_parameter);
|
|
|
|
if (!yon_char_is_empty(options)){
|
|
|
|
if (!yon_char_is_empty(options)){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->ManualEntry),options);
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str parsed = yon_char_parse(options,&size,",");
|
|
|
|
config_str parsed = yon_char_parse(options,&size,",");
|
|
|
|
@ -48,8 +72,6 @@ gboolean yon_interface_update(main_window *widgets){
|
|
|
|
yon_char_parsed_free(option_parsed,option_parsed_size);
|
|
|
|
yon_char_parsed_free(option_parsed,option_parsed_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(widgets->ManualEntry),"");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -64,6 +86,7 @@ gboolean yon_interface_update(main_window *widgets){
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->OptionsEditButton),G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->OptionsEditButton),G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->NumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->NumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->LayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->LayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->TTYLayoutCombo),G_CALLBACK(on_tty_changed),widgets);
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -135,6 +158,7 @@ void yon_config_init(){
|
|
|
|
int options_size;
|
|
|
|
int options_size;
|
|
|
|
config_str options = yon_config_load(command_full,&options_size);
|
|
|
|
config_str options = yon_config_load(command_full,&options_size);
|
|
|
|
for(int i=0;i<options_size;i++){
|
|
|
|
for(int i=0;i<options_size;i++){
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(options[i],'\n');
|
|
|
|
int parsed_size;
|
|
|
|
int parsed_size;
|
|
|
|
config_str parsed = yon_char_parse(options[i],&parsed_size,"|");
|
|
|
|
config_str parsed = yon_char_parse(options[i],&parsed_size,"|");
|
|
|
|
g_hash_table_insert(main_config.options,yon_char_new(parsed[0]),yon_char_new(options[i]));
|
|
|
|
g_hash_table_insert(main_config.options,yon_char_new(parsed[0]),yon_char_new(options[i]));
|
|
|
|
@ -148,6 +172,7 @@ void yon_config_init(){
|
|
|
|
main_config.options_list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN);
|
|
|
|
main_config.options_list = gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN);
|
|
|
|
config_str rtn = yon_config_load(get_options_command,&size);
|
|
|
|
config_str rtn = yon_config_load(get_options_command,&size);
|
|
|
|
for (int i=0; i<size;i++){
|
|
|
|
for (int i=0; i<size;i++){
|
|
|
|
|
|
|
|
yon_char_remove_last_symbol(rtn[i],'\n');
|
|
|
|
int option_size;
|
|
|
|
int option_size;
|
|
|
|
rtn[i] = yon_char_divide_search(rtn[i],"\n",-1);
|
|
|
|
rtn[i] = yon_char_divide_search(rtn[i],"\n",-1);
|
|
|
|
config_str option = yon_char_parse(rtn[i],&option_size,";");
|
|
|
|
config_str option = yon_char_parse(rtn[i],&option_size,";");
|
|
|
|
@ -181,6 +206,15 @@ void on_scroll_lock_switch(GtkWidget *,int status,main_window *widgets){
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
yon_interface_update(widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_tty_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
|
|
|
char *tty_layout = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->TTYLayoutCombo));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(tty_layout)){
|
|
|
|
|
|
|
|
yon_config_register(console_keymap_parameter,console_keymap_parameter_command,tty_layout);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_remove_by_key(console_keymap_parameter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_main_window_complete(main_window *widgets){
|
|
|
|
void yon_main_window_complete(main_window *widgets){
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
|
@ -193,13 +227,14 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
widgets->LayoutTree = yon_gtk_builder_get_widget(builder,"LayoutTree");
|
|
|
|
widgets->LayoutTree = yon_gtk_builder_get_widget(builder,"LayoutTree");
|
|
|
|
widgets->LayoutAddButton = yon_gtk_builder_get_widget(builder,"LayoutAddButton");
|
|
|
|
widgets->LayoutAddButton = yon_gtk_builder_get_widget(builder,"LayoutAddButton");
|
|
|
|
widgets->LayoutRemoveButton = yon_gtk_builder_get_widget(builder,"LayoutRemoveButton");
|
|
|
|
widgets->LayoutRemoveButton = yon_gtk_builder_get_widget(builder,"LayoutRemoveButton");
|
|
|
|
|
|
|
|
widgets->LayoutMoveUpButton = yon_gtk_builder_get_widget(builder,"LayoutMoveUpButton");
|
|
|
|
|
|
|
|
widgets->LayoutMoveDownButton = yon_gtk_builder_get_widget(builder,"LayoutMoveDownButton");
|
|
|
|
widgets->LayoutChangingCombo = yon_gtk_builder_get_widget(builder,"LayoutChangingCombo");
|
|
|
|
widgets->LayoutChangingCombo = yon_gtk_builder_get_widget(builder,"LayoutChangingCombo");
|
|
|
|
widgets->OptionsTree = yon_gtk_builder_get_widget(builder,"OptionsTree");
|
|
|
|
widgets->OptionsTree = yon_gtk_builder_get_widget(builder,"OptionsTree");
|
|
|
|
widgets->OptionsEditButton = yon_gtk_builder_get_widget(builder,"OptionsEditButton");
|
|
|
|
widgets->OptionsEditButton = yon_gtk_builder_get_widget(builder,"OptionsEditButton");
|
|
|
|
widgets->OptionsRemoveButton = yon_gtk_builder_get_widget(builder,"OptionsRemoveButton");
|
|
|
|
widgets->OptionsRemoveButton = yon_gtk_builder_get_widget(builder,"OptionsRemoveButton");
|
|
|
|
widgets->ComposeSwitch = yon_gtk_builder_get_widget(builder,"ComposeSwitch");
|
|
|
|
widgets->ComposeSwitch = yon_gtk_builder_get_widget(builder,"ComposeSwitch");
|
|
|
|
widgets->ScrollLockSwitch = yon_gtk_builder_get_widget(builder,"ScrollLockSwitch");
|
|
|
|
widgets->ScrollLockSwitch = yon_gtk_builder_get_widget(builder,"ScrollLockSwitch");
|
|
|
|
widgets->ManualEntry = yon_gtk_builder_get_widget(builder,"ManualEntry");
|
|
|
|
|
|
|
|
widgets->NumLockCombo = yon_gtk_builder_get_widget(builder,"NumLockCombo");
|
|
|
|
widgets->NumLockCombo = yon_gtk_builder_get_widget(builder,"NumLockCombo");
|
|
|
|
widgets->TTYLayoutCombo = yon_gtk_builder_get_widget(builder,"TTYLayoutCombo");
|
|
|
|
widgets->TTYLayoutCombo = yon_gtk_builder_get_widget(builder,"TTYLayoutCombo");
|
|
|
|
widgets->LayoutsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LayoutsList"));
|
|
|
|
widgets->LayoutsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LayoutsList"));
|
|
|
|
@ -212,6 +247,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutAddButton),"clicked",G_CALLBACK(on_system_layouts_add),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutAddButton),"clicked",G_CALLBACK(on_system_layouts_add),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutRemoveButton),"clicked",G_CALLBACK(on_system_layouts_remove),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutRemoveButton),"clicked",G_CALLBACK(on_system_layouts_remove),widgets);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->TTYLayoutCombo),"changed",G_CALLBACK(on_tty_changed),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->KeyboardModelCombo),"changed",G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->KeyboardModelCombo),"changed",G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->OptionsEditButton),"clicked",G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->OptionsEditButton),"clicked",G_CALLBACK(on_options_open),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->OptionsRemoveButton),"clicked",G_CALLBACK(on_option_remove),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->OptionsRemoveButton),"clicked",G_CALLBACK(on_option_remove),widgets);
|
|
|
|
@ -219,10 +255,17 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutChangingCombo),"changed",G_CALLBACK(on_options_save),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutChangingCombo),"changed",G_CALLBACK(on_options_save),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ComposeSwitch),"state-set",G_CALLBACK(on_compose_switch),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ComposeSwitch),"state-set",G_CALLBACK(on_compose_switch),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ScrollLockSwitch),"state-set",G_CALLBACK(on_scroll_lock_switch),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ScrollLockSwitch),"state-set",G_CALLBACK(on_scroll_lock_switch),widgets);
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(widgets->LayoutsList),"row-inserted",G_CALLBACK(on_layout_dnd_inserted),widgets);
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(widgets->LayoutsList),"row-deleted",G_CALLBACK(on_layout_dnd_deleted),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutTree);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutTree);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutAddButton);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutAddButton);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutRemoveButton);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutRemoveButton);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutMoveUpButton);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->DefaultLayoutsSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->LayoutMoveDownButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutMoveUpButton),"clicked",G_CALLBACK(on_layout_move_up),widgets);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LayoutMoveDownButton),"clicked",G_CALLBACK(on_layout_move_down),widgets);
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
|