|
@@ -13,6 +13,18 @@
|
|
#include <gdkmm/pixbuf.h>
|
|
#include <gdkmm/pixbuf.h>
|
|
#include <glibmm/fileutils.h>
|
|
#include <glibmm/fileutils.h>
|
|
|
|
|
|
|
|
+namespace
|
|
|
|
+{
|
|
|
|
+ struct PlayButtonParams
|
|
|
|
+ {
|
|
|
|
+ // Какой id видео
|
|
|
|
+ std::string yt_id;
|
|
|
|
+
|
|
|
|
+ // Кнопка
|
|
|
|
+ Gtk::Button* caller;
|
|
|
|
+ };
|
|
|
|
+}
|
|
|
|
+
|
|
namespace components {
|
|
namespace components {
|
|
|
|
|
|
MainWindow* MainWindow::create()
|
|
MainWindow* MainWindow::create()
|
|
@@ -250,9 +262,10 @@ namespace components {
|
|
auto btn_play = Gtk::make_managed<Gtk::Button>();
|
|
auto btn_play = Gtk::make_managed<Gtk::Button>();
|
|
btn_play->set_child(*(core::getButtonContents("Play video", "player_play")));
|
|
btn_play->set_child(*(core::getButtonContents("Play video", "player_play")));
|
|
btn_play->set_hexpand();
|
|
btn_play->set_hexpand();
|
|
|
|
+ auto btn_event = PlayButtonParams{ yt_id, btn_play };
|
|
btn_play->signal_clicked().connect(sigc::bind(
|
|
btn_play->signal_clicked().connect(sigc::bind(
|
|
- sigc::mem_fun(*this, &MainWindow::playSingleVideo),
|
|
|
|
- yt_id
|
|
|
|
|
|
+ sigc::mem_fun(*this, &MainWindow::onPlayButtonClicked),
|
|
|
|
+ btn_play
|
|
));
|
|
));
|
|
box_buttons->append(*btn_play);
|
|
box_buttons->append(*btn_play);
|
|
|
|
|
|
@@ -321,4 +334,10 @@ namespace components {
|
|
std::string command = "xdg-open https://youtu.be/"+yt_id;
|
|
std::string command = "xdg-open https://youtu.be/"+yt_id;
|
|
system(command.c_str());
|
|
system(command.c_str());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ void MainWindow::onPlayButtonClicked(PlayButtonParams e)
|
|
|
|
+ {
|
|
|
|
+ MainWindow::playSingleVideo(e.yt_id);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|