protected override string OnGetIconIdForFile(string filename) { if (filename == "Documentation") { return("gnome-fs-regular"); } if (System.IO.Directory.Exists(filename)) { return("gnome-fs-directory"); } else if (System.IO.File.Exists(filename)) { filename = EscapeFileName(filename); if (filename == null) { return("gnome-fs-regular"); } string icon = null; try { icon = Gio.GetIconIdForFile(filename); } catch {} if (icon != null && icon.Length > 0) { return(icon); } } return("gnome-fs-regular"); }
protected override string OnGetMimeTypeForUri(string uri) { if (uri == null) { return(null); } return(Gio.GetMimeTypeForUri(uri)); }
IEnumerable <DesktopApplication> GetApplicationsForMimeType(string mimeType) { if (useGio) { return(Gio.GetAllForType(mimeType)); } else { return(GetGnomeVfsApplications(mimeType)); } }
static GnomePlatform() { try { Gio.GetDefaultForType("text/plain"); useGio = true; } catch (Exception ex) { Console.WriteLine(ex); } //apparently Gnome.Icon needs GnomeVFS initialized even when we're using GIO. Gnome.Vfs.Vfs.Initialize(); }
protected override string OnGetMimeTypeDescription(string mt) { if (useGio) { return(Gio.GetMimeTypeDescription(mt)); } else { return(Gnome.Vfs.Mime.GetDescription(mt)); } }
protected override string OnGetMimeTypeForUri(string uri) { if (uri == null) { return(null); } if (useGio) { string mt = Gio.GetMimeTypeForUri(uri); if (mt != null) { return(mt); } } return(Gnome.Vfs.MimeType.GetMimeTypeForUri(ConvertFileNameToVFS(uri))); }
public override DesktopApplication [] GetAllApplications(string mimeType) { if (useGio) { return(Gio.GetAllForType(mimeType)); } var list = new List <DesktopApplication> (); var apps = Gnome.Vfs.Mime.GetAllApplications(mimeType); foreach (var app in apps) { var dap = (DesktopApplication)Marshal.PtrToStructure(app.Handle, typeof(DesktopApplication)); list.Add(dap); } return(list.ToArray()); }
public override DesktopApplication GetDefaultApplication(string mimeType) { if (useGio) { return(Gio.GetDefaultForType(mimeType)); } var app = Gnome.Vfs.Mime.GetDefaultApplication(mimeType); if (app != null) { return((DesktopApplication)Marshal.PtrToStructure(app.Handle, typeof(DesktopApplication))); } else { return(new DesktopApplication()); } }
protected override string OnGetMimeTypeDescription(string mt) { return(Gio.GetMimeTypeDescription(mt)); }
IEnumerable <DesktopApplication> GetApplicationsForMimeType(string mimeType) { return(Gio.GetAllForType(mimeType)); }