Re: [Rhythmbox-devel] Reading songs list
- From: "Bartosz Wiklak" <bwiklak gmail com>
- To: doclivingston gmail com
- Cc: rhythmbox-devel <rhythmbox-devel gnome org>
- Subject: Re: [Rhythmbox-devel] Reading songs list
- Date: Sun, 17 Feb 2008 08:51:00 +0100
Hi, I still have some problems.
How exactly iterate trough RhythmDBQueryModel to get RhythmDBEntry?
I'm doing this:
RBSource *source;
RhythmDBQueryModel *model;
RhythmDBEntry *entry1;
GtkTreeIter iter;
gboolean valid;
g_object_get (plugin->shell, "selected-source", &source, NULL);
g_object_get (source, "query-model", &model, NULL);
// Get the first iter in the list //
valid = gtk_tree_model_get_iter_first (model, &iter);
int row_count=0;
g_print ("DISPLAYING LIST:\n");
while (valid)
{
gchar *str_data = NULL;
gint int_data;
//gtk_tree_model_get (model, &iter,
// 0, &str_data,-1);
g_print ("get Entry");
rhythmdb_query_model_entry_to_iter(model,entry1,&iter);
g_print ("get entry data");
str_data = rhythmdb_entry_get_string(entry1,RHYTHMDB_PROP_TITLE);
// Do something with the data //
if(str_data){
g_print ("Row %d: (%s)\n", row_count, str_data);
g_free (str_data);
}
row_count ++;
g_print ("get next");
valid = gtk_tree_model_iter_next (model, &iter);
}
but getting only segmentation faults:)
On Feb 17, 2008 1:48 AM, Bartosz Wiklak <bwiklak gmail com> wrote:
> Than you for reply,
> I'm trying to learn GTK, and plugin writing by writing CoverFlow
> plugin for RB - http://bugzilla.gnome.org/show_bug.cgi?id=516186
>
> At activation I would like to build song list so I could load
> necessary covers and build my coverflow UI.
>
>
> On Feb 17, 2008 1:40 AM, James Doc Livingston <doclivingston gmail com> wrote:
> >
> > On Sat, 2008-02-16 at 23:23 +0100, Bartosz Wiklak wrote:
> > > Hi,
> > > I know that by colling
> > > rhythmdb_entry_get_string(entry,RHYTHMDB_PROP_TITLE) I can get current
> > > playing song title.
> > > How can I get list of all songs in library/current playlist?
> >
> > You can get the library via the following:
> >
> > RBSource *source;
> > g_object_get (shell, "library-source", &source, NULL);
> >
> > or the playing source via:
> >
> > RBSource *source;
> > g_object_get (shell, "selected-source", &source, NULL);
> >
> > Then retrieve the RhythmDBQueryModel for the source
> >
> > RhythmDBQueryModel *model;
> > g_object_get (source, "query-model", &model, NULL);
> >
> >
> > A RhythmDBQueryModel is a GtkTreeModel, so you can use normal GTK
> > functions to access it. What do you want to do with the list of songs?
> > The best way to get the information out depends on what you want to do.
> >
> >
> > Cheers,
> >
> > --
> > "To find an elephant using mathematical techniques, remove everything
> > from your search area that is not an elephant. If you find anything,
> > then it is, by construction, an elephant, Q.E.D."
> >
> >
> >
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]