|
|
|
@ -10,16 +10,38 @@ int yon_keyboard_save(main_window *widgets){
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->KeyboardLayoutTree);
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->KeyboardLayoutTree);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *final = NULL;
|
|
|
|
|
|
|
|
for_iter(widgets->LayoutsList, &iter){
|
|
|
|
|
|
|
|
char *target;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutsList),&iter,0,&target,-1);
|
|
|
|
|
|
|
|
char *temp = yon_char_append_element(final,target,",");
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(final)) free(final);
|
|
|
|
|
|
|
|
final = temp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_config_register(xkblayout_parameter,xkblayout_parameter_command,final);
|
|
|
|
|
|
|
|
if(!yon_char_is_empty(final)) free(final);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *keyboard_model = gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo));
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(keyboard_model)){
|
|
|
|
|
|
|
|
yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,(char*)keyboard_model);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yon_config_remove_by_key(xkbmodel_parameter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int numlock_active = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo));
|
|
|
|
|
|
|
|
char *numlock = NULL;
|
|
|
|
|
|
|
|
switch(numlock_active){
|
|
|
|
|
|
|
|
case 1: numlock = "on";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: numlock = "off";
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_config_register(num_lock_boot_parameter,num_lock_boot_parameter_command,numlock);
|
|
|
|
|
|
|
|
on_options_save(NULL,widgets);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_keyboard_init(main_window *widgets){
|
|
|
|
void yon_keyboard_init(main_window *widgets){
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardLayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardNumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardScrollLockSwitch),G_CALLBACK(on_scroll_lock_switch),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardComposeSwitch),G_CALLBACK(on_compose_switch),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets);
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets);
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo));
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo));
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
@ -89,8 +111,10 @@ void yon_keyboard_init(main_window *widgets){
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *name = yon_config_get_by_key(num_lock_boot_parameter);
|
|
|
|
char *name = yon_config_get_by_key(num_lock_boot_parameter);
|
|
|
|
if (name) {
|
|
|
|
if (name) {
|
|
|
|
if (!strcmp(name,"yes")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),1);
|
|
|
|
if (!strcmp(name,"yes")||!strcmp(name,"yes")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),1);
|
|
|
|
else if (!strcmp(name,"no")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),2);
|
|
|
|
else if (!strcmp(name,"no")||!strcmp(name,"off")) gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),2);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->KeyboardNumLockCombo),0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -118,22 +142,22 @@ void yon_keyboard_init(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardModelCombo),G_CALLBACK(on_model_changed),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardNumLockCombo),G_CALLBACK(on_num_lock_changed),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardLayoutChangingCombo),G_CALLBACK(on_options_save),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardScrollLockSwitch),G_CALLBACK(on_scroll_lock_switch),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardComposeSwitch),G_CALLBACK(on_compose_switch),widgets);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets);
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(widgets->KeyboardDefaultLayoutsSwitch),G_CALLBACK(on_layout_default_toggled),widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_layouts_accept(GtkWidget *self, layouts_window *window){
|
|
|
|
void on_layouts_accept(GtkWidget *self, layouts_window *window){
|
|
|
|
main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets");
|
|
|
|
main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets");
|
|
|
|
if (!yon_char_is_empty(window->parameters)){
|
|
|
|
gtk_list_store_clear(widgets->LayoutsList);
|
|
|
|
yon_config_register(xkblayout_parameter,xkblayout_parameter_command,window->parameters);
|
|
|
|
GtkTreeIter iter;
|
|
|
|
} else {
|
|
|
|
for_iter (window->list,&iter){
|
|
|
|
yon_config_remove_by_key(xkblayout_parameter);
|
|
|
|
int active;
|
|
|
|
|
|
|
|
char *target;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&target,3,&active,-1);
|
|
|
|
|
|
|
|
if (active){
|
|
|
|
|
|
|
|
yon_layout_load(target,widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
on_subwindow_close(self);
|
|
|
|
on_subwindow_close(self);
|
|
|
|
yon_keyboard_init(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_layouts_chosen(GtkCellRenderer *, gchar *path, layouts_window *window){
|
|
|
|
void on_layouts_chosen(GtkCellRenderer *, gchar *path, layouts_window *window){
|
|
|
|
@ -244,7 +268,6 @@ void yon_layouts_remove(GtkTreeView *tree, GtkListStore *cur_list, main_window *
|
|
|
|
if (yon_confirmation_dialog_call(widgets->MainWindow,data)!=GTK_RESPONSE_ACCEPT) return;
|
|
|
|
if (yon_confirmation_dialog_call(widgets->MainWindow,data)!=GTK_RESPONSE_ACCEPT) return;
|
|
|
|
gtk_list_store_remove(widgets->LayoutsList,&iter);
|
|
|
|
gtk_list_store_remove(widgets->LayoutsList,&iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_keyboard_init(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_system_layouts_remove(GtkWidget *, main_window *widgets){
|
|
|
|
void on_system_layouts_remove(GtkWidget *, main_window *widgets){
|
|
|
|
@ -356,30 +379,6 @@ void on_layout_move_down(GtkWidget *, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_compose_switch(GtkWidget *,int status,main_window *widgets){
|
|
|
|
|
|
|
|
switch(status){
|
|
|
|
|
|
|
|
case 0:{
|
|
|
|
|
|
|
|
yon_config_remove_element(xkboptions_parameter,"compose:rwin",",");
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case 1:{
|
|
|
|
|
|
|
|
yon_config_append_element(xkboptions_parameter,"compose:rwin",",");
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_keyboard_init(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_scroll_lock_switch(GtkWidget *,int status,main_window *widgets){
|
|
|
|
|
|
|
|
switch(status){
|
|
|
|
|
|
|
|
case 0:{
|
|
|
|
|
|
|
|
yon_config_remove_element(xkboptions_parameter,"grp_led:scroll",",");
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case 1:{
|
|
|
|
|
|
|
|
yon_config_append_element(xkboptions_parameter,"grp_led:scroll",",");
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
yon_keyboard_init(widgets);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_layout_default_sensitive_toggled(GtkWidget *, int status, main_window *widgets){
|
|
|
|
void on_layout_default_sensitive_toggled(GtkWidget *, int status, main_window *widgets){
|
|
|
|
gtk_widget_set_sensitive(widgets->KeyboardLayoutTree,!status);
|
|
|
|
gtk_widget_set_sensitive(widgets->KeyboardLayoutTree,!status);
|
|
|
|
gtk_widget_set_sensitive(widgets->KeyboardLayoutAddButton,!status);
|
|
|
|
gtk_widget_set_sensitive(widgets->KeyboardLayoutAddButton,!status);
|
|
|
|
@ -426,18 +425,6 @@ void on_layout_selection_changed(GtkTreeView *self,main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_num_lock_changed(GtkComboBox *self, main_window *){
|
|
|
|
|
|
|
|
switch (gtk_combo_box_get_active(self)){
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
yon_config_remove_by_key(num_lock_boot_parameter);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: yon_config_register(num_lock_boot_parameter,num_lock_boot_parameter_command,"yes");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:yon_config_register(num_lock_boot_parameter,num_lock_boot_parameter_command,"no");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_model_changed(GtkComboBoxText *self, main_window *widgets){
|
|
|
|
void on_model_changed(GtkComboBoxText *self, main_window *widgets){
|
|
|
|
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(self))){
|
|
|
|
switch (gtk_combo_box_get_active(GTK_COMBO_BOX(self))){
|
|
|
|
case 0:
|
|
|
|
case 0:
|
|
|
|
@ -452,14 +439,21 @@ void on_model_changed(GtkComboBoxText *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
void on_options_save(GtkWidget *,main_window *widgets){
|
|
|
|
void on_options_save(GtkWidget *,main_window *widgets){
|
|
|
|
char *main_id = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo));
|
|
|
|
char *main_id = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardLayoutChangingCombo));
|
|
|
|
int parameter_parsed_size;
|
|
|
|
char *options = yon_char_append_element(NULL,main_id,",");
|
|
|
|
config_str parameter_parsed = NULL;
|
|
|
|
if (gtk_switch_get_active(GTK_SWITCH(widgets->KeyboardComposeSwitch))){
|
|
|
|
yon_char_parsed_add_or_create_if_exists(parameter_parsed,¶meter_parsed_size,!yon_char_is_empty(main_id)?main_id:"");
|
|
|
|
char *temp = yon_char_append_element(options,"compose:rwin",",");
|
|
|
|
char *final_parameter = yon_char_parsed_to_string_full(parameter_parsed,parameter_parsed_size,",");
|
|
|
|
if (!yon_char_is_empty(options)) free(options);
|
|
|
|
yon_char_parsed_free(parameter_parsed,parameter_parsed_size);
|
|
|
|
options = temp;
|
|
|
|
if (!yon_char_is_empty(final_parameter)){
|
|
|
|
}
|
|
|
|
yon_config_register(xkboptions_parameter,xkboptions_parameter_command,final_parameter);
|
|
|
|
if (gtk_switch_get_active(GTK_SWITCH(widgets->KeyboardScrollLockSwitch))){
|
|
|
|
free(final_parameter);
|
|
|
|
char *temp = yon_char_append_element(options,"grp_led:scroll",",");
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(options)) free(options);
|
|
|
|
|
|
|
|
options = temp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(options)){
|
|
|
|
|
|
|
|
yon_config_register(xkboptions_parameter,xkboptions_parameter_command,options);
|
|
|
|
|
|
|
|
free(options);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yon_config_remove_by_key(xkboptions_parameter);
|
|
|
|
yon_config_remove_by_key(xkboptions_parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|