From ff4cc655810157cbe5532f9970673e342112c078 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 6 Jun 2025 11:31:08 +0000 Subject: [PATCH] Fixed checkbox saving --- source/ubl-settings-keyboard.c | 22 ++++++++++++++++++++++ ubl-settings-keyboard-layouts.glade | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source/ubl-settings-keyboard.c b/source/ubl-settings-keyboard.c index 1d117a3..ff78395 100644 --- a/source/ubl-settings-keyboard.c +++ b/source/ubl-settings-keyboard.c @@ -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;ilist,&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){ diff --git a/ubl-settings-keyboard-layouts.glade b/ubl-settings-keyboard-layouts.glade index 9e36f22..f36fbe5 100644 --- a/ubl-settings-keyboard-layouts.glade +++ b/ubl-settings-keyboard-layouts.glade @@ -1,5 +1,5 @@ - + @@ -98,7 +98,6 @@ 2 - 3