[f-spot] update gtk#beans to upstream



commit 876295d207d2a01238ee24b789f6f4a313d297c3
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Jun 16 10:38:55 2009 +0200

    update gtk#beans to upstream
    
    replace GetWindow usages by GdkWindow. the new upstream provides Global.ShowUri()

 gtk-sharp-beans/Global.cs   |   41 +++++++++++++++++++++++++++++++++++++++++
 gtk-sharp-beans/Makefile.am |    1 +
 gtk-sharp-beans/Widget.cs   |    9 ---------
 src/Widgets/DateEdit.cs     |    6 +++---
 4 files changed, 45 insertions(+), 12 deletions(-)
---
diff --git a/gtk-sharp-beans/Global.cs b/gtk-sharp-beans/Global.cs
new file mode 100644
index 0000000..1a2d684
--- /dev/null
+++ b/gtk-sharp-beans/Global.cs
@@ -0,0 +1,41 @@
+// GtkBeans.Global.cs
+//
+// Author(s):
+//      Stephane Delcroix <stephane delcroix org>
+//
+// Copyright (c) 2009 Novell, Inc.
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General 
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace GtkBeans {
+	public static class Global {
+		[DllImport("libgtk-win32-2.0-0.dll")]
+		static extern unsafe bool gtk_show_uri(IntPtr screen, IntPtr uri, uint timestamp, out IntPtr error);
+
+		public static unsafe bool ShowUri(Gdk.Screen screen, string uri, uint timestamp) {
+			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+			IntPtr error = IntPtr.Zero;
+			bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
+			bool ret = raw_ret;
+			GLib.Marshaller.Free (native_uri);
+			if (error != IntPtr.Zero) throw new GLib.GException (error);
+			return ret;
+		}
+	}
+}
diff --git a/gtk-sharp-beans/Makefile.am b/gtk-sharp-beans/Makefile.am
index 421f73d..130b63e 100644
--- a/gtk-sharp-beans/Makefile.am
+++ b/gtk-sharp-beans/Makefile.am
@@ -3,6 +3,7 @@ include ../Makefile.include
 SRCS =					\
 	$(srcdir)/Dialog.cs		\
 	$(srcdir)/Drawable.cs		\
+	$(srcdir)/Global.cs		\
 	$(srcdir)/Image.cs		\
 	$(srcdir)/Widget.cs		\
 	$(srcdir)/Format.cs		\
diff --git a/gtk-sharp-beans/Widget.cs b/gtk-sharp-beans/Widget.cs
index 9521aef..dea11d5 100644
--- a/gtk-sharp-beans/Widget.cs
+++ b/gtk-sharp-beans/Widget.cs
@@ -36,14 +36,5 @@ namespace Gtk {
 			Marshal.FreeHGlobal (native_clip_rect);
 			return ret;
 		}
-
-		[DllImport("libgtk-win32-2.0-0.dll")]
-		static extern IntPtr gtk_widget_get_window(IntPtr raw);
-
-		public static Gdk.Window GetWindow(this Widget widget) {
-			IntPtr raw_ret = gtk_widget_get_window(widget.Handle);
-			Gdk.Window ret = GLib.Object.GetObject(raw_ret) as Gdk.Window;  
-			return ret;
-		}
 	}
 }
diff --git a/src/Widgets/DateEdit.cs b/src/Widgets/DateEdit.cs
index e67e952..96bfd6d 100644
--- a/src/Widgets/DateEdit.cs
+++ b/src/Widgets/DateEdit.cs
@@ -178,7 +178,7 @@ namespace FSpot.Widgets
 		{
 			var requisition = calendar_popup.SizeRequest ();
 			int x, y;
-			date_button.GetWindow().GetOrigin (out x, out y);
+			date_button.GdkWindow.GetOrigin (out x, out y);
 			x += date_button.Allocation.X;
 			y += date_button.Allocation.Y;
 			x += date_button.Allocation.Width - requisition.Width;
@@ -194,7 +194,7 @@ namespace FSpot.Widgets
 		void HandleCalendarButtonClicked (object sender, EventArgs e)
 		{
 			//Temporarily grab pointer and keyboard
-			if (!GrabPointerAndKeyboard (this.GetWindow(), Gtk.Global.CurrentEventTime))
+			if (!GrabPointerAndKeyboard (GdkWindow, Gtk.Global.CurrentEventTime))
 				return;
 
 			//select the day on the calendar
@@ -206,7 +206,7 @@ namespace FSpot.Widgets
 			calendar.GrabFocus ();
 
 			//transfer the grabs to the popup
-			GrabPointerAndKeyboard (calendar_popup.GetWindow(), Gtk.Global.CurrentEventTime);
+			GrabPointerAndKeyboard (calendar_popup.GdkWindow, Gtk.Global.CurrentEventTime);
 		}
 
 		void HandleDateEntryActivated (object sender, EventArgs e)



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