Remove GtkType legacy API and type definitions

This commit is contained in:
Christian Dywan 2009-12-10 13:27:20 +01:00 committed by Javier Jardón
parent e8f1a3ccf0
commit c742482d48
4 changed files with 3 additions and 341 deletions

View File

@ -4295,15 +4295,6 @@ gtk_tree_view_columns_autosize
#if IN_HEADER(__GTK_TYPE_UTILS_H__)
#if IN_FILE(__GTK_TYPE_UTILS_C__)
gtk_identifier_get_type G_GNUC_CONST
#ifndef GTK_DISABLE_DEPRECATED
gtk_type_enum_find_value
gtk_type_enum_get_values
gtk_type_flags_find_value
gtk_type_flags_get_values
gtk_type_init
gtk_type_new
gtk_type_unique
#endif
#endif
#endif

View File

@ -24,8 +24,6 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#undef GTK_DISABLE_DEPRECATED
#include "config.h"
#include <string.h> /* strcmp */
@ -34,111 +32,6 @@
#include "gtkintl.h"
#include "gtkalias.h"
/* --- functions --- */
GtkType
gtk_type_unique (GtkType parent_type,
const GtkTypeInfo *gtkinfo)
{
GTypeInfo tinfo = { 0, };
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (parent_type), 0);
g_return_val_if_fail (gtkinfo != NULL, 0);
g_return_val_if_fail (gtkinfo->type_name != NULL, 0);
g_return_val_if_fail (g_type_from_name (gtkinfo->type_name) == 0, 0);
tinfo.class_size = gtkinfo->class_size;
tinfo.base_init = gtkinfo->base_class_init_func;
tinfo.base_finalize = NULL;
tinfo.class_init = (GClassInitFunc) gtkinfo->class_init_func;
tinfo.class_finalize = NULL;
tinfo.class_data = NULL;
tinfo.instance_size = gtkinfo->object_size;
tinfo.n_preallocs = 0;
tinfo.instance_init = gtkinfo->object_init_func;
return g_type_register_static (parent_type, gtkinfo->type_name, &tinfo, 0);
}
/**
* gtk_type_class
* @type: a #GtkType.
*
* Returns a pointer pointing to the class of @type or %NULL if there
* was any trouble identifying @type. Initializes the class if
* necessary.
*
* Returns: pointer to the class.
*
* Deprecated: 2.14: Use g_type_class_peek() or g_type_class_ref() instead.
**/
gpointer
gtk_type_class (GtkType type)
{
static GQuark quark_static_class = 0;
gpointer class;
if (!G_TYPE_IS_ENUM (type) && !G_TYPE_IS_FLAGS (type))
g_return_val_if_fail (G_TYPE_IS_OBJECT (type), NULL);
/* ok, this is a bit ugly, GLib reference counts classes,
* and gtk_type_class() used to always return static classes.
* while we coud be faster with just peeking the glib class
* for the normal code path, we can't be sure that that
* class stays around (someone else might be holding the
* reference count and is going to drop it later). so to
* ensure that Gtk actually holds a static reference count
* on the class, we use GType qdata to store referenced
* classes, and only return those.
*/
class = g_type_get_qdata (type, quark_static_class);
if (!class)
{
if (!quark_static_class)
quark_static_class = g_quark_from_static_string ("GtkStaticTypeClass");
class = g_type_class_ref (type);
g_assert (class != NULL);
g_type_set_qdata (type, quark_static_class, class);
}
return class;
}
gpointer
gtk_type_new (GtkType type)
{
gpointer object;
g_return_val_if_fail (GTK_TYPE_IS_OBJECT (type), NULL);
object = g_object_new (type, NULL);
return object;
}
void
gtk_type_init (GTypeDebugFlags debug_flags)
{
static gboolean initialized = FALSE;
if (!initialized)
{
GType unused;
initialized = TRUE;
/* initialize GLib type system
*/
g_type_init_with_debug_flags (debug_flags);
/* GTK_TYPE_OBJECT
*/
unused = gtk_object_get_type ();
}
}
GType
gtk_identifier_get_type (void)
{
@ -153,66 +46,5 @@ gtk_identifier_get_type (void)
return our_type;
}
GtkEnumValue*
gtk_type_enum_get_values (GtkType enum_type)
{
GEnumClass *class;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
class = gtk_type_class (enum_type);
return class->values;
}
GtkFlagValue*
gtk_type_flags_get_values (GtkType flags_type)
{
GFlagsClass *class;
g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL);
class = gtk_type_class (flags_type);
return class->values;
}
GtkEnumValue*
gtk_type_enum_find_value (GtkType enum_type,
const gchar *value_name)
{
GtkEnumValue *value;
GEnumClass *class;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
g_return_val_if_fail (value_name != NULL, NULL);
class = gtk_type_class (enum_type);
value = g_enum_get_value_by_name (class, value_name);
if (!value)
value = g_enum_get_value_by_nick (class, value_name);
return value;
}
GtkFlagValue*
gtk_type_flags_find_value (GtkType flags_type,
const gchar *value_name)
{
GtkFlagValue *value;
GFlagsClass *class;
g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL);
g_return_val_if_fail (value_name != NULL, NULL);
class = gtk_type_class (flags_type);
value = g_flags_get_value_by_name (class, value_name);
if (!value)
value = g_flags_get_value_by_nick (class, value_name);
return value;
}
#define __GTK_TYPE_UTILS_C__
#include "gtkaliasdef.c"

