Skip to content
Snippets Groups Projects
Commit 09610f85 authored by Nick Schermer's avatar Nick Schermer
Browse files

Protect the interfaces types and use g_type_register_static_simple where possible.

parent ce34ba48
No related branches found
No related tags found
No related merge requests found
......@@ -57,9 +57,10 @@ struct _PokeVolumeData
GType
thunar_browser_get_type (void)
{
static GType type = G_TYPE_INVALID;
if (G_UNLIKELY (type == G_TYPE_INVALID))
static volatile gsize type__volatile = 0;
GType type;
if (g_once_init_enter (&type__volatile))
{
type = g_type_register_static_simple (G_TYPE_INTERFACE,
I_("ThunarBrowser"),
......@@ -70,9 +71,11 @@ thunar_browser_get_type (void)
0);
g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
g_once_init_leave (&type__volatile, type);
}
return type;
return type__volatile;
}
......
......@@ -35,28 +35,25 @@ static void thunar_component_class_init (gpointer klass);
GType
thunar_component_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 (ThunarComponentIface),
NULL,
NULL,
(GClassInitFunc) thunar_component_class_init,
NULL,
NULL,
0,
0,
NULL,
};
type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarComponent"), &info, 0);
type = g_type_register_static_simple (G_TYPE_INTERFACE,
I_("ThunarComponent"),
sizeof (ThunarComponentIface),
(GClassInitFunc) thunar_component_class_init,
0,
NULL,
0);
g_type_interface_add_prerequisite (type, THUNAR_TYPE_NAVIGATOR);
g_once_init_leave (&type__volatile, type);
}
return type;
return type__volatile;
}
......
......@@ -29,28 +29,25 @@
GType
thunar_location_bar_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 (ThunarLocationBarIface),
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
type = g_type_register_static_simple (G_TYPE_INTERFACE,
I_("ThunarLocationBar"),
sizeof (ThunarLocationBarIface),
NULL,
0,
NULL,
0);
type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarLocationBar"), &info, 0);
g_type_interface_add_prerequisite (type, THUNAR_TYPE_COMPONENT);
g_once_init_leave (&type__volatile, type);
}
return type;
return type__volatile;
}
......
......@@ -46,9 +46,10 @@ static guint navigator_signals[LAST_SIGNAL];
GType
thunar_navigator_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 =
{
......@@ -65,9 +66,11 @@ thunar_navigator_get_type (void)
type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarNavigator"), &info, 0);
g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
g_once_init_leave (&type__volatile, type);
}
return type;
return type__volatile;
}
......
......@@ -33,29 +33,26 @@ static void thunar_side_pane_class_init (gpointer klass);
GType
thunar_side_pane_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 (ThunarSidePaneIface),
NULL,
NULL,
(GClassInitFunc) thunar_side_pane_class_init,
NULL,
NULL,
0,
0,
NULL,
};
type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarSidePane"), &info, 0);
type = g_type_register_static_simple (G_TYPE_INTERFACE,
I_("ThunarSidePane"),
sizeof (ThunarSidePaneIface),
(GClassInitFunc) thunar_side_pane_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;
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment