From kde-core-devel Fri May 11 16:41:43 2007 From: Thiago Macieira Date: Fri, 11 May 2007 16:41:43 +0000 To: kde-core-devel Subject: Controlling "current" concept via D-Bus Message-Id: <200705111841.52724.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=117890176227154 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart2396713.W8zBKMDJPo" --nextPart2396713.W8zBKMDJPo Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Andreas Hartmetz wrote: >> It's possible to use the D-Bus connection name structure for this >> task. If there's interest, I can show some proof-of-concept code. > >If this would still be needed when a generic e.g. media player manager > is availabe, yes please. But only if it doesn't take you too much time. > I might ask you some DBus questions in the future >:} I will use the Media Player concept here as an example. I will post some=20 example code later on. Suppose the user has 3 media players installed: Noatun Amarok kscd None of them are running at the moment. Each KDE application by default=20 gets its own D-Bus connection name upon starting (org.kde.noatun,=20 org.kde.amarok and org.kde.kscd). Those aren't affected at all by the=20 discussion that follows. 1) user starts Noatun 2) Noatun registers the name org.kde.mediaplayer with a flag of=20 AllowReplacement 3) the D-Bus daemon grants Noatun the name 4) user starts Amarok 5) Amarok registers as well the name org.kde.mediaplayer with a flag of=20 AllowReplacement 6) the D-Bus daemon sees this new registration and grants Amarok the name,= =20 telling Noatun that it lost the name 7) user presses Play in the manager interface, which makes a call to=20 org.kde.mediaplayer to start playing. In this case, it's Amarok that=20 starts playing. 8) Amarok receives the Play command and re-registers the=20 org.kde.mediaplayer, this time with the DontAllowReplacement flag 9) user starts kscd 10) kscd tries to register the name org.kde.mediaplayer (AllowReplacement) 11) the D-Bus daemon denies this registration so the name stays with=20 Amarok 12) user presses Stop in Amarok, the media player or using the global=20 shortcut 13) Amarok again re-registers the name org.kde.mediaplayer, but with=20 AllowReplacement At this point, if the user presses Play in Noatun or kscd, the D-Bus=20 daemon will grant that player the name, taking it from Amarok. The features of this process are: a) if no player has started playing, the player started last will be=20 the "current" player =E2=86=92 most recent =3D most likely top of mind b) if a player is playing, no other can take over the "currentness" c) the player that was playing but stopped is also the "current" one =E2=86= =92=20 most recent d) if the user wants to switch players, he has to use that one's=20 interface, not the manager Bugs: if the user quits the current player, which one will become "current" is=20 undefined =2D-=20 =C2=A0 Thiago Macieira =C2=A0- =C2=A0thiago (AT) macieira.info - thiago (AT= ) kde.org =C2=A0 =C2=A0 PGP/GPG: 0x6EF45358; fingerprint: =C2=A0 =C2=A0 E067 918B B660 DBD1 105C =C2=A0966C 33F5 F005 6EF4 5358 --nextPart2396713.W8zBKMDJPo Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGRJzHM/XwBW70U1gRAvrNAJ4+nSNuklF9eRjcdQ3YZY/RUjHu1gCgv00R fThevaaSozag7dE8QStHJGo= =z9ej -----END PGP SIGNATURE----- --nextPart2396713.W8zBKMDJPo--