diff options
author | Javier Jardón <javierjc1982@gmail.com> | 2009-10-12 15:59:45 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2009-10-14 03:30:57 +0200 |
commit | df9e1c329441bee4d066b10060660cbecd94b981 (patch) | |
tree | f77a689868544ef3fa0e5fd44d2f71007902e980 | |
parent | b66583f2a59e09ad9f27f1750b58917b243381ae (diff) | |
download | gtk+-df9e1c329441bee4d066b10060660cbecd94b981.tar.gz |
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
-rw-r--r-- | docs/developers.txt | 9 | ||||
-rw-r--r-- | docs/faq/gtk-faq.sgml | 4 | ||||
-rw-r--r-- | docs/refcounting.txt | 8 | ||||
-rw-r--r-- | docs/tutorial/gtk_tut.sgml | 4 | ||||
-rwxr-xr-x | docs/tutorial/gtk_tut_12.es.sgml | 4 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 4 |
6 files changed, 12 insertions, 21 deletions
diff --git a/docs/developers.txt b/docs/developers.txt index e50c8ca1ff..66e1d9309b 100644 --- a/docs/developers.txt +++ b/docs/developers.txt @@ -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 --------------------- diff --git a/docs/faq/gtk-faq.sgml b/docs/faq/gtk-faq.sgml index a4cad44403..b03f904bb0 100644 --- a/docs/faq/gtk-faq.sgml +++ b/docs/faq/gtk-faq.sgml @@ -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> diff --git a/docs/refcounting.txt b/docs/refcounting.txt index f8b62ed5e3..5ebf818502 100644 --- a/docs/refcounting.txt +++ b/docs/refcounting.txt @@ -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); } diff --git a/docs/tutorial/gtk_tut.sgml b/docs/tutorial/gtk_tut.sgml index 003f4c7af8..d42a349b43 100644 --- a/docs/tutorial/gtk_tut.sgml +++ b/docs/tutorial/gtk_tut.sgml @@ -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 diff --git a/docs/tutorial/gtk_tut_12.es.sgml b/docs/tutorial/gtk_tut_12.es.sgml index cca7bd9a7f..22ce28f870 100755 --- a/docs/tutorial/gtk_tut_12.es.sgml +++ b/docs/tutorial/gtk_tut_12.es.sgml @@ -8986,7 +8986,7 @@ se colapsará. Por lo tanto, si quiere que se mantenga el subárbol 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 diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index c1488754fb..ed286636d5 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -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, |