diff pkui-icon.c @ 18:9537882d759f

add an about dialog
author Guido Berhoerster <guido@berhoerster.name>
date Thu, 20 Oct 2011 13:03:37 +0200
parents 64f05992d8ec
children 38b37e4a4d63
line wrap: on
line diff
--- a/pkui-icon.c	Thu Oct 20 12:20:14 2011 +0200
+++ b/pkui-icon.c	Thu Oct 20 13:03:37 2011 +0200
@@ -98,6 +98,44 @@
 }
 
 static void
+about_dialog_show(GtkMenuItem *item, gpointer user_data)
+{
+	static const gchar *copyright = "Copyright \xc2\xa9 2011 Guido "
+	    "Berhoerster\nCopyright \xc2\xa9 2011 Pavol Rusnak\n";
+	static const gchar *authors[3] = {
+	    "Guido Berhoerster <gber@opensuse.org>",
+	    "Pavol Rusnak <stick@gk2.sk>",
+	    NULL
+	};
+	static const gchar *documenters[2] = {
+	    "Guido Berhoerster <gber@opensuse.org>",
+	    NULL
+	};
+	static const gchar *license =
+	    "Licensed under the GNU General Public License Version 2\n\nThis "
+	    "program is free software; you can redistribute it and/or modify it"
+	    " under the terms of the GNU General Public License as published by"
+	    " the Free Software Foundation; either version 2 of the License, or"
+	    " (at your option) any later version.\n\nThis program is "
+	    "distributed in the hope that it will be useful, but WITHOUT ANY "
+	    "WARRANTY; without even the implied warranty of MERCHANTABILITY or "
+	    "FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public "
+	    "License for more details.\n\nYou should have received a copy of "
+	    "the GNU General Public License along with this program; if not, "
+	    "write to the Free Software Foundation, Inc., 51 Franklin Street, "
+	    "Fifth Floor, Boston, MA 02110-1301 USA.";
+	const gchar *translators = _("translators");
+
+	if (strcmp(translators, "translators") == 0)
+	    translators = NULL;
+
+	gtk_show_about_dialog (NULL, "version", "0.1", "copyright", copyright,
+	    "authors", authors, "documenters", documenters,
+	    "translator-credits", translators, "license", license,
+	    "wrap-license", TRUE, NULL);
+}
+
+static void
 backend_check_now(GtkMenuItem *menu_item, gpointer user_data)
 {
 	PkuiIcon	*self = PKUI_ICON(user_data);
@@ -122,6 +160,14 @@
 	g_signal_connect(G_OBJECT(item), "activate",
 	    G_CALLBACK(backend_check_now), self);
 
+	item = gtk_image_menu_item_new_with_mnemonic(_("_About"));
+	image = gtk_image_new_from_icon_name(GTK_STOCK_ABOUT,
+	    GTK_ICON_SIZE_MENU);
+	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
+	gtk_menu_shell_append(GTK_MENU_SHELL(popup_menu), item);
+	g_signal_connect(G_OBJECT(item), "activate",
+	    G_CALLBACK(about_dialog_show), self);
+
 	gtk_widget_show_all(GTK_WIDGET(popup_menu));
 
 	return (popup_menu);