? acme.diff
? rb-player.c
? rb.c
? help/C/omf_timestamp
? shell/Rhythmbox-common.c
? shell/Rhythmbox-skels.c
? shell/Rhythmbox-stubs.c
? shell/Rhythmbox.h
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/rhythmbox/ChangeLog,v
retrieving revision 1.419
diff -u -r1.419 ChangeLog
--- ChangeLog	8 Feb 2003 15:58:04 -0000	1.419
+++ ChangeLog	11 Feb 2003 00:29:53 -0000
@@ -1,3 +1,12 @@
+2003-02-10  Mark Humphreys <marquee@users.sourceforge.net>
+ 
+ 	* shell/rb-player.c: (rb_player_get_right_part),
+ 	(rb_pause_or_play), (rb_player_action_handle_key):
+ 	* shell/rb-player.h:
+ 	* shell/rb.c: (rb_construct), (rb_set_title),
+ 	(rb_window_key_press_cb):
+ 	Addition of basic ACME support - prev / next / pause / play
+
 2003-02-08  Pauli Virtanen  <pauli.virtanen@hut.fi>
 
 	* configure.in: Added "fi" (Finnish) to ALL_LINGUAS.
Index: acconfig.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/acconfig.h,v
retrieving revision 1.2
diff -u -r1.2 acconfig.h
--- acconfig.h	9 Sep 2002 17:12:41 -0000	1.2
+++ acconfig.h	11 Feb 2003 00:29:53 -0000
@@ -4,3 +4,4 @@
 #undef GETTEXT_PACKAGE
 #undef HAVE_LC_MESSAGES
 #undef HAVE_REMOTE
+#undef HAVE_ACME
Index: configure.in
===================================================================
RCS file: /cvs/gnome/rhythmbox/configure.in,v
retrieving revision 1.43
diff -u -r1.43 configure.in
--- configure.in	8 Feb 2003 15:58:04 -0000	1.43
+++ configure.in	11 Feb 2003 00:29:53 -0000
@@ -33,6 +33,14 @@
 			AC_DEFINE(HAVE_REMOTE)]
 			,,) ] ,)
 
+dnl Check of Mulitmedia keys
+AC_ARG_ENABLE(xacme, AC_HELP_STRING([--disable-acme],
+				[don't build with acme support]))
+if test "x$enable_acme" != "xno"; then
+AC_CHECK_HEADER(X11/XF86keysym.h, [enable_acme=yes
+		AC_DEFINE(HAVE_ACME)],,)
+fi
+
 AC_SUBST(RHYTHMBOX_CFLAGS)
 AC_SUBST(RHYTHMBOX_LIBS)
 
Index: shell/rb-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-player.c,v
retrieving revision 1.31
diff -u -r1.31 rb-player.c
--- shell/rb-player.c	5 Feb 2003 00:21:31 -0000	1.31
+++ shell/rb-player.c	11 Feb 2003 00:29:55 -0000
@@ -43,6 +43,9 @@
 #include <unistd.h>
 #include <math.h>
 #include <monkey-media.h>
+#ifdef HAVE_ACME
+#include <X11/XF86keysym.h>
+#endif
 
 #include "rb-debug.h"
 #include "rb-player.h"
@@ -99,6 +102,9 @@
 			            guint cnxn_id,
 			            GConfEntry *entry,
 			            RBPlayer *player);
+#ifdef HAVE_ACME
+static void rb_player_pause_or_play (RBPlayer *player);
+#endif
 
 struct RBPlayerPrivate
 {
@@ -1312,4 +1318,50 @@
 rb_player_get_right_part (RBPlayer *player)
 {
 	return GTK_WIDGET (player->priv->playlist_view);
+}
+
+#ifdef HAVE_ACME
+static void
+rb_player_pause_or_play (RBPlayer *player)
+{
+ 	if (player != NULL)
+ 	{
+		switch (rb_player_get_state (player)) {
+		case RB_PLAYER_PLAYING :
+			rb_player_set_state (player, RB_PLAYER_PAUSED);
+			break;
+		case RB_PLAYER_STOPPED:
+		case RB_PLAYER_PAUSED:
+			rb_player_set_state (player, RB_PLAYER_PLAYING);
+			break;
+		default:
+			g_assert_not_reached ();
+			break;
+		}
+ 	}
+}
+#endif
+
+gboolean
+rb_player_action_handle_key (RBPlayer *player, guint keyval)
+{
+ 	gboolean retval = TRUE;
+#ifdef HAVE_ACME
+
+ 	switch (keyval) {
+ 	case XF86XK_AudioPlay:
+ 	case XF86XK_AudioPause:
+ 		rb_player_pause_or_play (player);
+ 		break;
+ 	case XF86XK_AudioPrev:
+		rb_previous (player);
+ 		break;
+	case XF86XK_AudioNext:
+		rb_next (player);
+ 		break;
+ 	default:
+ 		retval = FALSE;
+ 	}
+#endif 
+ 	return retval;
 }
Index: shell/rb-player.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-player.h,v
retrieving revision 1.8
diff -u -r1.8 rb-player.h
--- shell/rb-player.h	19 Jan 2003 20:21:27 -0000	1.8
+++ shell/rb-player.h	11 Feb 2003 00:29:55 -0000
@@ -85,6 +85,8 @@
 
 GtkWidget    *rb_player_get_right_part (RBPlayer *player);
 
+gboolean rb_player_action_handle_key (RBPlayer *player, guint keyval);
+
 G_END_DECLS
 
 #endif /* __RB_PLAYER_H */
Index: shell/rb.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb.c,v
retrieving revision 1.8
diff -u -r1.8 rb.c
--- shell/rb.c	1 Feb 2003 22:13:21 -0000	1.8
+++ shell/rb.c	11 Feb 2003 00:29:55 -0000
@@ -81,6 +81,8 @@
 		                RB *rb,
 			        const char *verbname);
 static void rb_quit (RB *rb);
+static int rb_window_key_press_cb (GtkWidget *win, GdkEventKey *event,
+                        gpointer user_data);
 
 /* prefs */
 #define CONF_STATE_WINDOW_WIDTH     "/apps/rhythmbox/state/window_width"
@@ -308,6 +310,12 @@
 			  G_CALLBACK (rb_window_delete_cb),
 			  rb);
 
+	/* Connect Multimedia keys */
+	gtk_widget_add_events (rb->priv->window, GDK_KEY_PRESS_MASK);
+	g_signal_connect (G_OBJECT(rb->priv->window), "key_press_event",
+			G_CALLBACK (rb_window_key_press_cb), 
+			rb);
+
 	rb->priv->container = bonobo_window_get_ui_container (win);
 
 	bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (win),
@@ -577,3 +585,23 @@
 	else
 		gtk_window_set_title (GTK_WINDOW (rb->priv->window), _("Music Player"));
 }
+
+static int
+rb_window_key_press_cb (GtkWidget *win, GdkEventKey *event,
+                        gpointer user_data)
+{
+	RBPlayer *player = RB_PLAYER (RB (user_data)->priv->player);
+
+	if (event->state != 0
+            && ((event->state & GDK_CONTROL_MASK)
+               || (event->state & GDK_MOD1_MASK)
+               || (event->state & GDK_MOD3_MASK)
+               || (event->state & GDK_MOD4_MASK)
+               || (event->state & GDK_MOD5_MASK)))
+	{
+		return FALSE;
+	}
+
+	return rb_player_action_handle_key (player, event->keyval);
+}
+
