From 3a2f01c534bdee1e13e66cc265c68eeeaf7fa94b Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Mon, 13 Jun 2011 18:00:08 +0200 Subject: [PATCH 1/8] sample: Port all existing GtkDemo samples to the new APIs The following samples crash because of an issue with the new Drawn handler: ColorSelection, DrawingArea and Pixbuf. The rest seem to work OK. --- sample/GtkDemo/DemoApplicationWindow.cs | 2 +- sample/GtkDemo/DemoColorSelection.cs | 37 ++++++----- sample/GtkDemo/DemoDialog.cs | 2 +- sample/GtkDemo/DemoDrawingArea.cs | 87 ++++++++++++------------- sample/GtkDemo/DemoEntryCompletion.cs | 2 +- sample/GtkDemo/DemoExpander.cs | 2 +- sample/GtkDemo/DemoHyperText.cs | 2 +- sample/GtkDemo/DemoImages.cs | 2 +- sample/GtkDemo/DemoMain.cs | 6 +- sample/GtkDemo/DemoPixbuf.cs | 22 ++----- sample/GtkDemo/DemoSizeGroup.cs | 4 +- sample/GtkDemo/DemoTextView.cs | 37 +++-------- sample/Makefile.am | 2 +- 13 files changed, 85 insertions(+), 122 deletions(-) diff --git a/sample/GtkDemo/DemoApplicationWindow.cs b/sample/GtkDemo/DemoApplicationWindow.cs index bc4df60aa..1d8462c56 100644 --- a/sample/GtkDemo/DemoApplicationWindow.cs +++ b/sample/GtkDemo/DemoApplicationWindow.cs @@ -192,7 +192,7 @@ namespace GtkDemo protected override bool OnWindowStateEvent (Gdk.EventWindowState evt) { if ((evt.ChangedMask & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) != 0) - statusbar.HasResizeGrip = (evt.NewWindowState & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) == 0; + HasResizeGrip = (evt.NewWindowState & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) == 0; return false; } diff --git a/sample/GtkDemo/DemoColorSelection.cs b/sample/GtkDemo/DemoColorSelection.cs index 1e8b90c87..d8f5f8b79 100644 --- a/sample/GtkDemo/DemoColorSelection.cs +++ b/sample/GtkDemo/DemoColorSelection.cs @@ -14,7 +14,7 @@ namespace GtkDemo [Demo ("Color Selection", "DemoColorSelection.cs")] public class DemoColorSelection : Gtk.Window { - private Gdk.Color color; + private Gdk.RGBA color; private Gtk.DrawingArea drawingArea; public DemoColorSelection () : base ("Color Selection") @@ -30,19 +30,22 @@ namespace GtkDemo vbox.PackStart (frame, true, true, 0); drawingArea = new DrawingArea (); - drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback); + drawingArea.Drawn += new DrawnHandler (DrawnCallback); // set a minimum size drawingArea.SetSizeRequest (200,200); // set the color - color = new Gdk.Color (0, 0, 0xff); - drawingArea.ModifyBg (StateType.Normal, color); + color.Red = 0; + color.Green = 0; + color.Blue = 1; + color.Alpha = 1; + drawingArea.OverrideBackgroundColor (StateFlags.Normal, color); frame.Add (drawingArea); Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f); Button button = new Button ("_Change the above color"); button.Clicked += new EventHandler (ChangeColorCallback); alignment.Add (button); - vbox.PackStart (alignment); + vbox.PackStart (alignment, false, false, 0); ShowAll (); } @@ -53,17 +56,15 @@ namespace GtkDemo return true; } - // Expose callback for the drawing area - private void ExposeEventCallback (object o, ExposeEventArgs args) + // Drawn callback for the drawing area + private void DrawnCallback (object o, DrawnArgs args) { - EventExpose eventExpose = args.Event; - Gdk.Window window = eventExpose.Window; - Rectangle area = eventExpose.Area; + Cairo.Context cr = args.Cr; + + Gdk.RGBA rgba = StyleContext.GetBackgroundColor (StateFlags.Normal); + cr.SetSourceRGBA (rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha); + cr.Paint (); - window.DrawRectangle (drawingArea.Style.BackgroundGC (StateType.Normal), - true, - area.X, area.Y, - area.Width, area.Height); args.RetVal = true; } @@ -71,13 +72,13 @@ namespace GtkDemo { using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) { colorSelectionDialog.TransientFor = this; - colorSelectionDialog.ColorSelection.PreviousColor = color; - colorSelectionDialog.ColorSelection.CurrentColor = color; + colorSelectionDialog.ColorSelection.SetPreviousRgba (color); + colorSelectionDialog.ColorSelection.CurrentRgba = color; colorSelectionDialog.ColorSelection.HasPalette = true; if (colorSelectionDialog.Run () == (int) ResponseType.Ok) { - Gdk.Color selected = colorSelectionDialog.ColorSelection.CurrentColor; - drawingArea.ModifyBg (StateType.Normal, selected); + Gdk.RGBA selected = colorSelectionDialog.ColorSelection.CurrentRgba; + drawingArea.OverrideBackgroundColor (StateFlags.Normal, selected); } colorSelectionDialog.Hide (); diff --git a/sample/GtkDemo/DemoDialog.cs b/sample/GtkDemo/DemoDialog.cs index 3bc74bb27..30c4a6c44 100644 --- a/sample/GtkDemo/DemoDialog.cs +++ b/sample/GtkDemo/DemoDialog.cs @@ -94,7 +94,7 @@ namespace GtkDemo HBox hbox = new HBox (false, 8); hbox.BorderWidth = 8; - dialog.VBox.PackStart (hbox, false, false, 0); + dialog.ContentArea.PackStart (hbox, false, false, 0); Image stock = new Image (Stock.DialogQuestion, IconSize.Dialog); hbox.PackStart (stock, false, false, 0); diff --git a/sample/GtkDemo/DemoDrawingArea.cs b/sample/GtkDemo/DemoDrawingArea.cs index ea7721274..c8744e177 100644 --- a/sample/GtkDemo/DemoDrawingArea.cs +++ b/sample/GtkDemo/DemoDrawingArea.cs @@ -22,7 +22,7 @@ namespace GtkDemo [Demo ("Drawing Area", "DemoDrawingArea.cs")] public class DemoDrawingArea : Gtk.Window { - private Pixmap pixmap = null; + private Cairo.Surface surface = null; public DemoDrawingArea () : base ("Drawing Area") { @@ -45,7 +45,7 @@ namespace GtkDemo // set a minimum size da.SetSizeRequest (100,100); frame.Add (da); - da.ExposeEvent += new ExposeEventHandler (CheckerboardExpose); + da.Drawn += new DrawnHandler (CheckerboardDrawn); // Create the scribble area label = new Label ("Scribble area"); @@ -62,7 +62,7 @@ namespace GtkDemo frame.Add (da); // Signals used to handle backing pixmap - da.ExposeEvent += new ExposeEventHandler (ScribbleExpose); + da.Drawn += new DrawnHandler (ScribbleDrawn); da.ConfigureEvent += new ConfigureEventHandler (ScribbleConfigure); // Event signals @@ -84,25 +84,21 @@ namespace GtkDemo return true; } - private void CheckerboardExpose (object o, ExposeEventArgs args) + private void CheckerboardDrawn (object o, DrawnArgs args) { const int CheckSize = 10; const int Spacing = 2; - DrawingArea da = o as DrawingArea; - - // It would be a bit more efficient to keep these - // GC's around instead of recreating on each expose, but - // this is the lazy/slow way. - Gdk.GC gc1 = new Gdk.GC (da.GdkWindow); - gc1.RgbFgColor = new Gdk.Color (117, 0, 117); - - Gdk.GC gc2 = new Gdk.GC (da.GdkWindow); - gc2.RgbFgColor = new Gdk.Color (255, 255, 255); + Widget widget = o as Widget; + Cairo.Context cr = args.Cr; int i, j, xcount, ycount; - Gdk.Rectangle alloc = da.Allocation; + // At the start of a draw handler, a clip region has been set on + // the Cairo context, and the contents have been cleared to the + // widget's background color. + + Rectangle alloc = widget.Allocation; // Start redrawing the Checkerboard xcount = 0; i = Spacing; @@ -110,13 +106,12 @@ namespace GtkDemo j = Spacing; ycount = xcount % 2; // start with even/odd depending on row while (j < alloc.Height) { - Gdk.GC gc; if (ycount % 2 != 0) - gc = gc1; + cr.SetSourceRGB (0.45777, 0, 0.45777); else - gc = gc2; - da.GdkWindow.DrawRectangle (gc, true, i, j, - CheckSize, CheckSize); + cr.SetSourceRGB (1, 1, 1); + // If we're outside the clip, this will do nothing. + cr.Rectangle (i, j, CheckSize, CheckSize); j += CheckSize + Spacing; ++ycount; @@ -130,33 +125,29 @@ namespace GtkDemo args.RetVal = true; } - private void ScribbleExpose (object o, ExposeEventArgs args) + private void ScribbleDrawn (object o, DrawnArgs args) { - Widget widget = o as Widget; - Gdk.Window window = widget.GdkWindow; - Rectangle area = args.Event.Area; - - // We use the "ForegroundGC" for the widget since it already exists, - // but honestly any GC would work. The only thing to worry about - // is whether the GC has an inappropriate clip region set. - window.DrawDrawable (widget.Style.ForegroundGC (StateType.Normal), - pixmap, - area.X, area.Y, - area.X, area.Y, - area.Width, area.Height); + Cairo.Context cr = args.Cr; + + cr.SetSourceSurface (surface, 0, 0); + cr.Paint (); } - // Create a new pixmap of the appropriate size to store our scribbles + // Create a new surface of the appropriate size to store our scribbles private void ScribbleConfigure (object o, ConfigureEventArgs args) { Widget widget = o as Widget; - Rectangle allocation = widget.Allocation; + + if (surface != null) + surface.Destroy (); - pixmap = new Pixmap (widget.GdkWindow, allocation.Width, allocation.Height, -1); + var allocation = widget.Allocation; - // Initialize the pixmap to white - pixmap.DrawRectangle (widget.Style.WhiteGC, true, 0, 0, - allocation.Width, allocation.Height); + surface = widget.Window.CreateSimilarSurface (Cairo.Content.Color, allocation.Width, allocation.Height); + var cr = new Cairo.Context (surface); + + cr.Paint (); + ((IDisposable)cr).Dispose (); // We've handled the configure event, no need for further processing. args.RetVal = true; @@ -166,7 +157,7 @@ namespace GtkDemo { // paranoia check, in case we haven't gotten a configure event - if (pixmap == null) + if (surface == null) return; // This call is very important; it requests the next motion event. @@ -192,19 +183,21 @@ namespace GtkDemo // Draw a rectangle on the screen private void DrawBrush (Widget widget, double x, double y) { - Rectangle update_rect = new Rectangle ((int)x - 3, (int)y - 3, 6, 6); + var update_rect = new Gdk.Rectangle ((int)x - 3, (int)y - 3, 6, 6); + var cr = new Cairo.Context (surface); + + cr.Fill (); + Gdk.CairoHelper.Rectangle (cr, update_rect); - // Paint to the pixmap, where we store our state - pixmap.DrawRectangle (widget.Style.BlackGC, true, - update_rect.X, update_rect.Y, - update_rect.Width, update_rect.Height); - widget.GdkWindow.InvalidateRect (update_rect, false); + ((IDisposable)cr).Dispose (); + + widget.Window.InvalidateRect (update_rect, false); } private void ScribbleButtonPress (object o, ButtonPressEventArgs args) { // paranoia check, in case we haven't gotten a configure event - if (pixmap == null) + if (surface == null) return; EventButton ev = args.Event; diff --git a/sample/GtkDemo/DemoEntryCompletion.cs b/sample/GtkDemo/DemoEntryCompletion.cs index 65cee5e52..2f4dab7a0 100644 --- a/sample/GtkDemo/DemoEntryCompletion.cs +++ b/sample/GtkDemo/DemoEntryCompletion.cs @@ -18,7 +18,7 @@ namespace GtkDemo VBox vbox = new VBox (false, 5); vbox.BorderWidth = 5; - this.VBox.PackStart (vbox, true, true, 0); + this.ContentArea.PackStart (vbox, true, true, 0); Label label = new Label ("Completion demo, try writing total or gnome for example."); label.UseMarkup = true; diff --git a/sample/GtkDemo/DemoExpander.cs b/sample/GtkDemo/DemoExpander.cs index 192b369fd..f5016554c 100644 --- a/sample/GtkDemo/DemoExpander.cs +++ b/sample/GtkDemo/DemoExpander.cs @@ -17,7 +17,7 @@ namespace GtkDemo Resizable = false; VBox vbox = new VBox (false, 5); - this.VBox.PackStart (vbox, true, true, 0); + this.ContentArea.PackStart (vbox, true, true, 0); vbox.BorderWidth = 5; vbox.PackStart (new Label ("Expander demo. Click on the triangle for details."), false, false, 0); diff --git a/sample/GtkDemo/DemoHyperText.cs b/sample/GtkDemo/DemoHyperText.cs index c97f92b13..a657aaf20 100644 --- a/sample/GtkDemo/DemoHyperText.cs +++ b/sample/GtkDemo/DemoHyperText.cs @@ -184,7 +184,7 @@ namespace GtkDemo view.WindowToBufferCoords (TextWindowType.Widget, (int) args.Event.X, (int) args.Event.Y, out x, out y); SetCursorIfAppropriate (view, x, y); - view.GdkWindow.GetPointer (out x, out y, out state); + view.Window.GetPointer (out x, out y, out state); } // Also update the cursor image if the window becomes visible diff --git a/sample/GtkDemo/DemoImages.cs b/sample/GtkDemo/DemoImages.cs index 07ccae595..fb79f30e1 100644 --- a/sample/GtkDemo/DemoImages.cs +++ b/sample/GtkDemo/DemoImages.cs @@ -170,7 +170,7 @@ namespace GtkDemo { Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf; pixbuf.Fill (0xaaaaaaff); - progressiveImage.FromPixbuf = pixbuf; + progressiveImage.Pixbuf = pixbuf; } void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args) diff --git a/sample/GtkDemo/DemoMain.cs b/sample/GtkDemo/DemoMain.cs index 36a4e0745..b2b39dd29 100644 --- a/sample/GtkDemo/DemoMain.cs +++ b/sample/GtkDemo/DemoMain.cs @@ -180,8 +180,8 @@ namespace GtkDemo scrolledWindow.Add (textView); if (IsSource) { - FontDescription fontDescription = FontDescription.FromString ("Courier 12"); - textView.ModifyFont (fontDescription); + FontDescription fontDescription = FontDescription.FromString ("monospace"); + textView.OverrideFont (fontDescription); textView.WrapMode = Gtk.WrapMode.None; } else { // Make it a bit nicer for text @@ -191,7 +191,7 @@ namespace GtkDemo } return scrolledWindow; - } + } private TreeStore FillTree () { diff --git a/sample/GtkDemo/DemoPixbuf.cs b/sample/GtkDemo/DemoPixbuf.cs index a1ae4a1b8..401f3263f 100644 --- a/sample/GtkDemo/DemoPixbuf.cs +++ b/sample/GtkDemo/DemoPixbuf.cs @@ -71,23 +71,13 @@ namespace GtkDemo } // Expose callback for the drawing area - void Expose (object o, ExposeEventArgs args) + void DrawnCallback (object o, DrawnArgs args) { - Widget widget = (Widget) o; - Gdk.Rectangle area = args.Event.Area; - byte[] pixels; - int rowstride; + Cairo.Context cr = args.Cr; + + Gdk.CairoHelper.SetSourcePixbuf (cr, frame, 0, 0); + cr.Paint (); - rowstride = frame.Rowstride; - pixels = new byte[(frame.Height - area.Y) * rowstride]; - IntPtr src = (IntPtr)(frame.Pixels.ToInt64 () + rowstride * area.Y + area.X * 3); - Marshal.Copy (src, pixels, 0, pixels.Length); - - widget.GdkWindow.DrawRgbImageDithalign (widget.Style.BlackGC, - area.X, area.Y, area.Width, area.Height, - Gdk.RgbDither.Normal, - pixels, rowstride, - area.X, area.Y); args.RetVal = true; } @@ -152,7 +142,7 @@ namespace GtkDemo frame = new Pixbuf (Colorspace.Rgb, false, 8, backWidth, backHeight); drawingArea = new DrawingArea (); - drawingArea.ExposeEvent += new ExposeEventHandler (Expose); + drawingArea.Drawn += new DrawnHandler (DrawnCallback); Add (drawingArea); timeoutId = GLib.Timeout.Add (FrameDelay, new GLib.TimeoutHandler(timeout)); diff --git a/sample/GtkDemo/DemoSizeGroup.cs b/sample/GtkDemo/DemoSizeGroup.cs index 42776f2ee..8d04cd509 100644 --- a/sample/GtkDemo/DemoSizeGroup.cs +++ b/sample/GtkDemo/DemoSizeGroup.cs @@ -33,7 +33,7 @@ namespace GtkDemo Resizable = false; VBox vbox = new VBox (false, 5); - this.VBox.PackStart (vbox, true, true, 0); + this.ContentArea.PackStart (vbox, true, true, 0); vbox.BorderWidth = 5; sizeGroup = new SizeGroup (SizeGroupMode.Horizontal); @@ -76,7 +76,7 @@ namespace GtkDemo // Convenience function to create a combo box holding a number of strings private ComboBox CreateComboBox (string [] strings) { - ComboBox combo = ComboBox.NewText (); + ComboBoxText combo = new ComboBoxText (); foreach (string str in strings) combo.AppendText (str); diff --git a/sample/GtkDemo/DemoTextView.cs b/sample/GtkDemo/DemoTextView.cs index 7873dc0b8..af9f60b27 100644 --- a/sample/GtkDemo/DemoTextView.cs +++ b/sample/GtkDemo/DemoTextView.cs @@ -71,7 +71,7 @@ namespace GtkDemo textView.AddChildAtAnchor (button, buttonAnchor); button.ShowAll (); - ComboBox combo = ComboBox.NewText (); + ComboBoxText combo = new ComboBoxText (); combo.AppendText ("Option 1"); combo.AppendText ("Option 2"); combo.AppendText ("Option 3"); @@ -154,20 +154,6 @@ namespace GtkDemo tag.Background = "red"; buffer.TagTable.Add (tag); - // The C gtk-demo passes NULL for the drawable param, which isn't - // multi-head safe, so it seems bad to allow it in the C# API. - // But the Window isn't realized at this point, so we can't get - // an actual Drawable from it. So we kludge for now. - Pixmap stipple = Pixmap.CreateBitmapFromData (Gdk.Screen.Default.RootWindow, gray50_bits, gray50_width, gray50_height); - - tag = new TextTag ("background_stipple"); - tag.BackgroundStipple = stipple; - buffer.TagTable.Add (tag); - - tag = new TextTag ("foreground_stipple"); - tag.ForegroundStipple = stipple; - buffer.TagTable.Add (tag); - tag = new TextTag ("big_gap_before_line"); tag.PixelsAboveLines = 30; buffer.TagTable.Add (tag); @@ -278,17 +264,10 @@ namespace GtkDemo buffer.Insert (ref insertIter, " or "); buffer.InsertWithTagsByName (ref insertIter, "a red background", "red_background"); buffer.Insert (ref insertIter, " or even "); - buffer.InsertWithTagsByName (ref insertIter, "a stippled red background", - "red_background", - "background_stipple"); - - buffer.Insert (ref insertIter, " or "); - buffer.InsertWithTagsByName (ref insertIter, - "a stippled blue foreground on solid red background", - "blue_foreground", - "red_background", - "foreground_stipple"); - buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n"); + buffer.InsertWithTagsByName (ref insertIter, "a blue foreground on red background", + "blue_foreground", + "red_background"); + buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n"); buffer.InsertWithTagsByName (ref insertIter, "Underline, strikethrough, and rise. ", "heading"); @@ -389,9 +368,9 @@ namespace GtkDemo // Event box is to add a black border around each child view EventBox eventBox = new EventBox (); - Gdk.Color color = new Gdk.Color (); - Gdk.Color.Parse ("black", ref color); - eventBox.ModifyBg (StateType.Normal, color); + Gdk.RGBA color = new Gdk.RGBA (); + color.Parse ("black"); + eventBox.OverrideBackgroundColor (StateFlags.Normal, color); Alignment align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f); align.BorderWidth = 1; diff --git a/sample/Makefile.am b/sample/Makefile.am index 8ef13e059..412e80fc7 100755 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -1,4 +1,4 @@ -# SUBDIRS = GtkDemo pixmaps valtest opaquetest gio gtk-gio +SUBDIRS = GtkDemo #pixmaps valtest opaquetest gio gtk-gio if ENABLE_DOTNET DOTNET_TARGETS=drawing-sample.exe From 29716c86336437b680ad65029297f6cc2fa13ebf Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 16:11:35 +0200 Subject: [PATCH 2/8] sample: Fix Makefile.am in valtest and opaque samples --- sample/opaquetest/Makefile.am | 2 +- sample/valtest/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/opaquetest/Makefile.am b/sample/opaquetest/Makefile.am index e9f5a6c8b..dfdda481a 100644 --- a/sample/opaquetest/Makefile.am +++ b/sample/opaquetest/Makefile.am @@ -21,7 +21,7 @@ generated/*.cs: opaque-api.xml $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=generated --assembly-name=opaque-sharp api: - PATH=../../parser:$PATH $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml + PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml $(RUNTIME) ../../parser/gapi-fixup.exe --metadata=Opaque.metadata --api=opaque-api.xml install: diff --git a/sample/valtest/Makefile.am b/sample/valtest/Makefile.am index 6109dea5e..38c1bbb51 100644 --- a/sample/valtest/Makefile.am +++ b/sample/valtest/Makefile.am @@ -21,7 +21,7 @@ Valobj.cs: valobj-api.xml $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=. --assembly-name=valobj-sharp api: - PATH=../../parser:$PATH $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml + PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml install: From 58cd79d8040185c7d537c1583177b2eaa7eec2f5 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 16:13:13 +0200 Subject: [PATCH 3/8] sample: Update valobj and opaque API definitions --- sample/opaquetest/opaque-api.xml | 18 +++++++++--------- sample/valtest/valobj-api.xml | 5 ++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sample/opaquetest/opaque-api.xml b/sample/opaquetest/opaque-api.xml index 96ab46c0e..88ea5f28c 100644 --- a/sample/opaquetest/opaque-api.xml +++ b/sample/opaquetest/opaque-api.xml @@ -1,5 +1,5 @@ - + + + + From 6300effd3abb528fb9c74b0c3a3f627f21ccf11f Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 16:15:01 +0200 Subject: [PATCH 4/8] sample: Fix gtk include in valobj.h --- sample/valtest/valobj.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sample/valtest/valobj.h b/sample/valtest/valobj.h index 2bb67a0c7..f4f5ce6cd 100644 --- a/sample/valtest/valobj.h +++ b/sample/valtest/valobj.h @@ -6,8 +6,7 @@ #ifndef GTKSHARP_VALOBJ_H #define GTKSHARP_VALOBJ_H 1 -#include -#include +#include #define GTKSHARP_TYPE_VALOBJ (gtksharp_valobj_get_type ()) #define GTKSHARP_VALOBJ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKSHARP_TYPE_VALOBJ, GtksharpValobj)) From 3ff334d0cc60a9a76d4f00f20486bbe47693ef63 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 16:16:41 +0200 Subject: [PATCH 5/8] gdk: Add explicit conversion to and from GLib.Value for Rectangle This allows the valtest sample to compile and work. --- gdk/Rectangle.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gdk/Rectangle.cs b/gdk/Rectangle.cs index d2b5511a0..deebb6852 100644 --- a/gdk/Rectangle.cs +++ b/gdk/Rectangle.cs @@ -71,6 +71,19 @@ namespace Gdk { { return !(r1 == r2); } + + public static explicit operator GLib.Value (Gdk.Rectangle boxed) + { + GLib.Value val = GLib.Value.Empty; + val.Init (Gdk.Rectangle.GType); + val.Val = boxed; + return val; + } + + public static explicit operator Gdk.Rectangle (GLib.Value val) + { + return (Gdk.Rectangle) val.Val; + } public override string ToString () { From 68110751229f6d7420378ca7ab9b7e38d5887eee Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 18:53:06 +0200 Subject: [PATCH 6/8] sample: Update the "test" samples to the new APIs Accessing Dialog.ActionArea triggers a crash, so some samples fail because of that. --- sample/test/Makefile.am | 8 +- sample/test/TestColorSelection.cs | 27 +++--- sample/test/TestComboBox.cs | 6 +- sample/test/TestDialog.cs | 11 +-- sample/test/TestFileSelection.cs | 67 -------------- sample/test/TestFlipping.cs | 4 +- sample/test/TestMenus.cs | 142 ------------------------------ sample/test/TestRange.cs | 2 - sample/test/TestSizeGroup.cs | 4 +- sample/test/TestToolbar.cs | 132 --------------------------- sample/test/TestTooltip.cs | 34 ------- sample/test/WidgetViewer.cs | 26 +----- 12 files changed, 27 insertions(+), 436 deletions(-) delete mode 100644 sample/test/TestFileSelection.cs delete mode 100644 sample/test/TestMenus.cs delete mode 100644 sample/test/TestToolbar.cs delete mode 100644 sample/test/TestTooltip.cs diff --git a/sample/test/Makefile.am b/sample/test/Makefile.am index 9bf18dadf..8afaf31eb 100644 --- a/sample/test/Makefile.am +++ b/sample/test/Makefile.am @@ -19,13 +19,13 @@ EXTRA_DIST = $(sources) ChangeLog sources = \ TestCheckButton.cs \ TestColorSelection.cs \ - TestRadioButton.cs \ - TestRange.cs \ - TestStatusbar.cs \ + TestComboBox.cs \ TestDialog.cs \ TestFlipping.cs \ + TestRadioButton.cs \ + TestRange.cs \ TestSizeGroup.cs \ - TestComboBox.cs \ + TestStatusbar.cs \ WidgetViewer.cs build_sources = $(addprefix $(srcdir)/, $(sources)) diff --git a/sample/test/TestColorSelection.cs b/sample/test/TestColorSelection.cs index eeb9cf049..da89063f4 100644 --- a/sample/test/TestColorSelection.cs +++ b/sample/test/TestColorSelection.cs @@ -27,8 +27,8 @@ namespace WidgetViewer { window.ColorSelection.HasPalette = true; window.SetDefaultSize (250, 200); - window.VBox.PackStart (options, false, false, 0); - window.VBox.BorderWidth = 10; + window.ContentArea.PackStart (options, false, false, 0); + window.ContentArea.BorderWidth = 10; check_button = new CheckButton("Show Opacity"); check_button.Active = true; @@ -59,18 +59,18 @@ namespace WidgetViewer { window.ColorSelection.HasPalette = ((ToggleButton )o).Active; } - static string HexFormat (Gdk.Color color) + static string HexFormat (Gdk.RGBA color) { StringBuilder s = new StringBuilder (); - ushort[] vals = { color.Red, color.Green, color.Blue }; + double[] vals = { color.Red, color.Green, color.Blue }; char[] hexchars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; s.Append ('#'); - foreach (ushort val in vals) { + foreach (double val in vals) { /* Convert to a range of 0-255, then lookup the * digit for each half-byte */ - byte rounded = (byte) (val >> 8); + byte rounded = (byte) (val * 255); s.Append (hexchars[(rounded & 0xf0) >> 4]); s.Append (hexchars[rounded & 0x0f]); } @@ -80,13 +80,13 @@ namespace WidgetViewer { static void Color_Changed (object o, EventArgs args) { - Gdk.Color color = window.ColorSelection.CurrentColor; + Gdk.RGBA color = window.ColorSelection.CurrentRgba; Console.WriteLine (HexFormat (color)); } static void Color_Selection_OK (object o, EventArgs args) { - Gdk.Color selected = window.ColorSelection.CurrentColor; + Gdk.RGBA selected = window.ColorSelection.CurrentRgba; window.Hide (); Display_Result (selected); } @@ -102,18 +102,17 @@ namespace WidgetViewer { window.ShowAll (); } - static void Display_Result (Gdk.Color color) + static void Display_Result (Gdk.RGBA color) { dialog = new Dialog (); dialog.Title = "Selected Color: " + HexFormat (color); - dialog.HasSeparator = true; - + DrawingArea da = new DrawingArea (); - da.ModifyBg (StateType.Normal, color); + da.OverrideBackgroundColor (StateFlags.Normal, color); - dialog.VBox.BorderWidth = 10; - dialog.VBox.PackStart (da, true, true, 10); + dialog.ContentArea.BorderWidth = 10; + dialog.ContentArea.PackStart (da, true, true, 10); dialog.SetDefaultSize (200, 200); Button button = new Button (Stock.Ok); diff --git a/sample/test/TestComboBox.cs b/sample/test/TestComboBox.cs index 1163a4595..a48a54ca3 100644 --- a/sample/test/TestComboBox.cs +++ b/sample/test/TestComboBox.cs @@ -25,9 +25,11 @@ namespace WidgetViewer { box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); - ComboBoxEntry combo = new Gtk.ComboBoxEntry (new string[] {"Foo", "Bar"}); + ComboBoxText combo = ComboBoxText.NewWithEntry (); + combo.AppendText ("Foo"); + combo.AppendText ("Bar"); combo.Changed += new EventHandler (OnComboActivated); - combo.Entry.Changed += new EventHandler (OnComboEntryChanged); + ((Entry)combo.Child).Changed += new EventHandler (OnComboEntryChanged); box2.PackStart (combo, true, true, 0); HSeparator separator = new HSeparator (); diff --git a/sample/test/TestDialog.cs b/sample/test/TestDialog.cs index 39a2fb50a..66c010999 100644 --- a/sample/test/TestDialog.cs +++ b/sample/test/TestDialog.cs @@ -34,10 +34,6 @@ namespace WidgetViewer { toggle_button.Clicked += new EventHandler (Label_Toggle); window.ActionArea.PackStart (toggle_button, true, true, 0); - toggle_button = new ToggleButton ("Toggle Separator"); - toggle_button.Clicked += new EventHandler (Separator_Toggle); - window.ActionArea.PackStart (toggle_button, true, true, 0); - window.ShowAll (); return window; @@ -58,18 +54,13 @@ namespace WidgetViewer { if (label == null) { label = new Label ("This is Text label inside a Dialog"); label.SetPadding (10, 10); - window.VBox.PackStart (label, true, true, 0); + window.ContentArea.PackStart (label, true, true, 0); label.Show (); } else { label.Destroy (); label = null; } } - - static void Separator_Toggle (object o, EventArgs args) - { - window.HasSeparator = (!((ToggleButton) o).Active); - } } } diff --git a/sample/test/TestFileSelection.cs b/sample/test/TestFileSelection.cs deleted file mode 100644 index af0842bb2..000000000 --- a/sample/test/TestFileSelection.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// TestFileSelection.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) 2002, Duncan Mak, Ximian Inc. -// - -using System; - -using Gtk; - -namespace WidgetViewer { - public class TestFileSelection - { - static FileSelection window = null; - static ToggleButton toggle_button = null; - static CheckButton check_button = null; - - public static Gtk.Window Create () - { - window = new FileSelection ("File Selection Dialog"); - window.HideFileopButtons (); - window.OkButton.Clicked += new EventHandler (file_selection_ok); - window.CancelButton.Clicked += new EventHandler (file_selection_cancel); - - check_button = new CheckButton ("Show Fileops"); - check_button.Toggled += new EventHandler (show_fileops); - window.ActionArea.PackStart (check_button, false, false, 0); - - toggle_button = new ToggleButton ("Select Multiple"); - toggle_button.Clicked += new EventHandler (select_multiple); - window.ActionArea.PackStart (toggle_button, false, false, 0); - - window.ShowAll (); - return window; - } - - static void file_selection_ok (object o, EventArgs args) - { - Gtk.FileSelection.FSButton fsbutton = (Gtk.FileSelection.FSButton) o; - - Console.WriteLine ("ok button clicked!"); - - fsbutton.FileSelection.Destroy (); - } - - static void show_fileops (object o, EventArgs args) - { - if (((ToggleButton) o).Active) - window.ShowFileopButtons (); - else - window.HideFileopButtons (); - } - - static void select_multiple (object o, EventArgs args) - { - window.SelectMultiple = toggle_button.Active; - } - - static void file_selection_cancel (object o, EventArgs args) - { - window.Destroy (); - } - } -} - diff --git a/sample/test/TestFlipping.cs b/sample/test/TestFlipping.cs index 57c496b53..301bd81a1 100644 --- a/sample/test/TestFlipping.cs +++ b/sample/test/TestFlipping.cs @@ -27,10 +27,10 @@ namespace WidgetViewer { label = new Label ("Label direction: Left-to-right"); label.UseMarkup = true; label.SetPadding (3, 3); - window.VBox.PackStart (label, true, true, 0); + window.ContentArea.PackStart (label, true, true, 0); check_button = new CheckButton ("Toggle label direction"); - window.VBox.PackStart (check_button, true, true, 2); + window.ContentArea.PackStart (check_button, true, true, 2); if (window.Direction == TextDirection.Ltr) check_button.Active = true; diff --git a/sample/test/TestMenus.cs b/sample/test/TestMenus.cs deleted file mode 100644 index fcdbaf147..000000000 --- a/sample/test/TestMenus.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -// TestMenus.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) 2002, Duncan Mak, Ximian Inc. -// - -using System; - -using Gtk; - -namespace WidgetViewer { - public class TestMenus { - - static Window window = null; - - public static Gtk.Window Create () - { - window = new Window ("Menus"); - - AccelGroup accel_group = new AccelGroup (); - window.AddAccelGroup (accel_group); - - VBox box1 = new VBox (false, 0); - window.Add (box1); - - MenuBar menubar = new MenuBar (); - box1.PackStart (menubar, false, false, 0); - - Menu menu = Create_Menu (2, true); - MenuItem menuitem = new MenuItem ("foo"); - menuitem.Submenu = menu; - menubar.Append (menuitem); - - menuitem = new MenuItem ("bar"); - menuitem.Submenu = Create_Menu (3, true); - menubar.Append (menuitem); - - Image image = new Image (Stock.Help, IconSize.Menu); - - menuitem = new ImageMenuItem ("Help"); - ((ImageMenuItem) menuitem).Image = image; - menuitem.Submenu = Create_Menu (4, true); - menuitem.RightJustified = true; - menubar.Append (menuitem); - - menubar = new MenuBar (); - box1.PackStart (menubar, false, true, 0); - - menu = Create_Menu (2, true); - - menuitem = new MenuItem ("Second menu bar"); - menuitem.Submenu = menu; - menubar.Append (menuitem); - - VBox box2 = new VBox (false, 10); - box2.BorderWidth = 10; - box1.PackStart (box2, true, true, 0); - - menu = Create_Menu (1, false); - menu.AccelGroup = accel_group; - - menu.Append (new SeparatorMenuItem ()); - - menuitem = new CheckMenuItem ("Accelerate Me"); - menu.Append (menuitem); - menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible); - - menuitem = new CheckMenuItem ("Accelerator locked"); - menu.Append (menuitem); - menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked); - - menuitem = new CheckMenuItem ("Accelerator Frozen"); - menu.Append (menuitem); - menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible); - menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible); - - OptionMenu option_menu = new OptionMenu (); - option_menu.Menu = menu; - option_menu.SetHistory (3); - box2.PackStart (option_menu, true, true, 0); - - box1.PackStart (new HSeparator (), false, false, 0); - - box2 = new VBox (false, 10); - box2.BorderWidth = 10; - box1.PackStart (box2, false, true, 0); - - Button close_button = new Button (Stock.Close); - close_button.Clicked += new EventHandler (Close_Button); - box2.PackStart (close_button, true, true, 0); - - close_button.CanDefault = true; - close_button.GrabDefault (); - - window.ShowAll (); - return window; - } - - static Menu Create_Menu (int depth, bool tearoff) - { - if (depth < 1) - return null; - - Menu menu = new Menu (); - MenuItem menuitem = null; - string label = null; - GLib.SList group = new GLib.SList (IntPtr.Zero); - - if (tearoff) { - menuitem = new TearoffMenuItem (); - menu.Append (menuitem); - menuitem.Show (); - } - - for (int i = 0, j = 1; i < 5; i++, j++) { - - label = String.Format ("item {0} - {1}", depth, j); - menuitem = new RadioMenuItem (group, label); - group = ((RadioMenuItem) menuitem).Group; - menuitem = new MenuItem (label); - menu.Append (menuitem); - - if (i == 3) - menuitem.Sensitive = false; - - Menu child = Create_Menu ((depth - 1), true); - - if (child != null) - menuitem.Submenu = child; - } - - return menu; - } - - static void Close_Button (object o, EventArgs args) - { - window.Destroy (); - } - } -} diff --git a/sample/test/TestRange.cs b/sample/test/TestRange.cs index 82fb81105..35fc8a6dd 100644 --- a/sample/test/TestRange.cs +++ b/sample/test/TestRange.cs @@ -32,14 +32,12 @@ namespace WidgetViewer { HScale hscale = new HScale (adjustment); hscale.SetSizeRequest (150, -1); - ((Range) hscale).UpdatePolicy = UpdateType.Delayed; hscale.Digits = 1; hscale.DrawValue = true; box2.PackStart (hscale, true, true, 0); HScrollbar hscrollbar = new HScrollbar (adjustment); - ((Range) hscrollbar).UpdatePolicy = UpdateType.Continuous; box2.PackStart (hscrollbar, true, true, 0); hscale = new HScale (adjustment); diff --git a/sample/test/TestSizeGroup.cs b/sample/test/TestSizeGroup.cs index 486643294..a6f189e07 100644 --- a/sample/test/TestSizeGroup.cs +++ b/sample/test/TestSizeGroup.cs @@ -23,7 +23,7 @@ namespace WidgetViewer { window.Resizable = false; VBox vbox = new VBox (false, 5); - window.VBox.PackStart (vbox, true, true, 0); + window.ContentArea.PackStart (vbox, true, true, 0); vbox.BorderWidth = 5; size_group = new SizeGroup (SizeGroupMode.Horizontal); @@ -85,7 +85,7 @@ namespace WidgetViewer { option_menu.Menu = menu; return option_menu;*/ - ComboBox combo_box = new ComboBox (); + ComboBoxText combo_box = new ComboBoxText (); foreach (string str in strings) { combo_box.AppendText (str); } diff --git a/sample/test/TestToolbar.cs b/sample/test/TestToolbar.cs deleted file mode 100644 index 3376c183f..000000000 --- a/sample/test/TestToolbar.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -// TestToolbar.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) 2002, Duncan Mak, Ximian Inc. -// - -using System; - -using Gtk; - -namespace WidgetViewer { - public class TestToolbar { - - static Window window = null; - static Toolbar toolbar = null; - static bool showTooltips = true; - - public static Gtk.Window Create () - { - window = new Window ("Toolbar"); - window.Resizable = false; - - toolbar = new Toolbar (); - toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New", - new SignalFunc (set_small_icon), IntPtr.Zero, -1); - - toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open", - new SignalFunc (set_large_icon), IntPtr.Zero, -1); - - toolbar.AppendSpace (); - - toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips", - new Image (Stock.DialogInfo, IconSize.LargeToolbar), - new SignalFunc (toggle_tooltips)); - - toolbar.AppendSpace (); - - toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal", - new Image (Stock.GoForward, IconSize.LargeToolbar), - new SignalFunc (set_horizontal)); - - toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical", - new Image (Stock.GoUp, IconSize.LargeToolbar), - new SignalFunc (set_vertical)); - - toolbar.AppendSpace (); - - toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly", - new Image (Stock.Home, IconSize.LargeToolbar), - new SignalFunc (set_icon_only)); - - toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly", - new Image (Stock.JustifyFill, IconSize.LargeToolbar), - new SignalFunc (set_text_only)); - - toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both", - new Image (Stock.Index, IconSize.LargeToolbar), - new SignalFunc (set_both)); - - toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz", - new Image (Stock.Index, IconSize.LargeToolbar), - new SignalFunc (set_both_horiz)); - - toolbar.AppendSpace (); - - toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close", - new SignalFunc (Close_Button), IntPtr.Zero, -1); - - window.Add (toolbar); - window.ShowAll (); - return window; - } - - static void set_small_icon () - { - toolbar.IconSize = IconSize.SmallToolbar; - } - - static void set_large_icon () - { - toolbar.IconSize = IconSize.LargeToolbar; - } - - static void set_icon_only () - { - toolbar.ToolbarStyle = ToolbarStyle.Icons; - } - - static void set_text_only () - { - toolbar.ToolbarStyle = ToolbarStyle.Text; - } - - static void set_horizontal () - { - toolbar.Orientation = Orientation.Horizontal; - } - - static void set_vertical () - { - toolbar.Orientation = Orientation.Vertical; - } - - static void set_both () - { - toolbar.ToolbarStyle = ToolbarStyle.Both; - } - - static void set_both_horiz () - { - toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; - } - - static void toggle_tooltips () - { - if (showTooltips == true) - showTooltips = false; - else - showTooltips = true; - - toolbar.Tooltips = showTooltips; - Console.WriteLine ("Show tooltips: " + showTooltips); - } - - static void Close_Button () - { - window.Destroy (); - } - } -} diff --git a/sample/test/TestTooltip.cs b/sample/test/TestTooltip.cs deleted file mode 100644 index 5b0a8b784..000000000 --- a/sample/test/TestTooltip.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// TestToolTip.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// Copyright (C) 2002, Duncan Mak, Ximian Inc. -// - -using System; - -using Gtk; - -namespace WidgetViewer { - public class TestToolTip - { - static Window window = null; - static Tooltips tooltips = null; - - public Gtk.Window Create () - { - window = new Window ("Tooltips"); - window.DefaultSize = new Gdk.Size (200, 150); - tooltips = new Tooltips (); - - return window; - } - - static void Window_Delete (object o, EventArgs args) - { - window.Destroy (); - } - } -} - diff --git a/sample/test/WidgetViewer.cs b/sample/test/WidgetViewer.cs index a3cdd8165..42e02faf2 100644 --- a/sample/test/WidgetViewer.cs +++ b/sample/test/WidgetViewer.cs @@ -41,15 +41,11 @@ namespace WidgetViewer { AddButton ("Check Buttons", new EventHandler (Check_Buttons)); AddButton ("Color Selection", new EventHandler (Color_Selection)); AddButton ("Combo Box", new EventHandler (Combo_Box)); - AddButton ("New Combo Box", new EventHandler (New_Combo_Box)); AddButton ("Dialog", new EventHandler (Dialog)); - AddButton ("File Selection", new EventHandler (File_Selection)); - AddButton ("Menus", new EventHandler (Menus)); AddButton ("Radio Buttons", new EventHandler (Radio_Buttons)); AddButton ("Range Controls", new EventHandler (Range_Controls)); AddButton ("Size Groups", new EventHandler (Size_Groups)); AddButton ("Statusbar", new EventHandler (Statusbar)); - AddButton ("Toolbar", new EventHandler (Toolbar)); box1.PackStart (new HSeparator (), false, false, 0); @@ -107,11 +103,6 @@ namespace WidgetViewer { AddWindow (TestColorSelection.Create ()); } - static void File_Selection (object o, EventArgs args) - { - //AddWindow (TestFileSelection.Create ()); - } - static void Radio_Buttons (object o, EventArgs args) { AddWindow (TestRadioButton.Create ()); @@ -127,11 +118,6 @@ namespace WidgetViewer { AddWindow (TestStatusbar.Create ()); } - static void Toolbar (object o, EventArgs args) - { - //AddWindow (TestToolbar.Create ()); - } - static void Dialog (object o, EventArgs args) { AddWindow (TestDialog.Create ()); @@ -142,24 +128,14 @@ namespace WidgetViewer { AddWindow (TestFlipping.Create ()); } - static void Menus (object o, EventArgs args) - { - //AddWindow (TestMenus.Create ()); - } - static void Size_Groups (object o, EventArgs args) { AddWindow (TestSizeGroup.Create ()); } - static void New_Combo_Box (object o, EventArgs args) + static void Combo_Box (object o, EventArgs args) { AddWindow (TestComboBox.Create ()); } - - static void Combo_Box (object o, EventArgs args) - { - AddWindow (TestCombo.Create ()); - } } } From 505fc5ff0bb1678f7c5b453c7d54a4231b8068bd Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sat, 18 Jun 2011 18:57:24 +0200 Subject: [PATCH 7/8] sample: re-enable all samples in the build --- sample/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/Makefile.am b/sample/Makefile.am index 412e80fc7..0e8aa4040 100755 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = GtkDemo #pixmaps valtest opaquetest gio gtk-gio +SUBDIRS = test GtkDemo pixmaps valtest opaquetest gio gtk-gio if ENABLE_DOTNET DOTNET_TARGETS=drawing-sample.exe From 5568a568a7c89e32fb9b7d041f7ab7061c1c2121 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sun, 19 Jun 2011 12:26:33 +0200 Subject: [PATCH 8/8] Have Dialog.ActionArea return a ButtonBox instead of a HButtonBox The action area is created as a GtkButtonBox, so casting it to a GtkHButtonBox doesn't work. And GtkHButtonBox is going to be deprecated in 3.2 anyway. This fixes a crash when accessing Dialog.ActionArea. With this, everything in sample/test seems to work OK. --- gtk/Gtk.metadata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index daeb9e376..555494d20 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -312,7 +312,7 @@ 1 1 1 - GtkHButtonBox* + GtkButtonBox* GtkBox* Respond GtkResponseType