Commit 73800758 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

deprecate gtk_type_class().

2008-06-18  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktypeutils.[ch]: deprecate gtk_type_class().

	* gtk/gtk.symbols: changed accordingly.

	* gtk/gtksettings.c (gtk_settings_install_property)
	(gtk_settings_install_property_parser): get rid of using
	gtk_type_class() by keeping a static reference to GtkSettingsClass
	around in both functions and passing that pointer on to
	settings_install_property_parser().

	* tests/testgtk.c: use g_type_class_ref()/unref() instead of
	gtk_type_class().

	* gtk/gtkobject.c: #undef GTK_DISABLE_DEPRECATED around including
	gtktypeutils.h.


svn path=/trunk/; revision=20444
parent 78c88e77
2008-06-18 Michael Natterer <mitch@imendio.com>
* gtk/gtktypeutils.[ch]: deprecate gtk_type_class().
* gtk/gtk.symbols: changed accordingly.
* gtk/gtksettings.c (gtk_settings_install_property)
(gtk_settings_install_property_parser): get rid of using
gtk_type_class() by keeping a static reference to GtkSettingsClass
around in both functions and passing that pointer on to
settings_install_property_parser().
* tests/testgtk.c: use g_type_class_ref()/unref() instead of
gtk_type_class().
* gtk/gtkobject.c: #undef GTK_DISABLE_DEPRECATED around including
gtktypeutils.h.
2008-06-17 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtkstyle.c: Add deprecated version
......
......@@ -4481,7 +4481,6 @@ gtk_tree_view_columns_autosize
#if IN_HEADER(__GTK_TYPE_UTILS_H__)
#if IN_FILE(__GTK_TYPE_UTILS_C__)
gtk_type_class
gtk_identifier_get_type G_GNUC_CONST
#ifndef GTK_DISABLE_DEPRECATED
gtk_type_enum_find_value
......@@ -4491,6 +4490,7 @@ gtk_type_flags_get_values
gtk_type_init
gtk_type_new
gtk_type_unique
gtk_type_class
#endif
#endif
#endif
......
......@@ -25,13 +25,19 @@
*/
#include <config.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#undef GTK_DISABLE_DEPRECATED
#include "gtkobject.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#define GTK_DISABLE_DEPRECATED
#include "gtkalias.h"
......
......@@ -1280,23 +1280,33 @@ _gtk_rc_property_parser_from_type (GType type)
void
gtk_settings_install_property (GParamSpec *pspec)
{
static GtkSettingsClass *klass = NULL;
GtkRcPropertyParser parser;
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
if (! klass)
klass = g_type_class_ref (GTK_TYPE_SETTINGS);
parser = _gtk_rc_property_parser_from_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
settings_install_property_parser (gtk_type_class (GTK_TYPE_SETTINGS), pspec, parser);
settings_install_property_parser (klass, pspec, parser);
}
void
gtk_settings_install_property_parser (GParamSpec *pspec,
GtkRcPropertyParser parser)
{
static GtkSettingsClass *klass = NULL;
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_return_if_fail (parser != NULL);
settings_install_property_parser (gtk_type_class (GTK_TYPE_SETTINGS), pspec, parser);
if (! klass)
klass = g_type_class_ref (GTK_TYPE_SETTINGS);
settings_install_property_parser (klass, pspec, parser);
}
static void
......
......@@ -60,6 +60,18 @@ gtk_type_unique (GtkType parent_type,
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)
{
......
......@@ -235,15 +235,10 @@ struct _GtkTypeInfo
GtkClassInitFunc base_class_init_func;
};
#endif /* GTK_DISABLE_DEPRECATED */
gpointer gtk_type_class (GtkType type);
#ifndef GTK_DISABLE_DEPRECATED
GtkType gtk_type_unique (GtkType parent_type,
const GtkTypeInfo *gtkinfo);
gpointer gtk_type_new (GtkType type);
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)
......
......@@ -6077,7 +6077,7 @@ set_cursor (GtkWidget *spinner,
label = g_object_get_data (G_OBJECT (spinner), "user_data");
class = gtk_type_class (GDK_TYPE_CURSOR_TYPE);
class = g_type_class_ref (GDK_TYPE_CURSOR_TYPE);
vals = class->values;
while (vals && vals->value != c)
......@@ -6087,6 +6087,8 @@ set_cursor (GtkWidget *spinner,
else
gtk_label_set_text (GTK_LABEL (label), "<unknown>");
g_type_class_unref (class);
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), c);
gdk_window_set_cursor (widget->window, cursor);
gdk_cursor_unref (cursor);
......@@ -13941,7 +13943,7 @@ main (int argc, char *argv[])
/* bindings test
*/
binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_WIDGET));
binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_WIDGET));
gtk_binding_entry_add_signal (binding_set,
'9', GDK_CONTROL_MASK | GDK_RELEASE_MASK,
"debug_msg",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment