Add logout feature

This commit is contained in:
daleclack 2021-06-29 21:05:15 +08:00
parent eca6a3d1dd
commit 8787af7d9f
5 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,11 @@
<attribute name='icon'>system</attribute> <attribute name='icon'>system</attribute>
<attribute name='action'>win.size</attribute> <attribute name='action'>win.size</attribute>
</item> </item>
<item>
<attribute name='label'>Log Out</attribute>
<attribute name='icon'>log_out</attribute>
<attribute name='action'>win.logout</attribute>
</item>
<item> <item>
<attribute name='label'>Exit</attribute> <attribute name='label'>Exit</attribute>
<attribute name='icon'>log_out</attribute> <attribute name='icon'>log_out</attribute>

View File

@ -44,3 +44,7 @@ void MyStack::add_stack(Gtk::Box &vbox){
void MyStack::btnlogin_clicked(){ void MyStack::btnlogin_clicked(){
stack->set_visible_child(*main_overlay); stack->set_visible_child(*main_overlay);
} }
void MyStack::logout(){
stack->set_visible_child(*login_overlay);
}

View File

@ -8,6 +8,7 @@ class MyStack{
public: public:
MyStack(Gtk::Window *parent1); MyStack(Gtk::Window *parent1);
void add_stack(Gtk::Box &vbox); void add_stack(Gtk::Box &vbox);
void logout();
Gtk::Stack *stack; Gtk::Stack *stack;
private: private:
//Parent Window //Parent Window

View File

@ -30,6 +30,7 @@ height(450)
add_action("back",sigc::mem_fun(*this,&MyWin::back_dialog)); add_action("back",sigc::mem_fun(*this,&MyWin::back_dialog));
add_action("size",sigc::mem_fun(*this,&MyWin::size_dialog)); add_action("size",sigc::mem_fun(*this,&MyWin::size_dialog));
add_action("about",sigc::mem_fun(*this,&MyWin::about_dialog)); add_action("about",sigc::mem_fun(*this,&MyWin::about_dialog));
add_action("logout",sigc::mem_fun(*this,&MyWin::win_logout));
//Set Popover Menu //Set Popover Menu
popover.bind_model(gmenu); popover.bind_model(gmenu);
@ -148,6 +149,10 @@ void MyWin::about_dialog(){
g_free(version); g_free(version);
} }
void MyWin::win_logout(){
main_stack.logout();
}
void MyWin::win_quit(){ void MyWin::win_quit(){
hide(); hide();
} }

View File

@ -36,5 +36,6 @@ private:
void size_dialog(); void size_dialog();
void change_background(int response); void change_background(int response);
void about_dialog(); void about_dialog();
void win_logout();
void win_quit(); void win_quit();
}; };