4a15c7e895249d1a3bd8c7d3c1488914a42815a9
[platform/upstream/pygobject2.git] / docs / html / class-gioicon.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gio.Icon</title><link rel="stylesheet" type="text/css" href="style.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="PyGObject Reference Manual"><link rel="up" href="gio-class-reference.html" title="PyGio Class Reference"><link rel="prev" href="class-giofilteroutputstream.html" title="gio.FilterOutputStream"><link rel="next" href="class-gioinputstream.html" title="gio.InputStream"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gio.Icon</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-giofilteroutputstream.html">Prev</a> </td><th width="60%" align="center">PyGio Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gioinputstream.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gio.Icon"><a name="class-gioicon"></a><div class="titlepage"></div><div class="refnamediv"><h2>gio.Icon</h2><p>gio.Icon — Interface for icons.</p></div><div class="refsect1" title="Synopsis"><a name="id514677"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gio.Icon</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a></span></span>):
2 <code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gioicon.html#method-gioicon--equal" title="gio.Icon.equal">equal</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon2</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gioicon.html#method-gioicon--to-string" title="gio.Icon.to_string">to_string</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><pre class="programlisting">
3 <span class="bold"><strong>Functions</strong></span>
4  
5 <code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gioicon.html#function-gio--icon-new-from-string" title="gio.icon_new_from_string">gio.icon_new_from_string</a></span>(<span class="methodparam"></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id514771"></a><h2>Ancestry</h2><pre class="synopsis">+-- <a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a>
6   +-- <a class="link" href="class-gioicon.html" title="gio.Icon">gio.Icon</a>
7 </pre></div><div class="refsect1" title="Known Derived Interfaces"><a name="id514793"></a><h2>Known Derived Interfaces</h2><p>
8             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a> is required by
9             <a class="link" href="class-gioloadableicon.html" title="gio.LoadableIcon"><code class="classname">gio.LoadableIcon</code></a>.
10         </p></div><div class="refsect1" title="Known Implementation"><a name="id514815"></a><h2>Known Implementation</h2><p>
11             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a> is implemented by
12             <a class="link" href="class-giothemedicon.html" title="gio.ThemedIcon"><code class="classname">gio.ThemedIcon</code></a>,
13             <a class="link" href="class-giofileicon.html" title="gio.FileIcon"><code class="classname">gio.FileIcon</code></a>,
14             <a class="link" href="class-gioemblem.html" title="gio.Emblem"><code class="classname">gio.Emblem</code></a>,
15             <a class="link" href="class-gioemblemedicon.html" title="gio.EmblemedIcon"><code class="classname">gio.EmblemedIcon</code></a>.
16         </p></div><div class="refsect1" title="Description"><a name="id514856"></a><h2>Description</h2><p>
17             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
18             is a very minimal interface for icons. It provides functions for checking
19             the equality of two icons, hashing of icons and serializing an icon to and from strings. 
20         </p><p>
21             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
22             does not provide the actual pixmap for the icon as this is out of GIO's
23             scope, however implementations of
24             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
25             may contain the name of an icon (see
26             <a class="link" href="class-giothemedicon.html" title="gio.ThemedIcon"><code class="classname">gio.ThemedIcon</code></a>),
27             or the path to an icon (see
28             <a class="link" href="class-gioloadableicon.html" title="gio.LoadableIcon"><code class="classname">gio.LoadableIcon</code></a>).
29         </p><p>
30             To check if two GIcons are equal, see
31             <code class="methodname"><a class="link" href="class-gioicon.html#method-gioicon--equal" title="gio.Icon.equal">gio.Icon.equal</a></code>().
32         </p><p>
33             For serializing a <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>,
34             use <code class="methodname"><PYGTKDOCLINK HREF="method-gioicon-%20-to-string">gio.Icon.to_string</PYGTKDOCLINK></code>() and
35             <code class="methodname"><PYGTKDOCLINK HREF="method-gioicon-%20-new-from-string">gio.Icon.new_from_string</PYGTKDOCLINK></code>(). 
36         </p><p>
37             If your application or library provides one or more
38             <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
39             implementations you need to ensure that each GType is registered
40             with the type system prior to calling
41             <code class="methodname"><PYGTKDOCLINK HREF="function-gioicon--new-from-string">gio.icon_new_from_string</PYGTKDOCLINK></code>(). 
42         </p></div><div class="refsect1" title="Methods"><a name="id514956"></a><h2>Methods</h2><div class="refsect2" title="gio.Icon.equal"><a name="method-gioicon--equal"></a><h3>gio.Icon.equal</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">equal</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon2</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>icon2</code></em> :</span></p></td><td>the second
43                     <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
44                     </td></tr></tbody></table><p>
45                 The <code class="methodname">equal</code>() method checks if two icons are equal.
46             </p></div><div class="refsect2" title="gio.Icon.to_string"><a name="method-gioicon--to-string"></a><h3>gio.Icon.to_string</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">to_string</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>An UTF8 string or <code class="literal">None</code>
47                     if icon can't be serialized.
48                     </td></tr></tbody></table><p>
49                 The <code class="methodname">to_string</code>() method generates a textual
50                 representation of icon that can be used for serialization such as when
51                 passing icon to a different process or saving it to persistent storage. Use
52                 <code class="methodname"><a class="link" href="class-gioicon.html#function-gio--icon-new-from-string" title="gio.icon_new_from_string">gio.icon_new_from_string</a></code>()
53                 to get icon back from the returned string.
54             </p><p>
55                 The encoding of the returned string is proprietary to GIcon except in the following two cases
56             </p><p>
57                 If icon is a <a class="link" href="class-giofileicon.html" title="gio.FileIcon"><code class="classname">gio.FileIcon</code></a>,
58                 the returned string is a native path (such as /path/to/my icon.png) without escaping
59                 if the <a class="link" href="class-giofile.html" title="gio.File"><code class="classname">gio.File</code></a>
60                 for icon is a native file. If the file is not native, the returned string is the result of
61                 <code class="methodname"><a class="link" href="class-giofile.html#method-giofile--get-uri" title="gio.File.get_uri">gio.File.get_uri</a></code>()
62                 (such as sftp://path/to/my%20icon.png).
63             </p><p>
64                 If icon is a <a class="link" href="class-giothemedicon.html" title="gio.ThemedIcon"><code class="classname">gio.ThemedIcon</code></a>
65                 with exactly one name, the encoding is simply the name (such as network-server).
66             </p></div></div><div class="refsect1" title="Functions"><a name="id515125"></a><h2>Functions</h2><div class="refsect2" title="gio.icon_new_from_string"><a name="function-gio--icon-new-from-string"></a><h3>gio.icon_new_from_string</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">icon_new_from_string</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>str</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td><td>A string obtained via
67                     <code class="methodname"><a class="link" href="class-gioicon.html#method-gioicon--to-string" title="gio.Icon.to_string">gio.Icon.to_string</a></code>().
68                     </td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>An object implementing the
69                     <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
70                     interface or <code class="literal">None</code> if error is set.
71                     </td></tr></tbody></table><p>
72                 The <code class="methodname">icon_new_from_string</code>() function generate a
73                 <a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
74                 instance from str. This function can fail if str is not valid - see
75                 <code class="methodname"><a class="link" href="class-gioicon.html#method-gioicon--to-string" title="gio.Icon.to_string">gio.Icon.to_string</a></code>()
76                 for discussion.
77             </p><p>
78                 If your application or library provides one or more GIcon implementations you need
79                 to ensure that each GType is registered with the type system prior to calling
80                 <code class="methodname"><a class="link" href="class-gioicon.html#function-gio--icon-new-from-string" title="gio.icon_new_from_string">gio.icon_new_from_string</a></code>().
81             </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-giofilteroutputstream.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gio-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gioinputstream.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gio.FilterOutputStream </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gio.InputStream</td></tr></table></div></body></html>