[Gtk-sharp-list] Gnome.IconList crashes with debian-based and mono >= 1.1.5
Mario Carrión
mario.carrion@gmail.com
Sat, 30 Apr 2005 03:15:59 -0500
Hello list
The following source code crashes with mono => 1.1.5, gtk# 1.9.3 in
Ubuntu Hoary and Debian Sarge, maybe in all debian-based systems.
For crashing it try:
- Click any icon, then click another
- Try selecting any icon with the keyboard
Any idea?
Cheers
-----
Mario Carrión
--- Sample.cs ----
using Gtk;
using Gnome;
using System;
namespace Sample
{
public class SelectProjectDialog : Gtk.Window, IDisposable
{
public static void Main (string[] args)
{
Application.Init ();
SelectProjectDialog dlg = new SelectProjectDialog ();
dlg.Show ();
Application.Run ();
}
public SelectProjectDialog () : base ("title")
{
Modal = true;
_iconlistOptions = new IconList (78, new Adjustment (1, 1, 1, 1, 1,
1) , 0);
ScrolledWindow scroll = new ScrolledWindow ();
scroll.Add (_iconlistOptions);
_vbox = new VBox (false, 0);
_buttonCancel = new Gtk.Button (Gtk.Stock.Cancel);
_buttonCancel.Clicked += OnButtonSelectProjectCancel;
_buttonOK = new Gtk.Button (Gtk.Stock.Ok);
_buttonOK.Clicked += OnButtonSelectProjectOK;
_vbox.PackStart (scroll, true, true, 0);
_vbox.PackEnd (_buttonCancel, false, false, 0);
_vbox.PackEnd (_buttonOK, false, false, 0);
Add (_vbox);
BuildIcons ();
ShowAll ();
WidthRequest = 350;
HeightRequest = 160;
WindowPosition = Gtk.WindowPosition.CenterAlways;
}
// Inserts the icons
private void BuildIcons()
{
_iconlistOptions.IconSelected += OnIconSelectedProject;
//Try selecting any icon with the keyboard. Crashes with
debian-based-systems and mono >= 1.1.5
_iconlistOptions.IconUnselected += OnIconUnselectedProject;
Gtk.Button button = new Gtk.Button ();
Gdk.Pixbuf pbuf = button.RenderIcon (Gtk.Stock.New,
Gtk.IconSize.LargeToolbar, Gtk.Stock.New);
_iconlistOptions.AppendPixbuf(pbuf , _icon_list[0,0],
_icon_list[0,1]);
pbuf = button.RenderIcon (Gtk.Stock.Open, Gtk.IconSize.LargeToolbar,
Gtk.Stock.Open);
_iconlistOptions.AppendPixbuf(pbuf , _icon_list[1,0],
_icon_list[1,1]);
_iconlistOptions.ShowAll ();
//_iconlistOptions.SelectIcon (0); //Crashes with
debian-based-systems and mono >= 1.1.5
}
private void OnIconSelectedProject (object o, IconSelectedArgs args)
{
_buttonOK.Sensitive = (args.Num >= 0);
}
//Crashes with debian-based-systems and mono >= 1.1.5
private void OnIconUnselectedProject (object o, IconUnselectedArgs
args)
{
_buttonOK.Sensitive = false;
}
private void OnButtonSelectProjectOK (object obj, EventArgs args)
{
Hide ();
}
private void OnButtonSelectProjectCancel (object obj, EventArgs args)
{
this.Hide ();
}
private string [,]_icon_list = new string[,]
{
{ "new.png", "New" },
{ "open.png", "Open" }
};
private Button _buttonOK;
private Button _buttonCancel;
private Gtk.VBox _vbox;
private IconList _iconlistOptions;
}
}
--- EOF --