]> Pileus Git - ~andy/gtk/blob - gtk/gtkshow.c
Revert name change
[~andy/gtk] / gtk / gtkshow.c
1 /*
2  * GTK - The GIMP Toolkit
3  * Copyright (C) 2008  Jaap Haitsma <jaap@haitsma.org>
4  *
5  * All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #include "config.h"
24
25 #include <gdk/gdk.h>
26
27 #include "gtkshow.h"
28
29 #include "gtkalias.h"
30
31
32 /**
33  * gtk_show_uri:
34  * @screen: screen to show the uri on or %NULL for the default screen
35  * @uri: the uri to show
36  * @timestamp: a timestamp to prevent focus stealing.
37  * @error: a #GError that is returned in case of errors
38  *
39  * This is a convenience function for launching the default application
40  * to show the uri. The uri must be of a form understood by GIO. Typical
41  * examples are
42  * <simplelist>
43  *   <member><filename>file:///home/gnome/pict.jpg</filename></member>
44  *   <member><filename>http://www.gnome.org</filename></member>
45  *   <member><filename>mailto:me&commat;gnome.org</filename></member>
46  * </simplelist>
47  * Ideally the timestamp is taken from the event triggering
48  * the gtk_show_uri() call. If timestamp is not known you can take
49  * %GDK_CURRENT_TIME.
50  *
51  * This function can be used as a replacement for gnome_vfs_url_show()
52  * and gnome_url_show().
53  *
54  * Returns: %TRUE on success, %FALSE on error.
55  *
56  * Since: 2.14
57  */
58 gboolean
59 gtk_show_uri (GdkScreen    *screen,
60               const gchar  *uri,
61               guint32       timestamp,
62               GError      **error)
63 {
64   GdkAppLaunchContext *context;
65   gboolean ret;
66
67   g_return_val_if_fail (uri != NULL, FALSE);
68
69   context = gdk_app_launch_context_new ();
70   gdk_app_launch_context_set_screen (context, screen);
71   gdk_app_launch_context_set_timestamp (context, timestamp);
72
73   ret = g_app_info_launch_default_for_uri (uri, (GAppLaunchContext*)context, error);
74   g_object_unref (context);
75
76   return ret;
77 }
78
79
80 #define __GTK_SHOW_C__
81 #include "gtkaliasdef.c"