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



commit 735a91c71e0b692893e415f15860ddc2e0e4e957
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 16:35:10 2020 +0300

    sticky-notes: use gp_applet_show_about

 gnome-applets/ga-module.c                          |  2 +
 .../sticky-notes/sticky-notes-applet-callbacks.c   | 29 --------------
 .../sticky-notes/sticky-notes-applet-callbacks.h   |  1 -
 gnome-applets/sticky-notes/sticky-notes-applet.c   | 44 +++++++++++++++++++++-
 gnome-applets/sticky-notes/sticky-notes-applet.h   |  2 +
 5 files changed, 47 insertions(+), 31 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 1c69e6996..53c91dd74 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -195,6 +195,8 @@ ga_get_applet_info (const char *id)
       name = _("Sticky Notes");
       description = _("Create, view, and manage sticky notes on the desktop");
       icon_name = "gnome-sticky-notes-applet";
+
+      about_func = stickynotes_applet_setup_about;
     }
   else if (g_strcmp0 (id, "timer") == 0)
     {
diff --git a/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.c 
b/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.c
index 91184845b..64ba6286d 100644
--- a/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.c
+++ b/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.c
@@ -370,35 +370,6 @@ void menu_help_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data
        }
 }
 
-/* Menu Callback : Display About window */
-void
-menu_about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
-{
-       static const gchar *authors[] = {
-               "Loban A Rahman <loban earthling net>",
-               "Davyd Madeley <davyd madeley id au>",
-               NULL
-       };
-
-       static const gchar *documenters[] = {
-               "Loban A Rahman <loban earthling net>",
-               "Sun GNOME Documentation Team <gdocteam sun com>",
-               NULL
-       };
-
-       gtk_show_about_dialog (NULL,
-               "version",      VERSION,
-               "copyright",    "\xC2\xA9 2002-2003 Loban A Rahman, "
-                               "\xC2\xA9 2005 Davyd Madeley",
-               "comments",     _("Sticky Notes for the "
-                                 "GNOME Desktop Environment"),
-               "authors",      authors,
-               "documenters",  documenters,
-               "translator-credits",   _("translator-credits"),
-               "logo-icon-name",       "gnome-sticky-notes-applet",
-               NULL);
-}
-
 /* Preferences Callback : Save. */
 void
 preferences_save_cb (gpointer data)
diff --git a/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.h 
b/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.h
index 3b66411a5..2ce3d0a90 100644
--- a/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.h
+++ b/gnome-applets/sticky-notes/sticky-notes-applet-callbacks.h
@@ -38,7 +38,6 @@ void menu_toggle_lock_cb(GSimpleAction *action, GVariant *parameter, gpointer us
 void menu_toggle_lock_state(GSimpleAction *action, GVariant *value, gpointer user_data);
 void menu_preferences_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
 void menu_help_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
-void menu_about_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data);
 
 /* Callbacks for sticky notes preferences dialog */
 void preferences_save_cb(gpointer data);
diff --git a/gnome-applets/sticky-notes/sticky-notes-applet.c 
b/gnome-applets/sticky-notes/sticky-notes-applet.c
index 0b89cc5a4..7d9fac773 100644
--- a/gnome-applets/sticky-notes/sticky-notes-applet.c
+++ b/gnome-applets/sticky-notes/sticky-notes-applet.c
@@ -36,7 +36,14 @@ static void sticky_notes_init_prefs (void);
 
 static void sticky_notes_applet_new (StickyNotesApplet *self);
 
-/* Popup menu on the applet */
+static void
+menu_about_cb (GSimpleAction *action,
+               GVariant      *parameter,
+               gpointer       user_data)
+{
+  gp_applet_show_about (GP_APPLET (user_data));
+}
+
 static const GActionEntry stickynotes_applet_menu_actions [] = {
        { "new-note",    menu_new_note_cb,    NULL, NULL,    NULL },
        { "hide-notes",  menu_hide_notes_cb,  NULL, NULL,    NULL },
@@ -547,3 +554,38 @@ stickynotes_applet_panel_icon_get_geometry (int *x, int *y, int *width, int *hei
        *width = allocation.x;
        *height = allocation.y;
 }
+
+void
+stickynotes_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comments;
+  const char **authors;
+  const char **documenters;
+  const char *copyright;
+
+  comments = _("Sticky Notes for the GNOME Desktop Environment");
+
+  authors = (const char *[])
+    {
+      "Loban A Rahman <loban earthling net>",
+      "Davyd Madeley <davyd madeley id au>",
+      NULL
+    };
+
+  documenters = (const char *[])
+    {
+      "Loban A Rahman <loban earthling net>",
+      "Sun GNOME Documentation Team <gdocteam sun com>",
+      NULL
+    };
+
+  copyright = "\xC2\xA9 2002-2003 Loban A Rahman, "
+              "\xC2\xA9 2005 Davyd Madeley";
+
+  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/sticky-notes/sticky-notes-applet.h 
b/gnome-applets/sticky-notes/sticky-notes-applet.h
index 68de8205b..5234f7303 100644
--- a/gnome-applets/sticky-notes/sticky-notes-applet.h
+++ b/gnome-applets/sticky-notes/sticky-notes-applet.h
@@ -94,4 +94,6 @@ void stickynotes_applet_update_tooltips(void);
 
 void stickynotes_applet_panel_icon_get_geometry (int *x, int *y, int *width, int *height);
 
+void stickynotes_applet_setup_about (GtkAboutDialog *dialog);
+
 #endif /* __STICKYNOTES_APPLET_H__ */


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