gtk+ r20444 - in trunk: . gtk tests



Author: mitch
Date: Wed Jun 18 07:00:46 2008
New Revision: 20444
URL: http://svn.gnome.org/viewvc/gtk+?rev=20444&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/gtk/gtk.symbols
   trunk/gtk/gtkobject.c
   trunk/gtk/gtksettings.c
   trunk/gtk/gtktypeutils.c
   trunk/gtk/gtktypeutils.h
   trunk/tests/testgtk.c

Modified: trunk/gtk/gtk.symbols
==============================================================================
--- trunk/gtk/gtk.symbols	(original)
+++ trunk/gtk/gtk.symbols	Wed Jun 18 07:00:46 2008
@@ -4481,7 +4481,6 @@
 
 #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_init
 gtk_type_new
 gtk_type_unique
+gtk_type_class
 #endif
 #endif
 #endif

Modified: trunk/gtk/gtkobject.c
==============================================================================
--- trunk/gtk/gtkobject.c	(original)
+++ trunk/gtk/gtkobject.c	Wed Jun 18 07:00:46 2008
@@ -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"
 
 

Modified: trunk/gtk/gtksettings.c
==============================================================================
--- trunk/gtk/gtksettings.c	(original)
+++ trunk/gtk/gtksettings.c	Wed Jun 18 07:00:46 2008
@@ -1280,23 +1280,33 @@
 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

Modified: trunk/gtk/gtktypeutils.c
==============================================================================
--- trunk/gtk/gtktypeutils.c	(original)
+++ trunk/gtk/gtktypeutils.c	Wed Jun 18 07:00:46 2008
@@ -60,6 +60,18 @@
   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)
 {

Modified: trunk/gtk/gtktypeutils.h
==============================================================================
--- trunk/gtk/gtktypeutils.h	(original)
+++ trunk/gtk/gtktypeutils.h	Wed Jun 18 07:00:46 2008
@@ -235,15 +235,10 @@
   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)

Modified: trunk/tests/testgtk.c
==============================================================================
--- trunk/tests/testgtk.c	(original)
+++ trunk/tests/testgtk.c	Wed Jun 18 07:00:46 2008
@@ -6077,7 +6077,7 @@
 
   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 @@
   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 @@
 
   /* 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",



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