32
32
namespace MonoDevelop.Ide.WelcomePage
34
class WelcomePageLinkButton : Gtk.Button
34
public class WelcomePageLinkButton : Gtk.Button
36
static readonly string linkUnderlinedFormat = "<span underline=\"single\" foreground=\"" + WelcomePageBranding.LinkColor + "\">{0}</span>";
37
static readonly string linkFormat = "<span foreground=\"" + WelcomePageBranding.LinkColor + "\">{0}</span>";
38
static readonly string descFormat = "<span size=\"small\" foreground=\"" + WelcomePageBranding.TextColor + "\">{0}</span>";
36
static readonly string linkUnderlinedFormat = "<span underline=\"single\" foreground=\"" + Styles.WelcomeScreen.Links.Color + "\">{0}</span>";
37
static readonly string linkFormat = "<span foreground=\"" + Styles.WelcomeScreen.Links.Color + "\">{0}</span>";
38
static readonly string descFormat = "<span size=\"small\" foreground=\"" + Styles.WelcomeScreen.Pad.TextColor + "\">{0}</span>";
43
43
Gtk.IconSize iconSize = IconSize.Menu;
46
public WelcomePageLinkButton (XElement el)
47
: this (el, Gtk.IconSize.Menu)
51
public WelcomePageLinkButton (XElement el, Gtk.IconSize iconSize)
46
public WelcomePageLinkButton (string title, string href, Gtk.IconSize iconSize = Gtk.IconSize.Menu, string icon = null, string desc = null, string tooltip = null)
54
49
this.iconSize = iconSize;
56
string title = (string) (el.Attribute ("title") ?? el.Attribute ("_title"));
57
51
if (string.IsNullOrEmpty (title))
58
52
throw new InvalidOperationException ("Link is missing title");
59
53
this.text = GettextCatalog.GetString (title);
61
string href = (string) el.Attribute ("href");
62
55
if (string.IsNullOrEmpty (href))
63
56
throw new InvalidOperationException ("Link is missing href");
64
57
this.LinkUrl = href;
66
string desc = (string) (el.Attribute ("desc") ?? el.Attribute ("_desc"));
67
59
if (!string.IsNullOrEmpty (desc))
68
60
this.desc = GettextCatalog.GetString (desc);
70
string tooltip = (string) (el.Attribute ("tooltip") ?? el.Attribute ("_tooltip"));
71
62
if (!string.IsNullOrEmpty (tooltip))
72
63
this.TooltipText = GettextCatalog.GetString (tooltip);
65
this.TooltipText = GetLinkTooltip (href);
74
string icon = (string) el.Attribute ("icon");
75
67
if (!string.IsNullOrEmpty (icon))
222
static StatusBarContext statusBar;
224
void DestroyStatusBar ()
226
if (statusBar != null) {
227
statusBar.Dispose ();
232
void SetLinkStatus (string link)
206
string GetLinkTooltip (string link)
238
210
if (link.IndexOf ("monodevelop://") != -1)
241
if (statusBar == null)
242
statusBar = IdeApp.Workbench.StatusBar.CreateContext ();
244
213
if (link.IndexOf ("project://") != -1) {
245
214
string message = link;
246
215
message = message.Substring (10);
247
216
string msg = GettextCatalog.GetString ("Open solution {0}", message);
248
217
if (IdeApp.Workspace.IsOpen)
249
218
msg += " - " + GettextCatalog.GetString ("Hold Control key to open in current workspace.");
250
statusBar.ShowMessage (msg);
252
string msg = GettextCatalog.GetString ("Open {0}", link);
253
statusBar.ShowMessage (msg);
221
return GettextCatalog.GetString ("Open {0}", link);