public ApplicationMenuItem(OpenWithMenu menu, MimeApplication ma) : base(ma.Name) { this.application = ma; if (!menu.ShowIcons) { return; } if (ma.Icon == null) { return; } Gdk.Pixbuf pixbuf = null; try { if (ma.Icon.StartsWith("/")) { pixbuf = new Gdk.Pixbuf(ma.Icon, 16, 16); } else { pixbuf = IconTheme.Default.LoadIcon(ma.Icon, 16, (IconLookupFlags)0); } } catch { pixbuf = null; } if (pixbuf != null) { Image = new Gtk.Image(pixbuf); } }
private void ShowPopupMenu () { Gtk.Menu menu = new Gtk.Menu (); // Add the default 'Open' menu item TileAction open = new TileAction (Catalog.GetString ("Open"), Stock.Open, Open); ActionMenuItem open_menu_item = new ActionMenuItem (open); menu.Append (open_menu_item); if (EnableOpenWith) { // FIXME: Not sure if going with the parent is // the right thing to do in all cases. string mimetype = Utils.GetFirstPropertyOfParent (hit, "beagle:MimeType"); OpenWithMenu owm = new OpenWithMenu (mimetype); owm.ApplicationActivated += OpenWith; owm.AppendToMenu (menu); } if (Actions.Count > 0) { SeparatorMenuItem separator = new SeparatorMenuItem (); menu.Append (separator); foreach (TileAction action in Actions) { ActionMenuItem item = new ActionMenuItem (action); menu.Append (item); } } menu.ShowAll (); menu.Popup (); }
public ApplicationMenuItem (OpenWithMenu menu, MimeApplication ma) : base (ma.Name) { this.application = ma; if (!menu.ShowIcons) return; if (ma.Icon == null) return; Gdk.Pixbuf pixbuf = null; try { if (ma.Icon.StartsWith ("/")) pixbuf = new Gdk.Pixbuf (ma.Icon, 16, 16); else pixbuf = IconTheme.Default.LoadIcon (ma.Icon, 16, (IconLookupFlags)0); } catch { pixbuf = null; } if (pixbuf != null) Image = new Gtk.Image (pixbuf); }