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



commit 0785ebac9b9423cc089a992c2780c451a0eea7b0
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 16:46:58 2020 +0300

    timer: use gp_applet_show_about

 gnome-applets/ga-module.c          |  2 ++
 gnome-applets/timer/timer-applet.c | 35 +++++++++++++++++++++++------------
 gnome-applets/timer/timer-applet.h |  2 ++
 3 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 7e13f9bb5..65e821d7d 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -205,6 +205,8 @@ ga_get_applet_info (const char *id)
       name = _("Timer");
       description = _("Start a timer and receive a notification when it is finished");
       icon_name = "gnome-panel-clock";
+
+      about_func = timer_applet_setup_about;
     }
 #ifdef HAVE_TRACKER_SEARCH_BAR
   else if (g_strcmp0 (id, "tracker-search-bar") == 0)
diff --git a/gnome-applets/timer/timer-applet.c b/gnome-applets/timer/timer-applet.c
index c2ae6ee58..8123a718d 100644
--- a/gnome-applets/timer/timer-applet.c
+++ b/gnome-applets/timer/timer-applet.c
@@ -232,20 +232,12 @@ timer_stop_callback (GSimpleAction *action, GVariant *parameter, gpointer data)
     timer_callback (applet);
 }
 
-/* Show the about dialog */
 static void
-timer_about_callback (GSimpleAction *action, GVariant *parameter, gpointer data)
+timer_about_callback (GSimpleAction *action,
+                      GVariant      *parameter,
+                      gpointer       user_data)
 {
-    const char* authors[] = { "Stefano Karapetsas <stefano karapetsas com>", NULL };
-
-    gtk_show_about_dialog(NULL,
-                          "version", VERSION,
-                          "copyright", "Copyright © 2014 Stefano Karapetsas",
-                          "authors", authors,
-                          "comments", _("Start a timer and receive a notification when it is finished"),
-                          "translator-credits", _("translator-credits"),
-                          "logo-icon-name", APPLET_ICON,
-                          NULL);
+  gp_applet_show_about (GP_APPLET (user_data));
 }
 
 /* calculate duration and save in GSettings */
@@ -452,3 +444,22 @@ timer_applet_init (TimerApplet *self)
 
   gp_applet_set_flags (applet, GP_APPLET_FLAGS_EXPAND_MINOR);
 }
+
+void
+timer_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char **authors;
+  const char *copyright;
+
+  authors = (const char *[])
+    {
+      "Stefano Karapetsas <stefano karapetsas com>",
+      NULL
+    };
+
+  copyright = "Copyright © 2014 Stefano Karapetsas";
+
+  gtk_about_dialog_set_authors (dialog, authors);
+  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+  gtk_about_dialog_set_copyright (dialog, copyright);
+}
diff --git a/gnome-applets/timer/timer-applet.h b/gnome-applets/timer/timer-applet.h
index 17ceed0ef..1fe4203fa 100644
--- a/gnome-applets/timer/timer-applet.h
+++ b/gnome-applets/timer/timer-applet.h
@@ -25,6 +25,8 @@ G_BEGIN_DECLS
 #define TIMER_TYPE_APPLET (timer_applet_get_type ())
 G_DECLARE_FINAL_TYPE (TimerApplet, timer_applet, TIMER, APPLET, GpApplet)
 
+void timer_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif


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