KatzeItem

KatzeItem — A useful item

Synopsis

#include <katze/katze.h>

struct              KatzeItem;
struct              KatzeItemClass;
KatzeItem *         katze_item_new                      (void);
const gchar *       katze_item_get_name                 (KatzeItem *item);
void                katze_item_set_name                 (KatzeItem *item,
                                                         const gchar *name);
const gchar *       katze_item_get_text                 (KatzeItem *item);
void                katze_item_set_text                 (KatzeItem *item,
                                                         const gchar *text);
const gchar *       katze_item_get_uri                  (KatzeItem *item);
void                katze_item_set_uri                  (KatzeItem *item,
                                                         const gchar *uri);
const gchar *       katze_item_get_icon                 (KatzeItem *item);
void                katze_item_set_icon                 (KatzeItem *item,
                                                         const gchar *icon);
GdkPixbuf *         katze_item_get_pixbuf               (KatzeItem *item,
                                                         GtkWidget *widget);
GtkWidget *         katze_item_get_image                (KatzeItem *item,
                                                         GtkWidget *widget);
const gchar *       katze_item_get_token                (KatzeItem *item);
void                katze_item_set_token                (KatzeItem *item,
                                                         const gchar *token);
gint64              katze_item_get_added                (KatzeItem *item);
void                katze_item_set_added                (KatzeItem *item,
                                                         gint64 added);
GList *             katze_item_get_meta_keys            (KatzeItem *item);
const gchar *       katze_item_get_meta_string          (KatzeItem *item,
                                                         const gchar *key);
void                katze_item_set_meta_string          (KatzeItem *item,
                                                         const gchar *key,
                                                         const gchar *value);
gint64              katze_item_get_meta_integer         (KatzeItem *item,
                                                         const gchar *key);
gboolean            katze_item_get_meta_boolean         (KatzeItem *item,
                                                         const gchar *key);
void                katze_item_set_meta_integer         (KatzeItem *item,
                                                         const gchar *key,
                                                         gint64 value);
gpointer            katze_item_get_parent               (KatzeItem *item);
void                katze_item_set_parent               (KatzeItem *item,
                                                         gpointer parent);
KatzeItem *         katze_item_copy                     (KatzeItem *item);

Description

KatzeItem is a particularly useful item that provides several commonly needed properties.

Details

struct KatzeItem

struct KatzeItem {
    GObject parent_instance;

    gchar* name;
    gchar* text;
    gchar* uri;
    gchar* token;
    gint64 added;
    GHashTable* metadata;

    KatzeItem* parent;
};

struct KatzeItemClass

struct KatzeItemClass {
    GObjectClass parent_class;

    gpointer
    (*copy)                       (KatzeItem*      item);
};

katze_item_new ()

KatzeItem *         katze_item_new                      (void);

Creates a new KatzeItem.

Returns :

a new KatzeItem. [transfer full]

katze_item_get_name ()

const gchar *       katze_item_get_name                 (KatzeItem *item);

Retrieves the name of item.

item :

a KatzeItem

Returns :

the name of the item

katze_item_set_name ()

void                katze_item_set_name                 (KatzeItem *item,
                                                         const gchar *name);

Sets the name of item.

item :

a KatzeItem

name :

a string

katze_item_get_text ()

const gchar *       katze_item_get_text                 (KatzeItem *item);

Retrieves the descriptive text of item.

item :

a KatzeItem

Returns :

the text of the item

katze_item_set_text ()

void                katze_item_set_text                 (KatzeItem *item,
                                                         const gchar *text);

Sets the descriptive text of item.

item :

a KatzeItem

text :

a string

katze_item_get_uri ()

const gchar *       katze_item_get_uri                  (KatzeItem *item);

Retrieves the URI of item.

item :

a KatzeItem

Returns :

the URI of the item

katze_item_set_uri ()

void                katze_item_set_uri                  (KatzeItem *item,
                                                         const gchar *uri);

Sets the URI of item.

item :

a KatzeItem

uri :

a string

katze_item_get_icon ()

const gchar *       katze_item_get_icon                 (KatzeItem *item);

Retrieves the icon of item.

item :

a KatzeItem

Returns :

the icon of the item

katze_item_set_icon ()

void                katze_item_set_icon                 (KatzeItem *item,
                                                         const gchar *icon);

Sets the icon of item.

item :

a KatzeItem

icon :

a string

katze_item_get_pixbuf ()

