/** * rb_removable_media_manager_queue_transfer: * @manager: the #RBRemovableMediaManager * @entry: the #RhythmDBEntry to transfer * @dest: the destination URI * @mime_types: a list of acceptable output MIME types * @callback: function to call when the transfer is complete * @userdata: data to pass to the callback * * Initiates a track transfer. This will transfer the track identified by the * #RhythmDBEntry to the given destination, transcoding it if its * current media type is not in the list of acceptable output types. */ void rb_removable_media_manager_queue_transfer (RBRemovableMediaManager *manager, RhythmDBEntry *entry, const char *dest, GList *mime_types, RBTransferCompleteCallback callback, gpointer userdata) { RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (manager); TransferData *data; g_assert (rb_is_main_thread ()); data = g_new0 (TransferData, 1); data->manager = manager; data->entry = entry; data->dest = g_strdup (dest); data->mime_types = rb_string_list_copy (mime_types); data->callback = callback; data->userdata = userdata; g_async_queue_push (priv->transfer_queue, data); priv->transfer_total++; do_transfer (manager); }
static void impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { RBTrackTransferBatch *batch = RB_TRACK_TRANSFER_BATCH (object); const char * const *strv; int i; switch (prop_id) { case PROP_MEDIA_TYPES: batch->priv->media_types = rb_string_list_copy (g_value_get_pointer (value)); break; case PROP_MEDIA_TYPES_STRV: strv = g_value_get_boxed (value); if (strv != NULL) { for (i = 0; strv[i] != NULL; i++) { batch->priv->media_types = g_list_append (batch->priv->media_types, g_strdup (strv[i])); } } break; case PROP_SOURCE: batch->priv->source = g_value_dup_object (value); break; case PROP_DESTINATION: batch->priv->destination = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/** * rb_library_browser_set_selection: * @widget: a #RBLibraryBrowser * @type: the property for which to set the selection * @selection: a list of strings to select * * Replaces any current selection for the specified property. */ void rb_library_browser_set_selection (RBLibraryBrowser *widget, RhythmDBPropType type, GList *selection) { RBLibraryBrowserPrivate *priv = RB_LIBRARY_BROWSER_GET_PRIVATE (widget); GList *old_selection; RBPropertyView *view; int rebuild_index; RBLibraryBrowserRebuildData *rebuild_data; old_selection = g_hash_table_lookup (priv->selections, (gpointer)type); if (rb_string_list_equal (old_selection, selection)) return; if (selection) g_hash_table_insert (priv->selections, (gpointer)type, rb_string_list_copy (selection)); else g_hash_table_remove (priv->selections, (gpointer)type); rebuild_index = prop_to_index (type); if (priv->rebuild_data != NULL) { rebuild_data = priv->rebuild_data; if (rebuild_data->rebuild_prop_index <= rebuild_index) { /* already rebuilding a model further up the chain, * so we don't need to do anything for this one. */ return; } g_source_remove (rebuild_data->rebuild_idle_id); rebuild_data = NULL; } view = g_hash_table_lookup (priv->property_views, (gpointer)type); if (view) { ignore_selection_changes (widget, view, TRUE); } rebuild_data = g_new0 (RBLibraryBrowserRebuildData, 1); rebuild_data->widget = g_object_ref (widget); rebuild_data->rebuild_prop_index = rebuild_index; rebuild_data->rebuild_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) idle_rebuild_model, rebuild_data, (GDestroyNotify) destroy_idle_rebuild_model); priv->rebuild_data = rebuild_data; }
static GList * impl_get_mime_types (RBRemovableMediaSource *source) { RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source); return rb_string_list_copy (priv->mediatypes); }