Add startup apps

This commit is contained in:
daleclack 2021-06-29 18:01:35 +08:00
parent 4218217f9e
commit 9b6d04d554
3 changed files with 54 additions and 1 deletions

View File

@ -19,4 +19,4 @@ link_directories (${GTKMM3_LIBRARY_DIRS})
add_executable(My_GtkUI src/main.cc src/MyWin.cc src/MyStack.cc add_executable(My_GtkUI src/main.cc src/MyWin.cc src/MyStack.cc
src/TopPanel.cc src/LeftPanel.cc src/winconf.cc src/resources.cc) src/TopPanel.cc src/LeftPanel.cc src/winconf.cc src/resources.cc)
add_definitions (${GTKMM3_CFLAGS_OTHER}) add_definitions (${GTKMM3_CFLAGS_OTHER})
target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES}) target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES} -lpthread)

View File

@ -1,8 +1,24 @@
#include "LeftPanel.hh" #include "LeftPanel.hh"
#include <thread>
#include <cstdlib>
LeftPanel::LeftPanel(Gtk::Window *parent1){ LeftPanel::LeftPanel(Gtk::Window *parent1){
//Get Widgets
panel_builder=Gtk::Builder::create_from_resource("/GtkUI/leftpanel.ui"); panel_builder=Gtk::Builder::create_from_resource("/GtkUI/leftpanel.ui");
panel_builder->get_widget("popover1",popover);
panel_builder->get_widget("btnbox",btnbox); panel_builder->get_widget("btnbox",btnbox);
panel_builder->get_widget("btnaud",btnaud);
panel_builder->get_widget("btngedit",btngedit);
panel_builder->get_widget("btnvlc",btnvlc);
panel_builder->get_widget("btn_note",btnnote);
panel_builder->get_widget("btn_vlc",btnvlc_win32);
//Link Signals
btnaud->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnaud_clicked));
btngedit->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btngedit_clicked));
btnvlc->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnvlc_clicked));
btnnote->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnnote_clicked));
btnvlc_win32->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::winvlc_clicked));
parent=parent1; parent=parent1;
} }
@ -11,3 +27,32 @@ void LeftPanel::add_panel(Gtk::Overlay &overlay){
btnbox->set_valign(Gtk::ALIGN_START); btnbox->set_valign(Gtk::ALIGN_START);
overlay.add_overlay(*btnbox); overlay.add_overlay(*btnbox);
} }
void LeftPanel::btnaud_clicked(){
std::thread first(system,"audacious");
first.detach();
popover->popdown();
}
void LeftPanel::btngedit_clicked(){
std::thread second(system,"gedit");
second.detach();
popover->popdown();
}
void LeftPanel::btnvlc_clicked(){
std::thread third(system,"vlc");
third.detach();
}
void LeftPanel::btnnote_clicked(){
std::thread fourth(system,"start notepad");
fourth.detach();
popover->popdown();
}
void LeftPanel::winvlc_clicked(){
std::thread fifth(system,"start ..\\vlc\\vlc.exe");
fifth.detach();
popover->popdown();
}

View File

@ -11,6 +11,14 @@ private:
Glib::RefPtr<Gtk::Builder> panel_builder; Glib::RefPtr<Gtk::Builder> panel_builder;
//Child widgets //Child widgets
Gtk::Box *btnbox; Gtk::Box *btnbox;
Gtk::Popover *popover;
Gtk::Button *btnaud,*btngedit,*btnvlc,*btnnote,*btnvlc_win32;
//Parent Window //Parent Window
Gtk::Window *parent; Gtk::Window *parent;
//Signal Handlers for application start
void btnaud_clicked();
void btngedit_clicked();
void btnvlc_clicked();
void btnnote_clicked();
void winvlc_clicked();
}; };