After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695021 - media-keys: Delegate popping up OSDs to GNOME Shell
media-keys: Delegate popping up OSDs to GNOME Shell
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: media-keys
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on: 613543
Blocks:
 
 
Reported: 2013-03-02 19:43 UTC by Florian Müllner
Modified: 2013-03-04 12:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
media-keys: Copy get_image_name_for_volume() from gsd-osd-window.c (2.23 KB, patch)
2013-03-02 19:44 UTC, Florian Müllner
committed Details | Review
media-keys: Generalize ensure_drag_cancellable() (3.33 KB, patch)
2013-03-02 19:44 UTC, Florian Müllner
committed Details | Review
media-keys: Use the shell's ShowOSD() method for OSDs (13.16 KB, patch)
2013-03-02 19:44 UTC, Florian Müllner
reviewed Details | Review
media-keys: Remove the old OSD implementation (53.17 KB, patch)
2013-03-02 19:44 UTC, Florian Müllner
committed Details | Review
media-keys: Adjust get_image_name_for_volume() to return a string (1.66 KB, patch)
2013-03-03 11:27 UTC, Florian Müllner
committed Details | Review
media-keys: Use the shell's ShowOSD() method for OSDs (12.31 KB, patch)
2013-03-03 11:36 UTC, Florian Müllner
none Details | Review
media-keys: Use the shell's ShowOSD() method for OSDs (12.36 KB, patch)
2013-03-03 11:52 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2013-03-02 19:43:56 UTC
See bug 613543 for the shell part.

In statistics:
    g-s changes:     218 insertions(+)
  g-s-d changes:     160 insertions(+), 1547 deletions(-)

Totally worth it!
Comment 1 Florian Müllner 2013-03-02 19:44:00 UTC
Created attachment 237839 [details] [review]
media-keys: Copy get_image_name_for_volume() from gsd-osd-window.c

Just as we now refer key grabbing to the shell, we will do the same
for OSD popups. Determining the correct volume icon is something
we'll still need to do, while the rest of GsdOsdWindow will become
obsolete and removed, so copy the function over.
Comment 2 Florian Müllner 2013-03-02 19:44:05 UTC
Created attachment 237840 [details] [review]
media-keys: Generalize ensure_drag_cancellable()

We will add another proxy for OSDs, changing the function to take
the address of a GCancellable* will make it reusable for that case.
Comment 3 Florian Müllner 2013-03-02 19:44:09 UTC
Created attachment 237841 [details] [review]
media-keys: Use the shell's ShowOSD() method for OSDs

Now that fallback mode has been dropped and we rely on the shell,
there's no longer any good reason to implement OSDs in g-s-d
(a background service!) while trying to mimick the shell style
as close as possible. Instead, delegate showing the actual UI
to the shell.
Comment 4 Florian Müllner 2013-03-02 19:44:16 UTC
Created attachment 237842 [details] [review]
media-keys: Remove the old OSD implementation
Comment 5 Florian Müllner 2013-03-02 19:52:47 UTC
Oh, I just noticed that there's another OSD implementation in the wacom plugin :(
Comment 6 Bastien Nocera 2013-03-02 23:06:37 UTC
(In reply to comment #5)
> Oh, I just noticed that there's another OSD implementation in the wacom plugin
> :(

Which has nothing to do with what media-keys might show.
Comment 7 Bastien Nocera 2013-03-02 23:13:35 UTC
Review of attachment 237839 [details] [review]:

Looks good.
Comment 8 Bastien Nocera 2013-03-02 23:13:59 UTC
Review of attachment 237839 [details] [review]:

Looks good.
Comment 9 Bastien Nocera 2013-03-02 23:14:41 UTC
Review of attachment 237840 [details] [review]:

++
Comment 10 Bastien Nocera 2013-03-02 23:22:19 UTC
Review of attachment 237841 [details] [review]:

Looks good otherwise.

::: plugins/media-keys/gsd-media-keys-manager.c
@@ +415,3 @@
+static GVariant *
+build_osd_params (const char  *icon_name,
+                  GIcon       *gicon,

The code you just added in the first patch returns a GIcon, but could just as easily return a string, and would avoid this bizarre icon or gicon code below.

I also don't really like this separate "build_osd_params" seeing as we'll always call it as one of show_osd's parameters.
Comment 11 Bastien Nocera 2013-03-02 23:23:29 UTC
Review of attachment 237842 [details] [review]:

Yep.
Comment 12 Florian Müllner 2013-03-03 11:27:20 UTC
Created attachment 237870 [details] [review]
media-keys: Adjust get_image_name_for_volume() to return a string

The shell's OSD DBus interface expects serialized GIcons for the
icons, e.g. the result of g_icon_to_string(). For GThemedIcons
with exactly one name, this is guaranteed to be the icon name itself,
so return that instead of a GIcon.
Comment 13 Florian Müllner 2013-03-03 11:36:05 UTC
Created attachment 237871 [details] [review]
media-keys: Use the shell's ShowOSD() method for OSDs

(In reply to comment #10)
> The code you just added in the first patch returns a GIcon, but could just as
> easily return a string, and would avoid this bizarre icon or gicon code below.

Yeah, it makes sense to use the icon name directly here. Actually I noticed that GThemedIcon with a single icon name guarantees that g_icon_to_string() returns the icon name itself, so I adjusted the DBus API to always require a serialized GIcon, so the icon/gicon code is gone for good!


> I also don't really like this separate "build_osd_params" seeing as we'll
> always call it as one of show_osd's parameters.

The idea was to have build_osd_params() as the general method, and then add special cases for volume etc. like the existing osd_$foo_action() stuff. But as it turned out, I just ended up using the same method everywhere, so yeah, makes sense to just merge this with show_osd() itself.
Comment 14 Florian Müllner 2013-03-03 11:52:34 UTC
Created attachment 237873 [details] [review]
media-keys: Use the shell's ShowOSD() method for OSDs

Accidentally dropped the "level" parameter of the battery action in the last version ...
Comment 15 Bastien Nocera 2013-03-04 10:34:31 UTC
Review of attachment 237870 [details] [review]:

Fine.
Comment 16 Bastien Nocera 2013-03-04 10:36:37 UTC
Review of attachment 237873 [details] [review]:

Looks good.

::: plugins/media-keys/gsd-media-keys-manager.c
@@ +1114,3 @@
+                          gvc_mixer_ui_device_get_description (device), vol);
+        } else {
+            show_osd (manager, icon, NULL, vol);

Indentation.
Comment 17 Florian Müllner 2013-03-04 12:32:37 UTC
Attachment 237839 [details] pushed as 2db01ed - media-keys: Copy get_image_name_for_volume() from gsd-osd-window.c
Attachment 237840 [details] pushed as dfeeca1 - media-keys: Generalize ensure_drag_cancellable()
Attachment 237842 [details] pushed as 476781c - media-keys: Remove the old OSD implementation
Attachment 237870 [details] pushed as 32e29c7 - media-keys: Adjust get_image_name_for_volume() to return a string
Attachment 237873 [details] pushed as 50e3b5b - media-keys: Use the shell's ShowOSD() method for OSDs

(In reply to comment #16)
> @@ +1114,3 @@
> +                          gvc_mixer_ui_device_get_description (device), vol);
> +        } else {
> +            show_osd (manager, icon, NULL, vol);
> 
> Indentation.

Ugh, sorry - I was paying really close attention to coding style, but nowadays I'm almost exclusively writing GNU-style ...