banshee r3481 - in branches/banshee/stable: . src/Core/Banshee.Base
- From: sdroege svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3481 - in branches/banshee/stable: . src/Core/Banshee.Base
- Date: Tue, 18 Mar 2008 23:27:18 +0000 (GMT)
Author: sdroege
Date: Tue Mar 18 23:27:18 2008
New Revision: 3481
URL: http://svn.gnome.org/viewvc/banshee?rev=3481&view=rev
Log:
* src/Core/Banshee.Base/GnomeMMKeys.cs: Add support for the new DBus
interface of gnome-settings-daemon 2.22.
Modified:
branches/banshee/stable/ChangeLog
branches/banshee/stable/src/Core/Banshee.Base/GnomeMMKeys.cs
Modified: branches/banshee/stable/src/Core/Banshee.Base/GnomeMMKeys.cs
==============================================================================
--- branches/banshee/stable/src/Core/Banshee.Base/GnomeMMKeys.cs (original)
+++ branches/banshee/stable/src/Core/Banshee.Base/GnomeMMKeys.cs Tue Mar 18 23:27:18 2008
@@ -37,17 +37,27 @@
public class GnomeMMKeys : IDisposable
{
private const string BusName = "org.gnome.SettingsDaemon";
- private const string ObjectPath = "/org/gnome/SettingsDaemon";
+ private const string oldObjectPath = "/org/gnome/SettingsDaemon";
+ private const string ObjectPath = "/org/gnome/SettingsDaemon/MediaKeys";
private delegate void MediaPlayerKeyPressedHandler(string application, string key);
[Interface("org.gnome.SettingsDaemon")]
+ private interface ISettingsDaemonOld
+ {
+ void GrabMediaPlayerKeys(string application, uint time);
+ void ReleaseMediaPlayerKeys(string application);
+ event MediaPlayerKeyPressedHandler MediaPlayerKeyPressed;
+ }
+
+ [Interface("org.gnome.SettingsDaemon.MediaKeys")]
private interface ISettingsDaemon
{
void GrabMediaPlayerKeys(string application, uint time);
void ReleaseMediaPlayerKeys(string application);
event MediaPlayerKeyPressedHandler MediaPlayerKeyPressed;
}
+
private static GnomeMMKeys instance;
@@ -69,15 +79,22 @@
private const string app_name = "Banshee";
- private ISettingsDaemon settings_daemon;
+ private object settings_daemon = null;
public GnomeMMKeys()
{
- settings_daemon = Bus.Session.GetObject<ISettingsDaemon>(BusName, new ObjectPath(ObjectPath));;
+ try {
+ ISettingsDaemon sd = Bus.Session.GetObject<ISettingsDaemon>(BusName, new ObjectPath(ObjectPath));
+ sd.GrabMediaPlayerKeys(app_name, 0);
+ sd.MediaPlayerKeyPressed += OnMediaPlayerKeyPressed;
+ settings_daemon = sd;
+ } catch {
+ ISettingsDaemonOld sd = Bus.Session.GetObject<ISettingsDaemonOld>(BusName, new ObjectPath(oldObjectPath));
+ sd.GrabMediaPlayerKeys(app_name, 0);
+ sd.MediaPlayerKeyPressed += OnMediaPlayerKeyPressed;
+ settings_daemon = sd;
+ }
- settings_daemon.GrabMediaPlayerKeys(app_name, 0);
- settings_daemon.MediaPlayerKeyPressed += OnMediaPlayerKeyPressed;
-
Globals.ShutdownRequested += OnShutdownRequested;
if(!Globals.UIManager.IsInitialized) {
@@ -110,9 +127,17 @@
return;
}
- settings_daemon.MediaPlayerKeyPressed -= OnMediaPlayerKeyPressed;
- settings_daemon.ReleaseMediaPlayerKeys(app_name);
- settings_daemon = null;
+ if(settings_daemon is ISettingsDaemon) {
+ ISettingsDaemon sd = (ISettingsDaemon) settings_daemon;
+ sd.MediaPlayerKeyPressed -= OnMediaPlayerKeyPressed;
+ sd.ReleaseMediaPlayerKeys(app_name);
+ settings_daemon = null;
+ } else {
+ ISettingsDaemonOld sd = (ISettingsDaemonOld) settings_daemon;
+ sd.MediaPlayerKeyPressed -= OnMediaPlayerKeyPressed;
+ sd.ReleaseMediaPlayerKeys(app_name);
+ settings_daemon = null;
+ }
}
private void OnMediaPlayerKeyPressed(string application, string key)
@@ -140,7 +165,10 @@
private void OnFocusInEvent(object o, FocusInEventArgs args)
{
if(settings_daemon != null) {
- settings_daemon.GrabMediaPlayerKeys(app_name, 0);
+ if(settings_daemon is ISettingsDaemon)
+ ((ISettingsDaemon) settings_daemon).GrabMediaPlayerKeys(app_name, 0);
+ else
+ ((ISettingsDaemonOld) settings_daemon).GrabMediaPlayerKeys(app_name, 0);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]