public static ThumbnailToolbarButton CreateThumbnailToolbarButton(this Gtk.Action action, Func <Gtk.Action, System.Drawing.Icon> icon_callback) { var button = new ThumbnailToolbarButton(id++) { DismissOnClick = false, Tooltip = action.Label.Replace("_", ""), Enabled = action.Sensitive, Hidden = !action.Visible, Icon = icon_callback != null?icon_callback(action) : null }; button.Clicked += (o, e) => action.Activate(); action.AddNotification("icon-name", (o, args) => button.Icon = icon_callback != null ? icon_callback(action) : null); action.AddNotification("stock-id", (o, args) => button.Icon = icon_callback != null ? icon_callback(action) : null); action.AddNotification("tooltip", (o, args) => button.Tooltip = action.Label.Replace("_", "")); action.AddNotification("sensitive", (o, args) => button.Enabled = action.Sensitive); action.AddNotification("visible", (o, args) => button.Hidden = !action.Visible); return(button); }