Gunnar Hjalmarsson has proposed merging 
~gunnarhj/ubuntu/+source/gnome-settings-daemon:ibus-live-session2 into 
~ubuntu-desktop/ubuntu/+source/gnome-settings-daemon:ubuntu/master.

Requested reviews:
  Iain Lane (laney)
Related bugs:
  Bug #1786344 in gnome-settings-daemon (Ubuntu): "Default IBus input method 
ignored in live session"
  https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/1786344

For more details, see:
https://code.launchpad.net/~gunnarhj/ubuntu/+source/gnome-settings-daemon/+git/gnome-settings-daemon/+merge/368657

An attempt with calling add_ibus_sources_from_locale() unconditionally during 
the first run of the maybe_convert_old_settings() function.

While this results in a slightly more complex patch, I suppose it's better 
conceptually, since we don't introduce a dependency of a stamp file belonging 
to some other package.

There is also an extra bonus (at least I think it is a bonus): When doing e.g. 
a Chinese or Japanese install, and unlike before, the IBus IM is active 
instantly at first login. That is, instead of:

[('xkb', 'cn'), ('ibus', 'libpinyin')]

in sources, libpinyin is now the first source:

[('ibus', 'libpinyin'), ('xkb', 'cn')]
-- 
Your team Ubuntu Desktop is subscribed to branch 
~ubuntu-desktop/ubuntu/+source/gnome-settings-daemon:ubuntu/master.
diff --git a/debian/changelog b/debian/changelog
index 6a493d0..7da503e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+gnome-settings-daemon (3.32.0-1ubuntu2) eoan; urgency=medium
+
+  * debian/patches/ubuntu_ibus_configs.patch:
+    - Call add_ibus_sources_from_locale() unconditionally during the
+      first run of the maybe_convert_old_settings() function. This will
+      hopefully make an IBus method be included when applicable also in
+      "live sessions" (LP: #1786344).
+
+ -- Gunnar Hjalmarsson <gunna...@ubuntu.com>  Tue, 11 Jun 2019 15:55:00 +0200
+
 gnome-settings-daemon (3.32.0-1ubuntu1) disco; urgency=medium
 
   * Merge with Debian. Remaining changes:
diff --git a/debian/patches/ubuntu_ibus_configs.patch b/debian/patches/ubuntu_ibus_configs.patch
index f69330f..3d6a19d 100644
--- a/debian/patches/ubuntu_ibus_configs.patch
+++ b/debian/patches/ubuntu_ibus_configs.patch
@@ -6,11 +6,11 @@ the locale, upstream removed it because they use an intial setup but we don't
 Bug: https://bugs.launchpad.net/bugs/1719938
 Forwarded: not-needed
 ---
- plugins/keyboard/gsd-keyboard-manager.c | 56 ++++++++++++++++++++++++++++++++-
- 1 file changed, 55 insertions(+), 1 deletion(-)
+ plugins/keyboard/gsd-keyboard-manager.c | 78 +++++++++++++++++++++---
+ 1 file changed, 69 insertions(+), 9 deletions(-)
 
 diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
-index fadde34..3b35c69 100644
+index fadde34..eb76921 100644
 --- a/plugins/keyboard/gsd-keyboard-manager.c
 +++ b/plugins/keyboard/gsd-keyboard-manager.c
 @@ -168,6 +168,58 @@ check_xkb_extension (GsdKeyboardManager *manager)
@@ -72,15 +72,76 @@ index fadde34..3b35c69 100644
  static void
  xkb_init (GsdKeyboardManager *manager)
  {
-@@ -762,8 +814,10 @@ maybe_create_initial_settings (GsdKeyboardManager *manager)
+@@ -707,7 +759,7 @@ convert_libgnomekbd_layouts (GSettings *settings)
+         g_object_unref (libgnomekbd_settings);
+ }
+ 
+-static void
++static gint
+ maybe_convert_old_settings (GSettings *settings)
+ {
+         GVariant *sources;
+@@ -715,6 +767,11 @@ maybe_convert_old_settings (GSettings *settings)
+         gchar *stamp_dir_path = NULL;
+         gchar *stamp_file_path = NULL;
+         GError *error = NULL;
++        gint count_sources;
++
++        sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
++        count_sources = g_variant_n_children (sources);
++        g_variant_unref (sources);
+ 
+         stamp_dir_path = g_build_filename (g_get_user_data_dir (), PACKAGE_NAME, NULL);
+         if (g_mkdir_with_parents (stamp_dir_path, 0755)) {
+@@ -726,12 +783,15 @@ maybe_convert_old_settings (GSettings *settings)
+         if (g_file_test (stamp_file_path, G_FILE_TEST_EXISTS))
+                 goto out;
+ 
+-        sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
+-        if (g_variant_n_children (sources) < 1) {
++        if (count_sources < 1)
+                 convert_libgnomekbd_layouts (settings);
+-        }
++
++        sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
++        count_sources = g_variant_n_children (sources);
+         g_variant_unref (sources);
+ 
++        add_ibus_sources_from_locale (settings);
++
+         options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS);
+         if (g_strv_length (options) < 1)
+                 convert_libgnomekbd_options (settings);
+@@ -744,13 +804,15 @@ maybe_convert_old_settings (GSettings *settings)
+ out:
+         g_free (stamp_file_path);
+         g_free (stamp_dir_path);
++
++        return count_sources;
+ }
+ 
+ static void
+ maybe_create_initial_settings (GsdKeyboardManager *manager)
+ {
+         GSettings *settings;
+-        GVariant *sources;
++        gint count_sources;
+         gchar **options;
+ 
+         settings = manager->priv->input_sources_settings;
+@@ -758,13 +820,11 @@ maybe_create_initial_settings (GsdKeyboardManager *manager)
+         if (g_getenv ("RUNNING_UNDER_GDM"))
+                 return;
+ 
+-        maybe_convert_old_settings (settings);
++        count_sources = maybe_convert_old_settings (settings);
  
          /* if we still don't have anything do some educated guesses */
-         sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
+-        sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
 -        if (g_variant_n_children (sources) < 1)
-+        if (g_variant_n_children (sources) < 1) {
++        if (count_sources < 1)
                  get_sources_from_xkb_config (manager);
-+                add_ibus_sources_from_locale (settings);
-+        }
-         g_variant_unref (sources);
+-        g_variant_unref (sources);
  
          options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS);
+         if (g_strv_length (options) < 1)
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to