From: Linus Torvalds Date: Sat, 24 Sep 2011 22:48:13 +0000 (-0700) Subject: Add an 'About' dialog X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=commitdiff_plain;h=d81553e1514e158f59c1d7aba6ece46de9764163 Add an 'About' dialog It's really just about the logo, but whatever. Dirk tells me I need one of these in order to call it 1.0. And I'm not going to fall into the trap of thinking that 1.0 needs to be something polished, it just needs to be working well enough.. Signed-off-by: Linus Torvalds --- diff --git a/gtk-gui.c b/gtk-gui.c index 4b994d1..7c8e364 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -338,9 +338,32 @@ static void renumber_dialog(GtkWidget *w, gpointer data) gtk_widget_destroy(dialog); } +static void about_dialog(GtkWidget *w, gpointer data) +{ + const char *logo_property = NULL; + GdkPixbuf *logo = NULL; + GtkWidget *image = gtk_image_new_from_file("icon.svg"); + + if (image) { + logo = gtk_image_get_pixbuf(GTK_IMAGE(image)); + logo_property = "logo"; + } + + gtk_show_about_dialog(NULL, + "program-name", "SubSurface", + "comments", "Half-arsed divelog software in C", + "license", "GPLv2", + "version", "1.0", + "copyright", "Linus Torvalds 2011", + /* Must be last: */ + logo_property, logo, + NULL); +} + static GtkActionEntry menu_items[] = { { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL}, { "LogMenuAction", GTK_STOCK_FILE, "Log", NULL, NULL, NULL}, + { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL}, { "OpenFile", GTK_STOCK_OPEN, NULL, "O", NULL, G_CALLBACK(file_open) }, { "SaveFile", GTK_STOCK_SAVE, NULL, "S", NULL, G_CALLBACK(file_save) }, { "Print", GTK_STOCK_PRINT, NULL, "P", NULL, G_CALLBACK(do_print) }, @@ -348,6 +371,7 @@ static GtkActionEntry menu_items[] = { { "Preferences", NULL, "Preferences", NULL, NULL, G_CALLBACK(preferences_dialog) }, { "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) }, { "Quit", GTK_STOCK_QUIT, NULL, "Q", NULL, G_CALLBACK(quit) }, + { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) }, }; static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); @@ -368,6 +392,9 @@ static const gchar* ui_string = " \ \ \ \ + \ + \ + \ \ \ ";