[gnome-panel/wip/muktupavels/help-about: 4/4] clock: use gp_applet_show_help



commit 43d5919a0b2adb3b62e3cac93a8036f58ab4e428
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 31 20:05:10 2020 +0300

    clock: use gp_applet_show_help

 modules/clock/clock-applet.c | 65 +-------------------------------------------
 1 file changed, 1 insertion(+), 64 deletions(-)
---
diff --git a/modules/clock/clock-applet.c b/modules/clock/clock-applet.c
index 0ef21b062..7ecc44397 100644
--- a/modules/clock/clock-applet.c
+++ b/modules/clock/clock-applet.c
@@ -1527,74 +1527,11 @@ prefs_hide_event (GtkWidget   *widget,
         return TRUE;
 }
 
-static void
-clock_utils_display_help (GtkWidget   *widget,
-                          const gchar *doc_id,
-                          const gchar *link_id,
-                          GtkWindow   *parent)
-{
-       GError *error = NULL;
-       char   *uri;
-
-       if (link_id)
-               uri = g_strdup_printf ("help:%s/%s", doc_id, link_id);
-       else
-               uri = g_strdup_printf ("help:%s", doc_id);
-
-       gtk_show_uri_on_window (parent, uri, gtk_get_current_event_time (), &error);
-       g_free (uri);
-
-       if (error &&
-           g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-               g_error_free (error);
-       else if (error) {
-               GtkWidget *dialog;
-               char      *primary;
-
-               primary = g_markup_printf_escaped (
-                               _("Could not display help document '%s'"),
-                               doc_id);
-               dialog = gtk_message_dialog_new (
-                               parent,
-                               GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
-                               GTK_MESSAGE_ERROR,
-                               GTK_BUTTONS_CLOSE,
-                               "%s", primary);
-
-               gtk_message_dialog_format_secondary_text (
-                                       GTK_MESSAGE_DIALOG (dialog),
-                                       "%s", error->message);
-
-               g_error_free (error);
-               g_free (primary);
-
-               g_signal_connect (dialog, "response",
-                                 G_CALLBACK (gtk_widget_destroy),
-                                 NULL);
-
-               gtk_window_set_icon_name (GTK_WINDOW (dialog), CLOCK_ICON);
-               gtk_window_set_screen (GTK_WINDOW (dialog),
-                                      gtk_widget_get_screen (widget));
-
-               if (parent == NULL) {
-                       /* we have no parent window */
-                       gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog),
-                                                         FALSE);
-                       gtk_window_set_title (GTK_WINDOW (dialog),
-                                             _("Error displaying help document"));
-               }
-
-               gtk_widget_show (dialog);
-       }
-}
-
 static void
 prefs_help (GtkWidget   *widget,
             ClockApplet *cd)
 {
-       clock_utils_display_help (cd->prefs_window,
-                                 "clock", "clock-settings",
-                                 GTK_WINDOW (cd->prefs_window));
+        gp_applet_show_help (GP_APPLET (cd), "clock-settings");
 }
 
 static void


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