Re: [Rhythmbox-devel] Reading songs list
- From: Matt Novenstern <fisxoj gmail com>
- To: Rhythmbox-devel list <rhythmbox-devel gnome org>
- Subject: Re: [Rhythmbox-devel] Reading songs list
- Date: Sun, 17 Feb 2008 03:10:09 -0500
On Sun, 2008-02-17 at 09:00 +0100, Bartosz Wiklak wrote:
> Also, how to track changes in source?
>
> thanks a lot,
> Bartek
>
> On Feb 17, 2008 8:55 AM, Bartosz Wiklak <bwiklak gmail com> wrote:
> > is
> >
> > gtk_tree_model_get (model, &iter,
> > 0, &entry1,-1);
> >
> > a good idea?
> > Seams it works.
> >
> >
> > On Feb 17, 2008 8:51 AM, Bartosz Wiklak <bwiklak gmail com> wrote:
> > > 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:)
> > >
I am by no means a GTK expert, but, I think that you might like the
gtk_tree_model_foreach() function, which lets you give it a function to
run with each item in the model (look in
plugins/mtpdevice/rb-mtp-source.c). Also, since the RhythmDBQueryModel
isn't quite a real tree model, you probably need to pass it as
GTK_TREE_MODEL(model) to whatever function you decide to use, since that
function is expecting a GTKTreeModel, and is getting a
RhythmDBQueryModel.
As far as keeping track of changes in RB source, SVN is probably the
best way. Take a look at http://live.gnome.org/Rhythmbox/FAQ for info
about checking out HEAD.
-Matt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]