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



commit 4de140b5bab61540a9e7b291c25c3cfd4b9b47d0
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 17:11:33 2020 +0300

    window-buttons: use gp_applet_show_about

 gnome-applets/ga-module.c                     |   2 +
 gnome-applets/window-buttons/window-buttons.c | 108 +++++++++++++++-----------
 gnome-applets/window-buttons/window-buttons.h |   2 +
 3 files changed, 67 insertions(+), 45 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 24fcbae00..76908c762 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -235,6 +235,8 @@ ga_get_applet_info (const char *id)
       name = _("Window Buttons");
       description = _("Window buttons for your GNOME Panel");
       icon_name = "windowbuttons-applet";
+
+      about_func = wb_applet_setup_about;
     }
   else if (g_strcmp0 (id, "window-picker") == 0)
     {
diff --git a/gnome-applets/window-buttons/window-buttons.c b/gnome-applets/window-buttons/window-buttons.c
index b4385be15..8a2881955 100755
--- a/gnome-applets/window-buttons/window-buttons.c
+++ b/gnome-applets/window-buttons/window-buttons.c
@@ -26,7 +26,6 @@
 static void init_wbapplet (WBApplet *);
 static void active_window_state_changed (WnckWindow *, WnckWindowState, WnckWindowState, WBApplet *);
 static void umaxed_window_state_changed (WnckWindow *, WnckWindowState, WnckWindowState, WBApplet *);
-static void about_cb ( GSimpleAction *, GVariant *, gpointer );
 static WnckWindow *getRootWindow (WnckScreen *screen);
 static WnckWindow *getUpperMaximized (WBApplet *);
 void setCustomLayout (WBPreferences *, gchar *);
@@ -41,6 +40,14 @@ GdkPixbuf ***getPixbufs(gchar ***);
 
 G_DEFINE_TYPE (WBApplet, wb_applet, GP_TYPE_APPLET)
 
+static void
+about_cb (GSimpleAction *action,
+          GVariant      *parameter,
+          gpointer       user_data)
+{
+  gp_applet_show_about (GP_APPLET (user_data));
+}
+
 static const GActionEntry windowbuttons_menu_actions [] = {
        { "preferences", wb_applet_properties_cb,  NULL, NULL, NULL },
        { "about",       about_cb, NULL, NULL, NULL },
@@ -126,50 +133,6 @@ wb_applet_init (WBApplet *self)
   gp_applet_set_flags (GP_APPLET (self), GP_APPLET_FLAGS_EXPAND_MINOR);
 }
 
-/* The About dialog */
-//static void about_cb (BonoboUIComponent *uic, WBApplet *applet) {
-static void about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) {
-    static const gchar *authors [] = {
-               "Andrej Belcijan <{andrejx}at{gmail.com}>",
-               " ",
-               "Also contributed:",
-               "quiescens",
-               NULL
-       };
-
-       const gchar *artists[] = {
-               "Andrej Belcijan <{andrejx}at{gmail.com}> for theme \"Default\" and contribution moderating",
-               "Maurizio De Santis <{desantis.maurizio}at{gmail.com}> for theme \"Blubuntu\"",
-               "Nasser Alshammari <{designernasser}at{gmail.com}> for logo design",
-               "Jeff M. Hubbard <{jeffmhubbard}at{gmail.com}> for theme \"Elementary\"",
-               "Gaurang Arora for theme \"Dust-Invert\"",
-               "Giacomo Porrà for themes \"Ambiance\", \"Ambiance-Maverick\", \"Radiance\", 
\"Radiance-Maverick\"",
-               "Vitalii Dmytruk for theme \"Ambiance-X-Studio\"",
-               "amoob for themes \"Plano\", \"New-Hope\" and \"WoW\"",
-               "McBurri for theme \"Equinox-Glass\"",
-               "milky2313 for theme \"Sorbet\"",
-               NULL
-       };
-
-       const gchar *documenters[] = {
-        "Andrej Belcijan <{andrejx}at{gmail.com}>",
-               NULL
-       };
-
-       gtk_show_about_dialog (NULL,
-               "version",      VERSION,
-               "comments",     N_("Window buttons for your GNOME Panel."),
-               "copyright",    "\xC2\xA9 2011 Andrej Belcijan",
-               "authors",      authors,
-           "artists",  artists,
-               "documenters",  documenters,
-               "translator-credits", ("translator-credits"),
-               "logo-icon-name",       "windowbuttons-applet",
-           "website",  "http://www.gnome-look.org/content/show.php?content=103732";,
-               "website-label", N_("Window Applets on Gnome-Look"),
-               NULL);
-}
-
 static WnckWindow *getRootWindow (WnckScreen *screen) {
        GList *winstack = wnck_screen_get_windows_stacked(screen);
        if (winstack) // we can't access data directly because sometimes we will get NULL
@@ -769,3 +732,58 @@ void toggleHidden (WBApplet *wbapplet) {
        if (!gtk_widget_get_visible(GTK_WIDGET(wbapplet)))
                gtk_widget_show_all(GTK_WIDGET(wbapplet));
 }
+
+void
+wb_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comments;
+  const char **authors;
+  const char **artists;
+  const char **documenters;
+  const char *copyright;
+
+  comments = _("Window buttons for your GNOME Panel.");
+
+  authors = (const char *[])
+    {
+      "Andrej Belcijan <{andrejx}at{gmail.com}>",
+      " ",
+      "Also contributed:",
+      "quiescens",
+      NULL
+    };
+
+  artists = (const char *[])
+    {
+      "Andrej Belcijan <{andrejx}at{gmail.com}> for theme \"Default\" and contribution moderating",
+      "Maurizio De Santis <{desantis.maurizio}at{gmail.com}> for theme \"Blubuntu\"",
+      "Nasser Alshammari <{designernasser}at{gmail.com}> for logo design",
+      "Jeff M. Hubbard <{jeffmhubbard}at{gmail.com}> for theme \"Elementary\"",
+      "Gaurang Arora for theme \"Dust-Invert\"",
+      "Giacomo Porrà for themes \"Ambiance\", \"Ambiance-Maverick\", \"Radiance\", \"Radiance-Maverick\"",
+      "Vitalii Dmytruk for theme \"Ambiance-X-Studio\"",
+      "amoob for themes \"Plano\", \"New-Hope\" and \"WoW\"",
+      "McBurri for theme \"Equinox-Glass\"",
+      "milky2313 for theme \"Sorbet\"",
+      NULL
+    };
+
+  documenters = (const char *[])
+    {
+      "Andrej Belcijan <{andrejx}at{gmail.com}>",
+      NULL
+    };
+
+  copyright = "\xC2\xA9 2011 Andrej Belcijan";
+
+  gtk_about_dialog_set_comments (dialog, comments);
+
+  gtk_about_dialog_set_authors (dialog, authors);
+  gtk_about_dialog_set_artists (dialog, artists);
+  gtk_about_dialog_set_documenters (dialog, documenters);
+  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
+  gtk_about_dialog_set_copyright (dialog, copyright);
+
+  gtk_about_dialog_set_website_label (dialog, _("Window Applets on Gnome-Look"));
+  gtk_about_dialog_set_website (dialog, "http://www.gnome-look.org/content/show.php?content=103732";);
+}
diff --git a/gnome-applets/window-buttons/window-buttons.h b/gnome-applets/window-buttons/window-buttons.h
index f4cb5e1f7..02c89cf81 100644
--- a/gnome-applets/window-buttons/window-buttons.h
+++ b/gnome-applets/window-buttons/window-buttons.h
@@ -25,6 +25,8 @@ G_BEGIN_DECLS
 #define WB_TYPE_APPLET (wb_applet_get_type ())
 G_DECLARE_FINAL_TYPE (WBApplet, wb_applet, WB, APPLET, GpApplet)
 
+void wb_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif


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