Merge lp:~ted/gsettings-ubuntu-touch-schemas/notifications into lp:gsettings-ubuntu-touch-schemas

Proposed by Ted Gould
Status: Rejected
Rejected by: Iain Lane
Proposed branch: lp:~ted/gsettings-ubuntu-touch-schemas/notifications
Merge into: lp:gsettings-ubuntu-touch-schemas
Diff against target: 199 lines (+103/-3)
12 files modified
Makefile.am (+1/-1)
cleanup/Makefile.am (+29/-0)
cleanup/clean-schemas.py (+31/-0)
cleanup/touch-schemas-clean.click-hook.in (+4/-0)
cleanup/touch-schemas-clean.conf.in (+12/-0)
configure.ac (+1/-0)
debian/control (+2/-1)
debian/gsettings-ubuntu-schemas.install (+2/-0)
debian/rules (+4/-1)
po/POTFILES.in (+1/-0)
schemas/Makefile.am (+1/-0)
schemas/com.ubuntu.touch.notifications.gschema.xml.in.in (+15/-0)
To merge this branch: bzr merge lp:~ted/gsettings-ubuntu-touch-schemas/notifications
Reviewer Review Type Date Requested Status
Thomas Voß (community) Needs Fixing
John Lenton (community) Approve
PS Jenkins bot continuous-integration Approve
Ubuntu Touch System Settings Pending
Review via email: mp+224549@code.launchpad.net

Commit message

Add schema for popup notification blacklist

Description of the change

Adding schema so that we can have a shared location between system settings and the post office of which applications are in the popup notification user blacklist. This should be used to block notifications if they're bothering the user.

This MR also adds an Upstart job and Click hook to clean up the list as legacy and click applications are removed from the system. In both cases a small Python script is run to ensure that all the entires in the setting are valid and removes those that are not.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Iain Lane (laney) wrote :

Why is the cleanup necessary? If I uninstall and then reinstall the next day my setting should be remembered, shouldn't

Regardless, I don't like doing this from the schemas package. It's not the place for housekeeping tasks, and the current attempt to run it once a day doesn't feel very nice to me. I would either have system-settings prune the list when it displays it (AIUI it's going to have the toggles) or the service consuming the key run the cleanup.

Revision history for this message
Ted Gould (ted) wrote :

On Thu, 2014-06-26 at 08:59 +0000, Iain Lane wrote:

> Why is the cleanup necessary? If I uninstall and then reinstall the
> next day my setting should be remembered, shouldn't

One, we don't know if you're ever going to reinstall the package. Two,
it provides a way to clear a setting that you might have forgotten out
to set. "This application is broken, it stopped sending notifications,
let me reinstall it and see if that fixes it."

> Regardless, I don't like doing this from the schemas package. It's not
> the place for housekeeping tasks, and the current attempt to run it
> once a day doesn't feel very nice to me. I would either have
> system-settings prune the list when it displays it (AIUI it's going to
> have the toggles) or the service consuming the key run the cleanup.

To me it felt like a "library function" of the service and the settings
app. And the "library" that they share is the schemas package. If for
some reason one or the other gets refactored or changed we don't have to
ensure cleanup gets migrated with that, it's part of the shared code
around the settings.

Revision history for this message
John Lenton (chipaca) wrote :

