[gnome-applets/wip/muktupavels/help-about] battstat: use gp_applet_show_about



commit c507ee0b3845b80bcb2f330c409ce059ffcd2b25
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 31 22:10:23 2020 +0300

    battstat: use gp_applet_show_about

 gnome-applets/battstat/battstat-applet.c | 78 +++++++++++++++++---------------
 gnome-applets/battstat/battstat-applet.h |  2 +
 gnome-applets/ga-module.c                |  3 ++
 3 files changed, 47 insertions(+), 36 deletions(-)
---
diff --git a/gnome-applets/battstat/battstat-applet.c b/gnome-applets/battstat/battstat-applet.c
index 485b5a746..20c6df816 100644
--- a/gnome-applets/battstat/battstat-applet.c
+++ b/gnome-applets/battstat/battstat-applet.c
@@ -1115,42 +1115,7 @@ about_cb (GSimpleAction *action,
           GVariant      *parameter,
           gpointer       user_data)
 {
-  ProgressData *battstat = (ProgressData *) user_data;
-  const gchar *authors[] = {
-    "J\xC3\xB6rgen Pehrson <jp spektr eu org>", 
-    "Lennart Poettering <lennart poettering de> (Linux ACPI support)",
-    "Seth Nickell <snickell stanford edu> (GNOME2 port)",
-    "Davyd Madeley <davyd madeley id au>",
-    "Ryan Lortie <desrt desrt ca>",
-    "Joe Marcus Clarke <marcus FreeBSD org> (FreeBSD ACPI support)",
-    NULL
-   };
-
-  const gchar *documenters[] = {
-    "J\xC3\xB6rgen Pehrson <jp spektr eu org>",
-    "Trevor Curtis <tcurtis somaradio ca>",
-    "Davyd Madeley <davyd madeley id au>",
-    NULL
-  };
-
-  char *comments = g_strdup_printf ("%s\n\n%s",
-                 _("This utility shows the status of your laptop battery."),
-                 _("upower backend enabled.")
-                 );
-
-  gtk_show_about_dialog( NULL,
-    "version",             VERSION,
-    "copyright",           "\xC2\xA9 2000 The Gnulix Society, "
-                           "\xC2\xA9 2002-2005 Free Software Foundation and "
-                           "others",
-    "comments",            comments,
-    "authors",             authors,
-    "documenters",         documenters,
-    "translator-credits",  _("translator-credits"),
-    "logo-icon-name",      "battery",
-    NULL );
-
-  g_free (comments);
+  gp_applet_show_about (GP_APPLET (user_data));
 }
 
 /* Rotate text on side panels.  Called on initial startup and when the
@@ -1572,3 +1537,44 @@ battstat_applet_init (BattstatApplet *self)
 {
   gp_applet_set_flags (GP_APPLET (self), GP_APPLET_FLAGS_EXPAND_MINOR);
 }
+
+void
+battstat_applet_setup_about (GtkAboutDialog *dialog)
+{
+  char *comments;
+
+  gtk_about_dialog_set_version (dialog, VERSION);
+  gtk_about_dialog_set_logo_icon_name (dialog, "battery");
+  gtk_about_dialog_set_copyright (dialog, "\xC2\xA9 2000 The Gnulix Society, "
+                                          "\xC2\xA9 2002-2005 Free Software Foundation and "
+                                          "others");
+  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+
+  gtk_about_dialog_set_program_name (dialog, _("Battery Charge Monitor"));
+
+  comments = g_strdup_printf ("%s\n\n%s",
+                              _("This utility shows the status of your laptop battery."),
+                              _("upower backend enabled."));
+
+  gtk_about_dialog_set_comments (dialog, comments);
+  g_free (comments);
+
+  gtk_about_dialog_set_authors (dialog,
+                                (const char * []) {
+                                  "J\xC3\xB6rgen Pehrson <jp spektr eu org>",
+                                  "Lennart Poettering <lennart poettering de> (Linux ACPI support)",
+                                  "Seth Nickell <snickell stanford edu> (GNOME2 port)",
+                                  "Davyd Madeley <davyd madeley id au>",
+                                  "Ryan Lortie <desrt desrt ca>",
+                                  "Joe Marcus Clarke <marcus FreeBSD org> (FreeBSD ACPI support)",
+                                  NULL
+                                });
+
+  gtk_about_dialog_set_documenters (dialog,
+                                    (const char * []) {
+                                      "J\xC3\xB6rgen Pehrson <jp spektr eu org>",
+                                      "Trevor Curtis <tcurtis somaradio ca>",
+                                      "Davyd Madeley <davyd madeley id au>",
+                                      NULL
+                                    });
+}
diff --git a/gnome-applets/battstat/battstat-applet.h b/gnome-applets/battstat/battstat-applet.h
index 2a4768b8c..043e10621 100644
--- a/gnome-applets/battstat/battstat-applet.h
+++ b/gnome-applets/battstat/battstat-applet.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (BattstatApplet, battstat_applet,
                       BATTSTAT, APPLET, GpApplet)
 
+void battstat_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 676915677..43f52dbfe 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -76,6 +76,9 @@ ga_get_applet_info (const char *id)
       name = _("Battery Charge Monitor");
       description = _("Monitor a laptop's remaining power");
       icon_name = "battery";
+
+      about_func = battstat_applet_setup_about;
+      help_uri = "help:battstat";
     }
   else if (g_strcmp0 (id, "brightness") == 0)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]