Blame docs/reference/gio/html/GIcon.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GIcon: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="icons.html" title="Icons">
Packit ae235b
<link rel="prev" href="icons.html" title="Icons">
Packit ae235b
<link rel="next" href="GFileIcon.html" title="GFileIcon">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Prerequisites  | 
Packit ae235b
                  Known Derived Interfaces  | 
Packit ae235b
                  Known Implementations
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GIcon

Packit ae235b

GIcon — Interface for icons

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_hash ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_equal ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_to_string ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GIcon *
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_new_for_string ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GVariant *
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_serialize ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GIcon *
Packit ae235b
Packit ae235b
Packit ae235b
g_icon_deserialize ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GIcon
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GIconIface
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GInterface
Packit ae235b
    ╰── GIcon
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Prerequisites

Packit ae235b

Packit ae235b
GIcon requires
Packit ae235b
 GObject.

Packit ae235b
Packit ae235b
Packit ae235b

Known Derived Interfaces

Packit ae235b

Packit ae235b
GIcon is required by
Packit ae235b
 GLoadableIcon.

Packit ae235b
Packit ae235b
Packit ae235b

Known Implementations

Packit ae235b

Packit ae235b
GIcon is implemented by
Packit ae235b
 GBytesIcon,  GEmblem,  GEmblemedIcon,  GFileIcon and  GThemedIcon.

Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

GIcon is a very minimal interface for icons. It provides functions

Packit ae235b
for checking the equality of two icons, hashing of icons and
Packit ae235b
serializing an icon to and from strings.

Packit ae235b

GIcon does not provide the actual pixmap for the icon as this is out

Packit ae235b
of GIO's scope, however implementations of GIcon may contain the name 
Packit ae235b
of an icon (see GThemedIcon), or the path to an icon (see GLoadableIcon). 

Packit ae235b

To obtain a hash of a GIcon, see g_icon_hash().

Packit ae235b

To check if two GIcons are equal, see g_icon_equal().

Packit ae235b

For serializing a GIcon, use g_icon_serialize() and

Packit ae235b
g_icon_deserialize().

Packit ae235b

If you want to consume GIcon (for example, in a toolkit) you must

Packit ae235b
be prepared to handle at least the three following cases:
Packit ae235b
GLoadableIcon, GThemedIcon and GEmblemedIcon.  It may also make
Packit ae235b
sense to have fast-paths for other cases (like handling GdkPixbuf
Packit ae235b
directly, for example) but all compliant GIcon implementations
Packit ae235b
outside of GIO must implement GLoadableIcon.

Packit ae235b

If your application or library provides one or more GIcon

Packit ae235b
implementations you need to ensure that your new implementation also
Packit ae235b
implements GLoadableIcon.  Additionally, you must provide an
Packit ae235b
implementation of g_icon_serialize() that gives a result that is
Packit ae235b
understood by g_icon_deserialize(), yielding one of the built-in icon
Packit ae235b
types.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_icon_hash ()

Packit ae235b
guint
Packit ae235b
g_icon_hash (gconstpointer icon);
Packit ae235b

Gets a hash for an icon.

Packit ae235b

Virtual: hash

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

icon

Packit ae235b

gconstpointer to an icon object.

