static void replace_command(gpointer user_data, const char *param) { gulong songs = 0; MpdData *data = advanced_search(param, FALSE); mpd_playlist_clear(connection); for (; data; data = mpd_data_get_next(data)) { if ((songs & 16383) == 16383) { mpd_playlist_queue_commit(connection); } if (data->type == MPD_DATA_TYPE_SONG) { mpd_playlist_queue_add(connection, data->song->file); songs++; } } mpd_playlist_queue_commit(connection); }
/* -------------------------------------------------------------------------- */ static void mpd_menu_handler(const char *event, const char *id, const char *arg, void *cookie) { char **ids; struct lcd_stuff_mpd *mpd = (struct lcd_stuff_mpd *)cookie; if (strlen(id) == 0) return; ids = g_strsplit(id, "_", 2); if ((g_ascii_strcasecmp(ids[0], "pl") == 0) && (ids[1] != NULL)) { int no = atoi(ids[1]) - 1; if (no == -1) { mpd_playlist_clear(mpd->mpd); mpd_playlist_queue_commit(mpd->mpd); } else if (mpd->current_list && (no < (int)mpd->current_list->len)) { char *list; list = g_strconcat(mpd->current_list->pdata[no], NULL); mpd_playlist_queue_load(mpd->mpd, list); mpd_playlist_queue_commit(mpd->mpd); if (mpd->current_state != MPD_PLAYER_PLAY) mpd_player_play(mpd->mpd); g_free(list); } } else if ((g_ascii_strcasecmp(ids[0], "standby") == 0)) { int min = atoi(arg) * 15; if (min == 0) { mpd->stop_time = INT_MAX; } else { mpd->stop_time = time(NULL) + 60 * min; } } g_strfreev(ids); }
static void gmpc_meta_data_widgets_similar_songs_replace_clicked (GmpcMetaDataWidgetsSimilarSongs* self, GtkWidget* item) { gboolean found; GtkTreeView* _tmp0_; GtkTreeView* tree; GtkTreeSelection* _tmp1_ = NULL; GtkTreeSelection* _tmp2_; GtkTreeSelection* sel; GtkTreeModel* model; GtkTreeIter iter = {0}; GtkTreeModel* _tmp3_ = NULL; GList* _tmp4_ = NULL; GtkTreeModel* _tmp5_; GList* list; g_return_if_fail (self != NULL); g_return_if_fail (item != NULL); found = FALSE; _tmp0_ = _g_object_ref0 (GTK_TREE_VIEW (self->priv->pchild)); tree = _tmp0_; _tmp1_ = gtk_tree_view_get_selection (tree); _tmp2_ = _g_object_ref0 (_tmp1_); sel = _tmp2_; model = NULL; _tmp4_ = gtk_tree_selection_get_selected_rows (sel, &_tmp3_); _g_object_unref0 (model); _tmp5_ = _g_object_ref0 (_tmp3_); model = _tmp5_; list = _tmp4_; { GList* path_collection; GList* path_it; path_collection = list; for (path_it = path_collection; path_it != NULL; path_it = path_it->next) { GtkTreePath* _tmp6_; GtkTreePath* path; _tmp6_ = _gtk_tree_path_copy0 ((GtkTreePath*) path_it->data); path = _tmp6_; { GtkTreeIter _tmp7_ = {0}; gboolean _tmp8_; _tmp8_ = gtk_tree_model_get_iter (model, &_tmp7_, path); iter = _tmp7_; if (_tmp8_) { const mpd_Song* song; song = NULL; gtk_tree_model_get (model, &iter, 0, &song, -1, -1); if (song != NULL) { mpd_playlist_queue_add (connection, song->file); found = TRUE; } } _gtk_tree_path_free0 (path); } } } if (found) { mpd_playlist_clear (connection); mpd_playlist_queue_commit (connection); mpd_player_play (connection); } gmpc_meta_data_widgets_similar_songs_play_clicked (self, item); __g_list_free__gtk_tree_path_free0_0 (list); _g_object_unref0 (model); _g_object_unref0 (sel); _g_object_unref0 (tree); }