renderer/native: Use g_initable_new() to create renderer

No need to do g_object_new then g_initable_init while tracking the
lifetime when g_initable_new() can do it for us.

https://bugzilla.gnome.org/show_bug.cgi?id=785381
This commit is contained in:
Jonas Ådahl 2017-10-05 10:47:25 -04:00
parent 78e6258b44
commit 7928b25ebf

View File

@ -3052,16 +3052,9 @@ MetaRendererNative *
meta_renderer_native_new (MetaMonitorManagerKms *monitor_manager_kms,
GError **error)
{
MetaRendererNative *renderer_native;
renderer_native = g_object_new (META_TYPE_RENDERER_NATIVE,
"monitor-manager", monitor_manager_kms,
NULL);
if (!g_initable_init (G_INITABLE (renderer_native), NULL, error))
{
g_object_unref (renderer_native);
return NULL;
}
return renderer_native;
return g_initable_new (META_TYPE_RENDERER_NATIVE,
NULL,
error,
"monitor-manager", monitor_manager_kms,
NULL);
}