summaryrefslogtreecommitdiff
path: root/thunar/thunar-view.c
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2009-08-22 20:50:06 +0200
committerNick Schermer <nick@xfce.org>2009-08-22 20:50:06 +0200
commit09610f85d7e8016a443510636aeed4554dfcf044 (patch)
treeb48491441fbb604892182953099af068b54d6a4e /thunar/thunar-view.c
parentce34ba48e5e38ea750c27df4a8aec94b39508f42 (diff)
downloadthunar-09610f85d7e8016a443510636aeed4554dfcf044.tar.gz
Protect the interfaces types and use g_type_register_static_simple where possible.
Diffstat (limited to 'thunar/thunar-view.c')
-rw-r--r--thunar/thunar-view.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/thunar/thunar-view.c b/thunar/thunar-view.c
index 85672f71..067bc09f 100644
--- a/thunar/thunar-view.c
+++ b/thunar/thunar-view.c
@@ -33,29 +33,26 @@ static void thunar_view_class_init (gpointer klass);
GType
thunar_view_get_type (void)
{
- static GType type = G_TYPE_INVALID;
+ static volatile gsize type__volatile = 0;
+ GType type;
- if (G_UNLIKELY (type == G_TYPE_INVALID))
+ if (g_once_init_enter (&type__volatile))
{
- static const GTypeInfo info =
- {
- sizeof (ThunarViewIface),
- NULL,
- NULL,
- (GClassInitFunc) thunar_view_class_init,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarView"), &info, 0);
+ type = g_type_register_static_simple (G_TYPE_INTERFACE,
+ I_("ThunarView"),
+ sizeof (ThunarViewIface),
+ (GClassInitFunc) thunar_view_class_init,
+ 0,
+ NULL,
+ 0);
+
g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
g_type_interface_add_prerequisite (type, THUNAR_TYPE_COMPONENT);
+
+ g_once_init_leave (&type__volatile, type);
}
- return type;
+ return type__volatile;
}