ClienteTFG/controller_install.cpp

41 lines
1.3 KiB
C++
Raw Normal View History

2020-05-16 20:52:10 +02:00
#include "controller_install.h"
2020-06-03 18:59:39 +02:00
#include "container_window.h"
#include <thread>
#include <gtkmm/messagedialog.h>
controller_install::controller_install(view_install *vis, session_manager *sesi, controller_info* con)
2020-05-16 20:52:10 +02:00
{
this->vis=vis;
this->sesi=sesi;
2020-06-03 18:59:39 +02:00
this->con=con;
2020-05-16 20:52:10 +02:00
this->add_controlers();
}
void controller_install::add_controlers(){
vis->m_button.signal_clicked().connect(sigc::mem_fun(this,
&controller_install::on_button_clicked));
}
void controller_install::on_button_clicked(){
2020-06-03 18:59:39 +02:00
std::string n_package = this->vis->entry.get_text();
std::string mesage="Compile the package ";
mesage.append(n_package);
mesage.append("?");
Gtk::MessageDialog mes=Gtk::MessageDialog(mesage,false,Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_OK_CANCEL);
int result=mes.run();
if(result==-5){
int res=this->sesi->install_command(n_package);
mes.close();
2020-06-03 22:39:48 +02:00
con->load_info();
2020-06-03 18:59:39 +02:00
if(res>0){
con->load_info();
Gtk::MessageDialog mesf=Gtk::MessageDialog("Compile end satisfactorily",false,Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_OK);
mesf.run();
}else{
Gtk::MessageDialog mesf=Gtk::MessageDialog("Compile fail",false,Gtk::MessageType::MESSAGE_ERROR, Gtk::ButtonsType::BUTTONS_OK);
mesf.run();
}
}
2020-05-16 20:52:10 +02:00
}
2020-06-03 18:59:39 +02:00