Merge lp:~ngaller/ubuntuone-client/hide-applet-notifications into lp:ubuntuone-client

Proposed by Nicolas Galler
Status: Rejected
Rejected by: dobey
Proposed branch: lp:~ngaller/ubuntuone-client/hide-applet-notifications
Merge into: lp:ubuntuone-client
Diff against target: 148 lines (+58/-16)
2 files modified
bin/ubuntuone-client-applet (+35/-16)
bin/ubuntuone-client-preferences (+23/-0)
To merge this branch: bzr merge lp:~ngaller/ubuntuone-client/hide-applet-notifications
Reviewer Review Type Date Requested Status
John O'Brien (community) Approve
dobey (community) Disapprove
Facundo Batista (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+15020@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nicolas Galler (ngaller) wrote :

Added an option to hide the "Updating file" notification popups. This is associated with https://bugs.launchpad.net/ubuntuone-client/+bug/485156. First time here, so please let me know if you need anything else from me!

Thanks

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Thank you for this contribution! I tested it and seems to work really well.

review: Approve
Revision history for this message
Facundo Batista (facundo) wrote :

It seems to work ok!

review: Approve
Revision history for this message
dobey (dobey) wrote :

This seems like the wrong solution to the problem, to me. It's solving the symptoms rather than the problem, and there are some "needs fixing" items if we do want to have an option to disable notifications. The option in the config and any variables or method names should be the whole word and not a truncation of it. Why was "notif" used instead of "notify" everywhere here? There's a one letter difference, but it makes a huge difference when you're reading the code, and don't already know what it is.

The symptom is that you're seeing several extraneous notifications when lots of tiny files get modified often. We shouldn't fix it by hiding the notifications, but with a proper fix to wait for a certain number of bytes, or a period of inactivity, so that we don't notify too often.

review: Disapprove
Revision history for this message
Nicolas Galler (ngaller) wrote :

I commented on why I thought it is still an important feature, regardless of the rate of updating, on the bug report.

However I should point out that I am very unaware of the naming conventions in use - I just tried to copy what I saw. The "hide_notif" stands for "hide_notifications" which seemed a bit long to type while "hide_notify" didn't seem grammatically sound to me. Not my baby though - feel free to rename it :)

Revision history for this message
John O'Brien (jdobrien) wrote :

This change seems reasonable to me since it is really changing the behavior of the applet and how it responds to notifications.

I personally would not have chosen to shorten to 'notif' but I don't think it's really that confusing.

Thanks for the contribution.

review: Approve
Revision history for this message
dobey (dobey) wrote :

I'm going to mark this as rejected as it seems like the wrong fix to me, and we are going to be getting rid of the applet soon. Thanks for contributing and I hope we can see more contributions from you. If you want to ping me or other developers in IRC or on the mailing list, to help lead in the right direction, we will be glad to help you.

Thanks again. :)

Revision history for this message
Nicolas Galler (ngaller) wrote :

Will do - thanks! :)

Unmerged revisions

279. By Nicolas Galler <nico@anoat>

