[gnome-applets/wip/muktupavels/help-about: 19/19] battstat: use gp_applet_show_help



commit a9b711b2bea55632be7e68b43403e2020d23b2fc
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 31 22:14:07 2020 +0300

    battstat: use gp_applet_show_help

 gnome-applets/battstat/battstat-applet.c | 37 +-------------------------------
 gnome-applets/battstat/battstat.h        |  1 -
 gnome-applets/battstat/properties.c      |  4 ++--
 gnome-applets/ga-module.c                |  1 +
 4 files changed, 4 insertions(+), 39 deletions(-)
---
diff --git a/gnome-applets/battstat/battstat-applet.c b/gnome-applets/battstat/battstat-applet.c
index 071baf5c2..93469bc03 100644
--- a/gnome-applets/battstat/battstat-applet.c
+++ b/gnome-applets/battstat/battstat-applet.c
@@ -1063,40 +1063,6 @@ check_for_updates( gpointer data )
   return TRUE;
 }
 
-/* Common function invoked by the 'Help' context menu item and the 'Help'
- * button in the preferences dialog.
- */
-void
-battstat_show_help( ProgressData *battstat, const char *section )
-{
-  GError *error = NULL;
-  char *uri;
-
-  if (section)
-    uri = g_strdup_printf ("help:battstat/%s", section);
-  else
-    uri = g_strdup ("help:battstat");
-
-  gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (battstat)),
-                uri,
-                gtk_get_current_event_time (),
-                &error);
-
-  g_free (uri);
-
-  if( error )
-  {
-    char *message;
-
-    message = g_strdup_printf( _("There was an error displaying help: %s"),
-                               error->message );
-    battstat_error_dialog (GTK_WIDGET (battstat), message);
-    g_error_free( error );
-    g_free( message );
-  }
-}
-
-
 /* Called when the user selects the 'help' menu item.
  */
 static void
@@ -1104,8 +1070,7 @@ help_cb (GSimpleAction *action,
          GVariant      *parameter,
          gpointer       user_data)
 {
-  ProgressData *battstat = (ProgressData *) user_data;
-  battstat_show_help( battstat, NULL );
+  gp_applet_show_help (GP_APPLET (user_data), NULL);
 }
 
 /* Called when the user selects the 'about' menu item.
diff --git a/gnome-applets/battstat/battstat.h b/gnome-applets/battstat/battstat.h
index 0ccf427e5..79935b6d9 100644
--- a/gnome-applets/battstat/battstat.h
+++ b/gnome-applets/battstat/battstat.h
@@ -160,6 +160,5 @@ void prop_cb (GSimpleAction *, GVariant *, gpointer);
 
 /* battstat_applet.c */
 void reconfigure_layout( ProgressData *battstat );
-void battstat_show_help( ProgressData *battstat, const char *section );
 
 #endif /* _battstat_h_ */
diff --git a/gnome-applets/battstat/properties.c b/gnome-applets/battstat/properties.c
index 8a2bf58a4..ff85fece4 100644
--- a/gnome-applets/battstat/properties.c
+++ b/gnome-applets/battstat/properties.c
@@ -185,9 +185,9 @@ static void
 response_cb (GtkDialog *dialog, gint id, gpointer data)
 {
   ProgressData *battstat = data;
-  
+
   if (id == GTK_RESPONSE_HELP)
-    battstat_show_help (battstat, "battstat-appearance");
+    gp_applet_show_help (GP_APPLET (battstat), "battstat-appearance");
   else
     gtk_widget_hide (GTK_WIDGET (battstat->prop_win));
 }
diff --git a/gnome-applets/ga-module.c b/gnome-applets/ga-module.c
index 80756deb5..43f52dbfe 100644
--- a/gnome-applets/ga-module.c
+++ b/gnome-applets/ga-module.c
@@ -78,6 +78,7 @@ ga_get_applet_info (const char *id)
       icon_name = "battery";
 
       about_func = battstat_applet_setup_about;
+      help_uri = "help:battstat";
     }
   else if (g_strcmp0 (id, "brightness") == 0)
     {


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