[gtk+] Substitute gtk_widget_ref/unref with g_object_ref/unref



commit df9e1c329441bee4d066b10060660cbecd94b981
Author: Javier Jardón <javierjc1982 gmail com>
Date:   Mon Oct 12 15:59:45 2009 +0200

    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

 docs/developers.txt              |    9 ---------
 docs/faq/gtk-faq.sgml            |    4 ++--
 docs/refcounting.txt             |    8 ++++----
 docs/tutorial/gtk_tut.sgml       |    4 ++--
 docs/tutorial/gtk_tut_12.es.sgml |    4 ++--
 gtk/gtkwidget.h                  |    4 ++--
 6 files changed, 12 insertions(+), 21 deletions(-)
---
diff --git a/docs/developers.txt b/docs/developers.txt
index e50c8ca..66e1d93 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 a4cad44..b03f904 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 f8b62ed..5ebf818 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 003f4c7..d42a349 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 cca7bd9..22ce28f 100755
--- a/docs/tutorial/gtk_tut_12.es.sgml
+++ b/docs/tutorial/gtk_tut_12.es.sgml
@@ -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
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index c148875..ed28663 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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]