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



commit fc9e14373ae6e082f4c62d97e8e3c0d5be81da24
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 17:03:40 2020 +0300

    trash: use gp_applet_show_about

 gnome-applets/ga-module.c          |  2 +
 gnome-applets/trash/trash-applet.c | 83 +++++++++++++++++++++-----------------
 gnome-applets/trash/trash-applet.h |  2 +
 3 files changed, 51 insertions(+), 36 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 0e03d8436..cca31eabe 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -225,6 +225,8 @@ ga_get_applet_info (const char *id)
       name = _("Trash");
       description = _("Go to Trash");
       icon_name = "user-trash-full";
+
+      about_func = trash_applet_setup_about;
     }
   else if (g_strcmp0 (id, "window-buttons") == 0)
     {
diff --git a/gnome-applets/trash/trash-applet.c b/gnome-applets/trash/trash-applet.c
index 6eb89f7bb..8c2a26cab 100644
--- a/gnome-applets/trash/trash-applet.c
+++ b/gnome-applets/trash/trash-applet.c
@@ -47,9 +47,6 @@ G_DEFINE_TYPE (TrashApplet, trash_applet, GP_TYPE_APPLET)
 static void trash_applet_do_empty    (GSimpleAction *action,
                                       GVariant      *parameter,
                                       gpointer       user_data);
-static void trash_applet_show_about  (GSimpleAction *action,
-                                      GVariant      *parameter,
-                                      gpointer       user_data);
 static void trash_applet_open_folder (GSimpleAction *action,
                                       GVariant      *parameter,
                                       gpointer       user_data);
@@ -57,6 +54,14 @@ static void trash_applet_show_help   (GSimpleAction *action,
                                       GVariant      *parameter,
                                       gpointer       user_data);
 
+static void
+trash_applet_show_about (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
+{
+  gp_applet_show_about (GP_APPLET (user_data));
+}
+
 static const GActionEntry trash_applet_menu_actions [] = {
        { "open",  trash_applet_open_folder, NULL, NULL, NULL },
        { "empty", trash_applet_do_empty,    NULL, NULL, NULL },
@@ -347,39 +352,6 @@ trash_applet_show_help (GSimpleAction *action,
     }
 }
 
-
-static void
-trash_applet_show_about (GSimpleAction *action,
-                         GVariant      *parameter,
-                         gpointer       user_data)
-{
-  static const char *authors[] = {
-    "Michiel Sikkes <michiel eyesopened nl>",
-    "Emmanuele Bassi <ebassi gmail com>",
-    "Sebastian Bacher <seb128 canonical com>",
-    "James Henstridge <james henstridge canonical com>",
-    "Ryan Lortie <desrt desrt ca>",
-    NULL
-  };
-  static const char *documenters[] = {
-    "Michiel Sikkes <michiel eyesopened nl>",
-    NULL
-  };
-
-  gtk_show_about_dialog (NULL,
-                         "version", VERSION,
-                         "copyright", "Copyright \xC2\xA9 2004 Michiel Sikkes,"
-                                      "\xC2\xA9 2008 Ryan Lortie",
-                         "comments", _("A GNOME trash bin that lives in your panel. "
-                                       "You can use it to view the trash or drag "
-                                       "and drop items into the trash."),
-                         "authors", authors,
-                         "documenters", documenters,
-                         "translator-credits", _("translator-credits"),
-                         "logo_icon_name", "user-trash-full",
-                         NULL);
-}
-
 static gboolean
 confirm_delete_immediately (GtkWidget *parent_view,
                             gint num_files,
@@ -591,3 +563,42 @@ trash_applet_init (TrashApplet *self)
   self->items = -1;
   trash_applet_monitor_changed (self);
 }
+
+void
+trash_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comments;
+  const char **authors;
+  const char **documenters;
+  const char *copyright;
+
+  comments = _("A GNOME trash bin that lives in your panel. "
+               "You can use it to view the trash or drag "
+               "and drop items into the trash.");
+
+  authors = (const char *[])
+    {
+      "Michiel Sikkes <michiel eyesopened nl>",
+      "Emmanuele Bassi <ebassi gmail com>",
+      "Sebastian Bacher <seb128 canonical com>",
+      "James Henstridge <james henstridge canonical com>",
+      "Ryan Lortie <desrt desrt ca>",
+      NULL
+    };
+
+  documenters = (const char *[])
+    {
+      "Michiel Sikkes <michiel eyesopened nl>",
+      NULL
+    };
+
+  copyright = "Copyright \xC2\xA9 2004 Michiel Sikkes, "
+              "\xC2\xA9 2008 Ryan Lortie";
+
+  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_translator_credits (dialog, _("translator-credits"));
+  gtk_about_dialog_set_copyright (dialog, copyright);
+}
diff --git a/gnome-applets/trash/trash-applet.h b/gnome-applets/trash/trash-applet.h
index cec24768a..2a8755459 100644
--- a/gnome-applets/trash/trash-applet.h
+++ b/gnome-applets/trash/trash-applet.h
@@ -25,6 +25,8 @@ G_BEGIN_DECLS
 #define TRASH_TYPE_APPLET (trash_applet_get_type ())
 G_DECLARE_FINAL_TYPE (TrashApplet, trash_applet, TRASH, APPLET, GpApplet)
 
+void trash_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif


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