diff options
author | David Robillard <d@drobilla.net> | 2011-04-22 06:26:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-22 06:26:38 +0000 |
commit | e41990c185f07027a3516b8dc4eb6f47436936d9 (patch) | |
tree | 10ca47560bd782e00bc08c56915d3e7e31490b6d /src/instance.c | |
parent | cf46c161552ab4ca049326e22e75338825a7e004 (diff) | |
download | suil-e41990c185f07027a3516b8dc4eb6f47436936d9.tar.gz suil-e41990c185f07027a3516b8dc4eb6f47436936d9.tar.bz2 suil-e41990c185f07027a3516b8dc4eb6f47436936d9.zip |
Remove UI instance API from SLV2 (apps should implement UIs via Suil now).
Remove UI extension API and header from public APIs entirely.
Rework UI instance API to support multiple UIs and a more precise notion of embedding support.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@3186 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/instance.c')
-rw-r--r-- | src/instance.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/instance.c b/src/instance.c index 6458d51..42b87d3 100644 --- a/src/instance.c +++ b/src/instance.c @@ -39,14 +39,25 @@ #define QT4_UI_URI NS_UI "Qt4UI" SUIL_API -bool -suil_ui_type_supported(const char* host_type_uri, - const char* ui_type_uri) +unsigned +suil_ui_supported(const char* container_type_uri, + const char* ui_type_uri) { - return (!strcmp(host_type_uri, GTK2_UI_URI) - || !strcmp(host_type_uri, QT4_UI_URI)) - && (!strcmp(ui_type_uri, GTK2_UI_URI) - || !strcmp(ui_type_uri, QT4_UI_URI)); + enum { + SUIL_WRAPPING_UNSUPPORTED = 0, + SUIL_WRAPPING_NATIVE = 1, + SUIL_WRAPPING_EMBEDDED = 2 + }; + if (!strcmp(container_type_uri, ui_type_uri)) { + return SUIL_WRAPPING_NATIVE; + } else if ((!strcmp(container_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, QT4_UI_URI)) + || (!strcmp(container_type_uri, QT4_UI_URI) + && !strcmp(ui_type_uri, GTK2_UI_URI))) { + return SUIL_WRAPPING_EMBEDDED; + } else { + return SUIL_WRAPPING_UNSUPPORTED; + } } struct _SuilModule { @@ -57,25 +68,25 @@ struct _SuilModule { typedef struct _SuilModule* SuilModule; static SuilModule -get_wrap_module(const char* host_type_uri, +get_wrap_module(const char* container_type_uri, const char* ui_type_uri) { - if (!strcmp(host_type_uri, ui_type_uri)) { + if (!strcmp(container_type_uri, ui_type_uri)) { return NULL; } const char* module_name = NULL; - if (!strcmp(host_type_uri, QT4_UI_URI) + if (!strcmp(container_type_uri, QT4_UI_URI) && !strcmp(ui_type_uri, GTK2_UI_URI)) { module_name = "libsuil_gtk2_in_qt4"; - } else if (!strcmp(host_type_uri, GTK2_UI_URI) + } else if (!strcmp(container_type_uri, GTK2_UI_URI) && !strcmp(ui_type_uri, QT4_UI_URI)) { module_name = "libsuil_qt4_in_gtk2"; } if (!module_name) { SUIL_ERRORF("Unable to wrap UI type <%s> as type <%s>\n", - ui_type_uri, host_type_uri); + ui_type_uri, container_type_uri); return NULL; } @@ -114,14 +125,14 @@ get_wrap_module(const char* host_type_uri, SUIL_API SuilInstance -suil_instance_new(const char* plugin_uri, +suil_instance_new(SuilHost host, + SuilController controller, + const char* container_type_uri, + const char* plugin_uri, const char* ui_uri, + const char* ui_type_uri, const char* ui_bundle_path, const char* ui_binary_path, - const char* ui_type_uri, - const char* host_type_uri, - LV2UI_Write_Function write_function, - LV2UI_Controller controller, const LV2_Feature* const* features) { // Open UI library @@ -166,9 +177,9 @@ suil_instance_new(const char* plugin_uri, features = (const LV2_Feature* const*)&local_features; } - SuilModule module = get_wrap_module(host_type_uri, ui_type_uri); + SuilModule module = get_wrap_module(container_type_uri, ui_type_uri); if (module) { - module->init(host_type_uri, ui_type_uri, features); + module->init(container_type_uri, ui_type_uri, features); } // Instantiate UI @@ -181,7 +192,7 @@ suil_instance_new(const char* plugin_uri, descriptor, plugin_uri, ui_bundle_path, - write_function, + host->write_func, controller, &instance->ui_widget, features); @@ -204,9 +215,9 @@ suil_instance_new(const char* plugin_uri, } if (module) { - if (module->wrap(host_type_uri, ui_type_uri, instance)) { + if (module->wrap(container_type_uri, ui_type_uri, instance)) { SUIL_ERRORF("Failed to wrap UI <%s> in type <%s>\n", - ui_uri, host_type_uri); + ui_uri, container_type_uri); suil_instance_free(instance); return NULL; } |