View File

@ -59,79 +59,7 @@ typedef void (*GtkCallbackMarshal) (GtkObject *object,
typedef gchar * (*GtkTranslateFunc) (const gchar *path,
gpointer func_data);
/* Everything below is deprecated and superseded by GType API
*/
#ifndef GTK_DISABLE_DEPRECATED
/* Fundamental Types
* many of these are just aliases for GLib types to maintain
* compatibility
*/
#define GTK_TYPE_INVALID G_TYPE_INVALID
#define GTK_TYPE_NONE G_TYPE_NONE
#define GTK_TYPE_ENUM G_TYPE_ENUM
#define GTK_TYPE_FLAGS G_TYPE_FLAGS
/* GtkArg types */
#define GTK_TYPE_CHAR G_TYPE_CHAR
#define GTK_TYPE_UCHAR G_TYPE_UCHAR
#define GTK_TYPE_BOOL G_TYPE_BOOLEAN
#define GTK_TYPE_INT G_TYPE_INT
#define GTK_TYPE_UINT G_TYPE_UINT
#define GTK_TYPE_LONG G_TYPE_LONG
#define GTK_TYPE_ULONG G_TYPE_ULONG
#define GTK_TYPE_FLOAT G_TYPE_FLOAT
#define GTK_TYPE_DOUBLE G_TYPE_DOUBLE
#define GTK_TYPE_STRING G_TYPE_STRING
#define GTK_TYPE_BOXED G_TYPE_BOXED
#define GTK_TYPE_POINTER G_TYPE_POINTER
typedef GType GtkFundamentalType;
/* --- type macros --- */
#define GTK_CLASS_NAME(class) (g_type_name (G_TYPE_FROM_CLASS (class)))
#define GTK_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
#define GTK_TYPE_IS_OBJECT(type) (g_type_is_a ((type), GTK_TYPE_OBJECT))
/* outdated macros that really shouldn't e used anymore,
* use the GLib type system instead
*/
#define GTK_TYPE_FUNDAMENTAL_LAST (G_TYPE_LAST_RESERVED_FUNDAMENTAL - 1)
#define GTK_TYPE_FUNDAMENTAL_MAX (G_TYPE_FUNDAMENTAL_MAX)
#define GTK_FUNDAMENTAL_TYPE G_TYPE_FUNDAMENTAL
#define GTK_STRUCT_OFFSET G_STRUCT_OFFSET
/* glib macro wrappers (compatibility) */
#define GTK_CHECK_CAST G_TYPE_CHECK_INSTANCE_CAST
#define GTK_CHECK_CLASS_CAST G_TYPE_CHECK_CLASS_CAST
#define GTK_CHECK_GET_CLASS G_TYPE_INSTANCE_GET_CLASS
#define GTK_CHECK_TYPE G_TYPE_CHECK_INSTANCE_TYPE
#define GTK_CHECK_CLASS_TYPE G_TYPE_CHECK_CLASS_TYPE
/* glib type wrappers (compatibility) */
typedef GType GtkType;
typedef GTypeInstance GtkTypeObject;
typedef GTypeClass GtkTypeClass;
typedef GBaseInitFunc GtkClassInitFunc;
typedef GInstanceInitFunc GtkObjectInitFunc;
typedef GSignalCMarshaller GtkSignalMarshaller;
typedef void (*GtkDestroyNotify) (gpointer data);
typedef void (*GtkSignalFunc) (void);
#define GTK_SIGNAL_FUNC(f) G_CALLBACK(f)
#endif /* GTK_DISABLE_DEPRECATED */
#if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
/* Used by gtk_container_foreach_unmarshal () */
#if defined (GTK_COMPILATION)
/* GtkArg, used to hold differently typed values */
struct _GtkArg
{
@ -166,96 +94,7 @@ struct _GtkArg
} signal_data;
} d;
};
/* argument value access macros, these must not contain casts,
* to allow the usage of these macros in combination with the
* address operator, e.g. &GTK_VALUE_CHAR (*arg)
*/
#define GTK_VALUE_CHAR(a) ((a).d.char_data)
#define GTK_VALUE_UCHAR(a) ((a).d.uchar_data)
#define GTK_VALUE_BOOL(a) ((a).d.bool_data)
#define GTK_VALUE_INT(a) ((a).d.int_data)
#define GTK_VALUE_UINT(a) ((a).d.uint_data)
#define GTK_VALUE_LONG(a) ((a).d.long_data)
#define GTK_VALUE_ULONG(a) ((a).d.ulong_data)
#define GTK_VALUE_FLOAT(a) ((a).d.float_data)
#define GTK_VALUE_DOUBLE(a) ((a).d.double_data)
#define GTK_VALUE_STRING(a) ((a).d.string_data)
#define GTK_VALUE_ENUM(a) ((a).d.int_data)
#define GTK_VALUE_FLAGS(a) ((a).d.uint_data)
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)
#define GTK_VALUE_OBJECT(a) ((a).d.object_data)
#define GTK_VALUE_POINTER(a) ((a).d.pointer_data)
#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data)
#endif /* !GTK_DISABLE_DEPRECATED || GTK_COMPILATION */
#ifndef GTK_DISABLE_DEPRECATED
/* return location macros, these all narrow down to
* pointer types, because return values need to be
* passed by reference
*/
#define GTK_RETLOC_CHAR(a) ((gchar*) (a).d.pointer_data)
#define GTK_RETLOC_UCHAR(a) ((guchar*) (a).d.pointer_data)
#define GTK_RETLOC_BOOL(a) ((gboolean*) (a).d.pointer_data)
#define GTK_RETLOC_INT(a) ((gint*) (a).d.pointer_data)
#define GTK_RETLOC_UINT(a) ((guint*) (a).d.pointer_data)
#define GTK_RETLOC_LONG(a) ((glong*) (a).d.pointer_data)
#define GTK_RETLOC_ULONG(a) ((gulong*) (a).d.pointer_data)
#define GTK_RETLOC_FLOAT(a) ((gfloat*) (a).d.pointer_data)
#define GTK_RETLOC_DOUBLE(a) ((gdouble*) (a).d.pointer_data)
#define GTK_RETLOC_STRING(a) ((gchar**) (a).d.pointer_data)
#define GTK_RETLOC_ENUM(a) ((gint*) (a).d.pointer_data)
#define GTK_RETLOC_FLAGS(a) ((guint*) (a).d.pointer_data)
#define GTK_RETLOC_BOXED(a) ((gpointer*) (a).d.pointer_data)
#define GTK_RETLOC_OBJECT(a) ((GtkObject**) (a).d.pointer_data)
#define GTK_RETLOC_POINTER(a) ((gpointer*) (a).d.pointer_data)
/* GTK_RETLOC_SIGNAL() - no such thing */
/* type registration, it is recommended to use
* g_type_register_static() or
* g_type_register_dynamic() instead
*/
typedef struct _GtkTypeInfo GtkTypeInfo;
struct _GtkTypeInfo
{
gchar *type_name;
guint object_size;
guint class_size;
GtkClassInitFunc class_init_func;
GtkObjectInitFunc object_init_func;
gpointer reserved_1;
gpointer reserved_2;
GtkClassInitFunc base_class_init_func;
};
void gtk_type_init (GTypeDebugFlags debug_flags);
GtkType gtk_type_unique (GtkType parent_type,
const GtkTypeInfo *gtkinfo);
gpointer gtk_type_class (GtkType type);
gpointer gtk_type_new (GtkType type);
/* --- compatibility defines --- */
#define gtk_type_name(type) g_type_name (type)
#define gtk_type_from_name(name) g_type_from_name (name)
#define gtk_type_parent(type) g_type_parent (type)
#define gtk_type_is_a(type, is_a_type) g_type_is_a ((type), (is_a_type))
/* enum/flags compatibility functions, we strongly
* recommend to use the glib enum/flags classes directly
*/
typedef GEnumValue GtkEnumValue;
typedef GFlagsValue GtkFlagValue;
GtkEnumValue* gtk_type_enum_get_values (GtkType enum_type);
GtkFlagValue* gtk_type_flags_get_values (GtkType flags_type);
GtkEnumValue* gtk_type_enum_find_value (GtkType enum_type,
const gchar *value_name);
GtkFlagValue* gtk_type_flags_find_value (GtkType flags_type,
const gchar *value_name);
#endif /* GTK_DISABLE_DEPRECATED */
#endif /* GTK_COMPILATION */
G_END_DECLS

View File

@ -148,7 +148,7 @@ gail_get_accessible_for_widget (GtkWidget *widget,
g_object_unref (obj);
}
}
else if (GTK_CHECK_TYPE ((widget), gnome_canvas))
else if (G_TYPE_CHECK_INSTANCE_TYPE ((widget), gnome_canvas))
{
GObject *focused_item;
GValue value = {0, };