diff options
author | David Robillard <d@drobilla.net> | 2011-06-01 19:14:25 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-06-01 19:14:25 +0000 |
commit | b4241912379b321a1a2ec0d192faff12f8db2101 (patch) | |
tree | 9f9bb51ca2aefbcf0f3499f9388a5048773c7d62 /src/gtk2_in_qt4.cpp | |
parent | 02fe4df201838c381d4106ec92849cbb5b959ccb (diff) | |
download | suil-b4241912379b321a1a2ec0d192faff12f8db2101.tar.gz suil-b4241912379b321a1a2ec0d192faff12f8db2101.tar.bz2 suil-b4241912379b321a1a2ec0d192faff12f8db2101.zip |
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
Diffstat (limited to 'src/gtk2_in_qt4.cpp')
-rw-r--r-- | src/gtk2_in_qt4.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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 <gdk/gdkx.h> #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; } |