Readd some gnome bindings so that beagle can compile with gtk-sharp 2.3 Index: Tiles/Tile.cs =================================================================== RCS file: /cvs/gnome/beagle/Tiles/Tile.cs,v retrieving revision 1.33 diff -u -B -p -r1.33 Tile.cs --- Tiles/Tile.cs 25 Oct 2005 16:42:39 -0000 1.33 +++ Tiles/Tile.cs 27 Oct 2005 17:51:00 -0000 @@ -27,7 +27,7 @@ using System; using System.Diagnostics; using Gtk; -using BU = Beagle.Util; +using Beagle.Util; namespace Beagle.Tile { @@ -169,11 +169,11 @@ namespace Beagle.Tile { command = "desktop-launch"; expects_uris = true; #else - Gnome.Vfs.MimeApplication app; - app = Gnome.Vfs.Mime.GetDefaultApplication (hit.MimeType); - if (app != null) { - command = app.Exec; - expects_uris = app.SupportsUris (); + GnomeFu.VFSMimeApplication app; + app = GnomeFu.GetDefaultAction (hit.MimeType); + if (app.command != null) { + command = app.command; + expects_uris = (app.expects_uris != GnomeFu.VFSMimeApplicationArgumentType.Path); } #endif if (command == null) { Index: Util/GnomeFu.cs =================================================================== RCS file: /cvs/gnome/beagle/Util/GnomeFu.cs,v retrieving revision 1.1 diff -u -B -p -r1.1 GnomeFu.cs --- Util/GnomeFu.cs 25 Oct 2005 16:42:39 -0000 1.1 +++ Util/GnomeFu.cs 27 Oct 2005 17:51:01 -0000 @@ -2,6 +2,7 @@ // GnomeFu.cs // // Copyright (C) 2005 Novell, Inc. +// Copyright (C) 2003, Mariano Cano P�rez // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -41,6 +42,11 @@ namespace Beagle.Util { [DllImport ("libgnomevfs-2")] extern static IntPtr gnome_vfs_get_file_mime_type (string filename, IntPtr optional_stat_info, bool suffix_only); [DllImport ("libgnomevfs-2")] extern static IntPtr gnome_vfs_get_file_mime_type_fast (string filename, IntPtr optional_stat_info); + // FIXME: When gtk-sharp 2.5 is a requirement + // use Gnome.Vfs.MimeApplication stuff instead + [DllImport("libgnomevfs-2")] + static extern IntPtr gnome_vfs_mime_get_default_application(string mime_type); + static GnomeFu () { Gnome.Vfs.Vfs.Initialize (); @@ -73,6 +79,75 @@ namespace Beagle.Util { return icon_info.Filename; } + + public static VFSMimeApplication GetDefaultAction(string mime_type) + { + IntPtr ptr = gnome_vfs_mime_get_default_application(mime_type); + VFSMimeApplication ret = VFSMimeApplication.New(ptr); + return ret; + } + + public enum VFSMimeApplicationArgumentType + { + Uris, + Path, + UrisForNonFiles + } + + [StructLayout(LayoutKind.Sequential)] + public struct VFSMimeApplication + { + public string id; + public string name; + public string command; + public bool can_open_multiple_files; + public VFSMimeApplicationArgumentType expects_uris; + //public List supported_uri_schemes; + private IntPtr supported_uri_schemes; + public bool requires_terminal; + + public IntPtr reserved1; + public IntPtr reserved2; + + public static VFSMimeApplication Zero = new VFSMimeApplication (); + + public static VFSMimeApplication New (IntPtr raw) + { + if(raw == IntPtr.Zero) + return VFSMimeApplication.Zero; + VFSMimeApplication self = new VFSMimeApplication(); + self = (VFSMimeApplication) Marshal.PtrToStructure (raw, self.GetType ()); + return self; + } + + //Fixme: Create the supported uri schemes struct + public List SupportedUriSchemes { + get { return new List (supported_uri_schemes); } + } + + public static bool operator == (VFSMimeApplication a, VFSMimeApplication b) + { + return a.Equals (b); + } + + public static bool operator != (VFSMimeApplication a, VFSMimeApplication b) + { + return ! a.Equals (b); + } + + public override bool Equals (object o) + { + //if (!(o is GnomeVFSMimeApplication)) + // return false; + return base.Equals(o) ; + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + } + } }