gtk_tree_model_iter_next works, what should I do about prev



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I've been having some great luck using a GtkListStore, but recently I
wanted to see the previous node on the list. Obviously, the
gtk_tree_model_iter_prev doesn't exist. So what is the best way to get
the previous node.

I tried something like the code below, but path was always NULL and so
it didn't work. Any hints on this?
// global
GtkListStore *playliststore;
GtkTreeIter iter;

// in the callback
GtkTreePath *path;
gchar *filename;
gint count;
gint playlist;

path = gtk_tree_model_get_path(GTK_TREE_MODEL(playliststore),&iter);
if (gtk_tree_path_prev(path)) {
        if(gtk_tree_model_get_iter(GTK_TREE_MODEL(playliststore),&iter,path)) {
                                          gtk_tree_model_get(GTK_TREE_MODEL(playliststore), &iter,
ITEM_COLUMN,&filename, COUNT_COLUMN,&count,PLAYLIST_COLUMN,&playlist,-1);
                        shutdown();
                        set_media_info(filename);
                        play_file(filename, playlist);
                                gtk_list_store_set(playliststore,&iter,COUNT_COLUMN,count+1, -1);
                        g_free(filename);
        }
}
gtk_tree_path_free(path);


Thanks,

Kevin

- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Remi - http://enigmail.mozdev.org

iD8DBQFGucXi6w2kMH0L1dERAox6AJ9/AibEKFN9+VvdNtJGmHkwNr0LVgCeLcLa
fvpEXSVYYzxqU91t8W404v8=
=O4kj
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]