|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
|
|
|
|
|
|
int yon_keyboard_save(main_window *widgets){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeIter iter,iter_child;
|
|
|
|
|
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(widgets->LayoutList),&iter)){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),LAYOUTS_CHOSEN_BUT_EMPTY_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->LayoutTree));
|
|
|
|
|
@ -12,9 +12,23 @@ int yon_keyboard_save(main_window *widgets){
|
|
|
|
|
char *cur_layout=NULL;
|
|
|
|
|
for_iter(layouts_model,&iter){
|
|
|
|
|
int chosen=0;
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,-1);
|
|
|
|
|
int primary=0;
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,4,&primary,-1);
|
|
|
|
|
if (chosen)
|
|
|
|
|
layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL);
|
|
|
|
|
if (primary){
|
|
|
|
|
yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,cur_layout);
|
|
|
|
|
}
|
|
|
|
|
if (gtk_tree_model_iter_children(layouts_model,&iter_child,&iter)){
|
|
|
|
|
for(int valid2=1;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->LayoutList),&iter_child)){
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter_child,0,&cur_layout,3,&chosen,4,&primary,-1);
|
|
|
|
|
if (chosen)
|
|
|
|
|
layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL);
|
|
|
|
|
if (primary){
|
|
|
|
|
yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,cur_layout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(layouts_list))
|
|
|
|
|
@ -211,6 +225,7 @@ void on_keyboard_clicked (GtkWidget *, main_window *widgets){
|
|
|
|
|
ubinstall_keyboard_window *window = yon_ubinstall_keyboard_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),KEYBOARD_TITLE_LABEL,icon_path,"keyboard-window");
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->LayoutsTree),GTK_TREE_MODEL(widgets->LayoutList));
|
|
|
|
|
gtk_tree_view_column_clicked(gtk_tree_view_get_column(GTK_TREE_VIEW(window->LayoutsTree),1));
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets);
|
|
|
|
|
@ -228,7 +243,7 @@ void yon_layout_build(char *key, GHashTable *value, main_window *widgets){
|
|
|
|
|
for (iterator=list;iterator;iterator=iterator->next){
|
|
|
|
|
if (!yon_char_is_empty((char*)iterator->data)){
|
|
|
|
|
gtk_tree_store_append(widgets->LayoutList,&iter,&parent);
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,-1);
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,4,1,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -299,4 +314,33 @@ void yon_keyboard_init(main_window *widgets){
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_keyboard_layout_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){
|
|
|
|
|
GtkTreeIter iter, itar, itor, itur;
|
|
|
|
|
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->LayoutsFilter),&iter,path);
|
|
|
|
|
int status;
|
|
|
|
|
char *target;
|
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&itur,&iter);
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->LayoutList),&itur,4,&status,1,&target,-1);
|
|
|
|
|
// g_signal_handlers_block_by_func(self,G_CALLBACK(on_keyboard_layout_chosen),widgets);
|
|
|
|
|
for_iter(GTK_TREE_MODEL(widgets->LayoutsFilter),&itar){
|
|
|
|
|
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),&itor,&itar);
|
|
|
|
|
// gtk_tree_model_sort_convert_iter_to_child_iter(GTK_TREE_MODEL_SORT(widgets->LayoutList),&itar,&itor);
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&itor,4,0,-1);
|
|
|
|
|
GtkTreeIter itor_child;
|
|
|
|
|
if (gtk_tree_model_iter_children(GTK_TREE_MODEL(widgets->LayoutList),&itor_child,&itor)){
|
|
|
|
|
for(int valid2=1;valid2;valid2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(widgets->LayoutList),&itor_child)){
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&itor_child,4,0,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&itur,4,!status,-1);
|
|
|
|
|
// g_signal_handlers_unblock_by_func(self,G_CALLBACK(on_keyboard_layout_chosen),widgets);
|
|
|
|
|
if (!status){
|
|
|
|
|
yon_config_register(xkbvariant_parameter,xkbvariant_parameter_command,target);
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key(xkbvariant_parameter);
|
|
|
|
|
}
|
|
|
|
|
}
|