private static Gdk.Pixbuf PlatformGetFileIcon(string path) { Gdk.Pixbuf icon = null; var info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(path), "standard::*", 0, new IntPtr(), new IntPtr())); var sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { icon = _theme.LoadIcon(sicon[i], 16, 0); if (icon != null) { break; } } catch { } } if (icon == null) { throw new Exception(); } return(icon); }
public static Pixbuf GetIcon(string fileName) { #if GTK3 GLib.FileInfo info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(fileName), "standard::*", 0, new IntPtr(), new IntPtr())); try { string[] sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { var icon = theme.LoadIcon(sicon[i], 16, (IconLookupFlags)0); if (icon != null) { return(icon); } } catch { } } } catch { } return(theme.LoadIcon("text-x-generic", 16, (IconLookupFlags)0)); #endif return(new Pixbuf(null, "MonoGame.Tools.Pipeline.Icons.blueprint.png")); }
private static void PlatformShowOpenWithDialog(string filePath) { var adialoghandle = Gtk3Wrapper.gtk_app_chooser_dialog_new(((Gtk.Window)MainWindow.Instance.ControlObject).Handle, 4 + (int)DialogFlags.Modal, Gtk3Wrapper.g_file_new_for_path(filePath)); var adialog = new AppChooserDialog(adialoghandle); if (adialog.Run() == (int)ResponseType.Ok) { Process.Start(adialog.AppInfo.Executable, "\"" + filePath + "\""); } adialog.Destroy(); }
private static Eto.Drawing.Image PlatformGetFileIcon(string path, bool exists) { Gdk.Pixbuf icon = null; try { var info = new GLib.FileInfo(Gtk3Wrapper.g_file_query_info(Gtk3Wrapper.g_file_new_for_path(path), "standard::*", 0, new IntPtr(), new IntPtr())); var sicon = info.Icon.ToString().Split(' '); for (int i = sicon.Length - 1; i >= 1; i--) { try { icon = _theme.LoadIcon(sicon[i], 16, 0); if (icon != null) { break; } } catch { } } } catch { } if (icon == null) { icon = _theme.LoadIcon("text-x-generic", 16, 0); } if (!exists) { icon = icon.Copy(); _iconMissing.Composite(icon, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); } return(new Bitmap(new BitmapHandler(icon))); }