Rhythmbox fix-up ....
- From: Lee Willis <lee leewillis co uk>
- To: Ryan P Skadberg <skadz stigmata org>
- Cc: dashboard-hackers gnome org
- Subject: Rhythmbox fix-up ....
- Date: Wed, 31 Dec 2003 16:10:51 +0000
Ryan,
The attached patch (Against rhythmbox 0.6.3) should trigger dashboard
events at the right times (Excepting un-pausing, but I'm not sure we
need that anyway?). Since you spotted it not working right last time do
you want to give this patch a try (Probably not tonight :p).
It's untested since I've re-compiled and b0rked my mono setup (It can't
find gtkhtml-sharp.dll - hmmm), but looks like it works!
If you don't have time then don't worry, I'll test it all when my system
sorts itself out...
Have a great New Year,
Lee
--
Lee Willis lee leewillis co uk
diff -u --recursive rhythmbox-0.6.3.orig/shell/rb-shell-player.c rhythmbox-0.6.3/shell/rb-shell-player.c
--- rhythmbox-0.6.3.orig/shell/rb-shell-player.c Sat Dec 20 00:20:50 2003
+++ rhythmbox-0.6.3/shell/rb-shell-player.c Wed Dec 31 15:45:57 2003
@@ -58,13 +58,6 @@
#include "rb-play-order.h"
-#ifdef WITH_DASHBOARD
-#include <stdio.h>
-#include <glib.h>
-#include <sys/time.h>
-#include "dashboard.c"
-#endif /* WITH_DASHBOARD */
-
typedef enum
{
PLAY_BUTTON_PLAY,
@@ -1392,12 +1385,6 @@
char *title;
RhythmDBEntry *entry;
char *duration;
-#ifdef WITH_DASHBOARD
- const char *album = NULL;
- const char *genre = NULL;
- const char *url = NULL;
- char *cluepacket;
-#endif
entry = rb_shell_player_get_playing_entry (player);
rb_debug ("playing source: %p, active entry: %p", player->priv->source, entry);
@@ -1409,12 +1396,6 @@
entry, RHYTHMDB_PROP_TITLE);
artist = rhythmdb_entry_get_string (player->priv->db, entry,
RHYTHMDB_PROP_ARTIST);
-#ifdef WITH_DASHBOARD
- album = rhythmdb_entry_get_string (player->priv->db, entry,
- RHYTHMDB_PROP_ALBUM);
- genre = rhythmdb_entry_get_string (player->priv->db, entry,
- RHYTHMDB_PROP_GENRE);
-#endif
rhythmdb_read_unlock (player->priv->db);
}
@@ -1453,23 +1434,6 @@
g_free (title);
rb_player_set_playing_entry (player->priv->player_widget, entry);
rb_player_sync (player->priv->player_widget);
-#ifdef WITH_DASHBOARD
- /* Send cluepacket to dashboard */
- if (player->priv->playbutton_state == PLAY_BUTTON_PLAY) {
- cluepacket =
- dashboard_build_cluepacket_then_free_clues ("Music Player",
- TRUE,
- url,
- dashboard_build_clue (entry_title, "title", 10),
- dashboard_build_clue (artist, "artist", 10),
- dashboard_build_clue (album, "album", 10),
- dashboard_build_clue (genre, "genre", 10),
- NULL);
-
- dashboard_send_raw_cluepacket (cluepacket);
- g_free (cluepacket);
- }
-#endif
}
void
diff -u --recursive rhythmbox-0.6.3.orig/shell/rb-shell.c rhythmbox-0.6.3/shell/rb-shell.c
--- rhythmbox-0.6.3.orig/shell/rb-shell.c Sat Dec 20 18:50:53 2003
+++ rhythmbox-0.6.3/shell/rb-shell.c Wed Dec 31 15:48:04 2003
@@ -79,6 +79,12 @@
#include "rb-thread-helpers.h"
#include "eel-gconf-extensions.h"
+#ifdef WITH_DASHBOARD
+#include <glib.h>
+#include <sys/time.h>
+#include "dashboard.c"
+#endif /* WITH_DASHBOARD */
+
static void rb_shell_class_init (RBShellClass *klass);
static void rb_shell_init (RBShell *shell);
static void rb_shell_finalize (GObject *object);
@@ -853,6 +859,33 @@
/* FIXME: arg should be released somehow */
}
+#ifdef WITH_DASHBOARD
+static void
+dashboard_shell_entry_changed_cb (GObject *object, GParamSpec *pspec, RBShell *shell)
+{
+ GNOME_Rhythmbox_SongInfo *song;
+ char *cluepacket;
+
+ g_assert (strcmp (pspec->name, "playing-entry") == 0);
+ song = get_song_info_from_player (shell);
+
+ if (song) {
+ g_printf ("IN callback for %s, by %s\n", song->title, song->artist);
+ /* Send cluepacket to dashboard */
+ cluepacket =
+ dashboard_build_cluepacket_then_free_clues ("Music Player",
+ TRUE,
+ "",
+ dashboard_build_clue (song->title, "title", 10),
+ dashboard_build_clue (song->artist, "artist", 10),
+ dashboard_build_clue (song->album, "album", 10),
+ NULL);
+ dashboard_send_raw_cluepacket (cluepacket);
+ g_free (cluepacket);
+ }
+}
+#endif //WITH_DASHBOARD
+
void
rb_shell_construct (RBShell *shell)
{
@@ -1412,17 +1445,26 @@
rb_debug ("selecting source %p", source);
- if (shell->priv->song_changed_cb_id != 0) {
+ if (shell->priv->selected_source) {
view = rb_source_get_entry_view (shell->priv->selected_source);
- g_signal_handler_disconnect (view,
- shell->priv->song_changed_cb_id);
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (rb_shell_entry_changed_cb),
+ shell);
+#ifdef WITH_DASHBOARD
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (dashboard_shell_entry_changed_cb),
+ shell);
+#endif // WITH_DASHBOARD
}
shell->priv->selected_source = source;
view = rb_source_get_entry_view (shell->priv->selected_source);
- shell->priv->song_changed_cb_id =
- g_signal_connect (view, "notify::playing-entry",
- (GCallback)rb_shell_entry_changed_cb, shell);
+ g_signal_connect (view, "notify::playing-entry",
+ G_CALLBACK(rb_shell_entry_changed_cb), shell);
+#ifdef WITH_DASHBOARD
+ g_signal_connect (view, "notify::playing-entry",
+ G_CALLBACK (dashboard_shell_entry_changed_cb), shell);
+#endif // WITH_DASHBOARD
/* show source */
gtk_notebook_set_current_page (GTK_NOTEBOOK (shell->priv->notebook),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]