Packit ae235b
[not nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a guint containing a hash for the icon

Packit ae235b
, suitable for
Packit ae235b
use in a GHashTable or similar data structure.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_icon_equal ()

Packit ae235b
gboolean
Packit ae235b
g_icon_equal (GIcon *icon1,
Packit ae235b
              GIcon *icon2);
Packit ae235b

Checks if two icons are equal.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

icon1

Packit ae235b

pointer to the first GIcon.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

icon2

Packit ae235b

pointer to the second GIcon.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE if icon1

Packit ae235b
is equal to icon2
Packit ae235b
. FALSE otherwise.

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_icon_to_string ()

Packit ae235b
gchar *
Packit ae235b
g_icon_to_string (GIcon *icon);
Packit ae235b

Generates a textual representation of icon

Packit ae235b
 that can be used for
Packit ae235b
serialization such as when passing icon
Packit ae235b
 to a different process or
Packit ae235b
saving it to persistent storage. Use g_icon_new_for_string() to
Packit ae235b
get icon
Packit ae235b
 back from the returned string.

Packit ae235b

The encoding of the returned string is proprietary to GIcon except

Packit ae235b
in the following two cases

Packit ae235b
    Packit ae235b
  • If icon

  • Packit ae235b
     is a GFileIcon, the returned string is a native path
    Packit ae235b
    (such as /path/to/my icon.png) without escaping
    Packit ae235b
    if the GFile for icon
    Packit ae235b
     is a native file.  If the file is not
    Packit ae235b
    native, the returned string is the result of g_file_get_uri()
    Packit ae235b
    (such as sftp://path/to/my%20icon.png).

    Packit ae235b
  • If icon

  • Packit ae235b
     is a GThemedIcon with exactly one name, the encoding is
    Packit ae235b
    simply the name (such as network-server).

    Packit ae235b
    Packit ae235b

    Virtual: to_tokens

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    icon

    Packit ae235b

    a GIcon.

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    An allocated NUL-terminated UTF8 string or

    Packit ae235b
    NULL if icon
    Packit ae235b
    can't be serialized. Use g_free() to free. 

    Packit ae235b

    [nullable]

    Packit ae235b
    Packit ae235b

    Since: 2.20

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_icon_new_for_string ()

    Packit ae235b
    GIcon *
    Packit ae235b
    g_icon_new_for_string (const gchar *str,
    Packit ae235b
                           GError **error);
    Packit ae235b

    Generate a GIcon instance from str

    Packit ae235b
    . This function can fail if
    Packit ae235b
    str
    Packit ae235b
     is not valid - see g_icon_to_string() for discussion.

    Packit ae235b

    If your application or library provides one or more GIcon

    Packit ae235b
    implementations you need to ensure that each GType is registered
    Packit ae235b
    with the type system prior to calling g_icon_new_for_string().

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    str

    Packit ae235b

    A string obtained via g_icon_to_string().

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    error

    Packit ae235b

    Return location for error.

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    An object implementing the GIcon

    Packit ae235b
    interface or NULL if error
    Packit ae235b
    is set. 

    Packit ae235b

    [transfer full]

    Packit ae235b
    Packit ae235b

    Since: 2.20

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_icon_serialize ()

    Packit ae235b
    GVariant *
    Packit ae235b
    g_icon_serialize (GIcon *icon);
    Packit ae235b

    Serializes a GIcon into a GVariant. An equivalent GIcon can be retrieved

    Packit ae235b
    back by calling g_icon_deserialize() on the returned value.
    Packit ae235b
    As serialization will avoid using raw icon data when possible, it only
    Packit ae235b
    makes sense to transfer the GVariant between processes on the same machine,
    Packit ae235b
    (as opposed to over the network), and within the same file system namespace.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    icon

    Packit ae235b

    a GIcon

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    a GVariant, or NULL when serialization fails.

    Packit ae235b

    [transfer full]

    Packit ae235b
    Packit ae235b

    Since: 2.38

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_icon_deserialize ()

    Packit ae235b
    GIcon *
    Packit ae235b
    g_icon_deserialize (GVariant *value);
    Packit ae235b

    Deserializes a GIcon previously serialized using g_icon_serialize().

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    value

    Packit ae235b

    a GVariant created with g_icon_serialize()

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    a GIcon, or NULL when deserialization fails.

    Packit ae235b

    [transfer full]

    Packit ae235b
    Packit ae235b

    Since: 2.38

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Types and Values

    Packit ae235b
    Packit ae235b

    GIcon

    Packit ae235b
    typedef struct _GIcon GIcon;
    Packit ae235b

    An abstract type that specifies an icon.

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    struct GIconIface

    Packit ae235b
    struct GIconIface {
    Packit ae235b
      GTypeInterface g_iface;
    Packit ae235b
    Packit ae235b
      /* Virtual Table */
    Packit ae235b
    Packit ae235b
      guint       (* hash)        (GIcon   *icon);
    Packit ae235b
      gboolean    (* equal)       (GIcon   *icon1,
    Packit ae235b
                                   GIcon   *icon2);
    Packit ae235b
      gboolean    (* to_tokens)   (GIcon   *icon,
    Packit ae235b
    			       GPtrArray *tokens,
    Packit ae235b
                                   gint    *out_version);
    Packit ae235b
      GIcon *     (* from_tokens) (gchar  **tokens,
    Packit ae235b
                                   gint     num_tokens,
    Packit ae235b
                                   gint     version,
    Packit ae235b
                                   GError **error);
    Packit ae235b
    Packit ae235b
      GVariant *  (* serialize)   (GIcon   *icon);
    Packit ae235b
    };
    Packit ae235b
    Packit ae235b

    GIconIface is used to implement GIcon types for various

    Packit ae235b
    different systems. See GThemedIcon and GLoadableIcon for
    Packit ae235b
    examples of how to implement this interface.

    Packit ae235b
    Packit ae235b

    Members

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    hash ()

    Packit ae235b

    A hash for a given GIcon.

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    equal ()

    Packit ae235b

    Checks if two GIcons are equal.

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    to_tokens ()

    Packit ae235b

    Serializes a GIcon into tokens. The tokens must not

    Packit ae235b
    contain any whitespace. Don't implement if the GIcon can't be
    Packit ae235b
    serialized (Since 2.20).

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    from_tokens ()

    Packit ae235b

    Constructs a GIcon from tokens. Set the GError if

    Packit ae235b
    the tokens are malformed. Don't implement if the GIcon can't be
    Packit ae235b
    serialized (Since 2.20).

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    serialize ()

    Packit ae235b

    Serializes a GIcon into a GVariant. Since: 2.38

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Generated by GTK-Doc V1.27
    Packit ae235b
    </body>
    Packit ae235b
    </html>