[gtk+] Use g_object_ref/unref instead deprecated gdk_*_ref/unref functions



commit 57bc51371396af839859293468ba6004adfebcad
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Oct 14 03:02:14 2009 +0200

    Use g_object_ref/unref instead deprecated gdk_*_ref/unref functions
    
    Substitute deprecated reference counting functions for
    g_object_ref/unref in documentation and in internal code
    
    https://bugzilla.gnome.org/show_bug.cgi?id=598217

 docs/dnd_internals.txt           |    2 --
 docs/faq/gtk-faq.sgml            |    4 ++--
 docs/tutorial/gtk_tut.sgml       |    8 ++++----
 docs/tutorial/gtk_tut_12.es.sgml |    6 +++---
 docs/widget_system.txt           |    2 +-
 gdk/directfb/gdkdnd-directfb.c   |    4 ++--
 gdk/gdkgc.h                      |    2 +-
 gdk/gdkimage.h                   |    2 +-
 gdk/gdkpixmap.h                  |    8 ++++----
 gdk/gdkwindow.h                  |    4 ++--
 gdk/testgdk.c                    |    2 +-
 gdk/x11/gdkcursor-x11.c          |    4 ++--
 12 files changed, 23 insertions(+), 25 deletions(-)
---
diff --git a/docs/dnd_internals.txt b/docs/dnd_internals.txt
index 62312ef..fc5afce 100644
--- a/docs/dnd_internals.txt
+++ b/docs/dnd_internals.txt
@@ -62,8 +62,6 @@ used by anything other than the DND code in GTK+.
 /* Drag and Drop */
 
 GdkDragContext * gdk_drag_context_new        (void);
-void             gdk_drag_context_ref        (GdkDragContext *context);
-void             gdk_drag_context_unref      (GdkDragContext *context);
 
 These create and refcount GdkDragContexts in a
 straightforward manner.
diff --git a/docs/faq/gtk-faq.sgml b/docs/faq/gtk-faq.sgml
index e1fd893..a4cad44 100644
--- a/docs/faq/gtk-faq.sgml
+++ b/docs/faq/gtk-faq.sgml
@@ -2307,8 +2307,8 @@ used, as in:</para>
                NULL, gtk_widget_get_colormap(top),
                &amp;pixmap_mask, NULL, pixfile);
   pixw = gtk_pixmap_new (pixmap, pixmap_mask);
-  gdk_pixmap_unref (pixmap);
-  gdk_pixmap_unref (pixmap_mask);
+  g_object_unref (pixmap);
+  g_object_unref (pixmap_mask);
 </programlisting>
 
 </sect1>
