Skip to content

Commit 2bb17da

Browse files
committed
gnome-xkb-info: Don't rely on gsettings to return the full set
of xkb layouts and options. Being able to only show the most common layouts in the Add Layout dialog is useful, but Cinnamon's KeyboardManager and cinnamon- settings should always be working with the full set. Get rid of checking a setting and just add another constructor that always returns the full list. The Add Layout dialog can still use the setting to determine how many layouts it presents to the user.
1 parent 10934db commit 2bb17da

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

debian/libcinnamon-desktop4.symbols

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ libcinnamon-desktop.so.4 libcinnamon-desktop4 #MINVER#
202202
gnome_xkb_info_get_options_for_group@Base 2.0.4
203203
gnome_xkb_info_get_type@Base 2.0.4
204204
gnome_xkb_info_new@Base 2.0.4
205+
gnome_xkb_info_new_with_extras@Base 6.6.0
205206
make_display_name@Base 3.8.1
206207
meta_dbus_display_config_call_apply_configuration@Base 6.2.0
207208
meta_dbus_display_config_call_apply_configuration_finish@Base 6.2.0

libcinnamon-desktop/gnome-xkb-info.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ struct _GnomeXkbInfoPrivate
7474
GHashTable *layouts_by_language;
7575
GHashTable *layouts_table;
7676

77+
gboolean include_extras;
78+
7779
/* Only used while parsing */
7880
XkbOptionGroup *current_parser_group;
7981
XkbOption *current_parser_option;
@@ -578,8 +580,6 @@ static void
578580
parse_rules (GnomeXkbInfo *self)
579581
{
580582
GnomeXkbInfoPrivate *priv = self->priv;
581-
GSettings *settings;
582-
gboolean show_all_sources;
583583
gchar *file_path;
584584
GError *error = NULL;
585585

@@ -610,11 +610,7 @@ parse_rules (GnomeXkbInfo *self)
610610
goto cleanup;
611611
g_free (file_path);
612612

613-
settings = g_settings_new ("org.cinnamon.desktop.input-sources");
614-
show_all_sources = g_settings_get_boolean (settings, "show-all-sources");
615-
g_object_unref (settings);
616-
617-
if (!show_all_sources)
613+
if (!priv->include_extras)
618614
return;
619615

620616
file_path = get_xml_rules_file_path (".extras.xml");
@@ -650,6 +646,7 @@ static void
650646
gnome_xkb_info_init (GnomeXkbInfo *self)
651647
{
652648
self->priv = gnome_xkb_info_get_instance_private (self);
649+
self->priv->include_extras = FALSE;
653650
}
654651

655652
static void
@@ -688,6 +685,22 @@ gnome_xkb_info_new (void)
688685
return g_object_new (GNOME_TYPE_XKB_INFO, NULL);
689686
}
690687

688+
/**
689+
* gnome_xkb_info_new_with_extras:
690+
*
691+
* Returns: (transfer full): a new #GnomeXkbInfo instance that includes extra layouts and options.
692+
*/
693+
GnomeXkbInfo *
694+
gnome_xkb_info_new_with_extras (void)
695+
{
696+
GnomeXkbInfo *info;
697+
698+
info = g_object_new (GNOME_TYPE_XKB_INFO, NULL);
699+
info->priv->include_extras = TRUE;
700+
701+
return info;
702+
}
703+
691704
/**
692705
* gnome_xkb_info_get_all_layouts:
693706
* @self: a #GnomeXkbInfo

libcinnamon-desktop/gnome-xkb-info.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GnomeXkbInfo, g_object_unref)
5959

6060
GType gnome_xkb_info_get_type (void);
6161
GnomeXkbInfo *gnome_xkb_info_new (void);
62+
GnomeXkbInfo *gnome_xkb_info_new_with_extras (void);
6263
GList *gnome_xkb_info_get_all_layouts (GnomeXkbInfo *self);
6364
gboolean gnome_xkb_info_get_layout_info (GnomeXkbInfo *self,
6465
const gchar *id,

0 commit comments

Comments
 (0)