[gnome-applets/wip/muktupavels/help-about: 4/9] brightness: 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: 4/9] brightness: use gp_applet_show_about
- Date: Fri, 3 Apr 2020 01:50:49 +0000 (UTC)
commit 2fb5af84e41e5ba294c1350fab67ccf97449ed6c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Apr 3 03:55:29 2020 +0300
brightness: use gp_applet_show_about
gnome-applets/brightness/brightness-applet.c | 106 ++++++++++++---------------
gnome-applets/brightness/brightness-applet.h | 2 +
gnome-applets/ga-module.c | 2 +
3 files changed, 52 insertions(+), 58 deletions(-)
---
diff --git a/gnome-applets/brightness/brightness-applet.c b/gnome-applets/brightness/brightness-applet.c
index dd54258c6..26c811ac7 100644
--- a/gnome-applets/brightness/brightness-applet.c
+++ b/gnome-applets/brightness/brightness-applet.c
@@ -59,8 +59,6 @@ static void gpm_applet_update_tooltip (GpmBrightnessApplet *applet);
#define GPM_BRIGHTNESS_APPLET_ICON_BRIGHTNESS "gpm-brightness-lcd"
#define GPM_BRIGHTNESS_APPLET_ICON_DISABLED "gpm-brightness-lcd-disabled"
#define GPM_BRIGHTNESS_APPLET_ICON_INVALID "gpm-brightness-lcd-invalid"
-#define GPM_BRIGHTNESS_APPLET_NAME _("Brightness Applet")
-#define GPM_BRIGHTNESS_APPLET_DESC _("Adjusts laptop panel brightness.")
/**
* gpm_applet_get_brightness:
@@ -597,64 +595,12 @@ gpm_applet_popup_cb (GpmBrightnessApplet *applet, GdkEventButton *event)
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_BRIGHTNESS_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_("Brightness 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_("Brightness 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_BRIGHTNESS_APPLET_NAME);
- gtk_about_dialog_set_version (about, VERSION);
- gtk_about_dialog_set_copyright (about, _("Copyright \xc2\xa9 2006 Benjamin Canou"));
- gtk_about_dialog_set_comments (about, GPM_BRIGHTNESS_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 [] =
@@ -822,3 +768,47 @@ gpm_brightness_applet_init (GpmBrightnessApplet *applet)
g_signal_connect (G_OBJECT(applet), "destroy",
G_CALLBACK(gpm_applet_destroy_cb), NULL);
}
+
+void
+gpm_brightness_applet_setup_about (GtkAboutDialog *dialog)
+{
+ const char *comments;
+ const char **authors;
+ const char *license;
+ const char *copyright;
+
+ comments = _("Adjusts laptop panel brightness.");
+
+ 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"
+
+ "Brightness 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"
+
+ "Brightness 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\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.\n");
+
+ copyright = _("Copyright \xc2\xa9 2006 Benjamin Canou");
+
+ gtk_about_dialog_set_comments (dialog, comments);
+
+ gtk_about_dialog_set_authors (dialog, authors);
+ gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+ gtk_about_dialog_set_license (dialog, license);
+ gtk_about_dialog_set_copyright (dialog, copyright);
+}
diff --git a/gnome-applets/brightness/brightness-applet.h b/gnome-applets/brightness/brightness-applet.h
index 358c92f1a..2bd9f67e2 100644
--- a/gnome-applets/brightness/brightness-applet.h
+++ b/gnome-applets/brightness/brightness-applet.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GpmBrightnessApplet, gpm_brightness_applet,
GPM, BRIGHTNESS_APPLET, GpApplet)
+void gpm_brightness_applet_setup_about (GtkAboutDialog *dialog);
+
G_END_DECLS
#endif
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 43f52dbfe..81b5d970a 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -86,6 +86,8 @@ ga_get_applet_info (const char *id)
name = _("Brightness Applet");
description = _("Adjusts Laptop panel brightness");
icon_name = "gnome-brightness-applet";
+
+ about_func = gpm_brightness_applet_setup_about;
}
else if (g_strcmp0 (id, "charpick") == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]