<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" style="task" id="mime-types-custom" lang="eu">

  <info>
    <link type="guide" xref="software#management"/>
    <link type="seealso" xref="mime-types"/>
    <link type="seealso" xref="mime-types-custom-user"/>
    <revision pkgversion="3.12" date="2014-06-17" status="review"/>

    <credit type="author copyright">
      <name>Petr Kovar</name>
      <email>pknbe@volny.cz</email>
      <years>2014</years>
    </credit>

    <license xmlns="http://projectmallard.org/1.0/" href="https://creativecommons.org/licenses/by-sa/3.0/">
  <p>This work is licensed under a <link href="https://creativecommons.org/licenses/by-sa/3.0/">Creative
  Commons Attribution-ShareAlike 3.0 Unported License</link>.</p>
</license>

    <desc>Sortu MIME motaren espezifikazio bat eta erregistratu aplikazio lehenetsi bat.</desc>
  </info>

    <title>Gehitu MIME mota pertsonalizatu bat erabiltzaile guztientzako</title>
    <p>
      To add a custom MIME type for all users on the system and register a default
      application for that MIME type, you need to create a new MIME type
      specification file in the <file>/usr/share/mime/packages/</file>
      directory and a <file>.desktop</file> file in the
      <file>/usr/share/applications/</file> directory.
    </p>
    <steps>
      <title>Gehitu <sys>application/x-newtype</sys> MIME mota pertsonalizatu bat erabiltzaile guztientzako</title>
      <item>
        <p>Sortu <file>/usr/share/mime/packages/application-x-newtype.xml</file> fitxategia:</p>
        <code mime="application/xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"&gt;
  &lt;mime-type type="application/x-newtype"&gt;
    &lt;comment&gt;new mime type&lt;/comment&gt;
    &lt;glob pattern="*.xyz"/&gt;
  &lt;/mime-type&gt;
&lt;/mime-info&gt;</code>
      <p>
        The sample <file>application-x-newtype.xml</file> file above
        defines a new MIME type <sys>application/x-newtype</sys>
        and assigns file names with the <file>.xyz</file> extension to
        that MIME type.
      </p>
      </item>
      <item>
        <p>
          Create a new <file>.desktop</file> file named, for example,
          <file>myapplication1.desktop</file>, and place it in the
          <file>/usr/share/applications/</file> directory:
        </p>
        <code>[Desktop Entry]
Type=Application
MimeType=application/x-newtype
Name=<var>My Application 1</var>
Exec=<var>myapplication1</var></code>
      <p>
        The sample <file>myapplication1.desktop</file> file above
        associates the <sys>application/x-newtype</sys> MIME type
        with an application named <app>My Application 1</app>,
        which is run by a command <cmd>myapplication1</cmd>.
      </p>
      </item>
      <item>
        <p>Erro gisa, eguneratu MIME datu-basea zure aldaketak indarrean sartu daitezen:</p>
        <screen><output># </output><input>update-mime-database /usr/share/mime</input>
        </screen>
      </item>
      <item>
        <p>Erro gisa, eguneratu aplikazioen datu-basea:</p>
        <screen><output># </output><input>update-desktop-database /usr/share/applications</input>
        </screen>
      </item>
      <item>
        <p><file>*.xyz</file> fitxategiak <sys>application/x-newtype</sys> MIME motarekin ondo lotu dituzula egiaztatzeko, hasteko sortu fitxategi huts bat, adibidez <file>proba.xyz</file>:</p>
        <screen><output>$ </output><input>touch proba.xyz</input></screen>
        <p>Ondoren, exekutatu <cmd>gio info</cmd> komandoa:</p>
        <screen><output>$ </output><input>gio info proba.xyz | grep "standard::content-type"</input>
  standard::content-type: application/x-newtype</screen>
        </item>
        <item>
          <p>
          To verify that <file>myapplication1.desktop</file> has been
          correctly set as the default registered application for the
          <sys>application/x-newtype</sys> MIME type, run the
          <cmd>gio mime</cmd> command:
          </p>
        <screen><output>$ </output><input>gio mime application/x-newtype</input>
Default application for “application/x-newtype”: myapplication1.desktop
Registered applications:
	myapplication1.desktop
Recommended applications:
	myapplication1.desktop</screen>
      </item>
    </steps>
</page>
