From 919f39972c45a501606680fb6f6c1fe5a6b8a27c Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 16 Feb 2020 11:33:30 +0100 Subject: Use gtk_show_about_dialog to show about dialog --- applets/inhibit/inhibit-applet.c | 79 +++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 46 deletions(-) (limited to 'applets/inhibit/inhibit-applet.c') diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c index ed10c95..23087ef 100644 --- a/applets/inhibit/inhibit-applet.c +++ b/applets/inhibit/inhibit-applet.c @@ -273,68 +273,55 @@ gpm_applet_click_cb (GpmInhibitApplet *applet, GdkEventButton *event) static void gpm_applet_dialog_about_cb (GtkAction *action, gpointer data) { - GtkAboutDialog *about; - - GdkPixbuf *logo = - gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - GPM_INHIBIT_APPLET_ICON_INHIBIT, - 128, 0, NULL); - static const gchar *authors[] = { "Benjamin Canou ", "Richard Hughes ", NULL }; - char copyright[] = \ - "Copyright \xc2\xa9 2012-2020 MATE developers\n" - "Copyright \xc2\xa9 2006-2007 Richard Hughes"; - const char *documenters [] = { NULL }; + const char *license[] = { - N_("Licensed under the GNU General Public License Version 2"), - N_("Power Manager is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU General Public License\n" - "as published by the Free Software Foundation; either version 2\n" + N_("Power Manager 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_("Power Manager is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details."), - N_("You should have received a copy of the GNU General Public License\n" - "along with this program; if not, write to the Free Software\n" - "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n" - "02110-1301, USA.") - }; - const char *translator_credits = NULL; - char *license_trans; - - license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", - _(license[2]), "\n\n", _(license[3]), "\n", NULL); - - about = (GtkAboutDialog*) gtk_about_dialog_new (); - gtk_about_dialog_set_program_name (about, GPM_INHIBIT_APPLET_NAME); - gtk_about_dialog_set_version (about, VERSION); - gtk_about_dialog_set_copyright (about, copyright); - gtk_about_dialog_set_comments (about, GPM_INHIBIT_APPLET_DESC); - gtk_about_dialog_set_authors (about, authors); - gtk_about_dialog_set_documenters (about, documenters); - gtk_about_dialog_set_translator_credits (about, translator_credits); - gtk_about_dialog_set_logo (about, logo); - gtk_about_dialog_set_license (about, license_trans); - gtk_about_dialog_set_website (about, "https://mate-desktop.org/"); - gtk_window_set_icon_name (GTK_WINDOW (about), GPM_INHIBIT_APPLET_ICON_INHIBIT); + N_("Power Manager 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.") , - g_signal_connect (G_OBJECT(about), "response", - G_CALLBACK(gtk_widget_destroy), NULL); + N_("You 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.") + }; - gtk_widget_show (GTK_WIDGET(about)); + char *license_trans; + + license_trans = g_strjoin("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL); + + gtk_show_about_dialog (NULL, + "program-name", GPM_INHIBIT_APPLET_NAME, + "version", VERSION, + "title", _("About Power Manager Inhibit Applet"), + "comments", GPM_INHIBIT_APPLET_DESC, + "copyright", _("Copyright \xC2\xA9 2006-2007 Richard Hughes\n" + "Copyright \xC2\xA9 2011-2020 MATE developers"), + "icon-name", GPM_INHIBIT_APPLET_ICON_INHIBIT, + "logo-icon-name", GPM_INHIBIT_APPLET_ICON_INHIBIT, + "license", license_trans, + "authors", authors, + "documenters", documenters, + "translator-credits", _("translator-credits"), + "wrap-license", TRUE, + "website", "https://mate-desktop.org", + NULL); g_free (license_trans); - g_object_unref (logo); } /** -- cgit v1.2.1