Commit f53ad339 authored by Matthias Clasen's avatar Matthias Clasen

Remove GtkObject completely

parent eac1959d
......@@ -93,7 +93,6 @@ gtk_message_dialog_get_type
gtk_misc_get_type
gtk_mount_operation_get_type
gtk_notebook_get_type
gtk_object_get_type
gtk_offscreen_window_get_type
gtk_orientable_get_type
gtk_page_setup_get_type
......
......@@ -244,7 +244,6 @@ gtk_public_h_sources = \
gtkmodules.h \
gtkmountoperation.h \
gtknotebook.h \
gtkobject.h \
gtkoffscreenwindow.h \
gtkorientable.h \
gtkpagesetup.h \
......@@ -512,7 +511,6 @@ gtk_base_c_sources = \
gtkmodules.c \
gtkmountoperation.c \
gtknotebook.c \
gtkobject.c \
gtkoffscreenwindow.c \
gtkorientable.c \
gtkpagesetup.c \
......
......@@ -127,7 +127,6 @@
#include <gtk/gtkmodules.h>
#include <gtk/gtkmountoperation.h>
#include <gtk/gtknotebook.h>
#include <gtk/gtkobject.h>
#include <gtk/gtkoffscreenwindow.h>
#include <gtk/gtkorientable.h>
#include <gtk/gtkpagesetup.h>
......
......@@ -2067,13 +2067,6 @@ gtk_notebook_set_action_widget
#endif
#endif
#if IN_HEADER(__GTK_OBJECT_H__)
#if IN_FILE(__GTK_OBJECT_C__)
gtk_object_destroy
gtk_object_get_type G_GNUC_CONST
#endif
#endif
#if IN_HEADER(__GTK_OFFSCREEN_WINDOW_H__)
#if IN_FILE(__GTK_OFFSCREEN_WINDOW_C__)
gtk_offscreen_window_get_type G_GNUC_CONST
......@@ -4361,6 +4354,7 @@ gtk_widget_get_margin_top
gtk_widget_set_margin_top
gtk_widget_get_margin_bottom
gtk_widget_set_margin_bottom
gtk_widget_in_destruction
#endif
#endif
......
......@@ -31,7 +31,6 @@
#ifndef __GTK_ADJUSTMENT_H__
#define __GTK_ADJUSTMENT_H__
#include <gtk/gtkobject.h>
#include <gdk/gdk.h>
G_BEGIN_DECLS
......
......@@ -48,6 +48,7 @@
#include <math.h>
#include "gtkarrow.h"
#include "gtksizerequest.h"
#include "gtktypeutils.h"
#include "gtkprivate.h"
#include "gtkintl.h"
......
......@@ -51,6 +51,7 @@
#include "gtkorientable.h"
#include "gtkprivate.h"
#include "gtksizerequest.h"
#include "gtktypeutils.h"
#include "gtkintl.h"
......
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* GtkBindingSet: Keybinding manager for GtkObjects.
* GtkBindingSet: Keybinding manager for GObjects.
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
......@@ -34,6 +34,7 @@
#include "gtkbindings.h"
#include "gtkkeyhash.h"
#include "gtktypeutils.h"
#include "gtkwidget.h"
#include "gtkrc.h"
......@@ -340,7 +341,7 @@ binding_ht_lookup_entry (GtkBindingSet *set,
}
static gboolean
binding_compose_params (GtkObject *object,
binding_compose_params (GObject *object,
GtkBindingArg *args,
GSignalQuery *query,
GValue **params_p)
......@@ -469,7 +470,7 @@ binding_compose_params (GtkObject *object,
static gboolean
gtk_binding_entry_activate (GtkBindingEntry *entry,
GtkObject *object)
GObject *object)
{
GtkBindingSignal *sig;
gboolean old_emission;
......@@ -593,7 +594,7 @@ gtk_binding_set_new (const gchar *set_name)
/**
* gtk_binding_set_by_class:
* @object_class: a valid #GtkObject class
* @object_class: a valid #GObject class
*
* This function returns the binding set named after the type name of
* the passed in class structure. New binding sets are created on
......@@ -604,10 +605,10 @@ gtk_binding_set_new (const gchar *set_name)
GtkBindingSet*
gtk_binding_set_by_class (gpointer object_class)
{
GtkObjectClass *class = object_class;
GObjectClass *class = object_class;
GtkBindingSet* binding_set;
g_return_val_if_fail (GTK_IS_OBJECT_CLASS (class), NULL);
g_return_val_if_fail (G_IS_OBJECT_CLASS (class), NULL);
if (!key_id_class_binding_set)
key_id_class_binding_set = g_quark_from_static_string (key_class_binding_set);
......@@ -671,12 +672,12 @@ gboolean
gtk_binding_set_activate (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
GtkObject *object)
GObject *object)
{
GtkBindingEntry *entry;
g_return_val_if_fail (binding_set != NULL, FALSE);
g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
keyval = gdk_keyval_to_lower (keyval);
modifiers = modifiers & BINDING_MOD_MASK ();
......@@ -1052,7 +1053,7 @@ gtk_binding_set_add_path (GtkBindingSet *binding_set,
static gboolean
binding_match_activate (GSList *pspec_list,
GtkObject *object,
GObject *object,
guint path_length,
gchar *path,
gchar *path_reversed,
......@@ -1170,7 +1171,7 @@ gtk_binding_entries_sort_patterns (GSList *entries,
}
static gboolean
gtk_bindings_activate_list (GtkObject *object,
gtk_bindings_activate_list (GObject *object,
GSList *entries,
gboolean is_release)
{
......@@ -1264,7 +1265,7 @@ gtk_bindings_activate_list (GtkObject *object,
* Return value: %TRUE if a binding was found and activated
*/
gboolean
gtk_bindings_activate (GtkObject *object,
gtk_bindings_activate (GObject *object,
guint keyval,
GdkModifierType modifiers)
{
......@@ -1274,8 +1275,6 @@ gtk_bindings_activate (GtkObject *object,
gboolean handled = FALSE;
gboolean is_release;
g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
if (!GTK_IS_WIDGET (object))
return FALSE;
......@@ -1296,7 +1295,7 @@ gtk_bindings_activate (GtkObject *object,
/**
* gtk_bindings_activate_event:
* @object: a #GtkObject (generally must be a widget)
* @object: a #GObject (generally must be a widget)
* @event: a #GdkEventKey
*
* Looks up key bindings for @object to find one matching
......@@ -1307,7 +1306,7 @@ gtk_bindings_activate (GtkObject *object,
* Since: 2.4
*/
gboolean
gtk_bindings_activate_event (GtkObject *object,
gtk_bindings_activate_event (GObject *object,
GdkEventKey *event)
{
GSList *entries = NULL;
......@@ -1315,8 +1314,6 @@ gtk_bindings_activate_event (GtkObject *object,
GtkKeyHash *key_hash;
gboolean handled = FALSE;
g_return_val_if_fail (GTK_IS_OBJECT (object), FALSE);
if (!GTK_IS_WIDGET (object))
return FALSE;
......
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* GtkBindingSet: Keybinding manager for GtkObjects.
* GtkBindingSet: Keybinding manager for GObjects.
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
......@@ -36,8 +36,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkobject.h>
#include <gtk/gtkenums.h>
G_BEGIN_DECLS
......@@ -101,15 +100,15 @@ struct _GtkBindingSignal
GtkBindingSet* gtk_binding_set_new (const gchar *set_name);
GtkBindingSet* gtk_binding_set_by_class(gpointer object_class);
GtkBindingSet* gtk_binding_set_find (const gchar *set_name);
gboolean gtk_bindings_activate (GtkObject *object,
gboolean gtk_bindings_activate (GObject *object,
guint keyval,
GdkModifierType modifiers);
gboolean gtk_bindings_activate_event (GtkObject *object,
gboolean gtk_bindings_activate_event (GObject *object,
GdkEventKey *event);
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
GtkObject *object);
GObject *object);
void gtk_binding_entry_skip (GtkBindingSet *binding_set,
guint keyval,
......
......@@ -78,6 +78,7 @@
#include "gtkbox.h"
#include "gtkorientable.h"
#include "gtksizerequest.h"
#include "gtktypeutils.h"
#include "gtkprivate.h"
#include "gtkintl.h"
......
......@@ -246,6 +246,7 @@
#include "gtkbuilder.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
#include "gtkdebug.h"
#include "gtkmain.h"
#include "gtkintl.h"
#include "gtkprivate.h"
......
......@@ -32,6 +32,7 @@
#include "gtkcellrendererspinner.h"
#include "gtkiconfactory.h"
#include "gtkicontheme.h"
#include "gtktypeutils.h"
#include "gtkintl.h"
......
......@@ -1283,7 +1283,7 @@ gtk_combo_box_remove (GtkContainer *container,
gtk_widget_unparent (widget);
_gtk_bin_set_child (GTK_BIN (container), NULL);
if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION)
if (gtk_widget_in_destruction (combo_box))
return;
gtk_widget_queue_resize (GTK_WIDGET (container));
......@@ -3964,12 +3964,12 @@ gtk_combo_box_menu_key_press (GtkWidget *widget,
{
GtkComboBox *combo_box = GTK_COMBO_BOX (data);
if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
{
/* The menu hasn't managed the
* event, forward it to the combobox
*/
gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
gtk_bindings_activate_event (G_OBJECT (combo_box), event);
}
return TRUE;
......@@ -4003,12 +4003,12 @@ gtk_combo_box_list_key_press (GtkWidget *widget,
return TRUE;
}
if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
{
/* The list hasn't managed the
* event, forward it to the combobox
*/
gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
gtk_bindings_activate_event (G_OBJECT (combo_box), event);
}
return TRUE;
......
......@@ -1086,7 +1086,7 @@ gtk_container_destroy (GtkWidget *widget)
GtkContainer *container = GTK_CONTAINER (widget);
GtkContainerPrivate *priv = container->priv;
if (GTK_CONTAINER_RESIZE_PENDING (container))
if (_gtk_widget_get_resize_pending (GTK_WIDGET (container)))
_gtk_container_dequeue_resize_handler (container);
if (priv->focus_child)
......@@ -1278,10 +1278,10 @@ void
_gtk_container_dequeue_resize_handler (GtkContainer *container)
{
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (GTK_CONTAINER_RESIZE_PENDING (container));
g_return_if_fail (_gtk_widget_get_resize_pending (GTK_WIDGET (container)));
container_resize_queue = g_slist_remove (container_resize_queue, container);
GTK_PRIVATE_UNSET_FLAG (container, GTK_RESIZE_PENDING);
_gtk_widget_set_resize_pending (GTK_WIDGET (container), FALSE);
}
/**
......@@ -1392,7 +1392,7 @@ gtk_container_idle_sizer (gpointer data)
widget = slist->data;
g_slist_free_1 (slist);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
_gtk_widget_set_resize_pending (widget, FALSE);
gtk_container_check_resize (GTK_CONTAINER (widget));
}
......@@ -1418,9 +1418,9 @@ _gtk_container_queue_resize (GtkContainer *container)
while (TRUE)
{
GTK_PRIVATE_SET_FLAG (widget, GTK_ALLOC_NEEDED);
GTK_PRIVATE_SET_FLAG (widget, GTK_WIDTH_REQUEST_NEEDED);
GTK_PRIVATE_SET_FLAG (widget, GTK_HEIGHT_REQUEST_NEEDED);
_gtk_widget_set_alloc_needed (widget, TRUE);
_gtk_widget_set_width_request_needed (widget, TRUE);
_gtk_widget_set_height_request_needed (widget, TRUE);
if ((resize_container && widget == GTK_WIDGET (resize_container)) ||
!(parent = gtk_widget_get_parent (widget)))
......@@ -1438,9 +1438,9 @@ _gtk_container_queue_resize (GtkContainer *container)
switch (resize_container->priv->resize_mode)
{
case GTK_RESIZE_QUEUE:
if (!GTK_CONTAINER_RESIZE_PENDING (resize_container))
if (!_gtk_widget_get_resize_pending (GTK_WIDGET (resize_container)))
{
GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
_gtk_widget_set_resize_pending (GTK_WIDGET (resize_container), TRUE);
if (container_resize_queue == NULL)
gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
gtk_container_idle_sizer,
......
......@@ -608,7 +608,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
child_ypad = 2 * border_width + priv->spacing + (interior_focus ? 0 : 2 * focus_width + 2 * focus_pad);
top_min_height = 2 * expander_spacing + expander_size;
child_visible = (child && GTK_WIDGET_CHILD_VISIBLE (child));
child_visible = (child && gtk_widget_get_child_visible (child));
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
{
......@@ -1103,7 +1103,7 @@ focus_in_site (GtkExpander *expander,
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (expander));
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
if (child && gtk_widget_get_child_visible (child))
return gtk_widget_child_focus (child, direction);
else
return FALSE;
......@@ -1312,7 +1312,7 @@ gtk_expander_get_preferred_width (GtkWidget *widget,
*natural_size += label_nat;
}
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
if (child && gtk_widget_get_child_visible (child))
{
gint child_min, child_nat;
......@@ -1382,7 +1382,7 @@ gtk_expander_get_preferred_height (GtkWidget *widget,
*natural_size += extra;
}
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
if (child && gtk_widget_get_child_visible (child))
{
gint child_min, child_nat;
......@@ -1457,7 +1457,7 @@ gtk_expander_get_preferred_height_for_width (GtkWidget *widget,
*natural_height += extra;
}
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
if (child && gtk_widget_get_child_visible (child))
{
gint child_min, child_nat;
......
......@@ -39,6 +39,7 @@
#include "gtkhsv.h"
#include "gtkbindings.h"
#include "gtkmarshalers.h"
#include "gtktypeutils.h"
#include "gtkintl.h"
/* Default width/height */
......
......@@ -39,6 +39,7 @@
#endif /* G_OS_WIN32 */
#include "gtkicontheme.h"
#include "gtkdebug.h"
#include "gtkiconfactory.h"
#include "gtkiconcache.h"
#include "gtkbuiltincache.h"
......
......@@ -26,7 +26,6 @@
#include <gdk/gdk.h>
#include <gtk/gtkobject.h>
G_BEGIN_DECLS
......
......@@ -27,6 +27,7 @@
#include "gtkimcontextsimple.h"
#include "gtksettings.h"
#include "gtkwidget.h"
#include "gtkdebug.h"
#include "gtkintl.h"
......
......@@ -263,7 +263,7 @@ gtk_invisible_style_set (GtkWidget *widget,
static void
gtk_invisible_show (GtkWidget *widget)
{
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
_gtk_widget_set_visible_flag (widget, TRUE);
gtk_widget_map (widget);
}
......
......@@ -1931,7 +1931,7 @@ gtk_grab_notify_foreach (GtkWidget *child,
if (is_shadowed)
{
GTK_PRIVATE_SET_FLAG (child, GTK_SHADOWED);
_gtk_widget_set_shadowed (child, TRUE);
if (!was_shadowed && devices &&
gtk_widget_is_sensitive (child))
synth_crossing_for_grab_notify (child, info->new_grab_widget,
......@@ -1940,7 +1940,7 @@ gtk_grab_notify_foreach (GtkWidget *child,
}
else
{
GTK_PRIVATE_UNSET_FLAG (child, GTK_SHADOWED);
_gtk_widget_set_shadowed (child, FALSE);
if (was_shadowed && devices &&
gtk_widget_is_sensitive (child))
synth_crossing_for_grab_notify (info->old_grab_widget, child,
......@@ -2240,25 +2240,25 @@ gtk_quit_destroy (GtkQuitFunction *quitf)
}
static gint
gtk_quit_destructor (GtkObject **object_p)
gtk_quit_destructor (GtkWidget **object_p)
{
if (*object_p)
gtk_object_destroy (*object_p);
gtk_widget_destroy (*object_p);
g_free (object_p);
return FALSE;
}
void
gtk_quit_add_destroy (guint main_level,
GtkObject *object)
gtk_quit_add_destroy (guint main_level,
GtkWidget *object)
{
GtkObject **object_p;
GtkWidget **object_p;
g_return_if_fail (main_level > 0);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (GTK_IS_WIDGET (object));
object_p = g_new (GtkObject*, 1);
object_p = g_new (GtkWidget*, 1);
*object_p = object;
g_signal_connect (object,
"destroy",
......
......@@ -33,6 +33,7 @@
#include <gdk/gdk.h>
#include <gtk/gtktypeutils.h>
#include <gtk/gtkwidget.h>
#ifdef G_PLATFORM_WIN32
#include <gtk/gtkbox.h>
......@@ -144,7 +145,7 @@ void gtk_device_grab_remove (GtkWidget *widget,
void gtk_init_add (GtkFunction function,
gpointer data);
void gtk_quit_add_destroy (guint main_level,
GtkObject *object);
GtkWidget *object);
guint gtk_quit_add (guint main_level,
GtkFunction function,
gpointer data);
......
......@@ -908,7 +908,7 @@ gtk_menu_shell_key_press (GtkWidget *widget,
if (!(menu_shell->active_menu_item || priv->in_unselectable_item) && menu_shell->parent_menu_shell)
return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
if (gtk_bindings_activate_event (GTK_OBJECT (widget), event))
if (gtk_bindings_activate_event (G_OBJECT (widget), event))
return TRUE;
g_object_get (gtk_widget_get_settings (widget),
......
......@@ -1702,7 +1702,7 @@ gtk_notebook_map (GtkWidget *widget)
{
if (priv->action_widget[i] &&
gtk_widget_get_visible (priv->action_widget[i]) &&
GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
gtk_widget_get_child_visible (priv->action_widget[i]) &&
!gtk_widget_get_mapped (priv->action_widget[i]))
gtk_widget_map (priv->action_widget[i]);
}
......@@ -4527,10 +4527,9 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
GList * next_list;
gint need_resize = FALSE;
GtkWidget *tab_label;
gboolean destroying;
destroying = GTK_OBJECT_FLAGS (notebook) & GTK_IN_DESTRUCTION;
destroying = gtk_widget_in_destruction (notebook);
next_list = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
if (!next_list)
......
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "gtkobject.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
/**
* SECTION:gtkobject
* @Short_description: The base class of the GTK+ type hierarchy
* @Title: GtkObject
* @See_also:#GObject
*
* #GtkObject is the base class for all widgets, and for a few
* non-widget objects such as #GtkAdjustment. #GtkObject predates
* #GObject; non-widgets that derive from #GtkObject rather than
* #GObject do so for backward compatibility reasons.
*
* #GtkObject<!-- -->s are created with a "floating" reference count.
* This means that the initial reference is not owned by anyone. Calling
* g_object_unref() on a newly-created #GtkObject is incorrect, the floating
* reference has to be removed first. This can be done by anyone at any time,
* by calling g_object_ref_sink() to convert the floating reference into a
* regular reference. g_object_ref_sink() returns a new reference if an object
* is already sunk (has no floating reference).
*
* When you add a widget to its parent container, the parent container
* will do this:
* <informalexample><programlisting>
* g_object_ref_sink (G_OBJECT (child_widget));
* </programlisting></informalexample>
* This means that the container now owns a reference to the child widget
* and the child widget has no floating reference.
*
* The purpose of the floating reference is to keep the child widget alive
* until you add it to a parent container:
* <informalexample><programlisting>
* button = gtk_button_new (<!-- -->);
* /&ast; button has one floating reference to keep it alive &ast;/
* gtk_container_add (GTK_CONTAINER (container), button);
* /&ast; button has one non-floating reference owned by the container &ast;/
* </programlisting></informalexample>
*
* #GtkWindow is a special case, because GTK+ itself will ref/sink it on creation.
* That is, after calling gtk_window_new(), the #GtkWindow will have one
* reference which is owned by GTK+, and no floating references.
*
* One more factor comes into play: the #GtkObject::destroy signal, emitted by the
* gtk_object_destroy() method. The #GtkObject::destroy signal asks all code owning a
* reference to an object to release said reference. So, for example, if you call
* gtk_object_destroy() on a #GtkWindow, GTK+ will release the reference count that
* it owns; if you call gtk_object_destroy() on a #GtkButton, then the button will
* be removed from its parent container and the parent container will release its
* reference to the button. Because these references are released, calling
* gtk_object_destroy() should result in freeing all memory associated with an
* object, unless some buggy code fails to release its references in response to
* the #GtkObject::destroy signal. Freeing memory (referred to as
* <firstterm>finalization</firstterm>) only happens if the reference count reaches
* zero.
*
* Some simple rules for handling #GtkObject:
* <itemizedlist>
* <listitem><para>
* Never call g_object_unref() unless you have previously called g_object_ref(),
* even if you created the #GtkObject. (Note: this is <emphasis>not</emphasis>
* true for #GObject; for #GObject, the creator of the object owns a reference.)
* </para></listitem>
* <listitem><para>
* Call gtk_object_destroy() to get rid of most objects in most cases.
* In particular, widgets are almost always destroyed in this way.
* </para></listitem>
* <listitem><para> Because of the floating reference count, you don't need to
* worry about reference counting for widgets and toplevel windows, unless you
* explicitly call g_object_ref() yourself.</para></listitem>
* </itemizedlist>
*/
enum {
DESTROY,
LAST_SIGNAL
};
static void gtk_object_dispose (GObject *object);
static void gtk_object_real_destroy (GtkObject *object);
static void gtk_object_finalize (GObject *object);
static guint object_signals[LAST_SIGNAL] = { 0 };
/****************************************************
* GtkObject type, class and instance initialization
*
****************************************************/
G_DEFINE_ABSTRACT_TYPE (GtkObject, gtk_object, G_TYPE_INITIALLY_UNOWNED);
static void
gtk_object_init (GtkObject *object)
{
}
static void
gtk_object_class_init (GtkObjectClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
gobject_class->dispose = gtk_object_dispose;
gobject_class->finalize = gtk_object_finalize;
class->destroy = gtk_object_real_destroy;
/**
* GtkObject::destroy:
* @object: the object which received the signal.
*
* Signals that all holders of a reference to the #GtkObject should release
* the reference that they hold. May result in finalization of the object
* if all references are released.
*/
object_signals[DESTROY] =
g_signal_new (I_("destroy"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (GtkObjectClass, destroy),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
/********************************************
* Functions to end a GtkObject's life time
*
********************************************/
/**
* gtk_object_destroy:
* @object: the object to destroy.
*
* Emits the #GtkObject::destroy signal notifying all reference holders that they should
* release the #GtkObject. See the overview documentation at the top of the
* page for more details.
*
* The memory for the object itself won't be deleted until
* its reference count actually drops to 0; gtk_object_destroy() merely asks
* reference holders to release their references, it does not free the object.
*/
void
gtk_object_destroy (GtkObject *object)
{
g_return_if_fail (GTK_IS_OBJECT (object));
if (!(GTK_OBJECT_FLAGS (object) & GTK_IN_DESTRUCTION))
g_object_run_dispose (G_OBJECT (object));