One month ago I heard about GJS for GNOME 3 and I wanted to try it out. What do I want to make? A simple Media Player for GNOME 3 with GJS.
So, the base has been programmed, eg.:
The problem is now that I want to manually change the selected Line in the TreeView Object (when the user presses the Forward or Back Button), and I don't have a clue how to do this.
I looked it up at the official GNOME-Docs, at the unofficial Seed Documentation and Google'd it up with no results. I tried to find it out with the C-Docs of GNOME 3, but still nothing.
I hope that somebody could give me a hand at this "little" problem. :)
The Link to the simple Music Player.
Okay, i just found the answer:
// Get the selection from the Gtk.TreeView Object
this.selection = this._soundList.get_selection ();
// Get the bool "isSelected", the model and the Iter from this.selection.get_selected()
let [ isSelected, model, iter ] = this.selection.get_selected();
// Get the previous row in the list (iter_next(iter) for the next row)
this._listStore.iter_previous(iter);
// The selection should get updated
this.selection.select_iter(iter);
// Get the URI from the Gtk.ListStore Object
this.sound.uri = this._listStore.get_value (iter, 1);
I hope this will help those who will need it.