ClienteTFG/dialog_add_user.cpp

38 lines
1.2 KiB
C++
Raw Normal View History

2020-05-23 19:59:55 +02:00
#include "dialog_add_user.h"
dialog_add_user::dialog_add_user(Gtk::Window *win, session_manager *sesion)
: Gtk::Dialog("Create user", *win, false),
box_user(Gtk::ORIENTATION_HORIZONTAL), user("user"),
box_pass(Gtk::ORIENTATION_HORIZONTAL), pass("password"),
box_admin(Gtk::ORIENTATION_HORIZONTAL), l_admin("admin permision"),
b_add("create")
{
this->sesion=sesion;
this->entry_pass.set_visibility(false);
this->b_add.signal_clicked().connect(sigc::mem_fun(this,
&dialog_add_user::on_button_clicked));
this->add_elements();
this->show_all_children();
}
void dialog_add_user::on_button_clicked(){
this->sesion->create_user(this->entry_user.get_text(), this->entry_pass.get_text(), this->c_admin.get_active());
this->hide();
}
void dialog_add_user::add_elements(){
this->box_user.add(this->user);
this->box_user.add(this->entry_user);
this->box_pass.add(this->pass);
this->box_pass.add(this->entry_pass);
this->box_admin.add(this->l_admin);
this->box_admin.add(this->c_admin);
this->get_content_area()->add(this->box_user);
this->get_content_area()->add(this->box_pass);
this->get_content_area()->add(this->box_admin);
this->get_content_area()->add(this->b_add);
}