From 406d7376bf8faf0965fb87feaf6401962d357962 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 14 Aug 2008 20:22:45 +0000 Subject: Only show GUI menu items for nodes with available GUIs. git-svn-id: http://svn.drobilla.net/lad/ingen@1378 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/PluginModel.cpp | 20 +++++++++++++++++++- src/libs/client/PluginModel.hpp | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src/libs/client') diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index 80d6a9f1..c798294d 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -44,6 +44,25 @@ PluginModel::default_node_name() #ifdef HAVE_SLV2 +bool +PluginModel::has_ui() const +{ + Glib::Mutex::Lock lock(_rdf_world->mutex()); + + SLV2Value gtk_gui_uri = slv2_value_new_uri(_slv2_world, + "http://lv2plug.in/ns/extensions/ui#GtkUI"); + + SLV2UIs uis = slv2_plugin_get_uis(_slv2_plugin); + + if (slv2_values_size(uis) > 0) + for (unsigned i=0; i < slv2_uis_size(uis); ++i) + if (slv2_ui_is_a(slv2_uis_get_at(uis, i), gtk_gui_uri)) + return true; + + return false; +} + + SharedPtr PluginModel::ui(Ingen::Shared::World* world, SharedPtr node) const { @@ -87,7 +106,6 @@ PluginModel::get_lv2_icon_path(SLV2Plugin plugin) slv2_value_free(svg_icon_pred); return result; } - #endif } // namespace Client diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp index a7adc735..f8630e94 100644 --- a/src/libs/client/PluginModel.hpp +++ b/src/libs/client/PluginModel.hpp @@ -100,6 +100,8 @@ public: _slv2_plugins = slv2_world_get_all_plugins(_slv2_world); } + bool has_ui() const; + SharedPtr ui(Ingen::Shared::World* world, SharedPtr node) const; -- cgit v1.2.1