Merge lp:~mitya57/indicator-session/settings-daemon-schema into lp:indicator-session

Proposed by Dmitry Shachnev
Status: Merged
Approved by: Alberts Muktupāvels
Approved revision: 509
Merged at revision: 507
Proposed branch: lp:~mitya57/indicator-session/settings-daemon-schema
Merge into: lp:indicator-session
Diff against target: 93 lines (+46/-5)
2 files modified
debian/control (+1/-1)
src/service.c (+45/-4)
To merge this branch: bzr merge lp:~mitya57/indicator-session/settings-daemon-schema
Reviewer Review Type Date Requested Status
Khurshid Alam (community) Approve
Alberts Muktupāvels Approve
Marco Trevisan (Treviño) Pending
Indicator Applet Developers Pending
Review via email: mp+400245@code.launchpad.net

Commit message

Use unity-settings-daemon GSettings schema only on Unity. On the other desktops, use gnome-settings-daemon schema.

Description of the change

This makes the behavior introduced in https://code.launchpad.net/~khurshid-alam/indicator-session/use-usd-schemas/+merge/372301 conditional on $XDG_CURRENT_DESKTOP value.

This fixes wrong keybinding for Lock that was shown on GNOME Flashback session. indicator-session showed Ctrl+Alt+L while it is really Super+L.

To post a comment you must log in.
Revision history for this message
Alberts Muktupāvels (muktupavels) :
Revision history for this message
Alberts Muktupāvels (muktupavels) :
review: Approve
507. By Dmitry Shachnev

Use unity-settings-daemon GSettings schema only on Unity

On the other desktops, use gnome-settings-daemon schema.

508. By Dmitry Shachnev

Adapt for screensaver key changing to array of strings in g-s-d >= 3.33.0

https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/103

509. By Dmitry Shachnev

Move unity-settings-daemon-schemas from Depends to Recommends

Anyone who is using Unity will have this package installed anyway.

Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

@Dmitry

Ok. This seems merged. But just wanted to point out unity remix people build unity-mini iso from netboot (and now cloud/core) image.

https://wiki.ubuntu.com/UbuntuUnityExperience/mimimal-unity-installation

For that unity-settings-daemon-schemas is needed to in depends no ?

Revision history for this message
Khurshid Alam (khurshid-alam) :
review: Approve
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Hi Khurshid!

unity has a hard dependency on unity-settings-daemon-schemas. So if unity itself is installed, that package will be installed too:

https://git.launchpad.net/unity/tree/debian/control#n80

So I think there is no need to depend on it here.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2020-11-18 15:28:59 +0000
3+++ debian/control 2021-03-26 20:30:38 +0000
4@@ -31,7 +31,6 @@
5 Depends: ${shlibs:Depends},
6 ${misc:Depends},
7 libpam-systemd,
8- unity-settings-daemon-schemas,
9 gnome-settings-daemon-common,
10 gsettings-desktop-schemas,
11 indicator-common,
12@@ -39,6 +38,7 @@
13 gnome-screensaver | mate-screensaver,
14 yelp,
15 unity-control-center | gnome-control-center | mate-control-center,
16+ unity-settings-daemon-schemas,
17 Suggests: lightdm,
18 apport,
19 zenity,
20
21=== modified file 'src/service.c'
22--- src/service.c 2019-09-05 07:30:39 +0000
23+++ src/service.c 2021-03-26 20:30:38 +0000
24@@ -716,9 +716,20 @@
25 {
26 if (want_accel)
27 {
28- gchar * str = g_settings_get_string (p->keybinding_settings, "screensaver");
29- g_menu_item_set_attribute (item, "accel", "s", str);
30- g_free (str);
31+ GVariant * value = g_settings_get_value (p->keybinding_settings, "screensaver");
32+ if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY))
33+ {
34+ const gchar ** strs = g_variant_get_strv (value, NULL);
35+ if (strs)
36+ g_menu_item_set_attribute (item, "accel", "s", strs[0]);
37+ g_free (strs);
38+ }
39+ else
40+ {
41+ const gchar * str = g_variant_get_string (value, NULL);
42+ g_menu_item_set_attribute (item, "accel", "s", str);
43+ }
44+ g_variant_unref (value);
45 }
46
47 g_menu_append_item (menu, item);
48@@ -1280,6 +1291,33 @@
49 g_signal_emit (self, signals[NAME_LOST], 0, NULL);
50 }
51
52+static gboolean
53+desktop_is_unity (void)
54+{
55+ const gchar * xdg_current_desktop;
56+ gchar ** desktop_names;
57+ int i;
58+
59+ xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
60+
61+ if (xdg_current_desktop == NULL)
62+ return FALSE;
63+
64+ desktop_names = g_strsplit (xdg_current_desktop, ":", 0);
65+
66+ for (i = 0; desktop_names[i]; ++i)
67+ {
68+ if (g_strcmp0 (desktop_names[i], "Unity") == 0)
69+ {
70+ g_strfreev (desktop_names);
71+ return TRUE;
72+ }
73+ }
74+
75+ g_strfreev (desktop_names);
76+ return FALSE;
77+}
78+
79 /***
80 ****
81 ***/
82@@ -1298,7 +1336,10 @@
83 INDICATOR_TYPE_SESSION_SERVICE,
84 IndicatorSessionServicePrivate);
85 p->indicator_settings = g_settings_new ("com.canonical.indicator.session");
86- p->keybinding_settings = g_settings_new ("com.canonical.unity.settings-daemon.plugins.media-keys");
87+ if (desktop_is_unity ())
88+ p->keybinding_settings = g_settings_new ("com.canonical.unity.settings-daemon.plugins.media-keys");
89+ else
90+ p->keybinding_settings = g_settings_new ("org.gnome.settings-daemon.plugins.media-keys");
91
92 /* Only use unity8 schema if it's installed; this avoids a hard dependency
93 on unity8-schemas */

Subscribers

People subscribed via source and target branches