Example #1
0
static void gtk_tree_entry_dispose(GObject* obj)
{
    GtkTreeEntry *entry;

    g_assert(GTK_IS_TREE_ENTRY(obj));

    entry = GTK_TREE_ENTRY(obj);

    /* free label if it exists */
    if(entry->label)
    {
        g_free(entry->label);
        g_free(entry->collate_key);
        entry->label = NULL;
        entry->collate_key = NULL;
    }

    /* call destroy callback if it exists */
    if(entry->destroy_func)
    {
        (*entry->destroy_func) (entry, entry->destroy_func_data);
        entry->destroy_func = NULL;
        entry->destroy_func_data = NULL;
    }

    /* clear userdata */
    entry->userdata = NULL;
}
Example #2
0
void   gtk_tree_entry_set_destroy_func  (GtkTreeEntry* entry,
        GtkTreeEntryDestroy destroy_func,
        gpointer destroy_func_data)
{
    g_assert(GTK_IS_TREE_ENTRY(entry));
    entry->destroy_func = destroy_func;
    entry->destroy_func_data = destroy_func_data;
}
Example #3
0
static void gtk_tree_entry_string_transform_func(const GValue *src_value,
        GValue *dest_value)
{
    GtkTreeEntry *entry;

    /* Make sure src is a treeentry and dest can hold a string */
    g_assert(GTK_IS_TREE_ENTRY(src_value->data[0].v_pointer));
    g_assert(G_VALUE_HOLDS(dest_value, G_TYPE_STRING));

    /* TODO: Use strdup here or just pass it? */
    entry = GTK_TREE_ENTRY(src_value->data[0].v_pointer);

    g_value_set_string(dest_value, entry->label);
}
Example #4
0
void     gtk_tree_entry_set_label       (GtkTreeEntry* entry, const gchar* label)
{
    g_assert(GTK_IS_TREE_ENTRY(entry));

    /* free previous if it exists */
    if(entry->label)
    {
        g_free(entry->label);
        g_free(entry->collate_key);
    }

    entry->label = g_strdup(label);
    entry->collate_key = g_utf8_collate_key(label, -1); /* -1 == null terminated */
}
Example #5
0
gpointer   gtk_tree_entry_get_userdata  (GtkTreeEntry* entry)
{
    g_assert(GTK_IS_TREE_ENTRY(entry));
    return entry->userdata;
}
Example #6
0
gchar*     gtk_tree_entry_get_label     (GtkTreeEntry* entry)
{
    g_assert(GTK_IS_TREE_ENTRY(entry));
    return entry->label;
}
Example #7
0
void   gtk_tree_entry_set_userdata      (GtkTreeEntry* entry, gpointer userdata)
{
    g_assert(GTK_IS_TREE_ENTRY(entry));
    entry->userdata = userdata;
}