[hyena] bind gtk_show_uri (bgo#587320)



commit 32f0df2b7cf58e73f50832a1ba53356d8a3b23c8
Author: Aaron Bockover <abockover novell com>
Date:   Sat Feb 6 00:56:33 2010 -0500

    bind gtk_show_uri (bgo#587320)
    
    This replaces Gnome.Url.Show. Hooray.

 src/Hyena.Gui/Hyena.Gui/GtkUtilities.cs |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Gui/GtkUtilities.cs b/src/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
index 1fc246a..3443d62 100644
--- a/src/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
+++ b/src/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
@@ -4,7 +4,7 @@
 // Author:
 //   Aaron Bockover <abockover novell com>
 //
-// Copyright (C) 2007 Novell, Inc.
+// Copyright 2007-2010 Novell, Inc.
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -164,5 +164,34 @@ namespace Hyena.Gui
                 }
             }
         }
+
+        public static bool ShowUri (string uri)
+        {
+            return ShowUri (null, uri);
+        }
+
+        public static bool ShowUri (Gdk.Screen screen, string uri)
+        {
+            return ShowUri (screen, uri, Gtk.Global.CurrentEventTime);
+        }
+
+        [System.Runtime.InteropServices.DllImport ("libgtk-win32-2.0-0.dll")]
+        private static extern unsafe bool gtk_show_uri (IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
+
+        public static bool ShowUri (Gdk.Screen screen, string uri, uint timestamp)
+        {
+            var native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+            var native_error = IntPtr.Zero;
+            
+            try {
+                return gtk_show_uri (screen == null ? IntPtr.Zero : screen.Handle,
+                    native_uri, timestamp, out native_error);
+            } finally {
+                GLib.Marshaller.Free (native_uri);
+                if (native_error != IntPtr.Zero) {
+                    throw new GLib.GException (native_error);
+                }
+            }
+		}
     }
 }



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