<HTML ><HEAD ><TITLE >gnome-fileconvert</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK REL="HOME" TITLE="Gnome Library Reference Manual" HREF="book1.html"><LINK REL="UP" TITLE="Gnome Library" HREF="libgnome.html"><LINK REL="PREVIOUS" TITLE="gnome-exec" HREF="gnome-gnome-exec.html"><LINK REL="NEXT" TITLE="gnome-help" HREF="gnome-gnome-help.html"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="5" >Gnome Library Reference Manual</FONT ></TH ></TR ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="gnome-gnome-exec.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="book1.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="libgnome.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="gnome-gnome-help.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ></TABLE ></DIV ><H1 ><A NAME="GNOME-GNOME-FILECONVERT" >gnome-fileconvert</A ></H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN1811" ></A ><H2 >Name</H2 >gnome-fileconvert -- File format conversion functions.</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN1814" ></A ><H2 >Synopsis</H2 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="SYNOPSIS" > #include <gnome.h> <GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > <A HREF="gnome-gnome-fileconvert.html#GNOME-FILE-CONVERT-FD" >gnome_file_convert_fd</A > (<GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > fd, <GTKDOCLINK HREF="GCHAR" >gchar</GTKDOCLINK > *fromtype, <GTKDOCLINK HREF="GCHAR" >gchar</GTKDOCLINK > *totype); <GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > <A HREF="gnome-gnome-fileconvert.html#GNOME-FILE-CONVERT" >gnome_file_convert</A > (const char *filename, const char *fromtype, const char *totype);</PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1824" ></A ><H2 >Description</H2 ><P >These routines provide conversion of information based on a source and target mime type. They return -1 on failure, or an opened file descriptor with the data on success</P ><P >The rules for converting from one MIME type to another are loaded from the <TT CLASS="FILENAME" >$gnome-prefix/share/type-convert</TT > directory. Any files in that directory whose extension is <TT CLASS="FILENAME" >.convert</TT > is loaded as well as the per-user <TT CLASS="FILENAME" >~/.gnome/type.convert</TT > file.</P ><P >The file format used to define a filter is very simple:</P ><DIV CLASS="EXAMPLE" ><A NAME="AEN1832" ></A ><P ><B >Example 1. Sample MIME type file conversion definition</B ></P ><TABLE BORDER="0" BGCOLOR="#D8F8D8" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >image/gif image/x-portable-pixmap giftopnm </PRE ></TD ></TR ></TABLE ></DIV ><P > This sample file conversion file defines a conversion rule from the image/gif MIME type to the image/x-portable-pixmap MIME type. The program used for the conversion is <TT CLASS="FILENAME" >giftopnm</TT >. This program should do the specified MIME type conversion by reading its standard input and writing the results on the standard output. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN1837" ></A ><H2 >Details</H2 ><DIV CLASS="REFSECT2" ><A NAME="AEN1839" ></A ><H3 ><A NAME="GNOME-FILE-CONVERT-FD" ></A >gnome_file_convert_fd ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" ><GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > gnome_file_convert_fd (<GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > fd, <GTKDOCLINK HREF="GCHAR" >gchar</GTKDOCLINK > *fromtype, <GTKDOCLINK HREF="GCHAR" >gchar</GTKDOCLINK > *totype);</PRE ></TD ></TR ></TABLE ><P >Converts the file opened by <TT CLASS="PARAMETER" ><I >fd</I ></TT > to the <TT CLASS="PARAMETER" ><I >totype</I ></TT > format.</P ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1851" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >fd</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > file desciptor pointing to the file to convert.</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >fromtype</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > mime type of the file</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >totype</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > target mime type we want</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" >-1 on failure, or a file descriptor to the converted file.</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ><HR><DIV CLASS="REFSECT2" ><A NAME="AEN1872" ></A ><H3 ><A NAME="GNOME-FILE-CONVERT" ></A >gnome_file_convert ()</H3 ><TABLE BORDER="0" BGCOLOR="#D6E8FF" WIDTH="100%" CELLPADDING="6" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" ><GTKDOCLINK HREF="GINT" >gint</GTKDOCLINK > gnome_file_convert (const char *filename, const char *fromtype, const char *totype);</PRE ></TD ></TR ></TABLE ><P >Converts <TT CLASS="PARAMETER" ><I >filename</I ></TT > to the <TT CLASS="PARAMETER" ><I >totype</I ></TT > format.</P ><P ></P ><DIV CLASS="INFORMALTABLE" ><A NAME="AEN1881" ></A ><P ></P ><TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFD0D0" CELLSPACING="0" CELLPADDING="4" CLASS="CALSTABLE" ><TBODY ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >filename</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > file to convert</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >fromtype</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > mime type of the file</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><TT CLASS="PARAMETER" ><I >totype</I ></TT > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" > target mime type we want</TD ></TR ><TR ><TD WIDTH="20%" ALIGN="RIGHT" VALIGN="TOP" ><SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >Returns</I ></SPAN > :</TD ><TD WIDTH="80%" ALIGN="LEFT" VALIGN="TOP" >-1 on failure, or a file descriptor to the converted file.</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><BR CLEAR="all"><BR><TABLE WIDTH="100%" BORDER="0" BGCOLOR="#000000" CELLPADDING="1" CELLSPACING="0" ><TR ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="left" ><A HREF="gnome-gnome-exec.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><<< Previous Page</B ></FONT ></A ></TD ><TD WIDTH="25%" BGCOLOR="#0000C0" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="book1.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Home</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#00C000" ALIGN="center" ><FONT COLOR="#FFFFFF" SIZE="3" ><B ><A HREF="libgnome.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Up</B ></FONT ></A ></B ></FONT ></TD ><TD WIDTH="25%" BGCOLOR="#C00000" ALIGN="right" ><A HREF="gnome-gnome-help.html" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >Next Page >>></B ></FONT ></A ></TD ></TR ><TR ><TD COLSPAN="2" ALIGN="left" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >gnome-exec</B ></FONT ></TD ><TD COLSPAN="2" ALIGN="right" ><FONT COLOR="#FFFFFF" SIZE="3" ><B >gnome-help</B ></FONT ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >