summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-14 20:22:45 +0000
committerDavid Robillard <d@drobilla.net>2008-08-14 20:22:45 +0000
commit406d7376bf8faf0965fb87feaf6401962d357962 (patch)
tree2c3505e577353f724cf3401766bdc641a7afd76e /src
parente075cfa10e698a21d68f89780dc61acd46459719 (diff)
downloadingen-406d7376bf8faf0965fb87feaf6401962d357962.tar.gz
ingen-406d7376bf8faf0965fb87feaf6401962d357962.tar.bz2
ingen-406d7376bf8faf0965fb87feaf6401962d357962.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PluginModel.cpp20
-rw-r--r--src/libs/client/PluginModel.hpp2
-rw-r--r--src/libs/gui/NodeMenu.cpp6
3 files changed, 26 insertions, 2 deletions
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<PluginUI>
PluginModel::ui(Ingen::Shared::World* world, SharedPtr<NodeModel> 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<PluginUI> ui(Ingen::Shared::World* world,
SharedPtr<NodeModel> node) const;
diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp
index 6051ec7c..05139540 100644
--- a/src/libs/gui/NodeMenu.cpp
+++ b/src/libs/gui/NodeMenu.cpp
@@ -64,7 +64,11 @@ NodeMenu::init(SharedPtr<NodeModel> node)
_embed_gui_menuitem->signal_toggled().connect(sigc::mem_fun(this,
&NodeMenu::on_menu_embed_gui));
- if ((!node->plugin()) || node->plugin()->type() != PluginModel::LV2) {
+ const PluginModel* plugin = dynamic_cast<const PluginModel*>(node->plugin());
+ if (plugin && plugin->type() == PluginModel::LV2 && plugin->has_ui()) {
+ _popup_gui_menuitem->show();
+ _embed_gui_menuitem->show();
+ } else {
_popup_gui_menuitem->hide();
_embed_gui_menuitem->hide();
}