From 08948281857bac280ee743045df1c0dbc140b4cc Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Thu, 24 Apr 2014 20:47:22 +0200 Subject: Add about dialog in tray icon This add dependency on libmate-desktop --- configure.ac | 2 ++ src/gpm-tray-icon.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/configure.ac b/configure.ac index d85e690..15b2343 100644 --- a/configure.ac +++ b/configure.ac @@ -126,6 +126,7 @@ LIBPANEL_REQUIRED=1.5.0 XRANDR_REQUIRED=1.2.0 CANBERRA_REQUIRED=0.10 UPOWER_REQUIRED=0.9.1 +MATE_DESKTOP_REQUIRED=1.9.0 dnl ---------------------------------------------------------------------------- dnl GTK library version @@ -166,6 +167,7 @@ PKG_CHECK_MODULES(DBUS,[ PKG_CHECK_MODULES(MATE, [ gtk+-$GTK_API_VERSION >= $GTK_REQUIRED + mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED cairo >= $CAIRO_REQUIRED]) PKG_CHECK_MODULES(GDK, [ diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index f2c26f7..ec6aea6 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "egg-debug.h" @@ -169,6 +170,37 @@ gpm_tray_icon_show_preferences_cb (GtkMenuItem *item, gpointer data) egg_warning ("Couldn't execute command: %s", command); } +/** + * gpm_tray_icon_show_about_cb: + * @action: A valid GtkAction + **/ +static void +gpm_tray_icon_show_about_cb (GtkMenuItem *item, gpointer data) +{ + const gchar *authors[] = + { + "Perberos", + "Steve Zesch", + "Stefano Karapetsas", + NULL + }; + + mate_show_about_dialog (NULL, + "program-name", _("Power Manager"), + "version", VERSION, + "comments", _("Power management daemon"), + "copyright", _("Copyright \xC2\xA9 2011-2014 MATE developers"), + "authors", authors, + /* Translators should localize the following string + * which will be displayed at the bottom of the about + * box to give credit to the translator(s). + */ + "translator-credits", _("translator-credits"), + "logo-icon-name", "mate-power-manager", + "website", "http://www.mate-desktop.org", + NULL); +} + /** * gpm_tray_icon_popup_cleared_cd: * @widget: The popup Gtkwidget @@ -300,6 +332,12 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon, guint32 timestamp) G_CALLBACK (gpm_tray_icon_show_preferences_cb), icon); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + /* about */ + item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL); + g_signal_connect (G_OBJECT (item), "activate", + G_CALLBACK (gpm_tray_icon_show_about_cb), icon); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + skip_prefs: /* show the menu */ gtk_widget_show_all (GTK_WIDGET (menu)); -- cgit v1.2.1