]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/treeentry_gtk.c
remove symbol exports, this code is private to the library
[wxWidgets.git] / src / gtk / treeentry_gtk.c
index c0f8b87c510de7e4a6f646c4987b33624bf0d066..5bdae1daa6111fb4144ff8ddc2c9668550058053 100644 (file)
@@ -7,7 +7,14 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////// */
 
-#include "wx/gtk/treeentry_gtk.h"
+#ifdef __VMS
+#include <types.h>
+typedef pid_t GPid;
+#define G_GNUC_INTERNAL 
+#define GSEAL(x) x
+#endif
+
+#include "wx/gtk/private/treeentry_gtk.h"
 
 /*
         GtkTreeEntry
 */
 
 /* forwards */
-static void gtk_tree_entry_class_init(GtkTreeEntryClass* klass);
-static void gtk_tree_entry_init (GTypeInstance* instance, gpointer g_class);
+static void gtk_tree_entry_class_init(void* g_class, void* class_data);
 static void gtk_tree_entry_string_transform_func(const GValue *src_value,
                                                  GValue *dest_value);
 static void gtk_tree_entry_dispose(GObject* obj);
 
+static GObjectClass* parent_class;
 
 /* public */
 GtkTreeEntry*
@@ -39,24 +46,24 @@ gtk_tree_entry_new()
     return GTK_TREE_ENTRY(g_object_new(GTK_TYPE_TREE_ENTRY, NULL));
 }
 
-GtkType
+GType
 gtk_tree_entry_get_type ()
 {
-    static GtkType tree_entry_type = 0;
+    static GType tree_entry_type = 0;
 
     if (!tree_entry_type)
     {
         const GTypeInfo tree_entry_info =
         {
-            sizeof (GtkTreeEntryClass),
+            sizeof(GObjectClass),
             NULL,           /* base_init */
             NULL,           /* base_finalize */
-            (GClassInitFunc) gtk_tree_entry_class_init,  /* class_init */
+            gtk_tree_entry_class_init,
             NULL,           /* class_finalize */
             NULL,           /* class_data */
             sizeof (GtkTreeEntry),
             16,             /* n_preallocs */
-            (GInstanceInitFunc) gtk_tree_entry_init, /*instance_init*/
+            NULL,           /* instance_init */
             NULL            /* value_table */
         };
         tree_entry_type = g_type_register_static (G_TYPE_OBJECT, "GtkTreeEntry",
@@ -71,6 +78,12 @@ gtk_tree_entry_get_type ()
 
 gchar*     gtk_tree_entry_get_collate_key (GtkTreeEntry* entry)
 {
+    if (entry->collate_key == NULL)
+    {
+        char* temp = g_utf8_casefold(entry->label, -1);
+        entry->collate_key = g_utf8_collate_key(temp, -1);
+        g_free(temp);
+    }
     return entry->collate_key;
 }
 
@@ -98,7 +111,7 @@ void     gtk_tree_entry_set_label       (GtkTreeEntry* entry, const gchar* label
     }
 
     entry->label = g_strdup(label);
-    entry->collate_key = g_utf8_collate_key(label, -1); /* -1 == null terminated */
+    entry->collate_key = NULL;
 }
 
 void   gtk_tree_entry_set_userdata      (GtkTreeEntry* entry, gpointer userdata)
@@ -117,36 +130,24 @@ void   gtk_tree_entry_set_destroy_func  (GtkTreeEntry* entry,
 }
 
 /* private */
-static void gtk_tree_entry_class_init(GtkTreeEntryClass* klass)
+static void gtk_tree_entry_class_init(void* g_class, void* class_data)
 {
-    GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
+    GObjectClass* gobject_class = G_OBJECT_CLASS(g_class);
     gobject_class->dispose = gtk_tree_entry_dispose;
-}
-
-static void gtk_tree_entry_init (GTypeInstance* instance, gpointer g_class)
-{
-    GtkTreeEntry* entry = (GtkTreeEntry*) instance;
-
-    /* clear */
-    entry->label = NULL;
-    entry->collate_key = NULL;
-    entry->userdata = NULL;
-    entry->destroy_func_data = NULL;
-    entry->destroy_func = NULL;
+    parent_class = G_OBJECT_CLASS(g_type_class_peek_parent(g_class));
 }
 
 static void gtk_tree_entry_string_transform_func(const GValue *src_value,
                                                  GValue *dest_value)
 {
     GtkTreeEntry *entry;
+    void* src_ptr = g_value_peek_pointer(src_value);
 
     /* Make sure src is a treeentry and dest can hold a string */
-    g_assert(GTK_IS_TREE_ENTRY(src_value->data[0].v_pointer));
+    g_assert(GTK_IS_TREE_ENTRY(src_ptr));
     g_assert(G_VALUE_HOLDS(dest_value, G_TYPE_STRING));
 
-    /* TODO: Use strdup here or just pass it? */
-    entry = GTK_TREE_ENTRY(src_value->data[0].v_pointer);
-
+    entry = GTK_TREE_ENTRY(src_ptr);
     g_value_set_string(dest_value, entry->label);
 }
 
@@ -177,4 +178,6 @@ static void gtk_tree_entry_dispose(GObject* obj)
 
     /* clear userdata */
     entry->userdata = NULL;
+
+    parent_class->dispose(obj);
 }