[gnome-applets/wip/muktupavels/help-about: 17/19] accessx-status: use gp_applet_show_about



commit 6412da43555906d2f8d2233ca67a022c0aebbff6
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 31 21:34:13 2020 +0300

    accessx-status: use gp_applet_show_about

 .../accessx-status/accessx-status-applet.c         | 53 +++++++++++++---------
 .../accessx-status/accessx-status-applet.h         |  2 +
 gnome-applets/ga-module.c                          |  6 +++
 3 files changed, 39 insertions(+), 22 deletions(-)
---
diff --git a/gnome-applets/accessx-status/accessx-status-applet.c 
b/gnome-applets/accessx-status/accessx-status-applet.c
index e7dd6f1a7..6c04f29ba 100644
--- a/gnome-applets/accessx-status/accessx-status-applet.c
+++ b/gnome-applets/accessx-status/accessx-status-applet.c
@@ -186,28 +186,7 @@ about_cb (GSimpleAction *action,
           GVariant      *parameter,
           gpointer       user_data)
 {
-        static const gchar *authors [] = {
-               "Calum Benson <calum benson sun com>",
-               "Bill Haneman <bill haneman sun com>",
-               NULL
-       };
-
-       const gchar *documenters[] = {
-               "Bill Haneman <bill haneman sun com>",
-                "Sun GNOME Documentation Team <gdocteam sun com>",
-               NULL
-       };
-       
-       gtk_show_about_dialog (NULL,
-               "version",      VERSION,
-               "comments",     _("Shows the state of AccessX features such "
-                                 "as latched modifiers"),
-               "copyright",    "\xC2\xA9 2003 Sun Microsystems",
-               "authors",      authors,
-               "documenters",  documenters,
-               "translator-credits",   _("translator-credits"),
-               "logo-icon-name",       "ax-applet",
-               NULL);
+  gp_applet_show_about (GP_APPLET (user_data));
 }
 
 static void
@@ -1303,3 +1282,33 @@ accessx_status_applet_init (AccessxStatusApplet *self)
 
   gdk_window_add_filter (NULL, accessx_status_xkb_filter, self);
 }
+
+void
+accessx_status_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comment;
+
+  gtk_about_dialog_set_version (dialog, VERSION);
+  gtk_about_dialog_set_logo_icon_name (dialog, "ax-applet");
+  gtk_about_dialog_set_copyright (dialog, "\xC2\xA9 2003 Sun Microsystems");
+  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+
+  gtk_about_dialog_set_program_name (dialog, _("Keyboard Accessibility Status"));
+
+  comment = _("Shows the state of AccessX features such as latched modifiers");
+  gtk_about_dialog_set_comments (dialog, comment);
+
+  gtk_about_dialog_set_authors (dialog,
+                                (const char * []) {
+                                  "Calum Benson <calum benson sun com>",
+                                  "Bill Haneman <bill haneman sun com>",
+                                  NULL
+                                });
+
+  gtk_about_dialog_set_documenters (dialog,
+                                    (const char * []) {
+                                      "Bill Haneman <bill haneman sun com>",
+                                      "Sun GNOME Documentation Team <gdocteam sun com>",
+                                      NULL
+                                    });
+}
diff --git a/gnome-applets/accessx-status/accessx-status-applet.h 
b/gnome-applets/accessx-status/accessx-status-applet.h
index 949a9b930..0a83a8a45 100644
--- a/gnome-applets/accessx-status/accessx-status-applet.h
+++ b/gnome-applets/accessx-status/accessx-status-applet.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (AccessxStatusApplet, accessx_status_applet,
                       ACCESSX_STATUS, APPLET, GpApplet)
 
+void accessx_status_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index cf0eb1823..676915677 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -53,9 +53,11 @@ ga_get_applet_info (const char *id)
   const char *name;
   const char *description;
   const char *icon_name;
+  GpAboutDialogFunc about_func;
   const char *help_uri;
   GpAppletInfo *info;
 
+  about_func = NULL;
   help_uri = NULL;
 
   if (g_strcmp0 (id, "accessx-status") == 0)
@@ -65,6 +67,7 @@ ga_get_applet_info (const char *id)
       description = _("Shows the status of keyboard accessibility features");
       icon_name = "ax-applet";
 
+      about_func = accessx_status_applet_setup_about;
       help_uri = "help:accessx-status";
     }
   else if (g_strcmp0 (id, "battstat") == 0)
@@ -212,6 +215,9 @@ ga_get_applet_info (const char *id)
 
   info = gp_applet_info_new (type_func, name, description, icon_name);
 
+  if (about_func != NULL)
+    gp_applet_info_set_about_dialog (info, about_func);
+
   if (help_uri != NULL)
     gp_applet_info_set_help_uri (info, help_uri);
 


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