public Gtk.Menu GetMenu () { owm = new OpenWithMenu (MainWindow.Toplevel.SelectedMimeTypes); owm.IgnoreApp = "f-spot"; owm.ApplicationActivated += delegate (Gnome.Vfs.MimeApplication app) { MainWindow.Toplevel.HandleOpenWith (this, app); }; return (Gtk.Menu) owm; }
public AppMenuItem(OpenWithMenu menu, MimeApplication mime_application) : base(mime_application.Name) { App = mime_application; if (menu.ShowIcons) { if (mime_application.Icon != null) { Gdk.Pixbuf pixbuf = null; try { if (mime_application.Icon.StartsWith("/")) { pixbuf = new Gdk.Pixbuf(mime_application.Icon, 16, 16); } else { pixbuf = IconTheme.Default.LoadIcon(mime_application.Icon, 16, (IconLookupFlags)0); } } catch (System.Exception) { pixbuf = null; } if (pixbuf != null) { Image = new Gtk.Image(pixbuf); } } } }
public Gtk.Menu GetMenu() { owm = new OpenWithMenu(MainWindow.Toplevel.SelectedMimeTypes); owm.IgnoreApp = "f-spot"; owm.ApplicationActivated += delegate(Gnome.Vfs.MimeApplication app) { MainWindow.Toplevel.HandleOpenWith(this, app); }; return((Gtk.Menu)owm); }
public AppMenuItem (OpenWithMenu menu, MimeApplication mime_application) : base (mime_application.Name) { App = mime_application; if (menu.ShowIcons) { if (mime_application.Icon != null) { Gdk.Pixbuf pixbuf = null; try { if (mime_application.Icon.StartsWith ("/")) pixbuf = new Gdk.Pixbuf (mime_application.Icon, 16, 16); else pixbuf = IconTheme.Default.LoadIcon (mime_application.Icon, 16, (IconLookupFlags)0); } catch (System.Exception) { pixbuf = null; } if (pixbuf != null) Image = new Gtk.Image (pixbuf); } } }
private static void ApplicationsFor (OpenWithMenu menu, string [] mime_types, out ArrayList union, out ArrayList intersection) { //Console.WriteLine ("Getting applications"); union = new ArrayList (); intersection = new ArrayList (); if (mime_types == null || mime_types.Length < 1) return; bool first = true; foreach (string mime_type in mime_types) { if (mime_type == null) continue; MimeApplication [] apps = Gnome.Vfs.Mime.GetAllApplications (mime_type); for (int i = 0; i < apps.Length; i++) { apps [i] = apps [i].Copy (); } foreach (MimeApplication app in apps) { // Skip apps that don't take URIs if (! app.SupportsUris ()) continue; // Skip apps that we were told to ignore if (menu.IgnoreApp != null) if (app.BinaryName.IndexOf (menu.IgnoreApp) != -1) continue; if (! union.Contains (app)) union.Add (app); if (first) intersection.Add (app); } if (! first) { for (int i = 0; i < intersection.Count; i++) { MimeApplication app = intersection [i] as MimeApplication; if (System.Array.IndexOf (apps, app) == -1) { intersection.Remove (app); i--; } } } first = false; } }
private static void ApplicationsFor(OpenWithMenu menu, string [] mime_types, out ArrayList union, out ArrayList intersection) { //Console.WriteLine ("Getting applications"); union = new ArrayList(); intersection = new ArrayList(); if (mime_types == null || mime_types.Length < 1) { return; } bool first = true; foreach (string mime_type in mime_types) { if (mime_type == null) { continue; } MimeApplication [] apps = Gnome.Vfs.Mime.GetAllApplications(mime_type); for (int i = 0; i < apps.Length; i++) { apps [i] = apps [i].Copy(); } foreach (MimeApplication app in apps) { // Skip apps that don't take URIs if (!app.SupportsUris()) { continue; } // Skip apps that we were told to ignore if (menu.IgnoreApp != null) { if (app.BinaryName.IndexOf(menu.IgnoreApp) != -1) { continue; } } if (!union.Contains(app)) { union.Add(app); } if (first) { intersection.Add(app); } } if (!first) { for (int i = 0; i < intersection.Count; i++) { MimeApplication app = intersection [i] as MimeApplication; if (System.Array.IndexOf(apps, app) == -1) { intersection.Remove(app); i--; } } } first = false; } }