From c9a8500eac2f2fdd36ba0561430e7871480a9d27 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 2 Jul 2011 11:35:55 +0200 Subject: [PATCH] sample: Update TestDnd and add it to the build --- sample/Makefile.am | 2 +- sample/TestDnd.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sample/Makefile.am b/sample/Makefile.am index 0e8aa4040..95e4acc1b 100755 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -8,7 +8,7 @@ DOTNET_TARGETS= DOTNET_ASSEMBLY= endif -TARGETS = gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe native-instantiation.exe polarfixed.exe cairo-sample.exe scribble.exe # custom-widget.exe custom-cellrenderer.exe scribble-xinput.exe testdnd.exe $(DOTNET_TARGETS) +TARGETS = gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe treemodeldemo.exe actions.exe spawn.exe assistant.exe registerprop.exe gexceptiontest.exe native-instantiation.exe polarfixed.exe cairo-sample.exe scribble.exe testdnd.exe #custom-widget.exe custom-cellrenderer.exe scribble-xinput.exe $(DOTNET_TARGETS) DEBUGS = $(addsuffix .mdb, $(TARGETS)) diff --git a/sample/TestDnd.cs b/sample/TestDnd.cs index f571355ca..21a1777d8 100644 --- a/sample/TestDnd.cs +++ b/sample/TestDnd.cs @@ -290,7 +290,7 @@ public class TestDnd { have_drag = false; // FIXME? Kinda wonky binding. - (sender as Gtk.Image).FromPixbuf = trashcan_closed_pixbuf; + (sender as Gtk.Image).Pixbuf = trashcan_closed_pixbuf; } private static void HandleTargetDragMotion (object sender, DragMotionArgs args) @@ -298,13 +298,13 @@ public class TestDnd { if (! have_drag) { have_drag = true; // FIXME? Kinda wonky binding. - (sender as Gtk.Image).FromPixbuf = trashcan_open_pixbuf; + (sender as Gtk.Image).Pixbuf = trashcan_open_pixbuf; } Widget source_widget = Gtk.Drag.GetSourceWidget (args.Context); Console.WriteLine ("motion, source {0}", source_widget == null ? "null" : source_widget.ToString ()); - Atom [] targets = args.Context.Targets; + Atom [] targets = args.Context.ListTargets (); foreach (Atom a in targets) Console.WriteLine (a.Name); @@ -316,7 +316,7 @@ public class TestDnd { { Console.WriteLine ("drop"); have_drag = false; - (sender as Gtk.Image).FromPixbuf = trashcan_closed_pixbuf; + (sender as Gtk.Image).Pixbuf = trashcan_closed_pixbuf; #if BROKEN // Context.Targets is not defined in the bindings if (Context.Targets.Length != 0) { @@ -474,7 +474,7 @@ public class TestDnd { Button button; Pixbuf drag_icon_pixbuf; - Application.Init (); + Gtk.Application.Init (); window = new Gtk.Window (Gtk.WindowType.Toplevel); window.DeleteEvent += new DeleteEventHandler (OnDelete); @@ -522,8 +522,7 @@ public class TestDnd { Gtk.Drag.SourceSet (button, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask, target_table, DragAction.Copy | DragAction.Move); - // FIXME can I pass a pixbuf here instead? - // Gtk.Drag.SourceSetIcon (button, window.Colormap, drag_icon, drag_mask); + Gtk.Drag.SourceSetIconPixbuf (button, drag_icon_pixbuf); table.Attach (button, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, @@ -534,11 +533,11 @@ public class TestDnd { window.ShowAll (); - Application.Run (); + Gtk.Application.Run (); } private static void OnDelete (object o, DeleteEventArgs e) { - Application.Quit (); + Gtk.Application.Quit (); } }