aboutsummaryrefslogtreecommitdiff
path: root/audio/rhythmbox
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2006-11-19 17:45:09 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2006-11-19 17:45:09 +0000
commit7f95e396fffd3b0fadab025988748f1c47b722c9 (patch)
tree03154438e4e317e747b50fb2789bafad707ea481 /audio/rhythmbox
parent82c9809b88949d15540998505db1caff04f695d9 (diff)
downloadports-7f95e396fffd3b0fadab025988748f1c47b722c9.tar.gz
ports-7f95e396fffd3b0fadab025988748f1c47b722c9.zip
* Fix a crash that can occur when trying to determine if a device is an iPod [1]
* Clean up the Podcast locking code to avoid crashes [2] * Fix some warnings pertaining to time_t casts Reported by: ahze, Khairil Yusof <kaeru@inigo-tech.com> [1] Submitted by: James "Doc" Livingston [2] Obtained from: http://bugzilla.gnome.org/show_bug.cgi?id=337332 [2]
Notes
Notes: svn path=/head/; revision=177602
Diffstat (limited to 'audio/rhythmbox')
-rw-r--r--audio/rhythmbox/Makefile2
-rw-r--r--audio/rhythmbox/files/patch-podcast_rb-podcast-manager.c333
-rw-r--r--audio/rhythmbox/files/patch-rhythmdb_rhythmdb.c29
-rw-r--r--audio/rhythmbox/files/patch-sources_rb-ipod-source.c51
4 files changed, 378 insertions, 37 deletions
diff --git a/audio/rhythmbox/Makefile b/audio/rhythmbox/Makefile
index 93201d3964ab..4e8d0c43025b 100644
--- a/audio/rhythmbox/Makefile
+++ b/audio/rhythmbox/Makefile
@@ -8,7 +8,7 @@
PORTNAME= rhythmbox
PORTVERSION= 0.9.6
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= audio gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/0.9
diff --git a/audio/rhythmbox/files/patch-podcast_rb-podcast-manager.c b/audio/rhythmbox/files/patch-podcast_rb-podcast-manager.c
index 2b79af214d6a..7fcd583d23a7 100644
--- a/audio/rhythmbox/files/patch-podcast_rb-podcast-manager.c
+++ b/audio/rhythmbox/files/patch-podcast_rb-podcast-manager.c
@@ -1,56 +1,317 @@
--- podcast/rb-podcast-manager.c.orig Sun Sep 24 07:03:53 2006
-+++ podcast/rb-podcast-manager.c Fri Oct 27 10:21:17 2006
-@@ -545,10 +545,12 @@ rb_podcast_manager_next_file (RBPodcastM
- size = g_list_length (pd->priv->download_list);
- g_mutex_unlock (pd->priv->download_list_mutex);
++++ podcast/rb-podcast-manager.c Sun Nov 19 12:31:44 2006
+@@ -85,8 +85,6 @@ struct RBPodcastManagerPrivate
+ guint next_time;
+ guint source_sync;
+ guint update_interval_notify_id;
+- GMutex *mutex_job;
+- GMutex *download_list_mutex;
+ gboolean remove_files;
+
+@@ -102,7 +100,6 @@ typedef struct
+ RBPodcastChannel *channel;
+ } RBPodcastManagerEvent;
+
+-/* used on donwload thread */
+ typedef struct
+ {
+ RBPodcastManager *pd;
+@@ -111,14 +108,12 @@ typedef struct
+ GnomeVFSURI *write_uri;
+ GnomeVFSURI *read_uri;
+ char *query_string;
+- GMutex *mutex_working;
+
+ guint total_size;
+ guint progress;
+ gboolean canceled;
+ } RBPodcastManagerInfo;
+
+-/* used on subscribe thread */
+ typedef struct
+ {
+ RBPodcastManager *pd;
+@@ -175,7 +170,6 @@ static guint download_progress_update_cb
+
+ /* internal functions */
+ static void download_info_free (RBPodcastManagerInfo *data);
+-static RBPodcastManagerInfo *download_info_new (void);
+ static void start_job (RBPodcastManagerInfo *data);
+ static void end_job (RBPodcastManagerInfo *data);
+ static void cancel_job (RBPodcastManagerInfo *pd);
+@@ -272,8 +266,6 @@ rb_podcast_manager_init (RBPodcastManage
+ pd->priv = RB_PODCAST_MANAGER_GET_PRIVATE (pd);
+
+ pd->priv->source_sync = 0;
+- pd->priv->mutex_job = g_mutex_new();
+- pd->priv->download_list_mutex = g_mutex_new();
+ pd->priv->event_queue = g_async_queue_new ();
+ pd->priv->db = NULL;
+ eel_gconf_monitor_add (CONF_STATE_PODCAST_PREFIX);
+@@ -321,8 +313,6 @@ rb_podcast_manager_finalize (GObject *ob
+ g_list_free (pd->priv->download_list);
+ }
+
+- g_mutex_free (pd->priv->mutex_job);
+- g_mutex_free (pd->priv->download_list_mutex);
+ g_async_queue_unref (pd->priv->event_queue);
+
+ G_OBJECT_CLASS (rb_podcast_manager_parent_class)->finalize (object);
+@@ -418,12 +408,12 @@ rb_podcast_manager_download_entry (RBPod
+ g_value_unset (&status_val);
+ }
+ rb_debug ("Try insert entry for download.");
+- data = download_info_new();
++
++ data = g_new0 (RBPodcastManagerInfo, 1);
+ data->pd = pd;
+ data->entry = entry;
+- g_mutex_lock (pd->priv->download_list_mutex);
++
+ pd->priv->download_list = g_list_append (pd->priv->download_list, data);
+- g_mutex_unlock (pd->priv->download_list_mutex);
+ g_idle_add ((GtkFunction) rb_podcast_manager_next_file , pd);
+ }
+ }
+@@ -535,23 +525,15 @@ rb_podcast_manager_head_query_cb (GtkTre
+ static gboolean
+ rb_podcast_manager_next_file (RBPodcastManager * pd)
+ {
++ gint size;
++
+ GDK_THREADS_ENTER ();
+-
+ rb_debug ("try lock file_process mutex");
+- if (g_mutex_trylock (pd->priv->mutex_job) == TRUE) {
+- gint size;
+
+- g_mutex_lock (pd->priv->download_list_mutex);
+- size = g_list_length (pd->priv->download_list);
+- g_mutex_unlock (pd->priv->download_list_mutex);
+-
- if (size > 0)
-+ if (size > 0) {
- rb_podcast_manager_copy_post (pd);
+- rb_podcast_manager_copy_post (pd);
- else
- g_mutex_unlock (pd->priv->mutex_job);
-+ } else {
-+ g_mutex_unlock (pd->priv->mutex_job);
-+ }
- } else {
- rb_debug ("not start");
- }
-@@ -635,6 +637,7 @@ rb_podcast_manager_download_file_info_cb
+- g_mutex_unlock (pd->priv->mutex_job);
+- } else {
+- rb_debug ("not start");
+- }
++ size = g_list_length (pd->priv->download_list);
++
++ if (size > 0)
++ rb_podcast_manager_copy_post (pd);
+
+ GDK_THREADS_LEAVE ();
+ return FALSE;
+@@ -565,9 +547,7 @@ rb_podcast_manager_copy_post (RBPodcastM
+ char *query_string;
- rb_debug ("got file info results for %s",
- rhythmdb_entry_get_string (data->entry, RHYTHMDB_PROP_LOCATION));
-+ g_mutex_lock (data->pd->priv->mutex_job);
+ /* get first element of list */
+- g_mutex_lock (pd->priv->download_list_mutex);
+ data = (RBPodcastManagerInfo *) g_list_first (pd->priv->download_list)->data;
+- g_mutex_unlock (pd->priv->download_list_mutex);
- if (result->result != GNOME_VFS_OK) {
+ g_assert (data != NULL);
+ g_assert (data->entry != NULL);
+@@ -765,13 +745,9 @@ rb_podcast_manager_abort_download (RBPod
+ {
+ RBPodcastManager *mgr = data->pd;
-@@ -769,6 +772,7 @@ rb_podcast_manager_abort_download (RBPod
+- g_mutex_lock (mgr->priv->download_list_mutex);
mgr->priv->download_list = g_list_remove (mgr->priv->download_list, (gconstpointer) data);
- g_mutex_unlock (mgr->priv->download_list_mutex);
+- g_mutex_unlock (mgr->priv->download_list_mutex);
+-
+ download_info_free (data);
+
+- g_mutex_unlock (mgr->priv->mutex_job);
+ g_idle_add ((GtkFunction) rb_podcast_manager_next_file, mgr);
+ }
+
+@@ -1021,6 +997,8 @@ write_job_data (RBPodcastManagerInfo *da
+ gnome_vfs_uri_to_string (data->write_uri, GNOME_VFS_URI_HIDE_NONE));
+
+ rhythmdb_commit (db);
++
++ end_job (data);
+ }
+
+ static void
+@@ -1040,19 +1018,9 @@ download_info_free (RBPodcastManagerInfo
+ data->query_string = NULL;
+ }
+
+- g_mutex_free (data->mutex_working);
+-
+ g_free (data);
+ }
+
+-static RBPodcastManagerInfo*
+-download_info_new (void)
+-{
+- RBPodcastManagerInfo *data = g_new0 (RBPodcastManagerInfo, 1);
+- data->mutex_working = g_mutex_new ();
+- return data;
+-}
+-
+ static void
+ start_job (RBPodcastManagerInfo *data)
+ {
+@@ -1070,8 +1038,6 @@ start_job (RBPodcastManagerInfo *data)
+ source_uri_list = g_list_prepend (source_uri_list, data->read_uri);
+ target_uri_list = g_list_prepend (target_uri_list, data->write_uri);
+
+- g_mutex_lock (data->mutex_working);
+-
+ rb_debug ("start async copy");
+ gnome_vfs_async_xfer ( &data->read_handle,
+ source_uri_list,
+@@ -1094,9 +1060,7 @@ rb_podcast_manager_cancel_all (RBPodcast
+ guint lst_len;
+ GList *lst;
+
+- g_mutex_lock (pd->priv->download_list_mutex);
+ lst = g_list_reverse (pd->priv->download_list);
+- g_mutex_unlock (pd->priv->download_list_mutex);
+
+ rb_debug ("cancel all job %d", g_list_length (lst));
+ lst_len = g_list_length (lst);
+@@ -1107,11 +1071,6 @@ rb_podcast_manager_cancel_all (RBPodcast
+ cancel_job (data);
+ rb_debug ("cancel next job");
+ }
+-
+- if (lst_len > 0) {
+- g_mutex_lock (pd->priv->mutex_job);
+- g_mutex_unlock (pd->priv->mutex_job);
+- }
+ }
+
+ static void
+@@ -1120,12 +1079,7 @@ end_job (RBPodcastManagerInfo *data)
+ RBPodcastManager *pd = data->pd;
+
+ rb_debug ("end_job");
+-
+- g_mutex_lock (data->pd->priv->download_list_mutex);
+ data->pd->priv->download_list = g_list_remove (data->pd->priv->download_list, (gconstpointer) data);
+- g_mutex_unlock (data->pd->priv->download_list_mutex);
+-
+- g_mutex_unlock (data->mutex_working);
+
+ if (data->canceled != TRUE) {
+ GDK_THREADS_ENTER ();
+@@ -1137,7 +1091,6 @@ end_job (RBPodcastManagerInfo *data)
+ }
-+ g_mutex_unlock (data->mutex_working);
download_info_free (data);
+- g_mutex_unlock (pd->priv->mutex_job);
+
+ g_idle_add ((GtkFunction) rb_podcast_manager_next_file, pd);
+ }
+@@ -1145,22 +1098,12 @@ end_job (RBPodcastManagerInfo *data)
+ static void
+ cancel_job (RBPodcastManagerInfo *data)
+ {
+- if (g_mutex_trylock (data->mutex_working) == FALSE) {
+- rb_debug ("async cancel");
+- data->canceled = TRUE;
+- }
+- else {
+- rb_debug ("job cancel");
+-
+- g_mutex_lock (data->pd->priv->download_list_mutex);
+- data->pd->priv->download_list = g_list_remove (data->pd->priv->download_list, (gconstpointer ) data);
+- g_mutex_unlock (data->pd->priv->download_list_mutex);
++ rb_debug ("job cancel");
- g_mutex_unlock (mgr->priv->mutex_job);
-@@ -1085,6 +1089,10 @@ start_job (RBPodcastManagerInfo *data)
- (GnomeVFSXferProgressCallback ) download_progress_cb,
- data);
+- g_mutex_unlock (data->mutex_working);
++ data->pd->priv->download_list = g_list_remove (data->pd->priv->download_list, (gconstpointer ) data);
-+ g_mutex_unlock (data->mutex_working);
+- download_info_free (data);
+- data = NULL;
+- }
++ download_info_free (data);
++ data = NULL;
+ }
+
+ static guint
+@@ -1175,16 +1118,16 @@ download_progress_cb (GnomeVFSXferProgre
+ if (info->status != GNOME_VFS_XFER_PROGRESS_STATUS_OK ||
+ ((info->phase == GNOME_VFS_XFER_PHASE_COMPLETED) && (info->file_size == 0))) {
+ GValue val = {0, };
+
-+ g_mutex_unlock (data->pd->priv->mutex_job);
+ rb_debug ("error on download");
+
- }
+ g_value_init (&val, G_TYPE_ULONG);
+ g_value_set_ulong (&val, RHYTHMDB_PODCAST_STATUS_ERROR);
+- GDK_THREADS_ENTER ();
+ rhythmdb_entry_set (data->pd->priv->db, data->entry, RHYTHMDB_PROP_STATUS, &val);
+ rhythmdb_commit (data->pd->priv->db);
+- GDK_THREADS_LEAVE ();
+ g_value_unset (&val);
+- end_job (data);
+- data = NULL;
++
++ g_idle_add ((GSourceFunc)end_job, data);
+ return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
+ }
- void
-@@ -1170,6 +1178,11 @@ download_progress_cb (GnomeVFSXferProgre
+@@ -1208,9 +1151,9 @@ download_progress_cb (GnomeVFSXferProgre
+ rb_debug ("download completed");
+ data->total_size = info->file_size;
+ write_job_data (data);
++ } else {
++ g_idle_add ((GSourceFunc)end_job, data);
+ }
+- end_job (data);
+- data = NULL;
+ return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
+ }
+
+@@ -1226,7 +1169,6 @@ download_progress_cb (GnomeVFSXferProgre
+ static guint
+ download_progress_update_cb (GnomeVFSAsyncHandle *handle, GnomeVFSXferProgressInfo *info, gpointer cb_data)
+ {
+-
+ RBPodcastManagerInfo *data = (RBPodcastManagerInfo *) cb_data;
if (data == NULL) {
- return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
-+ }
+@@ -1243,17 +1185,18 @@ download_progress_update_cb (GnomeVFSAsy
+ if (local_progress != data->progress) {
+ GValue val = {0,};
+
++ GDK_THREADS_ENTER ();
++
+ g_value_init (&val, G_TYPE_ULONG);
+ g_value_set_ulong (&val, local_progress);
+ rhythmdb_entry_set (data->pd->priv->db, data->entry, RHYTHMDB_PROP_STATUS, &val);
+ g_value_unset (&val);
+
+- GDK_THREADS_ENTER ();
+-
+ g_signal_emit (data->pd, rb_podcast_manager_signals[STATUS_CHANGED],
+ 0, data->entry, local_progress);
+
+ GDK_THREADS_LEAVE ();
+
-+ if (info->phase == GNOME_VFS_XFER_PHASE_INITIAL) {
-+ g_mutex_lock (data->mutex_working);
-+ g_mutex_lock (data->pd->priv->mutex_job);
+ data->progress = local_progress;
+ }
}
+@@ -1368,8 +1311,6 @@ rb_podcast_manager_cancel_download (RBPo
+ {
+ GList *lst;
- if (info->status != GNOME_VFS_XFER_PROGRESS_STATUS_OK ||
+- g_mutex_lock (pd->priv->download_list_mutex);
+-
+ lst = pd->priv->download_list;
+ while (lst) {
+ RBPodcastManagerInfo *data = (RBPodcastManagerInfo *) lst->data;
+@@ -1379,7 +1320,6 @@ rb_podcast_manager_cancel_download (RBPo
+ }
+ lst = lst->next;
+ }
+- g_mutex_unlock (pd->priv->download_list_mutex);
+
+ if (lst)
+ cancel_job (lst->data);
diff --git a/audio/rhythmbox/files/patch-rhythmdb_rhythmdb.c b/audio/rhythmbox/files/patch-rhythmdb_rhythmdb.c
new file mode 100644
index 000000000000..110386087615
--- /dev/null
+++ b/audio/rhythmbox/files/patch-rhythmdb_rhythmdb.c
@@ -0,0 +1,29 @@
+--- rhythmdb/rhythmdb.c.orig Sun Nov 19 12:40:07 2006
++++ rhythmdb/rhythmdb.c Sun Nov 19 12:40:26 2006
+@@ -2817,7 +2817,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
+ if (entry->last_played == 0) {
+ new = rb_refstring_new (never);
+ } else {
+- val = eel_strdup_strftime (format, localtime ((glong*)&entry->last_played));
++ val = eel_strdup_strftime (format, localtime ((time_t*)&entry->last_played));
+ new = rb_refstring_new (val);
+ g_free (val);
+ }
+@@ -2840,7 +2840,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
+ break;
+
+ old = g_atomic_pointer_get (&entry->first_seen_str);
+- val = eel_strdup_strftime (format, localtime ((glong*)&entry->first_seen));
++ val = eel_strdup_strftime (format, localtime ((time_t*)&entry->first_seen));
+ new = rb_refstring_new (val);
+ g_free (val);
+
+@@ -2864,7 +2864,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
+ old = g_atomic_pointer_get (&entry->last_seen_str);
+ /* only store last seen time as a string for hidden entries */
+ if (entry->flags & RHYTHMDB_ENTRY_HIDDEN) {
+- val = eel_strdup_strftime (format, localtime ((glong*)&entry->last_seen));
++ val = eel_strdup_strftime (format, localtime ((time_t*)&entry->last_seen));
+ new = rb_refstring_new (val);
+ g_free (val);
+ } else {
diff --git a/audio/rhythmbox/files/patch-sources_rb-ipod-source.c b/audio/rhythmbox/files/patch-sources_rb-ipod-source.c
new file mode 100644
index 000000000000..4084249f63ba
--- /dev/null
+++ b/audio/rhythmbox/files/patch-sources_rb-ipod-source.c
@@ -0,0 +1,51 @@
+--- sources/rb-ipod-source.c.orig Sun Nov 19 12:12:33 2006
++++ sources/rb-ipod-source.c Sun Nov 19 12:28:50 2006
+@@ -695,33 +695,36 @@ hal_udi_is_ipod (const char *udi)
+ char *spider_udi;
+ int vnd_id = 0;
+ int product_id = 0;
++ DBusError phone_error;
++
++ dbus_error_init (&phone_error);
+
+ spider_udi = g_strdup(parent_udi);
+ while (vnd_id == 0 && product_id == 0 && spider_udi != NULL) {
+ char *old_udi = spider_udi;
+ spider_udi = libhal_device_get_property_string (ctx, spider_udi,
+- "info.parent", &error);
+- if (dbus_error_is_set (&error)) {
+- dbus_error_free (&error);
+- dbus_error_init (&error);
++ "info.parent", &phone_error);
++ if (dbus_error_is_set (&phone_error)) {
++ dbus_error_free (&phone_error);
++ dbus_error_init (&phone_error);
+ spider_udi = NULL;
+ break;
+ }
+ g_free(old_udi);
+
+ vnd_id = libhal_device_get_property_int (ctx, spider_udi,
+- "usb.vendor_id", &error);
+- if (dbus_error_is_set(&error)) {
+- dbus_error_free (&error);
+- dbus_error_init (&error);
++ "usb.vendor_id", &phone_error);
++ if (dbus_error_is_set(&phone_error)) {
++ dbus_error_free (&phone_error);
++ dbus_error_init (&phone_error);
+ vnd_id = 0;
+ }
+
+ product_id = libhal_device_get_property_int (ctx, spider_udi,
+- "usb.product_id", &error);
+- if (dbus_error_is_set(&error)) {
+- dbus_error_free (&error);
+- dbus_error_init (&error);
++ "usb.product_id", &phone_error);
++ if (dbus_error_is_set(&phone_error)) {
++ dbus_error_free (&phone_error);
++ dbus_error_init (&phone_error);
+ product_id = 0;
+ }
+ }