[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
Mario Carrión
mario.carrion at gmail.com
Mon Jun 20 20:12:18 EDT 2005
On Mon, 2005-06-20 at 19:01 -0400, Daniel Morgan wrote:
> What is the ToolItem API?
>
> I get a warning CS0618: 'Gtk.Toolbar.AppendItem(string, string, string,
> Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by ToolItem API'
>
> Here is the warning message I get:
> sqlsharpgtk.cs(545) warning CS0618: 'Gtk.Toolbar.AppendItem(string,
> string, string, Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by
> ToolItem API'
>
> monodoc does not answer this online. I see where it mentions a function
> is deprecated - but it does not mention what replaces it.
>
> Here is the source code I have:
>
> Toolbar toolbar = new Toolbar ();
>
> toolbar.ToolbarStyle = Gtk.ToolbarStyle.Icons;
>
> toolbar.AppendItem ("New SQL Editor",
> "New SQL Editor", String.Empty,
> new Gtk.Image (Stock.New, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_FileNew));
>
> toolbar.AppendItem ("Open SQL Editor",
> "Open file into SQL Editor", String.Empty,
> new Gtk.Image (Stock.Open, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_FileOpen));
>
> toolbar.AppendItem ("Save SQL Editor",
> "Save file from SQL Editor", String.Empty,
> new Gtk.Image (Stock.Save, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_FileSave));
>
> toolbar.AppendItem ("Close SQL Editor",
> "Close SQL Editor", String.Empty,
> new Gtk.Image (Stock.Close, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_FileClose));
>
> toolbar.AppendSpace ();
>
> toolbar.AppendItem ("Execute Command",
> "Execute SQL Command.", String.Empty,
> new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_ExecuteCommand));
>
> toolbar.AppendItem ("Execute Script",
> "Execute SQL Script.", String.Empty,
> new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_ExecuteScript));
>
> toolbar.AppendItem ("Output",
> "Toggle Results to Grid or Log", String.Empty,
> new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_ToggleResultsOutput));
>
> toolbar.AppendItem ("Query Mode",
> "Execute as Query or NonQuery", String.Empty,
> new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
> new Gtk.SignalFunc (OnToolbar_ToggleQueryMode));
>
> combo = ComboBox.NewText();
> combo.Changed += new EventHandler (OnDataSourceChanged);
> toolbar.AppendWidget (combo, "Connected Data Source to send
> SQL statements to execute", String.Empty);
> combo.AppendText(NotConnected);
> combo.Active = 0;
Try using:
Gtk.Tooltips tooltips = new Gtk.Tooltips ();
Gtk.ToolButton button = new Gtk.ToolButton (Gtk.Stock.Ok);
button.SetTooltip (_tooltips, "My tool button", "My nice tool button!");
button.Clicked += SomeEventHandler;
//This method replaces AppendWidget (and some others)
toolbar.Insert (button, -1);
--
Cheers
---------
Mario Carrión <mario.carrion at gmail.com>
http://www.monouml.org
More information about the Gtk-sharp-list
mailing list