Merge lp:~3v1n0/indicator-sound/notify-osd-on-scroll into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Marco Trevisan (Treviño)
Status: Merged
Merged at revision: 123
Proposed branch: lp:~3v1n0/indicator-sound/notify-osd-on-scroll
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 202 lines (+98/-4)
4 files modified
configure.ac (+3/-1)
data/com.canonical.indicators.sound.gschema.xml (+9/-0)
src/indicator-sound.c (+84/-3)
src/indicator-sound.h (+2/-0)
To merge this branch: bzr merge lp:~3v1n0/indicator-sound/notify-osd-on-scroll
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Matthew Paul Thomas (community) design Approve
Review via email: mp+47189@code.launchpad.net

Description of the change

The indicator-sound indicator has a great usability issue imho: in fact when using the scroll event over it to change the volume level, no feedback is given (just the not-precise-at-all icon change).

Now I know that tooltips can't be show, but showing a notification via notify-osd like when using the volume keys imho is a good way to give precise informations about the current volume level, keeping coherency with the system.

Here how it works (video): http://go.3v1n0.net/hjRrGu

There's just one thing to improve, currently it "reccomends" the installation of notify-osd-icons, if this is has not been done, the "off" volume icon is not shown (I guess the "mute" one should be shown instead), I've tried to make it works anyway, but it doesn't. Look at commit 189 (http://bazaar.launchpad.net/~3v1n0/indicator-sound/notify-osd-on-scroll/revision/189) for more informations.

To post a comment you must log in.
Revision history for this message
TheBeest (thebeest) wrote :

Looks great!

Revision history for this message
Tom Wright (twright-tdw) wrote :

Great idea; this should greatly improve the usability of the sound indicator.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I was thinking... Maybe you'd prefer to get an option to disable this feature on request, with something like a gconf key...

Revision history for this message
Conor Curran (cjcurran) wrote :

Trevino, nice work.
I'd like to merge this after alpha 2 ( this week ) if that is okay. Some pressing bugs to see to first. A gsettings entry to switch on or off this would definitely help. I merged a big refactor yesterday which means alot your work below needs to be restructured. Not a biggie, we can look at this next week.

Conor

review: Needs Resubmitting
Revision history for this message
Matthew Paul Thomas (mpt) wrote :

I like this design-wise. I have corrected the Notify OSD specification to match. <https://wiki.ubuntu.com/NotifyOSD?action=diff&rev2=205&rev1=203> Thanks for your work, Treviño.

review: Approve (design)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> Trevino, nice work.
> I'd like to merge this after alpha 2 ( this week ) if that is okay. Some
> pressing bugs to see to first. A gsettings entry to switch on or off this
> would definitely help.

Ok, I'll see to do that, however I'd keep that setting ON by default, isn't it?

> I merged a big refactor yesterday which means alot your
> work below needs to be restructured. Not a biggie, we can look at this next
> week.

Yes, I saw that, I also had already started to merge my changes.

Revision history for this message
Conor Curran (cjcurran) wrote :

On by the default it fine.

>Yes, I saw that, I also had already started to merge my changes.
great.

Thanks for the nice patch.

Conor

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> On by the default it fine.

Done, the patch is coming to launchpad, feel free to merge it when you want! :)

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> > On by the default it fine.
>
> Done, the patch is coming to launchpad, feel free to merge it when you want!

Ah, remember that packagers should add "notify-osd" and "notify-osd-icons" in the Recommends field...

Revision history for this message
Conor Curran (cjcurran) wrote :

