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



commit dc86e388260517c4520fac4d4054f862f1bc85d3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 3 15:48:00 2020 +0300

    gweather: use gp_applet_show_about

 gnome-applets/ga-module.c                |  2 +
 gnome-applets/gweather/gweather-applet.c | 93 ++++++++++++++------------------
 gnome-applets/gweather/gweather-applet.h |  4 +-
 3 files changed, 45 insertions(+), 54 deletions(-)
---
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 70892e3cf..3ffff5d77 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -146,6 +146,8 @@ ga_get_applet_info (const char *id)
       name = _("Weather Report");
       description = _("Monitor the current weather conditions, and forecasts");
       icon_name = "weather-storm";
+
+      about_func = gweather_applet_setup_about;
     }
   else if (g_strcmp0 (id, "inhibit") == 0)
     {
diff --git a/gnome-applets/gweather/gweather-applet.c b/gnome-applets/gweather/gweather-applet.c
index bb17a8bef..e5d700f5b 100644
--- a/gnome-applets/gweather/gweather-applet.c
+++ b/gnome-applets/gweather/gweather-applet.c
@@ -59,63 +59,12 @@ get_default_location (GWeatherApplet *gw_applet)
     return location;
 }
 
-static const gchar *authors[] =
-  {
-    "Todd Kulesza <fflewddur dropline net>",
-    "Philip Langdale <philipl mail utexas edu>",
-    "Ryan Lortie <desrt desrt ca>",
-    "Davyd Madeley <davyd madeley id au>",
-    "Spiros Papadimitriou <spapadim+ cs cmu edu>",
-    "Kevin Vandersloot <kfv101 psu edu>",
-    NULL
-  };
-
-const gchar *documenters[] =
-  {
-    "Dan Mueth <d-mueth uchicago edu>",
-    "Spiros Papadimitriou <spapadim+ cs cmu edu>",
-    "Sun GNOME Documentation Team <gdocteam sun com>",
-    "Davyd Madeley <davyd madeley id au>",
-    NULL
-  };
-
 static void
 about_cb (GSimpleAction *action,
           GVariant      *parameter,
           gpointer       user_data)
 {
-  GWeatherApplet *applet;
-  GtkAboutDialog *dialog;
-  const gchar *text;
-
-  applet = (GWeatherApplet *) user_data;
-
-  if (applet->about_dialog != NULL)
-    {
-      gtk_window_present (GTK_WINDOW (applet->about_dialog));
-      return;
-    }
-
-  applet->about_dialog = gtk_about_dialog_new ();
-  dialog = GTK_ABOUT_DIALOG (applet->about_dialog);
-
-  gtk_about_dialog_set_version (dialog, VERSION);
-  gtk_about_dialog_set_logo_icon_name (dialog, "weather-storm");
-
-  text = _("\xC2\xA9 1999-2005 by S. Papadimitriou and others");
-  gtk_about_dialog_set_copyright (dialog, text);
-
-  text = _("A panel application for monitoring local weather conditions.");
-  gtk_about_dialog_set_copyright (dialog, text);
-
-  gtk_about_dialog_set_authors (dialog, authors);
-  gtk_about_dialog_set_documenters (dialog, documenters);
-  gtk_about_dialog_set_translator_credits (dialog, _("translator-credits"));
-
-  g_object_add_weak_pointer (G_OBJECT (applet->about_dialog),
-                             (gpointer *) &applet->about_dialog);
-
-  gtk_window_present (GTK_WINDOW (applet->about_dialog));
+  gp_applet_show_about (GP_APPLET (user_data));
 }
 
 static void help_cb (GSimpleAction *action,
@@ -621,3 +570,43 @@ static void
 gweather_applet_init (GWeatherApplet *self)
 {
 }
+
+void
+gweather_applet_setup_about (GtkAboutDialog *dialog)
+{
+  const char *comments;
+  const char **authors;
+  const char **documenters;
+  const char *copyright;
+
+  comments = _("A panel application for monitoring local weather conditions.");
+
+  authors = (const char *[])
+    {
+      "Todd Kulesza <fflewddur dropline net>",
+      "Philip Langdale <philipl mail utexas edu>",
+      "Ryan Lortie <desrt desrt ca>",
+      "Davyd Madeley <davyd madeley id au>",
+      "Spiros Papadimitriou <spapadim+ cs cmu edu>",
+      "Kevin Vandersloot <kfv101 psu edu>",
+      NULL
+    };
+
+  documenters = (const char *[])
+    {
+      "Dan Mueth <d-mueth uchicago edu>",
+      "Spiros Papadimitriou <spapadim+ cs cmu edu>",
+      "Sun GNOME Documentation Team <gdocteam sun com>",
+      "Davyd Madeley <davyd madeley id au>",
+      NULL
+    };
+
+  copyright = _("\xC2\xA9 1999-2005 by S. Papadimitriou and others");
+
+  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/gweather/gweather-applet.h b/gnome-applets/gweather/gweather-applet.h
index fb5a30abf..d156e9c11 100644
--- a/gnome-applets/gweather/gweather-applet.h
+++ b/gnome-applets/gweather/gweather-applet.h
@@ -51,8 +51,6 @@ struct _GWeatherApplet
   GtkWidget         *pref_dialog;
 
   GtkWidget         *details_dialog;
-
-  GtkWidget         *about_dialog;
 };
 
 void gweather_applet_create(GWeatherApplet *gw_applet);
@@ -60,6 +58,8 @@ gboolean timeout_cb (gpointer data);
 gboolean suncalc_timeout_cb (gpointer data);
 void gweather_update (GWeatherApplet *applet);
 
+void gweather_applet_setup_about (GtkAboutDialog *dialog);
+
 G_END_DECLS
 
 #endif /* __GWEATHER_APPLET_H_ */


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