diff --git a/docs/tutorial/gtk_tut.sgml b/docs/tutorial/gtk_tut.sgml
index 8c3357a..af812b8 100644
--- a/docs/tutorial/gtk_tut.sgml
+++ b/docs/tutorial/gtk_tut.sgml
@@ -4114,7 +4114,7 @@ static const char * xpm_data[] = {
 
 When we're done using a pixmap and not likely to reuse it again soon,
 it is a good idea to release the resource using
-gdk_pixmap_unref(). Pixmaps should be considered a precious resource,
+g_object_unref(). Pixmaps should be considered a precious resource,
 because they take up memory in the end-user's X server process. Even
 though the X client you write may run on a powerful "server" computer,
 the user may be running the X server on a small personal computer.
@@ -14476,7 +14476,7 @@ static gint
 configure_event (GtkWidget *widget, GdkEventConfigure *event)
 {
   if (pixmap)
-    gdk_pixmap_unref(pixmap);
+    g_object_unref(pixmap);
 
   pixmap = gdk_pixmap_new(widget->window,
 			  widget->allocation.width,
@@ -17406,7 +17406,7 @@ static gint configure_event( GtkWidget         *widget,
                              GdkEventConfigure *event )
 {
   if (pixmap)
-    gdk_pixmap_unref(pixmap);
+    g_object_unref(pixmap);
 
   pixmap = gdk_pixmap_new(widget->window,
 			  widget->allocation.width,
@@ -17592,7 +17592,7 @@ static gint
 configure_event (GtkWidget *widget, GdkEventConfigure *event)
 {
   if (pixmap)
-     gdk_pixmap_unref(pixmap);
+     g_object_unref(pixmap);
 
   pixmap = gdk_pixmap_new(widget->window,
                           widget->allocation.width,
diff --git a/docs/tutorial/gtk_tut_12.es.sgml b/docs/tutorial/gtk_tut_12.es.sgml
index 74b4827..cca7bd9 100755
--- a/docs/tutorial/gtk_tut_12.es.sgml
+++ b/docs/tutorial/gtk_tut_12.es.sgml
@@ -4061,7 +4061,7 @@ static const char * xpm_data[] = {
 
 Cuando hayamos acabado de usar un <em/pixmap/ y no lo vayamos a usar
 durante un tiempo suele ser conveniente liberar el recurso mediante
-gdk_pixmap_unref(). (Los <em/pixmaps/ deben ser considerados recursos
+g_object_unref(). (Los <em/pixmaps/ deben ser considerados recursos
 preciosos).
 
 Una vez que hemos creado el <em/pixmap/ lo podemos mostrar como un
@@ -13967,7 +13967,7 @@ static gint
 configure_event (GtkWidget *widget, GdkEventConfigure *event)
 {
   if (pixmap)
-    gdk_pixmap_unref(pixmap);
+    g_object_unref(pixmap);
 
   pixmap = gdk_pixmap_new(widget->window,
 			  widget->allocation.width,
@@ -16855,7 +16855,7 @@ static gint
 configure_event (GtkWidget *widget, GdkEventConfigure *event)
 {
   if (pixmap)
-    gdk_pixmap_unref(pixmap);
+    g_object_unref(pixmap);
 
   pixmap = gdk_pixmap_new(widget->window,
 			  widget->allocation.width,
diff --git a/docs/widget_system.txt b/docs/widget_system.txt
index e60ac32..1c2867c 100644
--- a/docs/widget_system.txt
+++ b/docs/widget_system.txt
@@ -365,7 +365,7 @@ When a widget receives the "realize" signal it should:
   1) set the realized flag
   2) set widget->window
       widget->window = gtk_widget_get_parent_window (widget);
-      gdk_window_ref (widget->window);
+      g_object_ref (widget->window);
   3) attach the widget's style
 
   widget->style = gtk_style_attach (widget->style, widget->window);
diff --git a/gdk/directfb/gdkdnd-directfb.c b/gdk/directfb/gdkdnd-directfb.c
index 2691279..6569105 100644
--- a/gdk/directfb/gdkdnd-directfb.c
+++ b/gdk/directfb/gdkdnd-directfb.c
@@ -235,7 +235,7 @@ local_send_enter (GdkDragContext *context,
 
   if (current_dest_drag != NULL)
     {
-      gdk_drag_context_unref (current_dest_drag);
+      g_object_unref (current_dest_drag);
       current_dest_drag = NULL;
     }
 
@@ -627,7 +627,7 @@ gdk_drop_finish (GdkDragContext   *context,
 				       context->dest_window);
   if (src_context)
     {
-      gdk_drag_context_ref (src_context);
+      g_object_ref (src_context);
 
       event.dnd.type       = GDK_DROP_FINISHED;
       event.dnd.window     = src_context->source_window;
diff --git a/gdk/gdkgc.h b/gdk/gdkgc.h
index ff04605..c64d2af 100644
--- a/gdk/gdkgc.h
+++ b/gdk/gdkgc.h
@@ -294,7 +294,7 @@ void         gdk_gc_set_rgb_bg_color (GdkGC          *gc,
 GdkScreen *  gdk_gc_get_screen	     (GdkGC          *gc);
 
 #ifndef GDK_DISABLE_DEPRECATED
-#define gdk_gc_destroy                 gdk_gc_unref
+#define gdk_gc_destroy                 g_object_unref
 #endif /* GDK_DISABLE_DEPRECATED */
 
 G_END_DECLS
diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h
index 1c3c401..92ac4ff 100644
--- a/gdk/gdkimage.h
+++ b/gdk/gdkimage.h
@@ -129,7 +129,7 @@ GdkImage* gdk_image_new_bitmap (GdkVisual     *visual,
 #endif /* GDK_ENABLE_BROKEN */
 
 #ifndef GDK_DISABLE_DEPRECATED
-#define gdk_image_destroy              gdk_image_unref
+#define gdk_image_destroy              g_object_unref
 #endif /* GDK_DISABLE_DEPRECATED */
 
 G_END_DECLS
diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h
index e309038..470a9e5 100644
--- a/gdk/gdkpixmap.h
+++ b/gdk/gdkpixmap.h
@@ -119,10 +119,10 @@ GdkPixmap*    gdk_pixmap_foreign_new_for_screen  (GdkScreen       *screen,
                                                   gint             depth);
 
 #ifndef GDK_DISABLE_DEPRECATED
-#define gdk_bitmap_ref                 gdk_drawable_ref
-#define gdk_bitmap_unref               gdk_drawable_unref
-#define gdk_pixmap_ref                 gdk_drawable_ref
-#define gdk_pixmap_unref               gdk_drawable_unref
+#define gdk_bitmap_ref                 g_object_ref
+#define gdk_bitmap_unref               g_object_unref
+#define gdk_pixmap_ref                 g_object_ref
+#define gdk_pixmap_unref               g_object_unref
 #endif /* GDK_DISABLE_DEPRECATED */
 
 G_END_DECLS
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index b850275..1a42ed5 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -693,8 +693,8 @@ void       gdk_window_remove_redirection     (GdkWindow     *window);
 #define gdk_window_get_colormap        gdk_drawable_get_colormap
 #define gdk_window_set_colormap        gdk_drawable_set_colormap
 #define gdk_window_get_visual          gdk_drawable_get_visual
-#define gdk_window_ref                 gdk_drawable_ref
-#define gdk_window_unref               gdk_drawable_unref
+#define gdk_window_ref                 g_object_ref
+#define gdk_window_unref               g_object_unref
 
 #define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
    gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
diff --git a/gdk/testgdk.c b/gdk/testgdk.c
index c7ca87b..0a4a656 100644
--- a/gdk/testgdk.c
+++ b/gdk/testgdk.c
@@ -303,7 +303,7 @@ test_gcs (void)
   gdk_gc_copy (black_gc, gc);
   gdk_gc_get_values (black_gc, &gcvalues);
   TEST (test_default_gc (&gcvalues, TRUE));
-  gdk_gc_unref (gc);
+  g_object_unref (gc);
 
   gdk_gc_set_foreground (black_gc, &black);
   gdk_gc_get_values (black_gc, &gcvalues);
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
index 9f72b79..19d79cf 100644
--- a/gdk/x11/gdkcursor-x11.c
+++ b/gdk/x11/gdkcursor-x11.c
@@ -347,8 +347,8 @@ gdk_cursor_new_for_display (GdkDisplay    *display,
  *  mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
  *                                      cursor1_width, cursor1_height);
  *  cursor = gdk_cursor_new_from_pixmap (source, mask, &amp;fg, &amp;bg, 8, 8);
- *  gdk_pixmap_unref (source);
- *  gdk_pixmap_unref (mask);
+ *  g_object_unref (source);
+ *  g_object_unref (mask);
  *  
  *  
  *  gdk_window_set_cursor (widget->window, cursor);



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