summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-24 15:48:13 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-24 15:48:13 -0700
commitd81553e1514e158f59c1d7aba6ece46de9764163 (patch)
treee20eb07fdda2699183635e6840329f46b01357e5
parentf12684dcd7f40651c2480be758c9d3b34ef19a6e (diff)
downloadsubsurface-d81553e1514e158f59c1d7aba6ece46de9764163.tar.gz
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 <torvalds@linux-foundation.org>
-rw-r--r--gtk-gui.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 4b994d17c..7c8e36423 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, "<control>O", NULL, G_CALLBACK(file_open) },
{ "SaveFile", GTK_STOCK_SAVE, NULL, "<control>S", NULL, G_CALLBACK(file_save) },
{ "Print", GTK_STOCK_PRINT, NULL, "<control>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, "<control>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 = " \
<menu name=\"LogMenu\" action=\"LogMenuAction\"> \
<menuitem name=\"Renumber\" action=\"Renumber\" /> \
</menu> \
+ <menu name=\"Help\" action=\"HelpMenuAction\"> \
+ <menuitem name=\"About\" action=\"About\" /> \
+ </menu> \
</menubar> \
</ui> \
";