[gnote] Add window parameter to open_url



commit 90efbae085ac3b7c19b179f6fdbec5254b9ce88a
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jul 23 13:02:01 2017 +0300

    Add window parameter to open_url

 src/addins/bugzilla/bugzillalink.cpp              |    3 ++-
 src/addins/exporttohtml/exporttohtmlnoteaddin.cpp |    2 +-
 src/utils.cpp                                     |    4 ++--
 src/utils.hpp                                     |    2 +-
 src/watchers.cpp                                  |    2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/addins/bugzilla/bugzillalink.cpp b/src/addins/bugzilla/bugzillalink.cpp
index 3152c1d..5212995 100644
--- a/src/addins/bugzilla/bugzillalink.cpp
+++ b/src/addins/bugzilla/bugzillalink.cpp
@@ -22,6 +22,7 @@
 #include "sharp/uri.hpp"
 #include "debug.hpp"
 #include "iconmanager.hpp"
+#include "ignote.hpp"
 #include "utils.hpp"
 #include "bugzillalink.hpp"
 #include "bugzillanoteaddin.hpp"
@@ -93,7 +94,7 @@ namespace bugzilla {
       DBG_OUT("Opening url '%s'...", get_bug_url().c_str());
                                
       try {
-        gnote::utils::open_url(get_bug_url());
+        gnote::utils::open_url(gnote::IGnote::obj().get_main_window(), get_bug_url());
       } 
       catch (const Glib::Error & e) {
         gnote::utils::show_opening_location_error(NULL, 
diff --git a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp 
b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
index e12d5d3..c955579 100644
--- a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
+++ b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
@@ -114,7 +114,7 @@ void ExportToHtmlNoteAddin::export_button_clicked(const Glib::VariantBase&)
 
     try {
       sharp::Uri output_uri(output_path);
-      gnote::utils::open_url("file://" + output_uri.get_absolute_uri());
+      gnote::utils::open_url(*get_host_window(), "file://" + output_uri.get_absolute_uri());
     } 
     catch (const Glib::Exception & ex) {
       ERR_OUT(_("Could not open exported note in a web browser: %s"),
diff --git a/src/utils.cpp b/src/utils.cpp
index 27d9919..fceba0f 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -183,12 +183,12 @@ namespace gnote {
     }
 
 
-    void open_url(const Glib::ustring & url)
+    void open_url(Gtk::Window & parent, const Glib::ustring & url)
     {
       if(!url.empty()) {
         GError *err = NULL;
         DBG_OUT("Opening url '%s'...", url.c_str());
-        gtk_show_uri (NULL, url.c_str(), GDK_CURRENT_TIME, &err);
+        gtk_show_uri_on_window(parent.gobj(), url.c_str(), GDK_CURRENT_TIME, &err);
         if(err) {
           throw Glib::Error(err, true);
         }
diff --git a/src/utils.hpp b/src/utils.hpp
index a1ae8ec..f69da54 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -52,7 +52,7 @@ namespace gnote {
     void popup_menu(Gtk::Menu &menu, const GdkEventButton *);
 
     void show_help(const Glib::ustring & filename, const Glib::ustring & link_id, Gtk::Window *parent);
-    void open_url(const Glib::ustring & url);
+    void open_url(Gtk::Window & parent, const Glib::ustring & url);
     void show_opening_location_error(Gtk::Window * parent,
                                      const Glib::ustring & url,
                                      const Glib::ustring & error);
diff --git a/src/watchers.cpp b/src/watchers.cpp
index 83776e9..df5db03 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -608,7 +608,7 @@ namespace gnote {
   {
     Glib::ustring url = get_url(start, end);
     try {
-      utils::open_url (url);
+      utils::open_url(*get_host_window(), url);
     } 
     catch (Glib::Error & e) {
       utils::show_opening_location_error (get_host_window(), url, e.what());


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