[gnome-applets/wip/muktupavels/help-about: 8/9] cpufreq: use gp_applet_show_about



commit 3b9c2c92f68465f5279c32f5a3293d4f6d4f9859
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 04:41:54 2020 +0300

    cpufreq: use gp_applet_show_about

 gnome-applets/cpufreq/cpufreq-applet.c | 71 +++++++++++++++++++++-------------
 gnome-applets/cpufreq/cpufreq-applet.h |  2 +
 gnome-applets/ga-module.c              |  2 +
 3 files changed, 48 insertions(+), 27 deletions(-)
---
diff --git a/gnome-applets/cpufreq/cpufreq-applet.c b/gnome-applets/cpufreq/cpufreq-applet.c
index a32425159..becfc21db 100644
--- a/gnome-applets/cpufreq/cpufreq-applet.c
+++ b/gnome-applets/cpufreq/cpufreq-applet.c
@@ -612,34 +612,10 @@ cpufreq_applet_help_cb (GSimpleAction *action,
 
 static void
 cpufreq_applet_about_cb (GSimpleAction *action,
-                        GVariant      *parameter,
-                        gpointer       user_data)
+                         GVariant      *parameter,
+                         gpointer       user_data)
 {
-        static const gchar *const authors[] = {
-                "Carlos Garcia Campos <carlosgc gnome org>",
-                NULL
-        };
-        static const gchar *const documenters[] = {
-                "Carlos Garcia Campos <carlosgc gnome org>",
-                "Davyd Madeley <davyd madeley id au>",
-                NULL
-        };
-        static const gchar *const artists[] = {
-                "Pablo Arroyo Loma <zzioma yahoo es>",
-                NULL
-        };
-
-        gtk_show_about_dialog (NULL,
-                               "version",       VERSION,
-                               "copyright",     "\xC2\xA9 2004 Carlos Garcia Campos",
-                               "comments",      _("This utility shows the current CPU "
-                                                  "Frequency Scaling."),
-                               "authors",       authors,
-                               "documenters",   documenters,
-                               "artists",       artists, 
-                               "translator-credits",    _("translator-credits"),
-                              "logo-icon-name",        "gnome-cpu-frequency-applet",
-                               NULL);
+  gp_applet_show_about (GP_APPLET (user_data));
 }
 
 static void
@@ -999,3 +975,44 @@ cpufreq_applet_setup (CPUFreqApplet *applet)
 
        gtk_widget_show (GTK_WIDGET (applet));
 }
+
+void
+cpufreq_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comments;
+  const char **authors;
+  const char **documenters;
+  const char **artists;
+  const char *copyright;
+
+  comments = _("This utility shows the current CPU Frequency Scaling.");
+
+  authors = (const char *[])
+    {
+      "Carlos Garcia Campos <carlosgc gnome org>",
+      NULL
+    };
+
+  documenters = (const char *[])
+    {
+      "Carlos Garcia Campos <carlosgc gnome org>",
+      "Davyd Madeley <davyd madeley id au>",
+      NULL
+    };
+
+  artists = (const char *[])
+    {
+      "Pablo Arroyo Loma <zzioma yahoo es>",
+      NULL
+    };
+
+  copyright = "\xC2\xA9 2004 Carlos Garcia Campos";
+
+  gtk_about_dialog_set_comments (dialog, comments);
+
+  gtk_about_dialog_set_authors (dialog, authors);
+  gtk_about_dialog_set_documenters (dialog, documenters);
+  gtk_about_dialog_set_artists (dialog, artists);
+  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+  gtk_about_dialog_set_copyright (dialog, copyright);
+}
diff --git a/gnome-applets/cpufreq/cpufreq-applet.h b/gnome-applets/cpufreq/cpufreq-applet.h
index 2ad7f3e36..40ceb3645 100644
--- a/gnome-applets/cpufreq/cpufreq-applet.h
+++ b/gnome-applets/cpufreq/cpufreq-applet.h
@@ -46,6 +46,8 @@ typedef enum {
 GType    cpufreq_applet_show_mode_get_type      (void) G_GNUC_CONST;
 GType    cpufreq_applet_show_text_mode_get_type (void) G_GNUC_CONST;
 
+void     cpufreq_applet_setup_about             (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif /* CPUFREQ_APPLET_H */
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 2f5245e5a..52ef30cd5 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -115,6 +115,8 @@ ga_get_applet_info (const char *id)
       name = _("CPU Frequency Scaling Monitor");
       description = _("Monitor the CPU Frequency Scaling");
       icon_name = "gnome-cpu-frequency-applet";
+
+      about_func = cpufreq_applet_setup_about;
     }
 #endif
   else if (g_strcmp0 (id, "drivemount") == 0)


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