Bug Summary

File:capplets/keyboard/cafe-keyboard-properties-xkbltadd.c
Warning:line 406, column 2
Value stored to 'options_list_strv' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name cafe-keyboard-properties-xkbltadd.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/capplets/keyboard -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I ../.. -I ../../capplets/common -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/libxml2 -I /usr/include/cafe-desktop-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -I ../../ -D G_LOG_DOMAIN="keyboard-properties" -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/polkit-1 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/libxml2 -D CAFECC_DATA_DIR="/usr/share/cafe-control-center" -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/capplets/keyboard -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-08-06-111517-113088-1 -x c cafe-keyboard-properties-xkbltadd.c
1/* -*- mode: c; style: linux -*- */
2
3/* cafe-keyboard-properties-xkbltadd.c
4 * Copyright (C) 2007 Sergey V. Udaltsov
5 *
6 * Written by: Sergey V. Udaltsov <svu@gnome.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 */
23
24#ifdef HAVE_CONFIG_H1
25# include <config.h>
26#endif
27
28#include <string.h>
29
30#include <libcafekbd/cafekbd-keyboard-drawing.h>
31#include <libcafekbd/cafekbd-util.h>
32
33#include "capplet-util.h"
34#include "cafe-keyboard-properties-xkb.h"
35
36enum {
37 COMBO_BOX_MODEL_COL_SORT,
38 COMBO_BOX_MODEL_COL_VISIBLE,
39 COMBO_BOX_MODEL_COL_XKB_ID,
40 COMBO_BOX_MODEL_COL_REAL_ID
41};
42
43typedef void (*LayoutIterFunc) (XklConfigRegistry * config,
44 ConfigItemProcessFunc func, gpointer data);
45
46typedef struct {
47 CtkListStore *list_store;
48 const gchar *lang_id;
49} AddVariantData;
50
51static void
52
53
54
55
56
57
58
59
60
61xkb_layout_chooser_available_layouts_fill (CtkBuilder * chooser_dialog,
62 const gchar cblid[],
63 const gchar cbvid[],
64 LayoutIterFunc layout_iterator,
65 ConfigItemProcessFunc
66 layout_handler,
67 GCallback combo_changed_notify);
68
69static void
70
71
72
73
74
75
76
77
78
79xkb_layout_chooser_available_language_variants_fill (CtkBuilder *
80 chooser_dialog);
81
82static void
83
84
85
86
87
88
89
90
91
92xkb_layout_chooser_available_country_variants_fill (CtkBuilder *
93 chooser_dialog);
94
95static void
96 xkb_layout_chooser_add_variant_to_available_country_variants
97 (XklConfigRegistry * config_registry,
98 XklConfigItem * parent_config_item, XklConfigItem * config_item,
99 AddVariantData * data) {
100 gchar *utf_variant_name = config_item ?
101 xkb_layout_description_utf8 (cafekbd_keyboard_config_merge_items
102 (parent_config_item->name,
103 config_item->name)) :
104 xci_desc_to_utf8 (parent_config_item);
105 CtkTreeIter iter;
106 const gchar *xkb_id =
107 config_item ?
108 cafekbd_keyboard_config_merge_items (parent_config_item->name,
109 config_item->name) :
110 parent_config_item->name;
111
112 if (config_item && g_object_get_data
113 (G_OBJECT (config_item)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((config_item)), (((GType) ((20) << (2))))))))
, XCI_PROP_EXTRA_ITEM"extraItem")) {
114 gchar *buf =
115 g_strdup_printf ("<i>%s</i>", utf_variant_name);
116 ctk_list_store_insert_with_values (data->list_store, &iter,
117 -1,
118 COMBO_BOX_MODEL_COL_SORT,
119 utf_variant_name,
120 COMBO_BOX_MODEL_COL_VISIBLE,
121 buf,
122 COMBO_BOX_MODEL_COL_XKB_ID,
123 xkb_id, -1);
124 g_free (buf);
125 } else
126 ctk_list_store_insert_with_values (data->list_store, &iter,
127 -1,
128 COMBO_BOX_MODEL_COL_SORT,
129 utf_variant_name,
130 COMBO_BOX_MODEL_COL_VISIBLE,
131 utf_variant_name,
132 COMBO_BOX_MODEL_COL_XKB_ID,
133 xkb_id, -1);
134 g_free (utf_variant_name);
135}
136
137static void
138 xkb_layout_chooser_add_variant_to_available_language_variants
139 (XklConfigRegistry * config_registry,
140 XklConfigItem * parent_config_item, XklConfigItem * config_item,
141 AddVariantData * data) {
142 xkb_layout_chooser_add_variant_to_available_country_variants
143 (config_registry, parent_config_item, config_item, data);
144}
145
146static void
147xkb_layout_chooser_add_language_to_available_languages (XklConfigRegistry *
148 config_registry,
149 XklConfigItem *
150 config_item,
151 CtkListStore *
152 list_store)
153{
154 ctk_list_store_insert_with_values (list_store, NULL((void*)0), -1,
155 COMBO_BOX_MODEL_COL_SORT,
156 config_item->description,
157 COMBO_BOX_MODEL_COL_VISIBLE,
158 config_item->description,
159 COMBO_BOX_MODEL_COL_REAL_ID,
160 config_item->name, -1);
161}
162
163static void
164xkb_layout_chooser_add_country_to_available_countries (XklConfigRegistry *
165 config_registry,
166 XklConfigItem *
167 config_item,
168 CtkListStore *
169 list_store)
170{
171 ctk_list_store_insert_with_values (list_store, NULL((void*)0), -1,
172 COMBO_BOX_MODEL_COL_SORT,
173 config_item->description,
174 COMBO_BOX_MODEL_COL_VISIBLE,
175 config_item->description,
176 COMBO_BOX_MODEL_COL_REAL_ID,
177 config_item->name, -1);
178}
179
180static void
181xkb_layout_chooser_enable_disable_buttons (CtkBuilder * chooser_dialog)
182{
183 CtkWidget *cbv =
184 CWID (ctk_notebook_get_current_page((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
185 (CTK_NOTEBOOK (CWID ("choosers_nb"))) ?((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
186 "xkb_language_variants_available" :((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
187 "xkb_country_variants_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
;
188 CtkTreeIter viter;
189 gboolean enable_ok =
190 ctk_combo_box_get_active_iter (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
,
191 &viter);
192
193 ctk_dialog_set_response_sensitive (CTK_DIALOG((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ())))))))), ((ctk_dialog_get_type (
)))))))
194 (CWID((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ())))))))), ((ctk_dialog_get_type (
)))))))
195 ("xkb_layout_chooser"))((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ())))))))), ((ctk_dialog_get_type (
)))))))
,
196 CTK_RESPONSE_OK, enable_ok);
197 ctk_widget_set_sensitive (CWID ("btnPrint")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "btnPrint"))), (
(ctk_widget_get_type ()))))))
, enable_ok);
198}
199
200static void
201xkb_layout_chooser_available_variant_changed (CtkBuilder * chooser_dialog)
202{
203 xkb_layout_preview_update (chooser_dialog);
204 xkb_layout_chooser_enable_disable_buttons (chooser_dialog);
205}
206
207static void
208xkb_layout_chooser_available_language_changed (CtkBuilder * chooser_dialog)
209{
210 xkb_layout_chooser_available_language_variants_fill
211 (chooser_dialog);
212 xkb_layout_chooser_available_variant_changed (chooser_dialog);
213}
214
215static void
216xkb_layout_chooser_available_country_changed (CtkBuilder * chooser_dialog)
217{
218 xkb_layout_chooser_available_country_variants_fill
219 (chooser_dialog);
220 xkb_layout_chooser_available_variant_changed (chooser_dialog);
221}
222
223static void
224xkb_layout_chooser_page_changed (CtkWidget * notebook, CtkWidget * page,
225 gint page_num,
226 CtkBuilder * chooser_dialog)
227{
228 xkb_layout_chooser_available_variant_changed (chooser_dialog);
229}
230
231static void
232xkb_layout_chooser_available_language_variants_fill (CtkBuilder *
233 chooser_dialog)
234{
235 CtkWidget *cbl = CWID ("xkb_languages_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_languages_available"
))), ((ctk_widget_get_type ()))))))
;
236 CtkWidget *cbv = CWID ("xkb_language_variants_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_language_variants_available"
))), ((ctk_widget_get_type ()))))))
;
237 CtkListStore *list_store;
238 CtkTreeIter liter;
239
240 list_store = ctk_list_store_new
241 (4, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))),
242 G_TYPE_STRING((GType) ((16) << (2))));
243
244 if (ctk_combo_box_get_active_iter (CTK_COMBO_BOX (cbl)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_combo_box_get_type ()))))))
, &liter)) {
245 CtkTreeModel *lm =
246 ctk_combo_box_get_model (CTK_COMBO_BOX (cbl)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_combo_box_get_type ()))))))
);
247 gchar *lang_id;
248 AddVariantData data = { list_store, 0 };
249
250 /* Now the variants of the selected layout */
251 ctk_tree_model_get (lm, &liter,
252 COMBO_BOX_MODEL_COL_REAL_ID,
253 &lang_id, -1);
254 data.lang_id = lang_id;
255
256 xkl_config_registry_foreach_language_variant
257 (config_registry, lang_id, (TwoConfigItemsProcessFunc)
258 xkb_layout_chooser_add_variant_to_available_language_variants,
259 &data);
260 g_free (lang_id);
261 }
262
263 /* Turn on sorting after filling the store, since that's faster */
264 ctk_tree_sortable_set_sort_column_id (CTK_TREE_SORTABLE((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
265 (list_store)((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
,
266 COMBO_BOX_MODEL_COL_SORT,
267 CTK_SORT_ASCENDING);
268
269 ctk_combo_box_set_model (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
,
270 CTK_TREE_MODEL (list_store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_model_get_type ()))))))
);
271 ctk_combo_box_set_active (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
, 0);
272}
273
274static void
275xkb_layout_chooser_available_country_variants_fill (CtkBuilder *
276 chooser_dialog)
277{
278 CtkWidget *cbl = CWID ("xkb_countries_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_countries_available"
))), ((ctk_widget_get_type ()))))))
;
279 CtkWidget *cbv = CWID ("xkb_country_variants_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
;
280 CtkListStore *list_store;
281 CtkTreeIter liter;
282
283 list_store = ctk_list_store_new
284 (4, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))),
285 G_TYPE_STRING((GType) ((16) << (2))));
286
287 if (ctk_combo_box_get_active_iter (CTK_COMBO_BOX (cbl)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_combo_box_get_type ()))))))
, &liter)) {
288 CtkTreeModel *lm =
289 ctk_combo_box_get_model (CTK_COMBO_BOX (cbl)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_combo_box_get_type ()))))))
);
290 gchar *country_id;
291 AddVariantData data = { list_store, 0 };
292
293 /* Now the variants of the selected layout */
294 ctk_tree_model_get (lm, &liter,
295 COMBO_BOX_MODEL_COL_REAL_ID,
296 &country_id, -1);
297 xkl_config_registry_foreach_country_variant
298 (config_registry, country_id,
299 (TwoConfigItemsProcessFunc)
300 xkb_layout_chooser_add_variant_to_available_country_variants,
301 &data);
302 g_free (country_id);
303 }
304
305 /* Turn on sorting after filling the store, since that's faster */
306 ctk_tree_sortable_set_sort_column_id (CTK_TREE_SORTABLE((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
307 (list_store)((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
,
308 COMBO_BOX_MODEL_COL_SORT,
309 CTK_SORT_ASCENDING);
310
311 ctk_combo_box_set_model (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
,
312 CTK_TREE_MODEL (list_store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_model_get_type ()))))))
);
313 ctk_combo_box_set_active (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
, 0);
314}
315
316static void
317xkb_layout_chooser_available_layouts_fill (CtkBuilder *
318 chooser_dialog,
319 const gchar cblid[],
320 const gchar cbvid[],
321 LayoutIterFunc layout_iterator,
322 ConfigItemProcessFunc
323 layout_handler,
324 GCallback combo_changed_notify)
325{
326 CtkWidget *cbl = CWID (cblid)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, cblid))), ((ctk_widget_get_type
()))))))
;
327 CtkWidget *cbev = CWID (cbvid)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, cbvid))), ((ctk_widget_get_type
()))))))
;
328 CtkCellRenderer *renderer;
329 CtkListStore *list_store;
330
331 list_store = ctk_list_store_new
332 (4, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2))),
333 G_TYPE_STRING((GType) ((16) << (2))));
334
335 ctk_combo_box_set_model (CTK_COMBO_BOX (cbl)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_combo_box_get_type ()))))))
,
336 CTK_TREE_MODEL (list_store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_model_get_type ()))))))
);
337
338 renderer = ctk_cell_renderer_text_new ();
339 ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (cbl)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_cell_layout_get_type ()))))))
, renderer, TRUE(!(0)));
340 ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (cbl)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbl)), ((ctk_cell_layout_get_type ()))))))
,
341 renderer, "markup",
342 COMBO_BOX_MODEL_COL_VISIBLE, NULL((void*)0));
343
344 layout_iterator (config_registry, layout_handler, list_store);
345
346 /* Turn on sorting after filling the model since that's faster */
347 ctk_tree_sortable_set_sort_column_id (CTK_TREE_SORTABLE((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
348 (list_store)((((CtkTreeSortable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((list_store)), ((ctk_tree_sortable_get_type ()))))))
,
349 COMBO_BOX_MODEL_COL_SORT,
350 CTK_SORT_ASCENDING);
351
352 g_signal_connect_swapped (G_OBJECT (cbl), "changed",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbl)), (((GType) ((20) << (2))))))
))), ("changed"), (combo_changed_notify), (chooser_dialog), (
(void*)0), G_CONNECT_SWAPPED)
353 combo_changed_notify, chooser_dialog)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbl)), (((GType) ((20) << (2))))))
))), ("changed"), (combo_changed_notify), (chooser_dialog), (
(void*)0), G_CONNECT_SWAPPED)
;
354
355 /* Setup the variants combo */
356 renderer = ctk_cell_renderer_text_new ();
357 ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (cbev)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbev)), ((ctk_cell_layout_get_type ()))))))
,
358 renderer, TRUE(!(0)));
359 ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (cbev)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbev)), ((ctk_cell_layout_get_type ()))))))
,
360 renderer, "markup",
361 COMBO_BOX_MODEL_COL_VISIBLE, NULL((void*)0));
362
363 g_signal_connect_swapped (G_OBJECT (cbev), "changed",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbev)), (((GType) ((20) << (2)))))
)))), ("changed"), (((GCallback) (xkb_layout_chooser_available_variant_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_SWAPPED)
364 G_CALLBACKg_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbev)), (((GType) ((20) << (2)))))
)))), ("changed"), (((GCallback) (xkb_layout_chooser_available_variant_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_SWAPPED)
365 (xkb_layout_chooser_available_variant_changed),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbev)), (((GType) ((20) << (2)))))
)))), ("changed"), (((GCallback) (xkb_layout_chooser_available_variant_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_SWAPPED)
366 chooser_dialog)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((cbev)), (((GType) ((20) << (2)))))
)))), ("changed"), (((GCallback) (xkb_layout_chooser_available_variant_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_SWAPPED)
;
367}
368
369GSList*
370xkb_layout_gslist_from_strv (gchar **array)
371{
372 GSList *list = NULL((void*)0);
373 gint i;
374 if (array != NULL((void*)0)) {
375 for (i = 0; array[i]; i++) {
376 list = g_slist_append (list, g_strdup (array[i])g_strdup_inline (array[i]));
377 }
378 }
379 return list;
380}
381
382gchar **
383xkb_layout_strv_from_gslist (GSList *list)
384{
385 GArray *array;
386 GSList *l;
387 array = g_array_new (TRUE(!(0)), TRUE(!(0)), sizeof (gchar *));
388 for (l = list; l; l = l->next) {
389 array = g_array_append_val (array, l->data)g_array_append_vals (array, &(l->data), 1);
390 }
391 return (gchar **) array->data;
392}
393
394
395
396void
397xkl_layout_chooser_add_default_switcher_if_necessary (GSList *
398 layouts_list)
399{
400 GSList *options_list = xkb_options_get_selected_list ();
401 gboolean was_appended;
402
403 gchar **layouts_list_strv = xkb_layout_strv_from_gslist (layouts_list);
404 gchar **options_list_strv = xkb_layout_strv_from_gslist (options_list);
405
406 options_list_strv =
Value stored to 'options_list_strv' is never read
407 cafekbd_keyboard_config_add_default_switch_option_if_necessary
408 (layouts_list_strv, options_list_strv, &was_appended);
409 if (was_appended) {
410 xkb_options_set_selected_list (options_list);
411
412 }
413 clear_xkb_elements_list (options_list);
414}
415
416static void
417xkb_layout_chooser_print (CtkBuilder * chooser_dialog)
418{
419 CtkWidget *chooser = CWID ("xkb_layout_chooser")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ()))))))
;
420 CtkWidget *kbdraw =
421 CTK_WIDGET (g_object_get_data (G_OBJECT (chooser), "kbdraw"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((chooser)), (((GType) ((20) << (2))
)))))), "kbdraw"))), ((ctk_widget_get_type ()))))))
;
422 const char *id =
423 xkb_layout_chooser_get_selected_id (chooser_dialog);
424 char *descr = xkb_layout_description_utf8 (id);
425 cafekbd_keyboard_drawing_print (CAFEKBD_KEYBOARD_DRAWING((((CafekbdKeyboardDrawing*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((kbdraw)), (cafekbd_keyboard_drawing_get_type
())))))
426 (kbdraw)((((CafekbdKeyboardDrawing*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((kbdraw)), (cafekbd_keyboard_drawing_get_type
())))))
,
427 CTK_WINDOW (CWID((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ())))))))), ((ctk_window_get_type (
)))))))
428 ("xkb_layout_chooser"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ())))))))), ((ctk_window_get_type (
)))))))
,
429 descr);
430 g_free (descr);
431}
432
433static void
434xkb_layout_chooser_response (CtkDialog * dialog,
435 gint response, CtkBuilder * chooser_dialog)
436{
437 CdkRectangle rect;
438
439 if (response == CTK_RESPONSE_OK) {
440 gchar *selected_id = (gchar *)
441 xkb_layout_chooser_get_selected_id (chooser_dialog);
442
443 if (selected_id != NULL((void*)0)) {
444 GSList *layouts_list =
445 xkb_layouts_get_selected_list ();
446
447 selected_id = g_strdup (selected_id)g_strdup_inline (selected_id);
448
449 layouts_list =
450 g_slist_append (layouts_list, selected_id);
451 xkb_layouts_set_selected_list (layouts_list);
452
453 xkl_layout_chooser_add_default_switcher_if_necessary
454 (layouts_list);
455
456 clear_xkb_elements_list (layouts_list);
457 }
458 } else if (response == ctk_dialog_get_response_for_widget
459 (dialog, CWID ("btnPrint")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "btnPrint"))), (
(ctk_widget_get_type ()))))))
)) {
460 xkb_layout_chooser_print (chooser_dialog);
461 g_signal_stop_emission_by_name (dialog, "response");
462 return;
463 }
464
465 ctk_window_get_position (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, &rect.x, &rect.y);
466 ctk_window_get_size (CTK_WINDOW (dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((dialog)), ((ctk_window_get_type ()))))))
, &rect.width,
467 &rect.height);
468 cafekbd_preview_save_position (&rect);
469}
470
471void
472xkb_layout_choose (CtkBuilder * dialog)
473{
474 CtkBuilder *chooser_dialog;
475
476 chooser_dialog = ctk_builder_new ();
477 ctk_builder_add_from_resource (chooser_dialog,
478 "/org/cafe/ccc/keyboard/cafe-keyboard-properties-layout-chooser.ui",
479 NULL((void*)0));
480 CtkWidget *chooser = CWID ("xkb_layout_chooser")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_layout_chooser"
))), ((ctk_widget_get_type ()))))))
;
481 CtkWidget *lang_chooser = CWID ("xkb_languages_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_languages_available"
))), ((ctk_widget_get_type ()))))))
;
482 CtkWidget *notebook = CWID ("choosers_nb")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ()))))))
;
483 CtkWidget *kbdraw = NULL((void*)0);
484 CtkWidget *toplevel = NULL((void*)0);
485
486 ctk_window_set_transient_for (CTK_WINDOW (chooser)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((chooser)), ((ctk_window_get_type ()))))))
,
487 CTK_WINDOW (WID((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (dialog, "keyboard_dialog"))), ((
ctk_widget_get_type ())))))))), ((ctk_window_get_type ())))))
)
488 ("keyboard_dialog"))((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (dialog, "keyboard_dialog"))), ((
ctk_widget_get_type ())))))))), ((ctk_window_get_type ())))))
)
);
489
490 xkb_layout_chooser_available_layouts_fill (chooser_dialog,
491 "xkb_countries_available",
492 "xkb_country_variants_available",
493 xkl_config_registry_foreach_country,
494 (ConfigItemProcessFunc)
495 xkb_layout_chooser_add_country_to_available_countries,
496 G_CALLBACK((GCallback) (xkb_layout_chooser_available_country_changed))
497 (xkb_layout_chooser_available_country_changed)((GCallback) (xkb_layout_chooser_available_country_changed)));
498 xkb_layout_chooser_available_layouts_fill (chooser_dialog,
499 "xkb_languages_available",
500 "xkb_language_variants_available",
501 xkl_config_registry_foreach_language,
502 (ConfigItemProcessFunc)
503 xkb_layout_chooser_add_language_to_available_languages,
504 G_CALLBACK((GCallback) (xkb_layout_chooser_available_language_changed))
505 (xkb_layout_chooser_available_language_changed)((GCallback) (xkb_layout_chooser_available_language_changed)));
506
507 g_signal_connect_after (G_OBJECT (notebook), "switch_page",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((notebook)), (((GType) ((20) << (2)
)))))))), ("switch_page"), (((GCallback) (xkb_layout_chooser_page_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_AFTER)
508 G_CALLBACKg_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((notebook)), (((GType) ((20) << (2)
)))))))), ("switch_page"), (((GCallback) (xkb_layout_chooser_page_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_AFTER)
509 (xkb_layout_chooser_page_changed),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((notebook)), (((GType) ((20) << (2)
)))))))), ("switch_page"), (((GCallback) (xkb_layout_chooser_page_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_AFTER)
510 chooser_dialog)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((notebook)), (((GType) ((20) << (2)
)))))))), ("switch_page"), (((GCallback) (xkb_layout_chooser_page_changed
))), (chooser_dialog), ((void*)0), G_CONNECT_AFTER)
;
511
512 ctk_combo_box_set_active (CTK_COMBO_BOX((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_countries_available"
))), ((ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type
()))))))
513 (CWID ("xkb_countries_available"))((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_countries_available"
))), ((ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type
()))))))
,
514 FALSE(0));
515
516 if (ctk_tree_model_iter_n_children
517 (ctk_combo_box_get_model (CTK_COMBO_BOX (lang_chooser)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((lang_chooser)), ((ctk_combo_box_get_type ()))))))
),
518 NULL((void*)0))) {
519 ctk_combo_box_set_active (CTK_COMBO_BOX((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_languages_available"
))), ((ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type
()))))))
520 (CWID((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_languages_available"
))), ((ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type
()))))))
521 ("xkb_languages_available"))((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "xkb_languages_available"
))), ((ctk_widget_get_type ())))))))), ((ctk_combo_box_get_type
()))))))
,
522 FALSE(0));
523 } else {
524 /* If language info is not available - remove the corresponding tab,
525 pretend there is no notebook at all */
526 ctk_notebook_remove_page (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((notebook)), ((ctk_notebook_get_type ()))))))
, 1);
527 ctk_notebook_set_show_tabs (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((notebook)), ((ctk_notebook_get_type ()))))))
,
528 FALSE(0));
529 ctk_notebook_set_show_border (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((notebook)), ((ctk_notebook_get_type ()))))))
,
530 FALSE(0));
531 }
532
533#ifdef HAVE_X11_EXTENSIONS_XKB_H1
534 if (!strcmp (xkl_engine_get_backend_name (engine), "XKB")) {
535 kbdraw = xkb_layout_preview_create_widget (chooser_dialog);
536 g_object_set_data (G_OBJECT (chooser)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((chooser)), (((GType) ((20) << (2))))))))
, "kbdraw", kbdraw);
537 ctk_container_add (CTK_CONTAINER((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "previewFrame"))
), ((ctk_widget_get_type ())))))))), ((ctk_container_get_type
()))))))
538 (CWID ("previewFrame"))((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "previewFrame"))
), ((ctk_widget_get_type ())))))))), ((ctk_container_get_type
()))))))
, kbdraw);
539 ctk_widget_show_all (kbdraw);
540 ctk_button_box_set_child_secondary (CTK_BUTTON_BOX((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "hbtnBox"))), ((
ctk_widget_get_type ())))))))), ((ctk_button_box_get_type ())
)))))
541 (CWID((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "hbtnBox"))), ((
ctk_widget_get_type ())))))))), ((ctk_button_box_get_type ())
)))))
542 ("hbtnBox"))((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "hbtnBox"))), ((
ctk_widget_get_type ())))))))), ((ctk_button_box_get_type ())
)))))
,
543 CWID((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "btnPrint"))), (
(ctk_widget_get_type ()))))))
544 ("btnPrint")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "btnPrint"))), (
(ctk_widget_get_type ()))))))
, TRUE(!(0)));
545 } else
546#endif
547 {
548 ctk_widget_hide (CWID ("vboxPreview")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "vboxPreview")))
, ((ctk_widget_get_type ()))))))
);
549 ctk_widget_hide (CWID ("btnPrint")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "btnPrint"))), (
(ctk_widget_get_type ()))))))
);
550 }
551
552 g_signal_connect (G_OBJECT (chooser),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((chooser)), (((GType) ((20) << (2))
))))))), ("response"), (((GCallback) (xkb_layout_chooser_response
))), (chooser_dialog), ((void*)0), (GConnectFlags) 0)
553 "response",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((chooser)), (((GType) ((20) << (2))
))))))), ("response"), (((GCallback) (xkb_layout_chooser_response
))), (chooser_dialog), ((void*)0), (GConnectFlags) 0)
554 G_CALLBACK (xkb_layout_chooser_response),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((chooser)), (((GType) ((20) << (2))
))))))), ("response"), (((GCallback) (xkb_layout_chooser_response
))), (chooser_dialog), ((void*)0), (GConnectFlags) 0)
555 chooser_dialog)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((chooser)), (((GType) ((20) << (2))
))))))), ("response"), (((GCallback) (xkb_layout_chooser_response
))), (chooser_dialog), ((void*)0), (GConnectFlags) 0)
;
556
557 toplevel = ctk_widget_get_toplevel (chooser);
558 if (ctk_widget_is_toplevel (toplevel)) {
559 CdkRectangle *rect = cafekbd_preview_load_position ();
560 if (rect != NULL((void*)0)) {
561 ctk_window_move (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_window_get_type ()))))))
,
562 rect->x, rect->y);
563 ctk_window_resize (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((toplevel)), ((ctk_window_get_type ()))))))
,
564 rect->width, rect->height);
565 g_free (rect);
566 }
567 }
568
569 xkb_layout_preview_update (chooser_dialog);
570 ctk_dialog_run (CTK_DIALOG (chooser)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((chooser)), ((ctk_dialog_get_type ()))))))
);
571 ctk_widget_destroy (chooser);
572}
573
574gchar *
575xkb_layout_chooser_get_selected_id (CtkBuilder * chooser_dialog)
576{
577 CtkWidget *cbv =
578 CWID (ctk_notebook_get_current_page((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
579 (CTK_NOTEBOOK (CWID ("choosers_nb"))) ?((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
580 "xkb_language_variants_available" :((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
581 "xkb_country_variants_available")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, ctk_notebook_get_current_page
(((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_builder_get_object (chooser_dialog, "choosers_nb")))
, ((ctk_widget_get_type ())))))))), ((ctk_notebook_get_type (
)))))))) ? "xkb_language_variants_available" : "xkb_country_variants_available"
))), ((ctk_widget_get_type ()))))))
;
582 CtkTreeModel *vm = ctk_combo_box_get_model (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
);
583 CtkTreeIter viter;
584 gchar *v_id;
585
586 if (!ctk_combo_box_get_active_iter (CTK_COMBO_BOX (cbv)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((cbv)), ((ctk_combo_box_get_type ()))))))
, &viter))
587 return NULL((void*)0);
588
589 ctk_tree_model_get (vm, &viter,
590 COMBO_BOX_MODEL_COL_XKB_ID, &v_id, -1);
591
592 return v_id;
593}