Index: libxfcegui4/netk-application.c =================================================================== --- libxfcegui4/netk-application.c (revision 23285) +++ libxfcegui4/netk-application.c (working copy) @@ -80,31 +80,20 @@ GType netk_application_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkApplicationClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_application_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkApplication), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_application_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "NetkApplication", - &object_info, 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkApplication", + sizeof (NetkApplicationClass), + netk_application_class_init, + sizeof (NetkApplication), + netk_application_init, + 0); } - return object_type; + return type; } static void Index: libxfcegui4/netk-class-group.c =================================================================== --- libxfcegui4/netk-class-group.c (revision 23285) +++ libxfcegui4/netk-class-group.c (working copy) @@ -64,30 +64,20 @@ GType netk_class_group_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkClassGroupClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_class_group_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkClassGroup), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_class_group_init, - NULL /* value_table */ - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "NetkClassGroup", &object_info, 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkClassGroup", + sizeof (NetkClassGroupClass), + netk_class_group_class_init, + sizeof (NetkClassGroup), + netk_class_group_init, + 0); } - return object_type; + return type; } static void Index: libxfcegui4/netk-pager.c =================================================================== --- libxfcegui4/netk-pager.c (revision 23285) +++ libxfcegui4/netk-pager.c (working copy) @@ -120,31 +120,20 @@ GType netk_pager_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkPagerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_pager_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkPager), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_pager_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (GTK_TYPE_WIDGET, "NetkPager", - &object_info, 0); + type = _netk_g_type_register_simple (GTK_TYPE_WIDGET, + "NetkPager", + sizeof (NetkPagerClass), + netk_pager_class_init, + sizeof (NetkPager), + netk_pager_init, + 0); } - return object_type; + return type; } static void Index: libxfcegui4/netk-private.h =================================================================== --- libxfcegui4/netk-private.h (revision 23285) +++ libxfcegui4/netk-private.h (working copy) @@ -44,6 +44,15 @@ #define _netk_slice_free(type, ptr) G_STMT_START{ g_free ((ptr)); }G_STMT_END #endif +GType +_netk_g_type_register_simple (GType type_parent, + const gchar *type_name_static, + guint class_size, + gpointer class_init, + guint instance_size, + gpointer instance_init, + GTypeFlags flags); + void p_netk_application_process_property_notify (NetkApplication * app, XEvent * xevent); void p_netk_window_process_property_notify (NetkWindow * window, Index: libxfcegui4/netk-screen.c =================================================================== --- libxfcegui4/netk-screen.c (revision 23285) +++ libxfcegui4/netk-screen.c (working copy) @@ -151,31 +151,20 @@ GType netk_screen_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkScreenClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_screen_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkScreen), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_screen_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "NetkScreen", &object_info, - 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkScreen", + sizeof (NetkScreenClass), + netk_screen_class_init, + sizeof (NetkScreen), + netk_screen_init, + 0); } - return object_type; + return type; } static void @@ -1005,6 +994,8 @@ g_list_free (created); g_list_free (closed_apps); g_list_free (created_apps); + g_list_free (closed_class_groups); + g_list_free (created_class_groups); --reentrancy_guard; Index: libxfcegui4/netk-tasklist.c =================================================================== --- libxfcegui4/netk-tasklist.c (revision 23285) +++ libxfcegui4/netk-tasklist.c (working copy) @@ -242,31 +242,20 @@ GType netk_task_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkTaskClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_task_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkTask), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_task_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "NetkTask", &object_info, - 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkTask", + sizeof (NetkTaskClass), + netk_task_class_init, + sizeof (NetkTask), + netk_task_init, + 0); } - return object_type; + return type; } static void @@ -387,31 +376,20 @@ GType netk_tasklist_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkTasklistClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_tasklist_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkTasklist), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_tasklist_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (GTK_TYPE_CONTAINER, "NetkTasklist", - &object_info, 0); + type = _netk_g_type_register_simple (GTK_TYPE_CONTAINER, + "NetkTasklist", + sizeof (NetkTasklistClass), + netk_tasklist_class_init, + sizeof (NetkTasklist), + netk_tasklist_init, + 0); } - return object_type; + return type; } static void @@ -909,6 +887,8 @@ } } + g_list_free (ungrouped_class_groups); + /* Always let you go down to a zero size: */ if (array->len > 0) g_array_index (array, int, array->len - 1) = 0; @@ -1057,11 +1037,13 @@ i++; l = l->next; } - g_list_free (visible_tasks); /* Update icon geometries. */ netk_tasklist_update_icon_geometries (tasklist); + g_list_free (visible_tasks); + g_list_free (ungrouped_class_groups); + GTK_WIDGET_CLASS (tasklist_parent_class)->size_allocate (widget, allocation); } Index: libxfcegui4/netk-trayicon.c =================================================================== --- libxfcegui4/netk-trayicon.c (revision 23285) +++ libxfcegui4/netk-trayicon.c (working copy) @@ -52,30 +52,20 @@ GType netk_tray_icon_get_type (void) { - static GType netk_tray_icon_type = 0; + static GType type = G_TYPE_INVALID; - if (!netk_tray_icon_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo netk_tray_icon_info = { - sizeof (NetkTrayIconClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) netk_tray_icon_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkTrayIcon), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_tray_icon_init, - NULL /* value_table */ - }; - - netk_tray_icon_type = g_type_register_static (GTK_TYPE_PLUG, - "NetkTrayIcon", - &netk_tray_icon_info, - 0); + type = _netk_g_type_register_simple (GTK_TYPE_PLUG, + "NetkTrayIcon", + sizeof (NetkTrayIconClass), + netk_tray_icon_class_init, + sizeof (NetkTrayIcon), + netk_tray_icon_init, + 0); } - return (netk_tray_icon_type); + return type; } static void Index: libxfcegui4/netk-util.c =================================================================== --- libxfcegui4/netk-util.c (revision 23285) +++ libxfcegui4/netk-util.c (working copy) @@ -42,6 +42,34 @@ } #endif +GType +_netk_g_type_register_simple (GType type_parent, + const gchar *type_name_static, + guint class_size, + gpointer class_init, + guint instance_size, + gpointer instance_init, + GTypeFlags flags) +{ + /* setup the type info on the stack */ + GTypeInfo info = + { + class_size, + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + instance_size, + 0, + (GInstanceInitFunc) instance_init, + NULL, + }; + + /* register the new type */ + return g_type_register_static (type_parent, (type_name_static), &info, 0); +} + void netk_gtk_window_set_type (GtkWindow * window, NetkWindowType type) { Index: libxfcegui4/netk-window.c =================================================================== --- libxfcegui4/netk-window.c (revision 23285) +++ libxfcegui4/netk-window.c (working copy) @@ -187,31 +187,20 @@ GType netk_window_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkWindowClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_window_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkWindow), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_window_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "NetkWindow", &object_info, - 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkWindow", + sizeof (NetkWindowClass), + netk_window_class_init, + sizeof (NetkWindow), + netk_window_init, + 0); } - return object_type; + return type; } static void Index: libxfcegui4/netk-workspace.c =================================================================== --- libxfcegui4/netk-workspace.c (revision 23285) +++ libxfcegui4/netk-workspace.c (working copy) @@ -65,31 +65,20 @@ GType netk_workspace_get_type (void) { - static GType object_type = 0; + static GType type = G_TYPE_INVALID; - g_type_init (); - - if (!object_type) + if (G_UNLIKELY (type == G_TYPE_INVALID)) { - static const GTypeInfo object_info = { - sizeof (NetkWorkspaceClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) netk_workspace_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (NetkWorkspace), - 0, /* n_preallocs */ - (GInstanceInitFunc) netk_workspace_init, - NULL /* value_table */ - }; - - object_type = - g_type_register_static (G_TYPE_OBJECT, "NetkWorkspace", - &object_info, 0); + type = _netk_g_type_register_simple (G_TYPE_OBJECT, + "NetkWorkspace", + sizeof (NetkWorkspaceClass), + netk_workspace_class_init, + sizeof (NetkWorkspace), + netk_workspace_init, + 0); } - return object_type; + return type; } static void