Merge lp:~philip.scott/wingpanel-indicator-sound/remember-last-player into lp:~wingpanel-devs/wingpanel-indicator-sound/trunk

Proposed by Felipe Escoto
Status: Merged
Approved by: Djax
Approved revision: 123
Merged at revision: 122
Proposed branch: lp:~philip.scott/wingpanel-indicator-sound/remember-last-player
Merge into: lp:~wingpanel-devs/wingpanel-indicator-sound/trunk
Diff against target: 78 lines (+24/-2)
2 files modified
src/Widgets/MprisGui.vala (+1/-0)
src/Widgets/MprisWidget.vala (+23/-2)
To merge this branch: bzr merge lp:~philip.scott/wingpanel-indicator-sound/remember-last-player
Reviewer Review Type Date Requested Status
Djax Approve
Felipe Escoto removing my needs fixing Approve
Review via email: mp+308985@code.launchpad.net

Commit message

Remember last player

Description of the change

Whenever you use a different music player other than your default, it never remembers which one you last used, and you can end up with two players even if the default one is inactive

To post a comment you must log in.
Revision history for this message
Djax (parnold-x) wrote :

hey felipe, maybe I'm don't get it right but why are you storing the player? For me the thing you want to achieve is that when the default media player is not running and some other is started you hide the default media player and when none is running you show the default media player right?

Revision history for this message
Felipe Escoto (philip.scott) wrote :

Well yeah, that's one thing I wanted to solve. But I also wanted to let the indicator store the last player you used (Spotify for example) even if that's not the default player

Revision history for this message
Djax (parnold-x) wrote :

And why does it need the last player? Do you want to show the last player instead of the default player starting then? In my testing it doesn't do that.

Revision history for this message
Felipe Escoto (philip.scott) wrote :

Ahh, i see my problem. It does replace the default one but only after wingpanel restarts or while the replacement is still running.

review: Needs Fixing
Revision history for this message
Djax (parnold-x) wrote :

Maybe it would be better to just hide the default if it is not running and something other is running. Would be a lot easier...

122. By Felipe Escoto

Hide default if another player is running

123. By Felipe Escoto

Corrected disapearing condition for the default widget

Revision history for this message
Felipe Escoto (philip.scott) wrote :

Djax: Alright, for now I followed your advice and just hid the default if is not running while another interface is there. I still would like if the indicator could remember the last player you used instead of it returning straight to the default app after you closed it, but i'll push that in another branch as it would require quite some changes

review: Approve (removing my needs fixing)
Revision history for this message
Djax (parnold-x) wrote :

Works as intended

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/MprisGui.vala'
2--- src/Widgets/MprisGui.vala 2016-09-28 20:49:29 +0000
3+++ src/Widgets/MprisGui.vala 2016-10-23 13:44:39 +0000
4@@ -272,6 +272,7 @@
5 settings.last_title_info = {ainfo.get_id (), title_label.get_text (), artist_label.get_text (), last_artUrl};
6
7 this.client = null;
8+ this.mpris_name = "";
9 }
10
11 private void connect_to_client () {
12
13=== modified file 'src/Widgets/MprisWidget.vala'
14--- src/Widgets/MprisWidget.vala 2015-09-14 21:09:53 +0000
15+++ src/Widgets/MprisWidget.vala 2016-10-23 13:44:39 +0000
16@@ -28,15 +28,19 @@
17 setup_dbus();
18 return false;
19 });
20+
21 default_music = AppInfo.get_default_for_type ("audio/x-vorbis+ogg", false);
22 if (default_music != null) {
23 default_widget = new ClientWidget.default (default_music, settings);
24+
25 default_widget.close.connect (() => {
26 close ();
27 });
28+
29 default_widget.show_all();
30 pack_start(default_widget, false, false, 0);
31 }
32+
33 show_all();
34 }
35
36@@ -60,7 +64,14 @@
37 if (iface.player.desktop_entry == default_music.get_id ().replace (".desktop","")) {
38 default_widget.set_client (name, iface);
39 ifaces.insert(name, default_widget);
40+ default_widget.no_show_all = false;
41+ default_widget.visible = true;
42 } else {
43+ if (default_widget.mpris_name == "") {
44+ default_widget.no_show_all = true;
45+ default_widget.visible = false;
46+ }
47+
48 ClientWidget widg = new ClientWidget (iface);
49 widg.close.connect (() => {
50 close ();
51@@ -83,9 +94,19 @@
52 var widg = ifaces[name];
53 if (widg != null) {
54 remove(widg);
55- ifaces.remove(name);
56 }
57 }
58+
59+ ifaces.remove(name);
60+
61+ if (ifaces.length != 0 && default_widget.mpris_name == "") {
62+ default_widget.no_show_all = true;
63+ default_widget.visible = false;
64+ } else {
65+ default_widget.no_show_all = false;
66+ default_widget.visible = true;
67+ show_all ();
68+ }
69 }
70
71 /**
72@@ -177,4 +198,4 @@
73
74 return cl;
75 }
76-}
77\ No newline at end of file
78+}

Subscribers

People subscribed via source and target branches

to all changes: