[Rhythmbox-devel] Revised dashboard patches
- From: Lee Willis <lee leewillis co uk>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] Revised dashboard patches
- Date: Tue, 13 Jan 2004 18:54:04 +0000
Based on some feedback from the dashboard guys it appears that the
previous patches that went in pre 0.6.3 didn't always send data to
dashboard at the right times. I've essentially moved the dashboard
sending stuff to a more sensible place and all seems to work better now.
I've attached 2 patches, one against current GNOME anoncvs, and another
against 0.6.4.
Are there any objections to these?
Thanks
Lee
--
Lee Willis <lee@leewillis.co.uk>
diff --recursive -u rhythmbox-0.6.4/shell/rb-shell-player.c rhythmbox-0.6.4-patched/shell/rb-shell-player.c
--- rhythmbox-0.6.4/shell/rb-shell-player.c Thu Jan 8 23:28:58 2004
+++ rhythmbox-0.6.4-patched/shell/rb-shell-player.c Sat Jan 10 19:00:40 2004
@@ -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 --recursive -u rhythmbox-0.6.4/shell/rb-shell.c rhythmbox-0.6.4-patched/shell/rb-shell.c
--- rhythmbox-0.6.4/shell/rb-shell.c Thu Jan 8 23:34:37 2004
+++ rhythmbox-0.6.4-patched/shell/rb-shell.c Sat Jan 10 19:01:05 2004
@@ -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);
@@ -285,8 +291,6 @@
char *cached_title;
char *cached_duration;
-
- gulong song_changed_cb_id;
};
static BonoboUIVerb rb_shell_verbs[] =
@@ -848,13 +852,30 @@
{
GNOME_Rhythmbox_SongInfo *song_info;
BonoboArg *arg;
-
+
g_assert (strcmp (pspec->name, "playing-entry") == 0);
song_info = get_song_info_from_player (shell);
arg = bonobo_arg_new (TC_GNOME_Rhythmbox_SongInfo);
(GNOME_Rhythmbox_SongInfo*)arg->_value = song_info;
shell_notify_pb_changes (shell, "song", arg);
/* FIXME: arg should be released somehow */
+
+#ifdef WITH_DASHBOARD
+ if (song_info) {
+ char *cluepacket;
+ /* Send cluepacket to dashboard */
+ cluepacket =
+ dashboard_build_cluepacket_then_free_clues ("Music Player",
+ TRUE,
+ "",
+ dashboard_build_clue (song_info->title, "song_title", 10),
+ dashboard_build_clue (song_info->artist, "artist", 10),
+ dashboard_build_clue (song_info->album, "album", 10),
+ NULL);
+ dashboard_send_raw_cluepacket (cluepacket);
+ g_free (cluepacket);
+ }
+#endif //WITH_DASHBOARD
}
void
@@ -1416,17 +1437,17 @@
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);
}
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);
/* show source */
gtk_notebook_set_current_page (GTK_NOTEBOOK (shell->priv->notebook),
Index: shell/rb-shell-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v
retrieving revision 1.109
diff -u -r1.109 rb-shell-player.c
--- shell/rb-shell-player.c 12 Jan 2004 06:38:16 -0000 1.109
+++ shell/rb-shell-player.c 13 Jan 2004 18:53:26 -0000
@@ -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,
@@ -1363,12 +1356,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);
@@ -1380,12 +1367,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);
}
@@ -1424,23 +1405,6 @@
g_free (title);
rb_header_set_playing_entry (player->priv->header_widget, entry);
rb_header_sync (player->priv->header_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
Index: shell/rb-shell.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v
retrieving revision 1.232
diff -u -r1.232 rb-shell.c
--- shell/rb-shell.c 12 Jan 2004 06:42:12 -0000 1.232
+++ shell/rb-shell.c 13 Jan 2004 18:53:26 -0000
@@ -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);
@@ -289,8 +295,6 @@
char *cached_title;
char *cached_duration;
-
- gulong song_changed_cb_id;
};
static BonoboUIVerb rb_shell_verbs[] =
@@ -867,6 +871,23 @@
(GNOME_Rhythmbox_SongInfo*)arg->_value = song_info;
shell_notify_pb_changes (shell, "song", arg);
/* FIXME: arg should be released somehow */
+
+#ifdef WITH_DASHBOARD
+ if (song_info) {
+ char *cluepacket;
+ /* Send cluepacket to dashboard */
+ cluepacket =
+ dashboard_build_cluepacket_then_free_clues ("Music Player",
+ TRUE,
+ "",
+ dashboard_build_clue (song_info->title, "song_title", 10),
+ dashboard_build_clue (song_info->artist, "artist", 10),
+ dashboard_build_clue (song_info->album, "album", 10),
+ NULL);
+ dashboard_send_raw_cluepacket (cluepacket);
+ g_free (cluepacket);
+ }
+#endif //WITH_DASHBOARD
}
void
@@ -1407,17 +1428,17 @@
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);
}
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);
/* 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]