static void rb_ipod_plugin_cmd_rename (GtkAction *action, RBIpodPlugin *plugin) { RBSourceList *sourcelist = NULL; RBSource *source = NULL; /* FIXME: this is pretty ugly, the sourcelist should automatically add * a "rename" menu item for sources that have can_rename == TRUE. * This is a bit trickier to handle though, since playlists want * to make rename sensitive/unsensitive instead of showing/hiding it */ g_object_get (G_OBJECT (plugin->shell), "selected-source", &source, NULL); if ((source == NULL) || !RB_IS_IPOD_SOURCE (source)) { g_critical ("got iPodSourceRename action for non-ipod source"); if (source != NULL) g_object_unref (source); return; } g_object_get (plugin->shell, "sourcelist", &sourcelist, NULL); rb_sourcelist_edit_source_name (sourcelist, source); /* Once editing is done, notify::name will be fired on the source, and * we'll catch that in our rename callback */ g_object_unref (sourcelist); g_object_unref (source); }
static void rb_ipod_plugin_cmd_playlist_rename (GtkAction *action, RBIpodPlugin *plugin) { RBSource *source = NULL; RBSourceList *sourcelist = NULL; g_object_get (G_OBJECT (plugin->shell), "selected-source", &source, "sourcelist", &sourcelist, NULL); if ((source == NULL) || !RB_IS_IPOD_STATIC_PLAYLIST_SOURCE (source)) { g_critical ("got iPodPlaylistSourceRename action for non-ipod playlist source"); g_object_unref (sourcelist); if (source != NULL) g_object_unref (source); return; } rb_sourcelist_edit_source_name (sourcelist, source); g_object_unref (sourcelist); g_object_unref (source); }
static void rb_generic_player_plugin_new_playlist (GtkAction *action, RBSource *source) { RBShell *shell; RBSourceList *sourcelist; RBSource *playlist; RhythmDBEntryType *entry_type; g_return_if_fail (RB_IS_GENERIC_PLAYER_SOURCE (source)); g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); playlist = rb_generic_player_playlist_source_new (shell, RB_GENERIC_PLAYER_SOURCE (source), NULL, NULL, entry_type); g_object_unref (entry_type); rb_generic_player_source_add_playlist (RB_GENERIC_PLAYER_SOURCE (source), shell, playlist); g_object_get (shell, "sourcelist", &sourcelist, NULL); rb_sourcelist_edit_source_name (sourcelist, playlist); g_object_unref (sourcelist); g_object_unref (shell); }