diff options
author | Lennart Poettering <lennart@poettering.net> | 2006-08-07 13:50:02 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2006-08-07 13:50:02 +0000 |
commit | 6649ebede686f00a694ec2786248637aef66c68f (patch) | |
tree | 1af27e1ce0bfcd297946d33276dd6e569f6a9859 | |
parent | 8a5e95797f13a9a8dcb5f7b2cf1649cebb49f310 (diff) |
show an watch cursor while loading device data
git-svn-id: file:///home/lennart/svn/public/pavucontrol/trunk@39 c17c95f2-f111-0410-90bf-f30a9569010c
-rw-r--r-- | src/pavucontrol.cc | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc index 8397af5..224be50 100644 --- a/src/pavucontrol.cc +++ b/src/pavucontrol.cc @@ -36,6 +36,7 @@ #endif static pa_context *context = NULL; +static int n_outstanding = 0; enum SinkType { SINK_ALL, @@ -165,6 +166,9 @@ public: virtual void onSourceTypeComboBoxChanged(); void updateDeviceVisibility(); + +protected: + virtual void on_realize(); }; void show_error(const char *txt) { @@ -433,6 +437,12 @@ MainWindow* MainWindow::create() { return w; } +void MainWindow::on_realize() { + Gtk::Window::on_realize(); + + get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH)); +} + MainWindow::~MainWindow() { for (std::map<int, char*>::iterator i = clientNames.begin(); i != clientNames.end(); ++i) g_free(i->second); @@ -632,11 +642,20 @@ void MainWindow::onSourceTypeComboBoxChanged() { updateDeviceVisibility(); } +static void dec_outstanding(MainWindow *w) { + assert(n_outstanding > 0); + + if (--n_outstanding <= 0) + w->get_window()->set_cursor(); +} + void sink_cb(pa_context *, const pa_sink_info *i, int eol, void *userdata) { MainWindow *w = static_cast<MainWindow*>(userdata); - if (eol) + if (eol) { + dec_outstanding(w); return; + } if (!i) { show_error("Sink callback failure"); @@ -649,8 +668,10 @@ void sink_cb(pa_context *, const pa_sink_info *i, int eol, void *userdata) { void source_cb(pa_context *, const pa_source_info *i, int eol, void *userdata) { MainWindow *w = static_cast<MainWindow*>(userdata); - if (eol) + if (eol) { + dec_outstanding(w); return; + } if (!i) { show_error("Source callback failure"); @@ -663,8 +684,10 @@ void source_cb(pa_context *, const pa_source_info *i, int eol, void *userdata) { void sink_input_cb(pa_context *, const pa_sink_input_info *i, int eol, void *userdata) { MainWindow *w = static_cast<MainWindow*>(userdata); - if (eol) + if (eol) { + dec_outstanding(w); return; + } if (!i) { show_error("Sink input callback failure"); @@ -677,8 +700,10 @@ void sink_input_cb(pa_context *, const pa_sink_input_info *i, int eol, void *use void client_cb(pa_context *, const pa_client_info *i, int eol, void *userdata) { MainWindow *w = static_cast<MainWindow*>(userdata); - if (eol) + if (eol) { + dec_outstanding(w); return; + } if (!i) { show_error("Client callback failure"); @@ -789,6 +814,8 @@ void context_state_callback(pa_context *c, void *userdata) { return; } pa_operation_unref(o); + + n_outstanding = 4; break; } |