[MonoDevelop] C# source files mime-type with gnome 2.6

Jeroen Zwartepoorte jeroen@xs4all.nl
Thu, 26 Feb 2004 08:48:29 +0100


Hi,

With GNOME 2.6, we're using the shared-mime-info from freedesktop now.
This differs from GNOME 2.4. One of the changes (bugs?) is that .cs
files will now appear to be application/octet-stream to nautilus (and
the rest of GNOME) instead of text/x-csharp.

If you want to quickly fix it and get gedit, MD and the rest to
automatically highlight C# files you need to do this:

1. Open $prefix/share/mime/packages/freedesktop.org.xml for editing.
2. Locate the "text/x-csrc" string.
3. Copy the <mime-type> tag from the C source after that one. Change the
type to "text/x-csharp". Change the <glob> pattern to "*.cs" and change
the <comment> to "C# source code.

It should look something like this:

  <mime-type type="text/x-csharp">
    <comment>C# source code</comment>
    <comment xml:lang="no">C#-kildekode</comment>
    <glob pattern="*.cs" />
  </mime-type>

4. Save the file, and run update-mime-database from a terminal: update-
mime-database $prefix/share/mime/
5. Restart nautilus and perhaps the gnome-vfs-daemon (not sure whether
the latter is really necessary). You also need to restart gedit/MD to
get it use the new mimetype.

HTH,

Jeroen