diff options
author | rbuj <[email protected]> | 2020-02-16 11:33:30 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-02-25 14:19:26 +0100 |
commit | 919f39972c45a501606680fb6f6c1fe5a6b8a27c (patch) | |
tree | 31e46a088dcfadf0ac164d79f859942b51c5be66 /applets | |
parent | 9da203a35c72d7212d99512b735730267200e810 (diff) | |
download | mate-power-manager-919f39972c45a501606680fb6f6c1fe5a6b8a27c.tar.bz2 mate-power-manager-919f39972c45a501606680fb6f6c1fe5a6b8a27c.tar.xz |
Use gtk_show_about_dialog to show about dialog
Diffstat (limited to 'applets')
-rw-r--r-- | applets/brightness/brightness-applet.c | 77 | ||||
-rw-r--r-- | applets/inhibit/inhibit-applet.c | 79 |
2 files changed, 65 insertions, 91 deletions
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 <[email protected]>", "Richard Hughes <[email protected]>", 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); } /** 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 <[email protected]>", "Richard Hughes <[email protected]>", 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); } /** |