More convenient data-setting functions

2000-11-20  Havoc Pennington  <hp@redhat.com>

	* gobject.c (g_object_get_data)
	(g_object_set_data)
	(g_object_set_data_full)
	(g_object_steal_data): More convenient data-setting functions
This commit is contained in:
Havoc Pennington 2000-11-20 22:24:12 +00:00 committed by Havoc Pennington
parent 399ad0b8b0
commit 40d62d0dd7
3 changed files with 68 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2000-11-20 Havoc Pennington <hp@redhat.com>
* gobject.c (g_object_get_data)
(g_object_set_data)
(g_object_set_data_full)
(g_object_steal_data): More convenient data-setting functions
Wed Nov 15 20:58:05 2000 Owen Taylor <otaylor@redhat.com>
* gtypemodule.c (g_type_module_use): If loading the

View File

@ -795,6 +795,56 @@ g_object_steal_qdata (GObject *object,
return g_datalist_id_remove_no_notify (&object->qdata, quark);
}
gpointer
g_object_get_data (GObject *object,
const gchar *key)
{
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
g_return_val_if_fail (key != NULL, NULL);
return g_object_get_qdata (object,
g_quark_try_string (key));
}
void
g_object_set_data (GObject *object,
const gchar *key,
gpointer data)
{
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_object_set_qdata (object,
g_quark_from_string (key),
data);
}
void
g_object_set_data_full (GObject *object,
const gchar *key,
gpointer data,
GDestroyNotify destroy)
{
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (key != NULL);
g_object_set_qdata_full (object,
g_quark_from_string (key),
data,
destroy);
}
gpointer
g_object_steal_data (GObject *object,
const gchar *key)
{
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
g_return_val_if_fail (key != NULL, NULL);
return g_object_steal_qdata (object,
g_quark_try_string (key));
}
static void
g_value_object_init (GValue *value)
{

View File

@ -149,6 +149,17 @@ void g_object_set_qdata_full (GObject *object,
GDestroyNotify destroy);
gpointer g_object_steal_qdata (GObject *object,
GQuark quark);
gpointer g_object_get_data (GObject *object,
const gchar *key);
void g_object_set_data (GObject *object,
const gchar *key,
gpointer data);
void g_object_set_data_full (GObject *object,
const gchar *key,
gpointer data,
GDestroyNotify destroy);
gpointer g_object_steal_data (GObject *object,
const gchar *key);
void g_object_watch_closure (GObject *object,
GClosure *closure);
GClosure* g_cclosure_new_object (GCallback callback_func,