Lines 40-46
Link Here
|
40 |
#define DEFAULT_VARIANT_ID "__default__" |
40 |
#define DEFAULT_VARIANT_ID "__default__" |
41 |
|
41 |
|
42 |
enum { |
42 |
enum { |
43 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
43 |
COMBO_BOX_MODEL_COL_SORT, |
|
|
44 |
COMBO_BOX_MODEL_COL_VISIBLE, |
44 |
COMBO_BOX_MODEL_COL_XKB_ID, |
45 |
COMBO_BOX_MODEL_COL_XKB_ID, |
45 |
COMBO_BOX_MODEL_COL_REAL_ID |
46 |
COMBO_BOX_MODEL_COL_REAL_ID |
46 |
}; |
47 |
}; |
Lines 54-77
typedef struct {
Link Here
|
54 |
} AddVariantData; |
55 |
} AddVariantData; |
55 |
|
56 |
|
56 |
static void |
57 |
static void |
57 |
xkb_layout_chooser_available_layouts_fill (GladeXML * chooser_dialog, |
|
|
58 |
const gchar cblid[], |
59 |
const gchar cbvid[], |
60 |
LayoutIterFunc layout_iterator, |
61 |
ConfigItemProcessFunc |
62 |
layout_handler, |
63 |
GCallback |
64 |
combo_changed_notify); |
65 |
|
58 |
|
66 |
static void |
59 |
|
67 |
xkb_layout_chooser_available_language_variants_fill (GladeXML * |
60 |
|
68 |
chooser_dialog); |
61 |
|
|
|
62 |
|
63 |
|
64 |
|
65 |
xkb_layout_chooser_available_layouts_fill (GladeXML * chooser_dialog, |
66 |
const gchar cblid[], |
67 |
const gchar cbvid[], |
68 |
LayoutIterFunc layout_iterator, |
69 |
ConfigItemProcessFunc |
70 |
layout_handler, |
71 |
GCallback combo_changed_notify); |
69 |
|
72 |
|
70 |
static void |
73 |
static void |
71 |
xkb_layout_chooser_available_country_variants_fill (GladeXML * |
74 |
|
|
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
xkb_layout_chooser_available_language_variants_fill (GladeXML * |
72 |
chooser_dialog); |
82 |
chooser_dialog); |
73 |
|
83 |
|
74 |
static void |
84 |
static void |
|
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
xkb_layout_chooser_available_country_variants_fill (GladeXML * |
93 |
chooser_dialog); |
94 |
|
95 |
static void |
75 |
xkb_layout_chooser_add_variant_to_available_country_variants |
96 |
xkb_layout_chooser_add_variant_to_available_country_variants |
76 |
(XklConfigRegistry * config_registry, |
97 |
(XklConfigRegistry * config_registry, |
77 |
XklConfigItem * parent_config_item, XklConfigItem * config_item, |
98 |
XklConfigItem * parent_config_item, XklConfigItem * config_item, |
Lines 85-99
static void
Link Here
|
85 |
const gchar *xkb_id = |
106 |
const gchar *xkb_id = |
86 |
config_item ? |
107 |
config_item ? |
87 |
gkbd_keyboard_config_merge_items (parent_config_item->name, |
108 |
gkbd_keyboard_config_merge_items (parent_config_item->name, |
88 |
config_item-> |
109 |
config_item->name) : |
89 |
name) : parent_config_item-> |
110 |
parent_config_item->name; |
90 |
name; |
111 |
|
91 |
|
112 |
if (config_item && g_object_get_data |
92 |
gtk_list_store_insert_with_values (data->list_store, &iter, -1, |
113 |
(G_OBJECT (config_item), XCI_PROP_EXTRA_ITEM)) { |
93 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
114 |
gchar *buf = |
94 |
utf_variant_name, |
115 |
g_strdup_printf ("<i>%s</i>", utf_variant_name); |
95 |
COMBO_BOX_MODEL_COL_XKB_ID, |
116 |
gtk_list_store_insert_with_values (data->list_store, &iter, |
96 |
xkb_id, -1); |
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 |
gtk_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); |
97 |
g_free (utf_variant_name); |
134 |
g_free (utf_variant_name); |
98 |
} |
135 |
} |
99 |
|
136 |
|
Lines 115-121
xkb_layout_chooser_add_language_to_available_languages (XklConfigRegistry *
Link Here
|
115 |
list_store) |
152 |
list_store) |
116 |
{ |
153 |
{ |
117 |
gtk_list_store_insert_with_values (list_store, NULL, -1, |
154 |
gtk_list_store_insert_with_values (list_store, NULL, -1, |
118 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
155 |
COMBO_BOX_MODEL_COL_SORT, |
|
|
156 |
config_item->description, |
157 |
COMBO_BOX_MODEL_COL_VISIBLE, |
119 |
config_item->description, |
158 |
config_item->description, |
120 |
COMBO_BOX_MODEL_COL_REAL_ID, |
159 |
COMBO_BOX_MODEL_COL_REAL_ID, |
121 |
config_item->name, -1); |
160 |
config_item->name, -1); |
Lines 130-136
xkb_layout_chooser_add_country_to_available_countries (XklConfigRegistry *
Link Here
|
130 |
list_store) |
169 |
list_store) |
131 |
{ |
170 |
{ |
132 |
gtk_list_store_insert_with_values (list_store, NULL, -1, |
171 |
gtk_list_store_insert_with_values (list_store, NULL, -1, |
133 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
172 |
COMBO_BOX_MODEL_COL_SORT, |
|
|
173 |
config_item->description, |
174 |
COMBO_BOX_MODEL_COL_VISIBLE, |
134 |
config_item->description, |
175 |
config_item->description, |
135 |
COMBO_BOX_MODEL_COL_REAL_ID, |
176 |
COMBO_BOX_MODEL_COL_REAL_ID, |
136 |
config_item->name, -1); |
177 |
config_item->name, -1); |
Lines 196-202
xkb_layout_chooser_available_language_variants_fill (GladeXML *
Link Here
|
196 |
GtkTreeIter liter; |
237 |
GtkTreeIter liter; |
197 |
|
238 |
|
198 |
list_store = gtk_list_store_new |
239 |
list_store = gtk_list_store_new |
199 |
(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
240 |
(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
|
|
241 |
G_TYPE_STRING); |
200 |
|
242 |
|
201 |
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (cbl), &liter)) { |
243 |
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (cbl), &liter)) { |
202 |
GtkTreeModel *lm = |
244 |
GtkTreeModel *lm = |
Lines 220-226
xkb_layout_chooser_available_language_variants_fill (GladeXML *
Link Here
|
220 |
/* Turn on sorting after filling the store, since that's faster */ |
262 |
/* Turn on sorting after filling the store, since that's faster */ |
221 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
263 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
222 |
(list_store), |
264 |
(list_store), |
223 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
265 |
COMBO_BOX_MODEL_COL_SORT, |
224 |
GTK_SORT_ASCENDING); |
266 |
GTK_SORT_ASCENDING); |
225 |
|
267 |
|
226 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbv), |
268 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbv), |
Lines 238-244
xkb_layout_chooser_available_country_variants_fill (GladeXML *
Link Here
|
238 |
GtkTreeIter liter; |
280 |
GtkTreeIter liter; |
239 |
|
281 |
|
240 |
list_store = gtk_list_store_new |
282 |
list_store = gtk_list_store_new |
241 |
(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
283 |
(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
|
|
284 |
G_TYPE_STRING); |
242 |
|
285 |
|
243 |
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (cbl), &liter)) { |
286 |
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (cbl), &liter)) { |
244 |
GtkTreeModel *lm = |
287 |
GtkTreeModel *lm = |
Lines 261-267
xkb_layout_chooser_available_country_variants_fill (GladeXML *
Link Here
|
261 |
/* Turn on sorting after filling the store, since that's faster */ |
304 |
/* Turn on sorting after filling the store, since that's faster */ |
262 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
305 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
263 |
(list_store), |
306 |
(list_store), |
264 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
307 |
COMBO_BOX_MODEL_COL_SORT, |
265 |
GTK_SORT_ASCENDING); |
308 |
GTK_SORT_ASCENDING); |
266 |
|
309 |
|
267 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbv), |
310 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbv), |
Lines 282-290
xkb_layout_chooser_available_layouts_fill (GladeXML *
Link Here
|
282 |
GtkWidget *cbl = CWID (cblid); |
325 |
GtkWidget *cbl = CWID (cblid); |
283 |
GtkWidget *cbev = CWID (cbvid); |
326 |
GtkWidget *cbev = CWID (cbvid); |
284 |
GtkCellRenderer *renderer; |
327 |
GtkCellRenderer *renderer; |
285 |
GtkListStore *list_store = |
328 |
GtkListStore *list_store; |
286 |
gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, |
329 |
|
287 |
G_TYPE_STRING); |
330 |
list_store = gtk_list_store_new |
|
|
331 |
(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
332 |
G_TYPE_STRING); |
288 |
|
333 |
|
289 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbl), |
334 |
gtk_combo_box_set_model (GTK_COMBO_BOX (cbl), |
290 |
GTK_TREE_MODEL (list_store)); |
335 |
GTK_TREE_MODEL (list_store)); |
Lines 293-307
xkb_layout_chooser_available_layouts_fill (GladeXML *
Link Here
|
293 |
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbl), renderer, TRUE); |
338 |
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbl), renderer, TRUE); |
294 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbl), |
339 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbl), |
295 |
renderer, "markup", |
340 |
renderer, "markup", |
296 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
341 |
COMBO_BOX_MODEL_COL_VISIBLE, NULL); |
297 |
NULL); |
|
|
298 |
|
342 |
|
299 |
layout_iterator (config_registry, layout_handler, list_store); |
343 |
layout_iterator (config_registry, layout_handler, list_store); |
300 |
|
344 |
|
301 |
/* Turn on sorting after filling the model since that's faster */ |
345 |
/* Turn on sorting after filling the model since that's faster */ |
302 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
346 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE |
303 |
(list_store), |
347 |
(list_store), |
304 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
348 |
COMBO_BOX_MODEL_COL_SORT, |
305 |
GTK_SORT_ASCENDING); |
349 |
GTK_SORT_ASCENDING); |
306 |
|
350 |
|
307 |
g_signal_connect_swapped (G_OBJECT (cbl), "changed", |
351 |
g_signal_connect_swapped (G_OBJECT (cbl), "changed", |
Lines 313-320
xkb_layout_chooser_available_layouts_fill (GladeXML *
Link Here
|
313 |
renderer, TRUE); |
357 |
renderer, TRUE); |
314 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbev), |
358 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbev), |
315 |
renderer, "markup", |
359 |
renderer, "markup", |
316 |
COMBO_BOX_MODEL_COL_DESCRIPTION, |
360 |
COMBO_BOX_MODEL_COL_VISIBLE, NULL); |
317 |
NULL); |
|
|
318 |
|
361 |
|
319 |
g_signal_connect_swapped (G_OBJECT (cbev), "changed", |
362 |
g_signal_connect_swapped (G_OBJECT (cbev), "changed", |
320 |
G_CALLBACK |
363 |
G_CALLBACK |
Lines 460-471
xkb_layout_choose (GladeXML * dialog)
Link Here
|
460 |
(xkb_layout_chooser_page_changed), |
503 |
(xkb_layout_chooser_page_changed), |
461 |
chooser_dialog); |
504 |
chooser_dialog); |
462 |
|
505 |
|
463 |
gtk_combo_box_set_active (CWID ("xkb_countries_available"), 0); |
506 |
gtk_combo_box_set_active (GTK_COMBO_BOX |
|
|
507 |
(CWID ("xkb_countries_available")), |
508 |
FALSE); |
464 |
|
509 |
|
465 |
if (gtk_tree_model_iter_n_children |
510 |
if (gtk_tree_model_iter_n_children |
466 |
(gtk_combo_box_get_model (GTK_COMBO_BOX (lang_chooser)), |
511 |
(gtk_combo_box_get_model (GTK_COMBO_BOX (lang_chooser)), |
467 |
NULL)) { |
512 |
NULL)) { |
468 |
gtk_combo_box_set_active (CWID ("xkb_languages_available"), 0); |
513 |
gtk_combo_box_set_active (GTK_COMBO_BOX |
|
|
514 |
(CWID |
515 |
("xkb_languages_available")), |
516 |
FALSE); |
469 |
} else { |
517 |
} else { |
470 |
/* If language info is not available - remove the corresponding tab, |
518 |
/* If language info is not available - remove the corresponding tab, |
471 |
pretend there is no notebook at all */ |
519 |
pretend there is no notebook at all */ |
Lines 512-518
xkb_layout_choose (GladeXML * dialog)
Link Here
|
512 |
} |
560 |
} |
513 |
} |
561 |
} |
514 |
|
562 |
|
515 |
xkb_layout_preview_update (chooser_dialog); |
563 |
xkb_layout_preview_update (chooser_dialog); |
516 |
gtk_dialog_run (GTK_DIALOG (chooser)); |
564 |
gtk_dialog_run (GTK_DIALOG (chooser)); |
517 |
gtk_widget_destroy (chooser); |
565 |
gtk_widget_destroy (chooser); |
518 |
} |
566 |
} |