[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been replaced by ToolItem API

Daniel Morgan danielmorgan at verizon.net
Tue Jun 21 19:27:53 EDT 2005


I'm using mono 1.1.8/gtk# 1.9.5/gtk+ 2.6  on Windows.

How do you use the UIManager API?

Is there is a Mono/GTK# Guide for Upgrading our apps from a Mono 
1.0.x/gtk# 1.0.x/gtk+ 2.2 API to a Mono 1.1.x/gtk# 1.9.x/gtk+ 2.6 API?

What did the developers working on MonoDevelop do?

Jeroen Zwartepoorte wrote:

>Even better is to use the new UIManager API (if you're using Gtk# >
>1.0). See sample/Actions.cs for a concrete example.
>
>Jeroen
>
>On 6/21/05, Mario Carrión <mario.carrion at gmail.com> wrote:
>  
>
>>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);
>>    
>>



More information about the Gtk-sharp-list mailing list