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/brightness/brightness-applet.c | 77 ++++++++++++++-------------------- 1 file changed, 32 insertions(+), 45 deletions(-) (limited to 'applets/brightness') diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c index 37d3c40..240cff8 100644 --- a/applets/brightness/brightness-applet.c +++ b/applets/brightness/brightness-applet.c @@ -776,68 +776,55 @@ gpm_applet_stop_scroll_events_cb (GtkWidget *widget, GdkEvent *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_BRIGHTNESS_APPLET_ICON, - 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 Benjamin Canou"; - 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" + + 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."), - 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" + + 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.") }; - 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_BRIGHTNESS_APPLET_NAME); - gtk_about_dialog_set_version (about, VERSION); - gtk_about_dialog_set_copyright (about, copyright); - gtk_about_dialog_set_comments (about, GPM_BRIGHTNESS_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_BRIGHTNESS_APPLET_ICON); - - g_signal_connect (G_OBJECT(about), "response", - G_CALLBACK(gtk_widget_destroy), NULL); - 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_BRIGHTNESS_APPLET_NAME, + "version", VERSION, + "title", _("About Power Manager Brightness Applet"), + "comments", GPM_BRIGHTNESS_APPLET_DESC, + "copyright", _("Copyright \xC2\xA9 2006 Benjamin Canou\n" + "Copyright \xC2\xA9 2011-2020 MATE developers"), + "icon-name", GPM_BRIGHTNESS_APPLET_ICON, + "logo-icon-name", GPM_BRIGHTNESS_APPLET_ICON, + "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