GdkPixbuf *         katze_item_get_pixbuf               (KatzeItem *item,
                                                         GtkWidget *widget);

Creates a GdkPixbuf fit to display item.

item :

a KatzeItem

widget :

a GtkWidget, or NULL

Returns :

the icon of the item, or NULL. [transfer full]

Since 0.4.6


katze_item_get_image ()

GtkWidget *         katze_item_get_image                (KatzeItem *item,
                                                         GtkWidget *widget);

Creates a GtkImage fit to display item.

item :

a KatzeItem

widget :

a GtkWidget, or NULL

Returns :

the icon of the item. [transfer floating]

Since 0.4.4


katze_item_get_token ()

const gchar *       katze_item_get_token                (KatzeItem *item);

Retrieves the token of item.

item :

a KatzeItem

Returns :

the token of the item

katze_item_set_token ()

void                katze_item_set_token                (KatzeItem *item,
                                                         const gchar *token);

Sets the token of item.

item :

a KatzeItem

token :

a string

katze_item_get_added ()

gint64              katze_item_get_added                (KatzeItem *item);

Determines when item was added.

item :

a KatzeItem

Returns :

a timestamp

katze_item_set_added ()

void                katze_item_set_added                (KatzeItem *item,
                                                         gint64 added);

Sets when item was added.

item :

a KatzeItem

added :

a timestamp

katze_item_get_meta_keys ()

GList *             katze_item_get_meta_keys            (KatzeItem *item);

Retrieves a list of all meta keys.

item :

a KatzeItem

Returns :

a newly allocated GList of constant strings. [element-type utf8][transfer container]

Since 0.1.8


katze_item_get_meta_string ()

const gchar *       katze_item_get_meta_string          (KatzeItem *item,
                                                         const gchar *key);

Retrieves a string value by the specified key from the meta data of the item.

Specify "namespace:key" or "key" to use the default namespace.

item :

a KatzeItem

key :

the name of an integer value

Returns :

a string, or NULL

Since 0.1.8


katze_item_set_meta_string ()

void                katze_item_set_meta_string          (KatzeItem *item,
                                                         const gchar *key,
                                                         const gchar *value);

Saves the specified string value in the meta data of the item under the specified key.

Specify "namespace:key" or "key" to use the default namespace.

item :

a KatzeItem

key :

the name of a string value

value :

the value as a string

Since 0.1.8


katze_item_get_meta_integer ()

gint64              katze_item_get_meta_integer         (KatzeItem *item,
                                                         const gchar *key);

Retrieves an integer value by the specified key from the meta data of the item.

If the key is present but not representable as an integer, -1 is returned.

item :

a KatzeItem

key :

the name of an integer value

Returns :

an integer value, or -1

Since 0.1.8


katze_item_get_meta_boolean ()

gboolean            katze_item_get_meta_boolean         (KatzeItem *item,
                                                         const gchar *key);

The Value should be set with katze_item_set_meta_integer(). If the value is set and not 0, TRUE will be returned.

item :

a KatzeItem

key :

the name of a boolean value

Since 0.2.7


katze_item_set_meta_integer ()

void                katze_item_set_meta_integer         (KatzeItem *item,
                                                         const gchar *key,
                                                         gint64 value);

Saves the specified integer value in the meta data of the item under the specified key.

A value of -1 is intepreted as unset.

item :

a KatzeItem

key :

the name of an integer value

Since 0.1.8


katze_item_get_parent ()

gpointer            katze_item_get_parent               (KatzeItem *item);

Determines the parent of item.

Since 0.1.2 you can monitor the "parent" property.

item :

a KatzeItem

Returns :

the parent of the item. [type GObject][transfer none]

katze_item_set_parent ()

void                katze_item_set_parent               (KatzeItem *item,
                                                         gpointer parent);

Sets the parent of item.

This is intended for item container implementations. Notably the new parent will not be notified of the change.

Since 0.1.2 you can monitor the "parent" property, so unsetting the parent is actually safe if the parent supports it.

item :

a KatzeItem

parent :

the new parent

katze_item_copy ()

KatzeItem *         katze_item_copy                     (KatzeItem *item);

Creates an exact copy of item.

Note that subclass specific features will only be preserved if the class implements it.

Since 0.4.3 meta data is copied.

item :

a KatzeItem

Returns :

a new KatzeItem. [transfer full]

Since 0.1.3

See Also

KatzeArray