summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-21 00:32:35 +0000
committerDavid Robillard <d@drobilla.net>2011-05-21 00:32:35 +0000
commitdc255319ff35012b892ed3ee2bb0d311ebe1a670 (patch)
treeb207cf938fc217c401f1e0aa27bfc368ad5f4f6c
parent2c6db7e54c8124a7dd49d04fa949c3351676aee1 (diff)
downloadingen-dc255319ff35012b892ed3ee2bb0d311ebe1a670.tar.gz
ingen-dc255319ff35012b892ed3ee2bb0d311ebe1a670.tar.bz2
ingen-dc255319ff35012b892ed3ee2bb0d311ebe1a670.zip
Fix Gtk warnings (avoid loading top level of UI file).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3305 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/gui/App.cpp10
-rw-r--r--src/gui/ControlPanel.cpp12
-rw-r--r--src/gui/Controls.cpp4
-rw-r--r--src/gui/NodeControlWindow.cpp3
-rw-r--r--src/gui/NodeModule.cpp3
-rw-r--r--src/gui/PatchCanvas.cpp2
-rw-r--r--src/gui/PatchPortModule.cpp3
-rw-r--r--src/gui/PatchView.cpp3
-rw-r--r--src/gui/Port.cpp3
-rw-r--r--src/gui/WidgetFactory.hpp12
-rw-r--r--src/gui/WindowFactory.cpp20
11 files changed, 34 insertions, 41 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 723c3cd8..99e0ee42 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -78,15 +78,13 @@ App::App(Ingen::Shared::World* world)
, _world(world)
, _enable_signal(true)
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
-
Glib::set_application_name("Ingen");
gtk_window_set_default_icon_name("ingen");
- xml->get_widget_derived("connect_win", _connect_window);
- xml->get_widget_derived("messages_win", _messages_window);
- xml->get_widget_derived("patch_tree_win", _patch_tree_window);
- xml->get_widget("about_win", _about_dialog);
+ WidgetFactory::get_widget_derived("connect_win", _connect_window);
+ WidgetFactory::get_widget_derived("messages_win", _messages_window);
+ WidgetFactory::get_widget_derived("patch_tree_win", _patch_tree_window);
+ WidgetFactory::get_widget("about_win", _about_dialog);
_about_dialog->property_program_name() = "Ingen";
_about_dialog->property_logo_icon_name() = "ingen";
diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp
index c87f7c5d..a3964cf5 100644
--- a/src/gui/ControlPanel.cpp
+++ b/src/gui/ControlPanel.cpp
@@ -89,22 +89,16 @@ ControlPanel::add_port(SharedPtr<const PortModel> pm)
if (pm->is_input()) {
if (pm->is_toggle()) {
ToggleControl* tc;
- Glib::RefPtr<Gtk::Builder> xml
- = WidgetFactory::create("toggle_control");
- xml->get_widget_derived("toggle_control", tc);
+ WidgetFactory::get_widget_derived("toggle_control", tc);
control = tc;
} else if (pm->is_a(PortType::CONTROL)
|| pm->supports(App::instance().uris().atom_Float32)) {
SliderControl* sc;
- Glib::RefPtr<Gtk::Builder> xml
- = WidgetFactory::create("control_strip");
- xml->get_widget_derived("control_strip", sc);
+ WidgetFactory::get_widget_derived("control_strip", sc);
control = sc;
} else if (pm->supports(App::instance().uris().atom_String)) {
StringControl* sc;
- Glib::RefPtr<Gtk::Builder> xml
- = WidgetFactory::create("string_control");
- xml->get_widget_derived("string_control", sc);
+ WidgetFactory::get_widget_derived("string_control", sc);
control = sc;
}
}
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index af4a139e..6ab0b3c3 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -106,10 +106,8 @@ Control::set_label(const string& name)
void
Control::menu_properties()
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
-
PortPropertiesWindow* window;
- xml->get_widget_derived("port_properties_win", window);
+ WidgetFactory::get_widget_derived("port_properties_win", window);
window->present(_port_model);
}
diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp
index a99de9a8..547c2e1f 100644
--- a/src/gui/NodeControlWindow.cpp
+++ b/src/gui/NodeControlWindow.cpp
@@ -47,8 +47,7 @@ NodeControlWindow::NodeControlWindow(SharedPtr<const NodeModel> node,
set_title(_node->plugin_model()->human_name() + " - Ingen");
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win");
- xml->get_widget_derived("control_panel_vbox", _control_panel);
+ WidgetFactory::get_widget_derived("control_panel_vbox", _control_panel);
show_all_children();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 6e598b27..d65ae217 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -78,8 +78,7 @@ NodeModule::~NodeModule()
void
NodeModule::create_menu()
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
- xml->get_widget_derived("object_menu", _menu);
+ WidgetFactory::get_widget_derived("object_menu", _menu);
_menu->init(_node);
_menu->signal_embed_gui.connect(
sigc::mem_fun(this, &NodeModule::embed_gui));
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 0a0adecd..6da4eb93 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -72,7 +72,7 @@ PatchCanvas::PatchCanvas(SharedPtr<const PatchModel> patch, int width, int heigh
, _human_names(true)
, _show_port_names(true)
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
+ Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("canvas_menu");
xml->get_widget("canvas_menu", _menu);
xml->get_widget("canvas_menu_add_audio_input", _menu_add_audio_input);
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 224a8f7e..df74626b 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -77,8 +77,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas,
void
PatchPortModule::create_menu()
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
- xml->get_widget_derived("object_menu", _menu);
+ WidgetFactory::get_widget_derived("object_menu", _menu);
_menu->init(_model, true);
set_menu(_menu);
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 04d6cf9c..19ff35d6 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -117,9 +117,8 @@ PatchView::set_patch(SharedPtr<const PatchModel> patch)
SharedPtr<PatchView>
PatchView::create(SharedPtr<const PatchModel> patch)
{
- const Glib::RefPtr<Gtk::Builder>& xml = WidgetFactory::create("patch_view_box");
PatchView* result = NULL;
- xml->get_widget_derived("patch_view_box", result);
+ WidgetFactory::get_widget_derived("patch_view_box", result);
assert(result);
result->set_patch(patch);
return SharedPtr<PatchView>(result);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 115afefc..484c461b 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -126,8 +126,7 @@ void
Port::create_menu()
{
PortMenu* menu = NULL;
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
- xml->get_widget_derived("object_menu", menu);
+ WidgetFactory::get_widget_derived("object_menu", menu);
menu->init(model(), _flipped);
set_menu(menu);
}
diff --git a/src/gui/WidgetFactory.hpp b/src/gui/WidgetFactory.hpp
index 43525246..1d200d0b 100644
--- a/src/gui/WidgetFactory.hpp
+++ b/src/gui/WidgetFactory.hpp
@@ -35,6 +35,18 @@ public:
static Glib::RefPtr<Gtk::Builder>
create(const std::string& toplevel_widget="");
+ template<typename T>
+ static void get_widget(const Glib::ustring& name, T*& widget) {
+ Glib::RefPtr<Gtk::Builder> xml = create(name);
+ xml->get_widget(name, widget);
+ }
+
+ template<typename T>
+ static void get_widget_derived(const Glib::ustring& name, T*& widget) {
+ Glib::RefPtr<Gtk::Builder> xml = create(name);
+ xml->get_widget_derived(name, widget);
+ }
+
private:
static void find_ui_file();
static Glib::ustring ui_filename;
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 99cf9d1d..15788243 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -47,17 +47,15 @@ WindowFactory::WindowFactory()
, _new_subpatch_win(NULL)
, _properties_win(NULL)
{
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create();
-
- xml->get_widget_derived("load_plugin_win", _load_plugin_win);
- xml->get_widget_derived("load_patch_win", _load_patch_win);
- xml->get_widget_derived("load_remote_patch_win", _load_remote_patch_win);
- xml->get_widget_derived("new_subpatch_win", _new_subpatch_win);
- xml->get_widget_derived("properties_win", _properties_win);
- xml->get_widget_derived("rename_win", _rename_win);
+ WidgetFactory::get_widget_derived("load_plugin_win", _load_plugin_win);
+ WidgetFactory::get_widget_derived("load_patch_win", _load_patch_win);
+ WidgetFactory::get_widget_derived("load_remote_patch_win", _load_remote_patch_win);
+ WidgetFactory::get_widget_derived("new_subpatch_win", _new_subpatch_win);
+ WidgetFactory::get_widget_derived("properties_win", _properties_win);
+ WidgetFactory::get_widget_derived("rename_win", _rename_win);
#ifdef HAVE_CURL
- xml->get_widget_derived("upload_patch_win", _upload_patch_win);
+ WidgetFactory::get_widget_derived("upload_patch_win", _upload_patch_win);
#endif
}
@@ -169,10 +167,8 @@ WindowFactory::new_patch_window(SharedPtr<const PatchModel> patch,
{
assert( !view || view->patch() == patch);
- Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("patch_win");
-
PatchWindow* win = NULL;
- xml->get_widget_derived("patch_win", win);
+ WidgetFactory::get_widget_derived("patch_win", win);
assert(win);
win->set_patch(patch, view);