summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-14 05:49:40 +0000
committerDavid Robillard <d@drobilla.net>2008-08-14 05:49:40 +0000
commit576774c657d99c7c9954eefff27b886694913022 (patch)
tree36a9a321b128515291a066843767ef92483adf4e /src/libs/gui
parentdb492ea9443c4813b4124f980793746405ae39ef (diff)
downloadingen-576774c657d99c7c9954eefff27b886694913022.tar.gz
ingen-576774c657d99c7c9954eefff27b886694913022.tar.bz2
ingen-576774c657d99c7c9954eefff27b886694913022.zip
Shave some more time off startup (send commands off before updating GUI things, don't show until as late as possible).
git-svn-id: http://svn.drobilla.net/lad/ingen@1374 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/ConnectWindow.cpp42
-rw-r--r--src/libs/gui/ConnectWindow.hpp3
2 files changed, 24 insertions, 21 deletions
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index 546cbb60..811dd919 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -115,7 +115,6 @@ ConnectWindow::start(Ingen::Shared::World* world)
set_connected_to(world->engine);
- show();
connect();
}
@@ -197,7 +196,7 @@ ConnectWindow::connect()
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
+ sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
} else if (_mode == LAUNCH_REMOTE) {
@@ -218,7 +217,7 @@ ConnectWindow::connect()
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
+ sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
} else {
cerr << "Failed to launch ingen process." << endl;
@@ -244,7 +243,7 @@ ConnectWindow::connect()
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
Glib::signal_timeout().connect(
- sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
+ sigc::mem_fun(this, &ConnectWindow::gtk_callback), 10);
}
}
@@ -268,6 +267,15 @@ ConnectWindow::disconnect()
void
+ConnectWindow::on_hide()
+{
+ Gtk::Dialog::on_hide();
+ if (!_attached)
+ Gtk::Main::quit();
+}
+
+
+void
ConnectWindow::quit()
{
if (_attached) {
@@ -330,20 +338,18 @@ ConnectWindow::gtk_callback()
assert(App::instance().engine());
assert(App::instance().client());
- _progress_label->set_text("Connecting to engine...");
- present();
-
App::instance().client()->signal_response_ok.connect(
sigc::mem_fun(this, &ConnectWindow::response_ok_received));
- _ping_id = rand();
- while (_ping_id == -1)
- _ping_id = rand();
-
+ _ping_id = rand() * 2;
App::instance().engine()->set_next_response_id(_ping_id);
App::instance().engine()->ping();
- ++_connect_stage;
+
+ _progress_label->set_text("Connecting to engine...");
+ _progress_bar->set_pulse_step(0.01);
+ present();
+ ++_connect_stage;
} else if (_connect_stage == 1) {
if (_attached) {
@@ -359,8 +365,8 @@ ConnectWindow::gtk_callback()
}
}
} else if (_connect_stage == 2) {
- _progress_label->set_text(string("Requesting root patch..."));
App::instance().engine()->request_all_objects();
+ _progress_label->set_text(string("Requesting root patch..."));
++_connect_stage;
} else if (_connect_stage == 3) {
if (App::instance().store()->objects().size() > 0) {
@@ -368,20 +374,16 @@ ConnectWindow::gtk_callback()
if (root) {
set_connected_to(App::instance().engine());
App::instance().window_factory()->present_patch(root);
+ App::instance().engine()->load_plugins();
+ _progress_label->set_text(string("Loading plugins..."));
++_connect_stage;
}
}
} else if (_connect_stage == 4) {
- _progress_label->set_text(string("Loading plugins..."));
- App::instance().engine()->load_plugins();
- ++_connect_stage;
- } else if (_connect_stage == 5) {
App::instance().engine()->request_plugins();
- ++_connect_stage;
- } else if (_connect_stage == 6) {
+ hide();
_progress_label->set_text("Connected to engine");
_connect_stage = 0; // set ourselves up for next time (if there is one)
- hide();
return false; // deregister this callback
}
diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp
index 53d0ccd5..d8635804 100644
--- a/src/libs/gui/ConnectWindow.hpp
+++ b/src/libs/gui/ConnectWindow.hpp
@@ -53,7 +53,7 @@ public:
void set_connected_to(SharedPtr<Shared::EngineInterface> engine);
void start(Ingen::Shared::World* world);
- void response_ok_received(int32_t id) { if ((id) == _ping_id) _attached = true; }
+ void response_ok_received(int32_t id) { if (id == _ping_id) _attached = true; }
private:
enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL };
@@ -65,6 +65,7 @@ private:
void disconnect();
void connect();
void quit();
+ void on_hide();
bool gtk_callback();