Commit df9e1c32 authored by Javier Jardón Cabezas's avatar Javier Jardón Cabezas Committed by Javier Jardón

Substitute gtk_widget_ref/unref with g_object_ref/unref

Substitute the use of gtk_widget_ref/unref in documentation examples
and in internal gtk+ code

https://bugzilla.gnome.org/show_bug.cgi?id=598218
parent b66583f2
......@@ -48,15 +48,6 @@ Events that are assured to have a valid GdkEvent.any.window field are
GDK_EXPOSE GtkWidget::expose_event
gtk_widget_ref() vs. gtk_object_ref()
-------------------------------------
The widget referencing functions gtk_widget_ref() and gtk_widget_unref()
are currently just wrappers about the corresponding referencing functions
for objects. Still you should use the widget referencing functions if you
are sure the referenced object is of type GTK_WIDGET_TYPE.
Writing Gdk functions
---------------------
......
......@@ -2108,10 +2108,10 @@ not.</para>
snippet:</para>
<programlisting role="C">
gtk_widget_ref(widget);
g_object_ref(widget);
gtk_container_remove(GTK_CONTAINER(old_parent), widget);
gtk_container_add(GTK_CONTAINER(new_parent), widget);
gtk_widget_unref(widget);
g_object_unref(widget);
</programlisting>
</sect1>
......
......@@ -250,12 +250,12 @@ Example code sequences that require reference wraps:
/* gtk_container_remove() will unparent the child and therefore
* cause its reference count to be decremented by one.
*/
gtk_widget_ref (widget);
g_object_ref (widget);
gtk_container_remove (container, widget);
/* without the reference count, the widget would have been destroyed here.
*/
gtk_container_add (container, widget);
gtk_widget_unref (widget);
g_object_unref (widget);
/* all items in item_list need to be referenced
......@@ -267,7 +267,7 @@ Example code sequences that require reference wraps:
slist = NULL;
for (list = item_list; list; list = list->next)
{
gtk_widget_ref (GTK_WIDGET (list->data));
g_object_ref (GTK_WIDGET (list->data));
slist = g_slist_prepend (slist, list->data);
}
gtk_list_remove_items (list, item_list);
......@@ -280,7 +280,7 @@ Example code sequences that require reference wraps:
tmp = slist;
slist = slist->next;
gtk_widget_unref (GTK_WIDGET (tmp->data));
g_object_unref (GTK_WIDGET (tmp->data));
g_slist_free_1 (tmp);
}
......
......@@ -9564,7 +9564,7 @@ which owns it will be collapsed. So, if you want it to stick around,
do something like the following:
<tscreen><verb>
gtk_widget_ref (tree);
g_object_ref (tree);
owner = GTK_TREE(tree)->tree_owner;
gtk_container_remove (GTK_CONTAINER(tree), item);
if (tree->parent == NULL){
......@@ -9572,7 +9572,7 @@ if (tree->parent == NULL){
gtk_tree_item_set_subtree (GTK_TREE_ITEM(owner), tree);
}
else
gtk_widget_unref (tree);
g_object_unref (tree);
</verb></tscreen>
Finally, drag-n-drop <em>does</em> work with TreeItems. You just
......
......@@ -8986,7 +8986,7 @@ se colapsar
tendrá que hacer algo así:
<tscreen><verb>
gtk_widget_ref (arbol);
g_object_ref (arbol);
propietario = GTK_TREE(arbol)->tree_owner;
gtk_container_remove (GTK_CONTAINER(arbol), item);
if (arbol->parent == NULL){
......@@ -8994,7 +8994,7 @@ if (arbol->parent == NULL){
gtk_tree_item_set_subtree (GTK_TREE_ITEM(propietario), arbol);
}
else
gtk_widget_unref (arbol);
g_object_unref (arbol);
</verb></tscreen>
Finalmente, hay que mencionar que la opción de drag-n-drop (arrastar y
......
......@@ -863,8 +863,8 @@ GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
void gtk_requisition_free (GtkRequisition *requisition);
#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
# define gtk_widget_ref gtk_object_ref
# define gtk_widget_unref gtk_object_unref
# define gtk_widget_ref g_object_ref
# define gtk_widget_unref g_object_unref
#endif /* GTK_TRACE_OBJECTS && __GNUC__ */
void _gtk_widget_grab_notify (GtkWidget *widget,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment