diff --git a/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.cc b/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.cc index ee2016b..6c0a0de 100644 --- a/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.cc +++ b/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.cc @@ -45,6 +45,7 @@ MediaPlayer::MediaPlayer() treeview.set_model(store); treeview.append_column("File Name", n_columns.file_name); selection = treeview.get_selection(); + treeview.signal_row_activated().connect(sigc::mem_fun(*this, &MediaPlayer::item_activated)); // Add vbox to the window set_child(vbox); @@ -124,6 +125,13 @@ void MediaPlayer::btnload_clicked() } } +void MediaPlayer::item_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *column) +{ + auto row = *(store->get_iter(path)); + auto filename = row[n_columns.file_path]; + video1.set_filename(filename); +} + void MediaPlayer::btnsave_clicked() { // Initalize Vectors diff --git a/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.hh b/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.hh index 4e27ac7..cfc084b 100644 --- a/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.hh +++ b/Gtkmm4/gtk139_mediaplayer2/src/MediaPlayer.hh @@ -45,4 +45,5 @@ private: void btnremove_clicked(); void btnload_clicked(); void btnsave_clicked(); + void item_activated(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column); }; \ No newline at end of file