[gtranslator/leo] Use gtk_show_uri_on_window instead callig yelp directly



commit a01503d8720b05038e17f074527b6519d421ab3b
Author: Daniel Mustieles <daniel mustieles gmail com>
Date:   Thu Oct 10 09:03:55 2019 +0200

    Use gtk_show_uri_on_window instead callig yelp directly

 src/gtr-actions-app.c        |  2 +-
 src/gtr-preferences-dialog.c |  5 +++++
 src/gtr-utils.c              | 32 ++++++++++++--------------------
 src/gtr-utils.h              |  4 +---
 4 files changed, 19 insertions(+), 24 deletions(-)
---
diff --git a/src/gtr-actions-app.c b/src/gtr-actions-app.c
index 9f1acabe..1ac0e7b8 100644
--- a/src/gtr-actions-app.c
+++ b/src/gtr-actions-app.c
@@ -37,7 +37,7 @@
 void
 gtr_show_help (GtrWindow *window)
 {
-  gtr_utils_help_display (GTK_WINDOW (window), "gtranslator", "");
+  gtr_utils_help_display (GTK_WINDOW (window));
 }
 
 /* Creates and shows the about box for gtranslator */
diff --git a/src/gtr-preferences-dialog.c b/src/gtr-preferences-dialog.c
index 0263ce68..e0efa98e 100644
--- a/src/gtr-preferences-dialog.c
+++ b/src/gtr-preferences-dialog.c
@@ -423,8 +423,10 @@ active_toggled_cb (GtkCellRendererToggle *cell_renderer,
 
   gtk_tree_model_get (model, &iter, PROFILE_COLUMN, &active_profile, -1);
 
+
   if (active_profile != NULL)
     {
+  gtk_widget_set_sensitive (priv->edit_button, TRUE);
       GtrProfileManager *prof_manager;
 
       prof_manager = gtr_profile_manager_get_default ();
@@ -623,6 +625,8 @@ gtr_preferences_dialog_init (GtrPreferencesDialog * dlg)
   profiles_scrolled_window = GTK_WIDGET (gtk_builder_get_object (builder, "profiles-scrolledwindow"));
   g_object_unref (builder);
 
+  gtk_widget_set_sensitive (priv->edit_button, FALSE);
+
   gtk_box_pack_start (content_area, priv->notebook, FALSE, FALSE, 0);
 
   gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 5);
@@ -681,3 +685,4 @@ gtr_show_preferences_dialog (GtrWindow * window)
 
   gtk_window_present (GTK_WINDOW (dlg));
 }
+
diff --git a/src/gtr-utils.c b/src/gtr-utils.c
index 33a20c67..db1a6824 100644
--- a/src/gtr-utils.c
+++ b/src/gtr-utils.c
@@ -454,6 +454,15 @@ finally_2:
  * Shows the help for an specific document in the default help browser.
  */
 void
+gtr_utils_help_display (GtkWindow * window)
+{
+        gtk_show_uri_on_window (GTK_WINDOW (window), "help:gtranslator",
+                               gtk_get_current_event_time (), NULL);
+}
+
+
+/*
+void
 gtr_utils_help_display (GtkWindow * parent,
                         const gchar * doc_id, const gchar * file_name)
 {
@@ -466,24 +475,6 @@ gtr_utils_help_display (GtkWindow * parent,
   gchar *uri = NULL;
   gint i;
 
-
-  /* FIXME: How to display help on windows. Gedit opens a browser and displays
-     a url with the contents of the help 
-     if (uri == NULL)
-     {
-     GtkWidget *dialog;
-     dialog = gtk_message_dialog_new (parent,
-     GTK_DIALOG_DESTROY_WITH_PARENT,
-     GTK_MESSAGE_ERROR,
-     GTK_BUTTONS_CLOSE,
-     _("Sorry, Translation Editor for windows is unable to display help yet."));
-     gtk_dialog_run (GTK_DIALOG (dialog));
-     gtk_widget_destroy (dialog);
-
-     return;
-     } End of FIXME: How to display help on windows. */
-
-
   g_return_if_fail (file_name != NULL);
 
   langs = g_get_language_names ();
@@ -522,8 +513,8 @@ gtr_utils_help_display (GtkWindow * parent,
       return;
     }
 
-  /* Should be updated to use gtk_show_uri instead, see
-   * https://wiki.gnome.org/Initiatives/GnomeGoals/RemoveGnomeOpenGnomeHelp */
+  // Should be updated to use gtk_show_uri instead, see
+  // https://wiki.gnome.org/Initiatives/GnomeGoals/RemoveGnomeOpenGnomeHelp
   command = g_strconcat ("yelp ", uri, NULL);
   g_free (uri);
 
@@ -539,6 +530,7 @@ gtr_utils_help_display (GtkWindow * parent,
     }
   g_free (command);
 }
+*/
 
 gchar *
 gtr_utils_get_current_date (void)
diff --git a/src/gtr-utils.h b/src/gtr-utils.h
index 8916d879..86e84d49 100644
--- a/src/gtr-utils.h
+++ b/src/gtr-utils.h
@@ -55,9 +55,7 @@ void gtr_utils_menu_position_under_tree_view (GtkMenu * menu,
      gboolean g_utf8_caselessnmatch (const gchar * s1,
                                      const gchar * s2, gssize n1, gssize n2);
 
-     void gtr_utils_help_display (GtkWindow * parent,
-                                  const gchar * doc_id,
-                                  const gchar * file_name);
+     void gtr_utils_help_display (GtkWindow * parent);
 
      gchar *gtr_utils_get_user_config_dir (void);
 


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