[epiphany] search provider: open result in default browser
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] search provider: open result in default browser
- Date: Fri, 12 Sep 2014 13:56:57 +0000 (UTC)
commit faaa23cb8956336fcd16258fd74ab9f69c01e438
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Thu Sep 11 16:05:08 2014 -0500
search provider: open result in default browser
https://bugzilla.gnome.org/show_bug.cgi?id=720245
src/ephy-search-provider.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/ephy-search-provider.c b/src/ephy-search-provider.c
index e478ca6..efc3458 100644
--- a/src/ephy-search-provider.c
+++ b/src/ephy-search-provider.c
@@ -266,12 +266,29 @@ static void
launch_uri (const char *uri,
guint timestamp)
{
- char *str;
+ GdkDisplay *display;
+ GdkAppLaunchContext *launch_context;
+ GAppInfo *appinfo;
+ GList *uris = NULL;
+ GError *error = NULL;
+
+ display = gdk_display_get_default ();
+ if (display == NULL)
+ return;
+
+ launch_context = gdk_display_get_app_launch_context (display);
+ gdk_app_launch_context_set_timestamp (launch_context, timestamp);
+ appinfo = g_app_info_get_default_for_type ("text/html", TRUE);
+ uris = g_list_append (uris, (gpointer)uri);
+
+ if (!g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
+ g_warning ("Failed to launch %s: %s", uri, error->message);
+ g_error_free (error);
+ }
- /* TODO: Handle the timestamp */
- str = g_strdup_printf ("epiphany %s", uri);
- g_spawn_command_line_async (str, NULL);
- g_free (str);
+ g_object_unref (launch_context);
+ g_object_unref (appinfo);
+ g_list_free (uris);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]