Add About window

This commit is contained in:
daleclack 2022-01-28 17:10:54 +08:00
parent 4cb0dfaa74
commit ad377527eb
4 changed files with 81 additions and 33 deletions

View File

@ -4,6 +4,7 @@
<section>
<item>
<attribute name="label">About My GtkUI Mac version</attribute>
<attribute name="action">win.about</attribute>
</item>
<item>
<attribute name="label">Software Update...</attribute>

View File

@ -18,6 +18,7 @@ MyWin::MyWin()
// Add Action for menus
add_action("logout", sigc::mem_fun(*this, &MyWin::logout_activated));
add_action("quit", sigc::mem_fun(*this, &MyWin::quit_activated));
add_action("about",sigc::mem_fun(*this,&MyWin::about_activated));
// Add Stack
m_overlay.add_overlay(*(main_stack.stack));
@ -38,16 +39,61 @@ MyWin::MyWin()
show_all_children();
}
void MyWin::press(int n_press,double x,double y){
void MyWin::press(int n_press, double x, double y)
{
// Show Menu
context_menu.set_pointing_to(Gdk::Rectangle((int)x, (int)y, 1, 1));
context_menu.popup();
}
void MyWin::logout_activated(){
void MyWin::logout_activated()
{
main_stack.logout();
}
void MyWin::quit_activated(){
void MyWin::about_activated()
{
// Authors information
const char *authors[] = {
"Dale Clack",
"GCR_CMake on github https://github.com/Makman2/GCR_CMake",
NULL};
//Version information
char *version;
version = g_strdup_printf("5.0\nRunning Against: Gtkmm %d.%d.%d",
GTKMM_MAJOR_VERSION,
GTKMM_MINOR_VERSION,
GTKMM_MICRO_VERSION);
// Get Year information
time_t t;
t=time(NULL);
struct tm * local;
local = localtime(&t);
//Copyright
char * copyright;
copyright = g_strdup_printf("©2019—%04d The Xe Project",local->tm_year+1900);
//Show the about dialog
gtk_show_about_dialog(GTK_WINDOW(gobj()),
"program-name", "My_GtkUI",
"version", version,
"copyright", copyright,
"comments", "A program that simulates desktop (Mac Version)",
"authors", authors,
"license-type", GTK_LICENSE_GPL_3_0,
"logo-icon-name", "My_GtkUI",
"title", "About My GtkUI Mac Version",
NULL);
//Free Memory
g_free(version);
g_free(copyright);
}
void MyWin::quit_activated()
{
hide();
}

View File

@ -23,5 +23,6 @@ private:
//Signal Handlers
void logout_activated();
void quit_activated();
void about_activated();
};