So, with this, popups can be blacklisted through this setting, sounds (and vibrations?) can be muted elsewhere. Messaging menu/notification centre entries, emblem counters, and led light whatsits (haven't looked into those yet so don't know what they're called) can't be disabled.

Is that the intent?

Revision history for this message
John Lenton (chipaca) wrote :

Actually, I'll talk with mpt about changing the settings to be disable all "interrupting" notifications per-app (that is, disabling bubbles, sounds and vibrations). It seems more sensible than disabling just popups. If he agrees, can we rename this too?

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2014-07-08 at 12:15 +0000, John Lenton wrote:

> Actually, I'll talk with mpt about changing the settings to be disable
> all "interrupting" notifications per-app (that is, disabling bubbles,
> sounds and vibrations). It seems more sensible than disabling just
> popups. If he agrees, can we rename this too?

Sure, I was just mapping to the system settings design. If that changes,
I think this should adapt as well.

Revision history for this message
John Lenton (chipaca) wrote :

WFM. Let's land this, and change it if the design changes.

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

Just to be extra sure: for click apps then this expects an array of (s,s) where the strings are like:

"com.ubuntu.developer.ralsina.hello" "com.ubuntu.developer.ralsina.hello_hello" ?

Or

"com.ubuntu.developer.ralsina.hello" "com.ubuntu.developer.ralsina.hello_hello_0.2" ?

Or

"com.ubuntu.developer.ralsina.hello" "hello" ?

Revision history for this message
Thomas Voß (thomas-voss) wrote :

> On Thu, 2014-06-26 at 08:59 +0000, Iain Lane wrote:
>
> > Why is the cleanup necessary? If I uninstall and then reinstall the
> > next day my setting should be remembered, shouldn't
>
>
> One, we don't know if you're ever going to reinstall the package. Two,
> it provides a way to clear a setting that you might have forgotten out
> to set. "This application is broken, it stopped sending notifications,
> let me reinstall it and see if that fixes it."
>
>
> > Regardless, I don't like doing this from the schemas package. It's not
> > the place for housekeeping tasks, and the current attempt to run it
> > once a day doesn't feel very nice to me. I would either have
> > system-settings prune the list when it displays it (AIUI it's going to
> > have the toggles) or the service consuming the key run the cleanup.
>
>
> To me it felt like a "library function" of the service and the settings
> app. And the "library" that they share is the schemas package. If for
> some reason one or the other gets refactored or changed we don't have to
> ensure cleanup gets migrated with that, it's part of the shared code
> around the settings.

Well, that's the difficult part of just sharing settings instead of putting a "real" library in place. I see your point about sharing those keys, but I agree with Laney that we shouldn't rely on a daily task to cleanup.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

As pointed out before: We should encode the cleanup logic in a different place. I'm fine with the schema and sharing the keys. Briefly checked with security, and gsettings/dconf is fine for system services.

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

So clearly I'm outvoted on this one. Do you folks think that we should
remove the Upstart job and the Click hook or just the Upstart job. I
think the Upstart job is more hacky considering we don't get a notice in
the session of the package being removed. But I think the click hook
makes more sense to be centrally located.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

> So clearly I'm outvoted on this one. Do you folks think that we should
> remove the Upstart job and the Click hook or just the Upstart job. I
> think the Upstart job is more hacky considering we don't get a notice in
> the session of the package being removed. But I think the click hook
> makes more sense to be centrally located.

So I think we should just keep the Click hook in place for the time being. Admittedly, legacy applications are not captured by removing the upstart hook, but we can tackle that issue going forward, with a little more time to think it through.

Revision history for this message
Roberto Alsina (ralsina) wrote :

As a paliative, system-settings can do some cleanup in that clicks that are not installed are going to disappear from the list, and on save will disappear from the settings as well. Of course if the user forgot the settings page existed it doesn't help at all.

Revision history for this message
Iain Lane (laney) wrote :

It's been a philosophical position of mine that this schemas project is only about the schemas themselves and it does not care about their contents. A few months ago we had a skirmish around the sounds - the schemas grew a dependency on the default set of ringtones. We came to the realisation that this was an error and reverted the change.

I'd like to maintain that position here. I don't want gsettings-ubuntu-touch-schemas to be a repository for cleanup scripts. In this case, as I mentioned earlier, the hook can move to whatever is displaying the notification, or system settings can get this logic if it's not so important to do this housekeeping regularly. I don't think we should be worrying about possible future refactorings losing random bits of still-useful code, because we would have some problems if that were taking place and need to make sure it doesn't.

Revision history for this message
John Lenton (chipaca) wrote :

I've proposed just the settings at https://code.launchpad.net/~chipaca/gsettings-ubuntu-touch-schemas/just-the-touch-settings/+merge/228317

The cleanup scripts will be picked up by the touch client itself.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Should we mark that merge request superseeded then?

Revision history for this message
John Lenton (chipaca) wrote :

That one? no. But this one, probably. Doing so now.

Revision history for this message
John Lenton (chipaca) wrote :

Oh, I can't do it myself.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2014-01-13 16:30:17 +0000
3+++ Makefile.am 2014-06-26 03:15:21 +0000
4@@ -1,4 +1,4 @@
5-SUBDIRS = accountsservice schemas po
6+SUBDIRS = accountsservice schemas po cleanup
7
8 EXTRA_DIST = autogen.sh
9
10
11=== added directory 'cleanup'
12=== added file 'cleanup/Makefile.am'
13--- cleanup/Makefile.am 1970-01-01 00:00:00 +0000
14+++ cleanup/Makefile.am 2014-06-26 03:15:21 +0000
15@@ -0,0 +1,29 @@
16+
17+CLICK_HOOK_OUTPUT=$(top_srcdir)/debian/gsettings-ubuntu-schemas.touch-schemas-clean.click-hook
18+
19+all: $(CLICK_HOOK_OUTPUT)
20+
21+$(CLICK_HOOK_OUTPUT): touch-schemas-clean.click-hook.in Makefile
22+ $(AM_V_GEN) $(SED) -e 's^\@pkgdatadir\@^$(pkgdatadir)^g' < $< > $@
23+
24+%.conf: %.conf.in Makefile
25+ $(AM_V_GEN) $(SED) -e 's^\@pkgdatadir\@^$(pkgdatadir)^g' < $< > $@
26+
27+upstart_jobs_in = \
28+ touch-schemas-clean.conf.in
29+
30+upstart_jobs_DATA = $(upstart_jobs_in:.conf.in=.conf)
31+upstart_jobsdir = $(datadir)/upstart/sessions
32+
33+upstart_scripts_SCRIPTS = \
34+ clean-schemas.py
35+upstart_scriptsdir = $(pkgdatadir)
36+
37+EXTRA_DIST = \
38+ touch-schemas-clean.click-hook.in \
39+ $(upstart_jobs_in) \
40+ $(upstart_scripts_SCRIPTS)
41+
42+CLEANFILES = \
43+ $(CLICK_HOOK_OUTPUT) \
44+ $(upstart_jobs_DATA)
45
46=== added file 'cleanup/clean-schemas.py'
47--- cleanup/clean-schemas.py 1970-01-01 00:00:00 +0000
48+++ cleanup/clean-schemas.py 2014-06-26 03:15:21 +0000
49@@ -0,0 +1,31 @@
50+#!/usr/bin/python3
51+
52+from gi.repository import GLib
53+from gi.repository import Gio
54+from gi.repository import Click
55+
56+def tup2variant (tup) :
57+ builder = GLib.VariantBuilder.new(GLib.VariantType.new("(ss)"))
58+ builder.add_value(GLib.Variant.new_string(tup[0]))
59+ builder.add_value(GLib.Variant.new_string(tup[1]))
60+ return builder.end()
61+
62+clickdb = Click.DB.new()
63+clickdb.read()
64+
65+pkgnames = []
66+for package in clickdb.get_packages(False) :
67+ pkgnames.append(package.get_property('package'))
68+
69+settings = Gio.Settings.new('com.ubuntu.touch.notifications')
70+goodapps = GLib.VariantBuilder.new(GLib.VariantType.new("a(ss)"))
71+
72+for appname in settings.get_value('popup-blacklist').unpack() :
73+ if appname[0] in pkgnames :
74+ goodapps.add_value(tup2variant(appname))
75+ elif (appname[0] == appname[1]) :
76+ appinfo = Gio.DesktopAppInfo.new(appname[0] + ".desktop")
77+ if not appinfo is None :
78+ goodapps.add_value(tup2variant(appname))
79+
80+settings.set_value('popup-blacklist', goodapps.end())
81
82=== added file 'cleanup/touch-schemas-clean.click-hook.in'
83--- cleanup/touch-schemas-clean.click-hook.in 1970-01-01 00:00:00 +0000
84+++ cleanup/touch-schemas-clean.click-hook.in 2014-06-26 03:15:21 +0000
85@@ -0,0 +1,4 @@
86+Pattern: ${home}/.cache/gsettings-ubuntu-schemas/packages/${id}.json
87+Exec: @pkgdatadir@/clean-schemas.py
88+User-Level: yes
89+Hook-Name: apparmor
90
91=== added file 'cleanup/touch-schemas-clean.conf.in'
92--- cleanup/touch-schemas-clean.conf.in 1970-01-01 00:00:00 +0000
93+++ cleanup/touch-schemas-clean.conf.in 2014-06-26 03:15:21 +0000
94@@ -0,0 +1,12 @@
95+# When we rotate the logs (approximately daily) we also check to see
96+# if we need to update any of the schemas to remove legacy applications
97+# that have been removed.
98+
99+description "Remove any entries that are related to removed applications"
100+
101+start on :sys:rotate-logs
102+
103+task
104+
105+exec @pkgdatadir@/clean-schemas.py
106+
107
108=== modified file 'configure.ac'
109--- configure.ac 2014-01-13 16:30:17 +0000
110+++ configure.ac 2014-06-26 03:15:21 +0000
111@@ -27,6 +27,7 @@
112 accountsservice/Makefile
113 schemas/Makefile
114 po/Makefile.in
115+cleanup/Makefile
116 ])
117
118 dnl ---------------------------------------------------------------------------
119
120=== modified file 'debian/control'
121--- debian/control 2014-02-20 15:41:04 +0000
122+++ debian/control 2014-06-26 03:15:21 +0000
123@@ -2,7 +2,8 @@
124 Section: gnome
125 Priority: optional
126 Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
127-Build-Depends: debhelper (>= 9),
128+Build-Depends: click-dev,
129+ debhelper (>= 9),
130 dh-autoreconf,
131 gnome-common,
132 intltool (>= 0.40.0),
133
134=== modified file 'debian/gsettings-ubuntu-schemas.install'
135--- debian/gsettings-ubuntu-schemas.install 2014-02-19 12:53:52 +0000
136+++ debian/gsettings-ubuntu-schemas.install 2014-06-26 03:15:21 +0000
137@@ -1,1 +1,3 @@
138 usr/share/glib-2.0
139+usr/share/upstart
140+usr/share/gsettings-ubuntu-touch-schemas
141
142=== modified file 'debian/rules'
143--- debian/rules 2013-07-24 06:24:34 +0000
144+++ debian/rules 2014-06-26 03:15:21 +0000
145@@ -5,7 +5,10 @@
146 #export DH_VERBOSE=1
147
148 %:
149- dh $@ --with autoreconf --fail-missing
150+ dh $@ --with autoreconf,click --fail-missing
151
152 override_dh_autoreconf:
153 dh_autoreconf -- ./autogen.sh
154+
155+override_dh_click:
156+ dh_click --name touch-schemas-clean
157
158=== modified file 'po/POTFILES.in'
159--- po/POTFILES.in 2014-02-24 12:01:25 +0000
160+++ po/POTFILES.in 2014-06-26 03:15:21 +0000
161@@ -1,6 +1,7 @@
162 # List of source files containing translatable strings.
163 # Please keep this list in alphabetic order.
164 schemas/com.ubuntu.touch.network.gschema.xml.in.in
165+schemas/com.ubuntu.touch.notifications.gschema.xml.in.in
166 schemas/com.ubuntu.touch.sound.gschema.xml.in.in
167 schemas/com.ubuntu.touch.system.gschema.xml.in.in
168 schemas/com.ubuntu.sound.gschema.xml.in.in
169
170=== modified file 'schemas/Makefile.am'
171--- schemas/Makefile.am 2014-02-24 11:36:24 +0000
172+++ schemas/Makefile.am 2014-06-26 03:15:21 +0000
173@@ -1,5 +1,6 @@
174 desktop_gschemas_in_in = \
175 com.ubuntu.touch.network.gschema.xml.in.in \
176+ com.ubuntu.touch.notifications.gschema.xml.in.in \
177 com.ubuntu.touch.sound.gschema.xml.in.in \
178 com.ubuntu.touch.system.gschema.xml.in.in \
179 com.ubuntu.sound.gschema.xml.in.in \
180
181=== added file 'schemas/com.ubuntu.touch.notifications.gschema.xml.in.in'
182--- schemas/com.ubuntu.touch.notifications.gschema.xml.in.in 1970-01-01 00:00:00 +0000
183+++ schemas/com.ubuntu.touch.notifications.gschema.xml.in.in 2014-06-26 03:15:21 +0000
184@@ -0,0 +1,15 @@
185+<schemalist gettext-domain="gsettings-ubuntu-touch-schemas">
186+ <schema id="com.ubuntu.touch.notifications" path="/com/ubuntu/touch/notifications/">
187+ <key name="popup-blacklist" type="a(ss)">
188+ <_summary>User blacklist of application notifications</_summary>
189+ <default>[]</default>
190+ <_description>
191+ A list of applications that the user has blocked notifications from.
192+ For applications that are installed via Click packaging the strings are
193+ the name of the package and then the name of the application in the
194+ package. For dpkg based applications the strings are both the
195+ AppID of the application, or the desktop file name.
196+ </_description>
197+ </key>
198+ </schema>
199+</schemalist>

Subscribers

People subscribed via source and target branches