void rb_podcast_main_source_add_subsources (RBPodcastMainSource *source) { RhythmDBQuery *query; RBSource *podcast_subsource; RBPodcastManager *podcast_mgr; RhythmDB *db; RBShell *shell; g_object_get (source, "shell", &shell, "podcast-manager", &podcast_mgr, NULL); g_object_get (shell, "db", &db, NULL); query = rhythmdb_query_parse (db, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_PODCAST_POST, RHYTHMDB_QUERY_PROP_CURRENT_TIME_WITHIN, RHYTHMDB_PROP_FIRST_SEEN, 3600 * 24 * 7, RHYTHMDB_QUERY_END); podcast_subsource = rb_podcast_source_new (shell, podcast_mgr, query, _("New Episodes"), RB_STOCK_AUTO_PLAYLIST); rhythmdb_query_free (query); rb_source_set_hidden_when_empty (podcast_subsource, TRUE); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (podcast_subsource), RB_DISPLAY_PAGE (source)); query = rhythmdb_query_parse (db, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, RHYTHMDB_ENTRY_TYPE_PODCAST_POST, RHYTHMDB_QUERY_PROP_CURRENT_TIME_WITHIN, RHYTHMDB_PROP_LAST_SEEN, 3600 * 24 * 7, RHYTHMDB_QUERY_END); podcast_subsource = rb_podcast_source_new (shell, podcast_mgr, query, _("New Downloads"), /* better name? */ RB_STOCK_AUTO_PLAYLIST); rhythmdb_query_free (query); rb_source_set_hidden_when_empty (podcast_subsource, TRUE); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (podcast_subsource), RB_DISPLAY_PAGE (source)); g_object_unref (db); g_object_unref (shell); }
static void import_complete_cb (RhythmDBImportJob *job, int total, RBAndroidSource *source) { RBAndroidSourcePrivate *priv = GET_PRIVATE (source); GSettings *settings; RBShell *shell; if (priv->ejecting) { rb_device_source_default_eject (RB_DEVICE_SOURCE (source)); } else { g_object_get (source, "shell", &shell, NULL); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (priv->import_errors), RB_DISPLAY_PAGE (source)); g_object_unref (shell); g_object_set (source, "load-status", RB_SOURCE_LOAD_STATUS_LOADED, NULL); g_object_get (source, "encoding-settings", &settings, NULL); rb_transfer_target_transfer (RB_TRANSFER_TARGET (source), settings, NULL, FALSE); g_object_unref (settings); rb_media_player_source_purge_metadata_cache (RB_MEDIA_PLAYER_SOURCE (source)); } g_clear_object (&priv->import_job); }
static void import_complete_cb (RhythmDBImportJob *job, int total, RBGenericPlayerSource *source) { RBGenericPlayerSourceClass *klass = RB_GENERIC_PLAYER_SOURCE_GET_CLASS (source); RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source); RBShell *shell; GDK_THREADS_ENTER (); g_object_get (source, "shell", &shell, NULL); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (priv->import_errors), RB_DISPLAY_PAGE (source)); g_object_unref (shell); if (klass->impl_load_playlists) klass->impl_load_playlists (source); g_object_unref (priv->import_job); priv->import_job = NULL; rb_display_page_notify_status_changed (RB_DISPLAY_PAGE (source)); g_object_set (source, "load-status", RB_SOURCE_LOAD_STATUS_LOADED, NULL); rb_transfer_target_transfer (RB_TRANSFER_TARGET (source), NULL, FALSE); GDK_THREADS_LEAVE (); }
static void grilo_source_added_cb (GrlPluginRegistry *registry, GrlMediaPlugin *grilo_plugin, RBGriloPlugin *plugin) { RBSource *grilo_source; RBShell *shell; int i; if (GRL_IS_MEDIA_SOURCE (grilo_plugin) == FALSE) { /* TODO use metadata sources for album art and lyrics */ rb_debug ("grilo source %s is not interesting", grl_media_plugin_get_name (grilo_plugin)); return; } for (i = 0; i < G_N_ELEMENTS (ignored_plugins); i++) { if (g_str_equal (ignored_plugins[i], grl_media_plugin_get_id (grilo_plugin))) { rb_debug ("grilo source %s is blacklisted", grl_media_plugin_get_name (grilo_plugin)); return; } } rb_debug ("new grilo source: %s", grl_media_plugin_get_name (grilo_plugin)); grilo_source = rb_grilo_source_new (G_OBJECT (plugin), GRL_MEDIA_SOURCE (grilo_plugin)); g_hash_table_insert (plugin->sources, grilo_plugin, grilo_source); /* probably put some sources under 'shared', some under 'stores'? */ g_object_get (plugin, "object", &shell, NULL); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (grilo_source), RB_DISPLAY_PAGE_GROUP_SHARED); g_object_unref (shell); }
static void grilo_source_added_cb (GrlRegistry *registry, GrlSource *grilo_source, RBGriloPlugin *plugin) { GrlPlugin *grilo_plugin; GrlSupportedOps ops; const GList *keys; RBSource *source; RBShell *shell; int i; if (!(grl_source_get_supported_media (grilo_source) & GRL_MEDIA_TYPE_AUDIO)) { rb_debug ("grilo source %s doesn't support audio", grl_source_get_name (grilo_source)); goto ignore; } grilo_plugin = grl_source_get_plugin (grilo_source); for (i = 0; i < G_N_ELEMENTS (ignored_plugins); i++) { if (g_str_equal (ignored_plugins[i], grl_plugin_get_id (grilo_plugin))) { rb_debug ("grilo source %s is blacklisted", grl_source_get_name (grilo_source)); goto ignore; } } ops = grl_source_supported_operations (grilo_source); if (((ops & GRL_OP_BROWSE) == 0) && ((ops & GRL_OP_SEARCH) == 0)) { rb_debug ("grilo source %s is not interesting", grl_source_get_name (grilo_source)); goto ignore; } keys = grl_source_supported_keys (grilo_source); if (g_list_find ((GList *)keys, GINT_TO_POINTER (GRL_METADATA_KEY_URL)) == NULL) { rb_debug ("grilo source %s doesn't do urls", grl_source_get_name (grilo_source)); goto ignore; } rb_debug ("new grilo source: %s", grl_source_get_name (grilo_source)); source = rb_grilo_source_new (G_OBJECT (plugin), grilo_source); g_hash_table_insert (plugin->sources, g_object_ref (grilo_source), g_object_ref_sink (source)); /* probably put some sources under 'shared', some under 'stores'? */ g_object_get (plugin, "object", &shell, NULL); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE_GROUP_SHARED); g_object_unref (shell); return; ignore: grl_registry_unregister_source (registry, grilo_source, NULL); }
void rb_generic_player_source_add_playlist (RBGenericPlayerSource *source, RBShell *shell, RBSource *playlist) { RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source); g_object_ref (playlist); priv->playlists = g_list_prepend (priv->playlists, playlist); g_signal_connect_object (playlist, "deleted", G_CALLBACK (playlist_deleted_cb), source, 0); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (playlist), RB_DISPLAY_PAGE (source)); }
static void rb_mtp_plugin_maybe_add_source (RBMtpPlugin *plugin, const char *udi, LIBMTP_raw_device_t *raw_devices, int num_raw_devices) { int i; int device_num = 0; DBusError error; rb_debug ("checking if UDI %s matches an MTP device", udi); /* get device number */ dbus_error_init (&error); device_num = libhal_device_get_property_int (plugin->hal_context, udi, "usb.linux.device_number", &error); if (dbus_error_is_set (&error)) { rb_debug ("unable to get USB device number: %s", error.message); dbus_error_free (&error); return; } rb_debug ("USB device number: %d", device_num); for (i = 0; i < num_raw_devices; i++) { rb_debug ("detected MTP device: device number %d (bus location %u)", raw_devices[i].devnum, raw_devices[i].bus_location); if (raw_devices[i].devnum == device_num) { RBSource *source; RBShell *shell; rb_debug ("device matched, creating a source"); g_object_get (plugin, "object", &shell, NULL); source = RB_SOURCE (rb_mtp_source_new (shell, G_OBJECT (plugin), udi, &raw_devices[i])); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE_GROUP_DEVICES); plugin->mtp_sources = g_list_prepend (plugin->mtp_sources, source); g_signal_connect_object (source, "deleted", G_CALLBACK (source_deleted_cb), plugin, 0); g_object_unref (shell); } } }
static void impl_activate (PeasActivatable *activatable) { RBVisualizerPlugin *pi = RB_VISUALIZER_PLUGIN (activatable); RBDisplayPageGroup *page_group; RhythmDBEntry *entry; GtkToggleAction *fullscreen; GtkWidget *menu; RBShell *shell; g_object_get (pi, "object", &shell, NULL); pi->settings = g_settings_new ("org.gnome.rhythmbox.plugins.visualizer"); g_signal_connect_object (pi->settings, "changed", G_CALLBACK (settings_changed_cb), pi, 0); /* create UI actions and menus and stuff */ fullscreen = gtk_toggle_action_new ("VisualizerFullscreen", _("Fullscreen"), _("Toggle fullscreen visual effects"), GTK_STOCK_FULLSCREEN); menu = rb_visualizer_create_popup_menu (fullscreen); g_object_ref_sink (menu); /* create visualizer page */ pi->page = rb_visualizer_page_new (G_OBJECT (pi), shell, fullscreen, menu); g_signal_connect_object (pi->page, "start", G_CALLBACK (start_visualizer_cb), pi, 0); g_signal_connect_object (pi->page, "stop", G_CALLBACK (stop_visualizer_cb), pi, 0); /* don't do anything if we couldn't create a video sink (clutter is broken, etc.) */ g_object_get (pi->page, "sink", &pi->sink, NULL); if (pi->sink == NULL) { g_object_unref (shell); return; } /* prepare style stuff for fullscreen display */ rb_visualizer_fullscreen_load_style (G_OBJECT (pi)); /* add the visualizer page to the UI */ page_group = rb_display_page_group_get_by_id ("display"); if (page_group == NULL) { page_group = rb_display_page_group_new (G_OBJECT (shell), "display", _("Display"), RB_DISPLAY_PAGE_GROUP_CATEGORY_TOOLS); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (page_group), NULL); } g_object_set (pi->page, "visibility", FALSE, NULL); rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (pi->page), RB_DISPLAY_PAGE (page_group)); /* get player objects */ g_object_get (shell, "shell-player", &pi->shell_player, NULL); g_object_get (pi->shell_player, "player", &pi->player, NULL); /* only show the page in the page tree when playing something */ g_signal_connect_object (pi->shell_player, "playing-song-changed", G_CALLBACK (playing_song_changed_cb), pi, 0); entry = rb_shell_player_get_playing_entry (pi->shell_player); playing_song_changed_cb (pi->shell_player, entry, pi); if (entry != NULL) { rhythmdb_entry_unref (entry); } /* figure out how to insert the visualizer into the playback pipeline */ if (g_object_class_find_property (G_OBJECT_GET_CLASS (pi->player), "playbin")) { rb_debug ("using playbin-based visualization"); pi->playbin_notify_id = g_signal_connect_object (pi->player, "notify::playbin", G_CALLBACK (playbin_notify_cb), pi, 0); g_object_get (pi->player, "playbin", &pi->playbin, NULL); if (pi->playbin != NULL) { mutate_playbin (pi, pi->playbin); } } else if (RB_IS_PLAYER_GST_TEE (pi->player)) { rb_debug ("using tee-based visualization"); } else { g_warning ("unknown player backend type"); g_object_unref (pi->player); pi->player = NULL; } g_object_unref (shell); }