From b4241912379b321a1a2ec0d192faff12f8db2101 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 1 Jun 2011 19:14:25 +0000 Subject: Fix GtkBuilder using (and likely other) Gtk UIs in Qt4 hosts that do not link to Gtk (fix ticket #696). git-svn-id: http://svn.drobilla.net/lad/trunk/suil@3345 a436a847-0d15-0410-975c-d299462d15a1 --- src/gtk2_in_qt4.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/gtk2_in_qt4.cpp') diff --git a/src/gtk2_in_qt4.cpp b/src/gtk2_in_qt4.cpp index 91fa3b1..585d1d5 100644 --- a/src/gtk2_in_qt4.cpp +++ b/src/gtk2_in_qt4.cpp @@ -21,16 +21,32 @@ #include #include "suil_internal.h" +#include "suil-config.h" extern "C" { SUIL_API int -suil_wrap_init(const char* host_type_uri, +suil_wrap_init(SuilHost* host, + const char* host_type_uri, const char* ui_type_uri, const LV2_Feature* const* features) { - gtk_init(0, NULL); + /* We have to open libgtk here, so Gtk type symbols are present and will be + found by the introspection stuff. This is required at least to make + GtkBuilder use in UIs work, otherwise they will cause "Invalid object + type" errors. + */ + if (!host->gtk_lib) { + dlerror(); + host->gtk_lib = dlopen(SUIL_GTK2_LIB_NAME, RTLD_LAZY|RTLD_GLOBAL); + if (!host->gtk_lib) { + fprintf(stderr, "Failed to open %s (%s)\n", + SUIL_GTK2_LIB_NAME, dlerror()); + } + return 1; + } + return 0; } -- cgit v1.2.1