[yelp/yelp-3-0] [yelp-window] Launch default application for external URIs



commit fb19b10f6dc794889bf86eb3deea7af6cbe55500
Author: Shaun McCance <shaunm gnome org>
Date:   Wed Mar 17 15:23:56 2010 -0500

    [yelp-window] Launch default application for external URIs

 src/yelp-window.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 5a9ccd6..c4c6364 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -62,6 +62,9 @@ static void          entry_location_selected      (YelpLocationEntry  *entry,
 static void          back_button_clicked          (GtkWidget          *button,
                                                    YelpWindow         *window);
 
+static void          view_external_uri            (YelpView           *view,
+                                                   YelpUri            *uri,
+                                                   YelpWindow         *window);
 static void          view_uri_selected            (YelpView           *view,
                                                    GParamSpec         *pspec,
                                                    YelpWindow         *window);
@@ -250,6 +253,7 @@ yelp_window_init (YelpWindow *window)
     gtk_box_pack_end (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
 
     priv->view = (YelpView *) yelp_view_new ();
+    g_signal_connect (priv->view, "external-uri", G_CALLBACK (view_external_uri), window);
     g_signal_connect (priv->view, "notify::yelp-uri", G_CALLBACK (view_uri_selected), window);
     g_signal_connect (priv->view, "notify::page-title", G_CALLBACK (view_page_title), window);
     g_signal_connect (priv->view, "notify::page-desc", G_CALLBACK (view_page_desc), window);
@@ -480,6 +484,16 @@ back_button_clicked (GtkWidget  *button,
 }
 
 static void
+view_external_uri (YelpView   *view,
+                   YelpUri    *uri,
+                   YelpWindow *window)
+{
+    gchar *struri = yelp_uri_get_canonical_uri (uri);
+    g_app_info_launch_default_for_uri (struri, NULL, NULL);
+    g_free (struri);
+}
+
+static void
 view_uri_selected (YelpView     *view,
                    GParamSpec   *pspec,
                    YelpWindow   *window)



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