[gnome-applets/wip/muktupavels/help-about] inhibit: use gp_applet_show_about
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/muktupavels/help-about] inhibit: use gp_applet_show_about
- Date: Fri, 3 Apr 2020 14:24:21 +0000 (UTC)
commit ff91d80fc1ff8efebcb550e0f7797866bc90ff4c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Apr 3 15:58:07 2020 +0300
inhibit: use gp_applet_show_about
gnome-applets/ga-module.c | 2 +
gnome-applets/inhibit/inhibit-applet.c | 106 +++++++++++++++------------------
gnome-applets/inhibit/inhibit-applet.h | 2 +
3 files changed, 52 insertions(+), 58 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 1db65080e..6ed326cd7 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -156,6 +156,8 @@ ga_get_applet_info (const char *id)
name = _("Inhibit Applet");
description = _("Allows user to inhibit automatic power saving");
icon_name = "gnome-inhibit-applet";
+
+ about_func = inhibit_applet_setup_about;
}
else if (g_strcmp0 (id, "mini-commander") == 0)
{
diff --git a/gnome-applets/inhibit/inhibit-applet.c b/gnome-applets/inhibit/inhibit-applet.c
index 2c67ff84f..9cd5ecfed 100644
--- a/gnome-applets/inhibit/inhibit-applet.c
+++ b/gnome-applets/inhibit/inhibit-applet.c
@@ -50,12 +50,10 @@ struct _InhibitApplet
G_DEFINE_TYPE (InhibitApplet, inhibit_applet, GP_TYPE_APPLET)
-#define GPM_INHIBIT_APPLET_ICON "gnome-inhibit-applet"
#define GPM_INHIBIT_APPLET_ICON_INHIBIT "gpm-inhibit"
#define GPM_INHIBIT_APPLET_ICON_INVALID "gpm-inhibit-invalid"
#define GPM_INHIBIT_APPLET_ICON_UNINHIBIT "gpm-uninhibit"
#define GPM_INHIBIT_APPLET_NAME _("Inhibit Applet")
-#define GPM_INHIBIT_APPLET_DESC _("Allows user to inhibit automatic power saving.")
/** cookie is returned as an unsigned integer */
static gboolean
@@ -244,64 +242,12 @@ gpm_applet_click_cb (InhibitApplet *applet,
return TRUE;
}
-/**
- * gpm_applet_dialog_about_cb:
- *
- * displays about dialog
- **/
static void
-gpm_applet_dialog_about_cb (GSimpleAction *action, GVariant *parameter, gpointer data)
+gpm_applet_dialog_about_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GtkAboutDialog *about;
-
- GdkPixbuf *logo =
- gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- GPM_INHIBIT_APPLET_ICON,
- 128, 0, NULL);
-
- static const gchar *authors[] = {
- "Benjamin Canou <bookeldor gmail com>",
- "Richard Hughes <richard hughsie com>",
- NULL
- };
- const char *license[] = {
- N_("Licensed under the GNU General Public License Version 2"),
- N_("Inhibit Applet 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"
- "of the License, or (at your option) any later version."),
- N_("Inhibit Applet 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 \xc2\xa9 2006-2007 Richard Hughes"));
- gtk_about_dialog_set_comments (about, GPM_INHIBIT_APPLET_DESC);
- gtk_about_dialog_set_authors (about, authors);
- gtk_about_dialog_set_translator_credits (about, translator_credits);
- gtk_about_dialog_set_logo (about, logo);
- gtk_about_dialog_set_license (about, license_trans);
-
- g_signal_connect (G_OBJECT(about), "response",
- G_CALLBACK(gtk_widget_destroy), NULL);
-
- gtk_widget_show (GTK_WIDGET(about));
-
- g_free (license_trans);
- g_object_unref (logo);
+ gp_applet_show_about (GP_APPLET (user_data));
}
static const GActionEntry menu_actions[] =
@@ -437,3 +383,47 @@ inhibit_applet_init (InhibitApplet *applet)
g_signal_connect (G_OBJECT(applet), "size-allocate",
G_CALLBACK(gpm_applet_size_allocate_cb), NULL);
}
+
+void
+inhibit_applet_setup_about (GtkAboutDialog *dialog)
+{
+ const char *comments;
+ const char **authors;
+ const char *license;
+ const char *copyright;
+
+ comments = _("Allows user to inhibit automatic power saving.");
+
+ authors = (const char *[])
+ {
+ "Benjamin Canou <bookeldor gmail com>",
+ "Richard Hughes <richard hughsie com>",
+ NULL
+ };
+
+ license = _("Licensed under the GNU General Public License Version 2\n\n"
+
+ "Inhibit Applet 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"
+ "of the License, or (at your option) any later version.\n\n"
+
+ "Inhibit Applet 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."
+
+ "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.\n");
+
+ copyright = _("Copyright \xc2\xa9 2006-2007 Richard Hughes");
+
+ gtk_about_dialog_set_comments (dialog, comments);
+
+ gtk_about_dialog_set_authors (dialog, authors);
+ gtk_about_dialog_set_license (dialog, license);
+ gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+ gtk_about_dialog_set_copyright (dialog, copyright);
+}
diff --git a/gnome-applets/inhibit/inhibit-applet.h b/gnome-applets/inhibit/inhibit-applet.h
index 3377e4fa5..c61c85b90 100644
--- a/gnome-applets/inhibit/inhibit-applet.h
+++ b/gnome-applets/inhibit/inhibit-applet.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (InhibitApplet, inhibit_applet,
INHIBIT, APPLET, GpApplet)
+void inhibit_applet_setup_about (GtkAboutDialog *dialog);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]