Fixed checkbox saving

pull/10/head
parent 100c0af8e5
commit ff4cc65581

@ -283,6 +283,7 @@ GList *yon_get_all_selected(GtkTreeView *tree, int column){
void on_layouts_accept(GtkWidget *self, dictionary *dict){
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
layouts_window *window = yon_dictionary_get_data(dict->first->next,layouts_window*);
gtk_list_store_clear(widgets->layoutsList);
GtkTreeModel *model = GTK_TREE_MODEL(window->list);
GList *list = yon_get_all_selected(GTK_TREE_VIEW(window->MainTree),2);
char *name;
@ -320,6 +321,8 @@ void on_layouts_add(GtkWidget *, main_window *widgets){
gtk_tree_view_set_model(GTK_TREE_VIEW(window->MainTree), GTK_TREE_MODEL(window->list));
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(window->MainTree)),GTK_SELECTION_MULTIPLE);
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,icon_path,"layout_window");
dictionary *dict = NULL;
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
@ -327,6 +330,25 @@ void on_layouts_add(GtkWidget *, main_window *widgets){
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_layouts_accept),dict);
g_signal_connect(G_OBJECT(window->ChosenCell),"toggled",G_CALLBACK(on_layouts_chosen),window);
char *languages = config(keyboard_layout_parameter);
int size;
config_str parsed = yon_char_parse(languages,&size,",");
GtkTreeIter iter;
for_iter(window->list,&iter){
int found = 0;
char *id;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&id,-1);
for (int i=0;i<size;i++){
if (!strcmp(id,parsed[i])){
gtk_list_store_set(window->list,&iter,2,1,-1);
found=1;
break;
}
}
if (!found) {
gtk_list_store_set(window->list,&iter,2,0,-1);
}
}
}
void on_layouts_remove(GtkWidget *, main_window *widgets){

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!-- Generated with glade 3.40.0 -->
<interface domain="ubl-settings-keyboard">
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image1">
@ -98,7 +98,6 @@
<object class="GtkCellRendererToggle" id="ChosenCell"/>
<attributes>
<attribute name="active">2</attribute>
<attribute name="radio">3</attribute>
</attributes>
</child>
</object>

Loading…
Cancel
Save