These are some todo things for the CDCollect application in no particular order:

- Move to sqlite version 3 

- Speed up selection and display of CD contents (maybe sorting)

- Regex in find 

- Adding files when searching must not sort as it is too slow!

- Create a beagle filter to allow searching on beagle.

- Re-write find search backend to use threads

- Show previous window when opening a second program instance. 

- Get mount point for CD. Now it defaults to /mnt/cdrom but we could read /etc/fstab.

- Get device for CD. Now it defaults to /dev/cdrom but again could read /etc/fstab.

- Implement icon support on files so a small icon can be shown in FilesView (below some code that might be useful)


/*
 * MonoTagEditor
 *
 * Copyright (C) 2003, Mariano Cano Pérez <mariano.cano@hispalinux.es>
 *
 * This file is part of MonoTagEditor.
 *
 * MonoTagEditor is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MonoTagEditor is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MonoTagEditor; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

using System;
using Gtk;
using GLib;
using System.Runtime.InteropServices;

public enum GnomeVFSMimeApplicationArgumentType
{
	Uris,
	Path,
	UrisForNonFiles
}

[StructLayout(LayoutKind.Sequential)]
public struct GnomeVFSMimeApplication
{
	public string id;
	public string name;
	public string command;
	public bool can_open_multiple_files;
	public GnomeVFSMimeApplicationArgumentType expects_uris;
	public List supported_uri_schemes;
	public bool requires_terminal;
	
	public IntPtr reserved1;
	public IntPtr reserved2;

	public static GnomeVFSMimeApplication Zero = new GnomeVFSMimeApplication ();
	
	public static GnomeVFSMimeApplication New (IntPtr raw)
	{
		if(raw == IntPtr.Zero)
		{
			return GnomeVFSMimeApplication.Zero;
		}
		GnomeVFSMimeApplication self = new GnomeVFSMimeApplication();
		self = (GnomeVFSMimeApplication) Marshal.PtrToStructure (raw, self.GetType ());
		return self;
	}

	public static bool operator == (GnomeVFSMimeApplication a, GnomeVFSMimeApplication b)
	{
		return a.Equals (b);
	}

	public static bool operator != (GnomeVFSMimeApplication a, GnomeVFSMimeApplication b)
	{
		return ! a.Equals (b);
	}

	public override bool Equals (object o)
	{
		 if (!(o is GnomeVFSMimeApplication))
			 return false;

		return ((GnomeVFSMimeApplication) o) == this;
	}
	
	public override int GetHashCode ()
	{
		return this.GetHashCode ();
	}
}

public enum GnomeIconLookupFlags
{
	None,
	EmbeddingText,
	SmallImages
}

public enum GnomeIconLookupResultsFlags
{
	None,
	Thumbnail
}

class GnomeIconLookup{

	[DllImport("libgnomeui-2")]
	static extern string gnome_icon_lookup (IntPtr icon_theme, 
						IntPtr thumbnail_factory,
						string uri,
						string custim_icon,
						IntPtr file_info,
						string mime_type,
						GnomeIconLookupFlags flags,
						ref GnomeIconLookupResultsFlags result);
	[DllImport("libgnomeui-2")]
	static extern string gnome_icon_theme_lookup_icon (IntPtr icon_theme,
						string icon_name,
						IconSize icon_size,
						ref IntPtr icon_data,
						ref int base_size);
	
	[DllImport("libgnomeui-2")]
	static extern void gnome_icon_data_free (IntPtr icon_data);
	
	[DllImport("libgnomeui-2")]
	static extern IntPtr gnome_icon_theme_new ();
	
	[DllImport("libgnomevfs-2")]
	static extern string gnome_vfs_mime_type_from_name (string mime_type);

	[DllImport("libgnomevfs-2")]
	static extern IntPtr gnome_vfs_application_registry_get_applications(string mime_type);
	
	[DllImport("libgnomevfs-2")]
	static extern IntPtr gnome_vfs_mime_get_default_application(string mime_type);
	
	public static string LookupMimeIcon(string mime,IconSize size)
	{
		string icon_name=String.Empty;
		string icon_path=String.Empty;
		GnomeIconLookupResultsFlags result=0;
		IntPtr icon_data=IntPtr.Zero;
		int base_size=0;
		IntPtr icon_theme = gnome_icon_theme_new ();
		
		if(icon_theme==IntPtr.Zero)
		{
			return String.Empty;
		}
		
		icon_name=gnome_icon_lookup(
			icon_theme,
			IntPtr.Zero,
			String.Empty,
			String.Empty,
			IntPtr.Zero,
			mime,
			GnomeIconLookupFlags.None, 
			ref result);
			
		if(icon_name.Length>0)
		{
			icon_path=gnome_icon_theme_lookup_icon (
				icon_theme,
				icon_name,
				size,
				ref icon_data,
				ref base_size);
			if(icon_data!=IntPtr.Zero)
				gnome_icon_data_free(icon_data);
		}	
		return icon_path;
	}
	
	public static string LookupFileIcon(string file,IconSize size)
	{
		string mime = gnome_vfs_mime_type_from_name(file);
		
		if(mime.Length>0)
			return LookupMimeIcon(mime,size);
		
		return String.Empty;
	}
	
	public static string GetMimeType(string file)
	{
		return gnome_vfs_mime_type_from_name(file);
	}
	
	public static GLib.List GetApplications(string mime_type)
	{
		IntPtr raw_ret = gnome_vfs_application_registry_get_applications(mime_type);
		GLib.List app = new GLib.List(raw_ret);
		return app;
	}
	
	public static GnomeVFSMimeApplication GetDefaultAction(string mime_type)
	{
		IntPtr ptr = gnome_vfs_mime_get_default_application(mime_type);
		GnomeVFSMimeApplication ret = GnomeVFSMimeApplication.New(ptr);
		return ret;
	}
}