Works nicely Trevino. Thank you !
I might in the morning move the notify code out of the indicator-sound and into the state-manager. Will merge by lunchtime.
thanks again :)
c

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2011-01-27 03:09:45 +0000
+++ configure.ac 2011-01-27 17:35:48 +0000
@@ -35,11 +35,13 @@
35INDICATOR_DISPLAY_OBJECTS=0.1.1135INDICATOR_DISPLAY_OBJECTS=0.1.11
36DBUSMENUGLIB_REQUIRED_VERSION=0.3.936DBUSMENUGLIB_REQUIRED_VERSION=0.3.9
37GIO_2_0_REQUIRED_VERSION=2.25.1337GIO_2_0_REQUIRED_VERSION=2.25.13
38LIBNOTIFY_REQUIRED_VERSION=0.5.0
3839
39PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION40PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
40 indicator >= $INDICATOR_REQUIRED_VERSION41 indicator >= $INDICATOR_REQUIRED_VERSION
41 dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION42 dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
42 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS)43 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
44 libnotify >= $LIBNOTIFY_REQUIRED_VERSION)
43 45
44AC_SUBST(APPLET_CFLAGS)46AC_SUBST(APPLET_CFLAGS)
45AC_SUBST(APPLET_LIBS)47AC_SUBST(APPLET_LIBS)
4648
=== modified file 'data/com.canonical.indicators.sound.gschema.xml'
--- data/com.canonical.indicators.sound.gschema.xml 2010-12-16 12:36:43 +0000
+++ data/com.canonical.indicators.sound.gschema.xml 2011-01-27 17:35:48 +0000
@@ -25,5 +25,14 @@
25 On start up volume should not be muted.25 On start up volume should not be muted.
26 </description>26 </description>
27 </key>27 </key>
28 <key name="show-notify-osd-on-scroll" type="b">
29 <default>true</default>
30 <summary>Initial setting for showing notify-osd notification on scroll volume-change</summary>
31 <description>
32 When using the mouse scroll-wheel over the indicator-sound icon, the volume changes.
33 Enabling this setting, every scroll volume-change a notify-osd bubble with the
34 updated volume value will be shown (if supported by your notification daemon).
35 </description>
36 </key>
28 </schema>37 </schema>
29</schemalist>38</schemalist>
3039
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2011-01-26 22:40:38 +0000
+++ src/indicator-sound.c 2011-01-27 17:35:48 +0000
@@ -27,6 +27,8 @@
2727
28#include <gio/gio.h>28#include <gio/gio.h>
2929
30#include <libnotify/notify.h>
31
30#include "indicator-sound.h"32#include "indicator-sound.h"
31#include "transport-widget.h"33#include "transport-widget.h"
32#include "metadata-widget.h"34#include "metadata-widget.h"
@@ -47,6 +49,8 @@
47 GList* transport_widgets_list;49 GList* transport_widgets_list;
48 GDBusProxy *dbus_proxy; 50 GDBusProxy *dbus_proxy;
49 SoundStateManager* state_manager;51 SoundStateManager* state_manager;
52 GSettings *settings_manager;
53 NotifyNotification* notification;
50};54};
5155
52#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))56#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))
@@ -70,6 +74,11 @@
70 gint delta,74 gint delta,
71 IndicatorScrollDirection direction);75 IndicatorScrollDirection direction);
7276
77//Notification
78static void indicator_sound_notification_init (IndicatorSound *self);
79static void indicator_sound_notification_show (IndicatorSound *self,
80 SoundState state, double value);
81
73//key/moust event handlers82//key/moust event handlers
74static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);83static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
75static gboolean key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);84static gboolean key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
@@ -130,7 +139,11 @@
130 GList* t_list = NULL;139 GList* t_list = NULL;
131 priv->transport_widgets_list = t_list;140 priv->transport_widgets_list = t_list;
132 priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);141 priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);
133 142 priv->notification = NULL;
143
144 priv->settings_manager = g_settings_new("com.canonical.indicators.sound");
145 indicator_sound_notification_init (self);
146
134 g_signal_connect ( G_OBJECT(self->service),147 g_signal_connect ( G_OBJECT(self->service),
135 INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,148 INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,
136 G_CALLBACK(connection_changed), self );149 G_CALLBACK(connection_changed), self );
@@ -149,6 +162,12 @@
149162
150 g_list_free ( priv->transport_widgets_list );163 g_list_free ( priv->transport_widgets_list );
151164
165 g_object_unref(priv->settings_manager);
166
167 if (priv->notification) {
168 notify_uninit();
169 }
170
152 G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);171 G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);
153 return;172 return;
154}173}
@@ -198,6 +217,33 @@
198}217}
199218
200static void219static void
220indicator_sound_notification_init (IndicatorSound *self)
221{
222 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
223
224 if (!notify_init(PACKAGE_NAME))
225 return;
226
227 GList* caps = notify_get_server_caps();
228 gboolean has_notify_osd = FALSE;
229
230 if (caps) {
231 if (g_list_find_custom(caps, "x-canonical-private-synchronous",
232 (GCompareFunc) g_strcmp0)) {
233 has_notify_osd = TRUE;
234 }
235 g_list_foreach(caps, (GFunc) g_free, NULL);
236 g_list_free(caps);
237 }
238
239 if (has_notify_osd) {
240 priv->notification = notify_notification_new(PACKAGE_NAME, NULL, NULL, NULL);
241 notify_notification_set_hint_string(priv->notification,
242 "x-canonical-private-synchronous", "");
243 }
244}
245
246static void
201connection_changed (IndicatorServiceManager * sm,247connection_changed (IndicatorServiceManager * sm,
202 gboolean connected,248 gboolean connected,
203 gpointer user_data)249 gpointer user_data)
@@ -388,7 +434,11 @@
388 newitem,434 newitem,
389 menu_volume_item,435 menu_volume_item,
390 parent);436 parent);
391 return TRUE; 437
438 if (priv->notification)
439 notify_notification_attach_to_widget(priv->notification, volume_widget);
440
441 return TRUE;
392}442}
393443
394/*******************************************************************/444/*******************************************************************/
@@ -549,6 +599,34 @@
549 return digested;599 return digested;
550}600}
551601
602static void
603indicator_sound_notification_show(IndicatorSound *self, SoundState state, double value)
604{
605 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
606
607 if (priv->notification == NULL)
608 return;
609
610 char *icon;
611 const int notify_value = CLAMP((int)value, -1, 101);
612
613 if (state == ZERO_LEVEL) {
614 // Not available for all the themes
615 icon = "audio-volume-off";
616 } else if (state == LOW_LEVEL) {
617 icon = "audio-volume-low";
618 } else if (state == MEDIUM_LEVEL) {
619 icon = "audio-volume-medium";
620 } else if (state == HIGH_LEVEL) {
621 icon = "audio-volume-high";
622 } else {
623 icon = "audio-volume-muted";
624 }
625
626 notify_notification_update(priv->notification, PACKAGE_NAME, NULL, icon);
627 notify_notification_set_hint_int32(priv->notification, "value", notify_value);
628 notify_notification_show(priv->notification, NULL);
629}
552630
553static void631static void
554indicator_sound_scroll (IndicatorObject *io, gint delta, 632indicator_sound_scroll (IndicatorObject *io, gint delta,
@@ -575,5 +653,8 @@
575 value -= adj->step_increment;653 value -= adj->step_increment;
576 }654 }
577 //g_debug("indicator-sound-scroll - update slider with value %f", value);655 //g_debug("indicator-sound-scroll - update slider with value %f", value);
578 volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value); 656 volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value);
657
658 if (g_settings_get_boolean(priv->settings_manager, "show-notify-osd-on-scroll"))
659 indicator_sound_notification_show(INDICATOR_SOUND (io), current_state, value);
579}660}
580661
=== modified file 'src/indicator-sound.h'
--- src/indicator-sound.h 2011-01-24 22:26:21 +0000
+++ src/indicator-sound.h 2011-01-27 17:35:48 +0000
@@ -23,6 +23,8 @@
23You should have received a copy of the GNU General Public License along23You should have received a copy of the GNU General Public License along
24with this program. If not, see <http://www.gnu.org/licenses/>.24with this program. If not, see <http://www.gnu.org/licenses/>.
25*/25*/
26#include "config.h"
27
26#include <libindicator/indicator.h>28#include <libindicator/indicator.h>
27#include <libindicator/indicator-object.h>29#include <libindicator/indicator-object.h>
28#include <libindicator/indicator-service-manager.h>30#include <libindicator/indicator-service-manager.h>

Subscribers

People subscribed via source and target branches