totem r5067 - in trunk: . src/plugins/media-player-keys



Author: hadess
Date: Mon Feb  4 18:17:09 2008
New Revision: 5067
URL: http://svn.gnome.org/viewvc/totem?rev=5067&view=rev

Log:
2008-02-04  Bastien Nocera  <hadess hadess net>

	* configure.in:
	* src/plugins/media-player-keys/totem-media-player-keys.c:
	(on_window_focus_in_event), (impl_activate), (impl_deactivate):
	Use dbus-glib directly, instead of the C-glue, so that the
	media keys plugin can work against both the old and the new
	gnome-settings-daemon media-player keys API (Closes: #514037)



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/plugins/media-player-keys/totem-media-player-keys.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Feb  4 18:17:09 2008
@@ -477,10 +477,10 @@
 			fi
 		;;
 		media-player-keys)
-			PKG_CHECK_MODULES(MEDIA_PLAYER_KEYS, gnome-settings-daemon >= 2.17.4 dbus-glib-1,
+			PKG_CHECK_MODULES(MEDIA_PLAYER_KEYS, dbus-glib-1,
 				[HAVE_MEDIA_PLAYER_KEYS=yes], [HAVE_MEDIA_PLAYER_KEYS=no])
 			if test "${HAVE_MEDIA_PLAYER_KEYS}" != "yes" ; then
-				plugin_error_or_ignore "you need gnome-settings-daemon >= 2.17.4 and dbus-glib-1 installed for the media-player-keys plugin"
+				plugin_error_or_ignore "you need dbus-glib-1 installed for the media-player-keys plugin"
 				add_plugin="0"
 			fi
 		;;

Modified: trunk/src/plugins/media-player-keys/totem-media-player-keys.c
==============================================================================
--- trunk/src/plugins/media-player-keys/totem-media-player-keys.c	(original)
+++ trunk/src/plugins/media-player-keys/totem-media-player-keys.c	Mon Feb  4 18:17:09 2008
@@ -31,9 +31,9 @@
 #include <glib-object.h>
 #include <glib/gi18n-lib.h>
 #include <gmodule.h>
+#include <dbus/dbus-glib.h>
 #include <string.h>
 
-#include <gnome-settings-daemon/gnome-settings-client.h>
 #include "totem-marshal.h"
 
 #include "totem-plugin.h"
@@ -113,8 +113,10 @@
 on_window_focus_in_event (GtkWidget *window, GdkEventFocus *event, TotemMediaPlayerKeysPlugin *pi)
 {
 	if (pi->media_player_keys_proxy != NULL) {
-		org_gnome_SettingsDaemon_grab_media_player_keys (pi->media_player_keys_proxy,
-				"Totem", 0, NULL);
+		dbus_g_proxy_call (pi->media_player_keys_proxy,
+				   "GrabMediaPlayerKeys", NULL,
+				   G_TYPE_STRING, "Totem", G_TYPE_UINT, 0, G_TYPE_INVALID,
+				   G_TYPE_INVALID);
 	}
 
 	return FALSE;
@@ -143,9 +145,21 @@
 		return FALSE;
 	}
 
+	/* Try the gnome-settings-daemon version,
+	 * then the gnome-control-center version of things */
 	pi->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
-			"org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon",
-			"org.gnome.SettingsDaemon", &err);
+								       "org.gnome.SettingsDaemon.MediaKeys",
+								       "/org/gnome/SettingsDaemon/MediaKeys",
+								       "org.gnome.SettingsDaemon.MediaKeys",
+								       NULL);
+	if (pi->media_player_keys_proxy == NULL) {
+		pi->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
+									       "org.gnome.SettingsDaemon",
+									       "/org/gnome/SettingsDaemon",
+									       "org.gnome.SettingsDaemon",
+									       &err);
+	}
+
 	dbus_g_connection_unref (connection);
 	if (err != NULL) {
 		gboolean daemon_not_running;
@@ -163,9 +177,10 @@
 					 pi, 0);
 	}
 
-
-	org_gnome_SettingsDaemon_grab_media_player_keys (pi->media_player_keys_proxy,
-			"Totem", 0, NULL);
+	dbus_g_proxy_call (pi->media_player_keys_proxy,
+			   "GrabMediaPlayerKeys", NULL,
+			   G_TYPE_STRING, "Totem", G_TYPE_UINT, 0, G_TYPE_INVALID,
+			   G_TYPE_INVALID);
 
 	dbus_g_object_register_marshaller (totem_marshal_VOID__STRING_STRING,
 			G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
@@ -191,7 +206,9 @@
 	GtkWindow *window;
 
 	if (pi->media_player_keys_proxy != NULL) {
-		org_gnome_SettingsDaemon_release_media_player_keys (pi->media_player_keys_proxy, "Totem", NULL);
+		dbus_g_proxy_call (pi->media_player_keys_proxy,
+				   "ReleaseMediaPlayerKeys", NULL,
+				   G_TYPE_STRING, "Totem", G_TYPE_INVALID, G_TYPE_INVALID);
 		g_object_unref (pi->media_player_keys_proxy);
 		pi->media_player_keys_proxy = NULL;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]