1 // GtkBeans.Global.cs 2 // 3 // Author(s): 4 // Stephane Delcroix <stephane@delcroix.org> 5 // 6 // Copyright (c) 2009 Novell, Inc. 7 // 8 // This program is free software; you can redistribute it and/or 9 // modify it under the terms of version 2 of the Lesser GNU General 10 // Public License as published by the Free Software Foundation. 11 // 12 // This program 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 program; if not, write to the 19 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 // Boston, MA 02111-1307, USA. 21 22 using System; 23 using System.Collections; 24 using System.Runtime.InteropServices; 25 26 namespace GtkBeans { 27 public static class Global { 28 [DllImport("libgtk-win32-2.0-0.dll")] gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error)29 static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error); 30 ShowUri(Gdk.Screen screen, string uri, uint timestamp)31 public static unsafe bool ShowUri(Gdk.Screen screen, string uri, uint timestamp) { 32 IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri); 33 IntPtr error = IntPtr.Zero; 34 bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error); 35 bool ret = raw_ret; 36 GLib.Marshaller.Free (native_uri); 37 if (error != IntPtr.Zero) throw new GLib.GException (error); 38 return ret; 39 } 40 ShowUri(Gdk.Screen screen, string uri)41 public static bool ShowUri (Gdk.Screen screen, string uri) 42 { 43 return ShowUri (screen, uri, Gdk.EventHelper.GetTime (new Gdk.Event(IntPtr.Zero))); 44 } 45 } 46 } 47