Add option for hiding the Updating notifications

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntuone-client-applet'
2--- bin/ubuntuone-client-applet 2009-10-22 18:56:58 +0000
3+++ bin/ubuntuone-client-applet 2009-11-19 04:25:18 +0000
4@@ -114,6 +114,9 @@
5 if not self.config.has_option("ubuntuone", "show_applet"):
6 self.config.set("ubuntuone", "show_applet", "1")
7
8+ if not self.config.has_option("ubuntuone", "hide_notif"):
9+ self.config.set("ubuntuone", "hide_notif", "False")
10+
11 if not self.config.has_option("ubuntuone", "connect"):
12 self.config.set("ubuntuone", "connect", "0")
13
14@@ -441,6 +444,8 @@
15 # A ConfigParser object that we can poke at
16 self.__config = config
17 self.__show_when = self.__config.getint("ubuntuone", "show_applet")
18+ self.__hide_notif = self.__config.getboolean("ubuntuone",
19+ "hide_notif")
20
21 self.__managed_dir = None
22
23@@ -525,6 +530,11 @@
24 """Update the connection config."""
25 self.__config.set("ubuntuone", "connect", str(connect))
26
27+ def set_hide_notif_config(self, hide_notif):
28+ """Update setting to hide non-critical notifications."""
29+ self.__hide_notif = hide_notif
30+ self.__config.set("ubuntuone", "hide_notif", hide_notif)
31+
32 def __update_transfer_status(self, done=False):
33 """Update the status display."""
34 with self.__lock:
35@@ -562,14 +572,15 @@
36 self.__total = total + self.__updating
37 if first:
38 self.set_from_icon_name("ubuntuone-client-updating")
39- n = pynotify.Notification(
40- _("Updating files..."),
41- _("Ubuntu One is now updating your files."))
42- pixbuf = self.__theme.load_icon(
43- "ubuntuone-client-updating", NOTIFY_ICON_SIZE,
44- gtk.ICON_LOOKUP_GENERIC_FALLBACK)
45- n.set_icon_from_pixbuf(pixbuf)
46- n.show()
47+ if not self.__hide_notif:
48+ n = pynotify.Notification(
49+ _("Updating files..."),
50+ _("Ubuntu One is now updating your files."))
51+ pixbuf = self.__theme.load_icon(
52+ "ubuntuone-client-updating", NOTIFY_ICON_SIZE,
53+ gtk.ICON_LOOKUP_GENERIC_FALLBACK)
54+ n.set_icon_from_pixbuf(pixbuf)
55+ n.show()
56 if last:
57 if self.__last_id != 0:
58 gobject.source_remove(self.__last_id)
59@@ -589,18 +600,21 @@
60 return False
61
62 with self.__lock:
63+ total = self.__total
64+ self.__total = 0
65+ self.__updating = 0
66+
67+ if not self.__hide_notif:
68 n = pynotify.Notification(
69 _("Updating Finished"),
70 ngettext("Ubuntu One finished updating %(total)d file.",
71 "Ubuntu One finished updating %(total)d files.",
72- self.__total) % { 'total' : self.__total })
73- self.__total = 0
74- self.__updating = 0
75- pixbuf = self.__theme.load_icon(
76- "ubuntuone-client-updating", NOTIFY_ICON_SIZE,
77- gtk.ICON_LOOKUP_GENERIC_FALLBACK)
78- n.set_icon_from_pixbuf(pixbuf)
79- n.show()
80+ total) % { 'total' : total})
81+ pixbuf = self.__theme.load_icon(
82+ "ubuntuone-client-updating", NOTIFY_ICON_SIZE,
83+ gtk.ICON_LOOKUP_GENERIC_FALLBACK)
84+ n.set_icon_from_pixbuf(pixbuf)
85+ n.show()
86 self.__update_transfer_status(True)
87 return False
88
89@@ -1045,6 +1059,11 @@
90 def set_connection_config(self, connect):
91 self.icon.set_connection_config(connect)
92
93+ @dbus.service.method(APPLET_CONFIG_NAME,
94+ in_signature='b', out_signature='')
95+ def set_hide_notif_config(self, hide_notif):
96+ self.icon.set_hide_notif_config(bool(hide_notif))
97+
98
99 if __name__ == "__main__":
100 gettext.bindtextdomain(clientdefs.GETTEXT_PACKAGE, clientdefs.LOCALEDIR)
101
102=== modified file 'bin/ubuntuone-client-preferences'
103--- bin/ubuntuone-client-preferences 2009-11-06 04:44:12 +0000
104+++ bin/ubuntuone-client-preferences 2009-11-19 04:25:18 +0000
105@@ -118,6 +118,9 @@
106 if not self.config.has_option("ubuntuone", "show_applet"):
107 self.config.set("ubuntuone", "show_applet", "1")
108
109+ if not self.config.has_option("ubuntuone", "hide_notif"):
110+ self.config.set("ubuntuone", "hide_notif", "False")
111+
112 if not self.config.has_option("ubuntuone", "connect"):
113 self.config.set("ubuntuone", "connect", "0")
114
115@@ -214,6 +217,19 @@
116 except DBusException, e:
117 self.__dbus_error(e)
118
119+ def __hide_notif_toggled(self, check, data=None):
120+ """Update the config for hiding non-critical notifications."""
121+ value = check.get_active()
122+ self.config.set("ubuntuone", "hide_notif", str(value))
123+ try:
124+ client = self.__bus.get_object(APPLET_IFACE_NAME, "/config",
125+ follow_name_owner_changes=True)
126+ iface = dbus.Interface(client, APPLET_IFACE_CONFIG_NAME)
127+ iface.set_hide_notif_config(value, reply_handler=dbus_async,
128+ error_handler=self.__dbus_error)
129+ except DBusException, e:
130+ self.__dbus_error(e)
131+
132 def __bw_limit_toggled(self, button, data=None):
133 """Toggle the bw limit panel."""
134 self.bw_enabled = self.limit_check.get_active()
135@@ -277,6 +293,13 @@
136 table.attach(self.show_menu, 1, 2, 0, 1)
137 self.show_menu.show()
138
139+ # Option to hide common notifications
140+ check = gtk.CheckButton(_("_Hide Non-Critical Notifications"))
141+ check.connect("toggled", self.__hide_notif_toggled)
142+ check.set_active(self.config.getboolean("ubuntuone", "hide_notif"))
143+ vbox.add(check)
144+ check.show()
145+
146 label = gtk.Label(_("Connect on start:"))
147 label.set_use_underline(True)
148 label.set_alignment(0, 0.5)

Subscribers

People subscribed via source and target branches