summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2010-04-20 20:22:38 +0100
committerColin Guthrie <cguthrie@mandriva.org>2010-04-20 20:24:15 +0100
commit7de18201a38fc8bee15e6ef162fb35d242e6d00b (patch)
treeade4a61727a24665746c723deea90e3b3cfdba79
parent84dc67b395dc5e8734c1245d839fb3058cf76ffe (diff)
connection: Show a nice label when connecting to PA.
-rw-r--r--src/mainwindow.cc21
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/pavucontrol.cc7
-rw-r--r--src/pavucontrol.glade9
4 files changed, 39 insertions, 4 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 7a831e8..7ada1ca 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -73,7 +73,8 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
showSourceOutputType(SOURCE_OUTPUT_CLIENT),
showSourceType(SOURCE_NO_MONITOR),
eventRoleWidget(NULL),
- canRenameDevices(false) {
+ canRenameDevices(false),
+ m_connected(false) {
x->get_widget("cardsVBox", cardsVBox);
x->get_widget("streamsVBox", streamsVBox);
@@ -85,6 +86,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
x->get_widget("noRecsLabel", noRecsLabel);
x->get_widget("noSinksLabel", noSinksLabel);
x->get_widget("noSourcesLabel", noSourcesLabel);
+ x->get_widget("connectingLabel", connectingLabel);
x->get_widget("sinkInputTypeComboBox", sinkInputTypeComboBox);
x->get_widget("sourceOutputTypeComboBox", sourceOutputTypeComboBox);
x->get_widget("sinkTypeComboBox", sinkTypeComboBox);
@@ -106,6 +108,10 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
sourceOutputTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceOutputTypeComboBoxChanged));
sinkTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSinkTypeComboBoxChanged));
sourceTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceTypeComboBoxChanged));
+
+ /* Hide first and show when we're connected */
+ notebook->hide();
+ connectingLabel->show();
}
MainWindow* MainWindow::create() {
@@ -720,6 +726,19 @@ gboolean idle_cb(gpointer data) {
return FALSE;
}
+void MainWindow::setConnectionState(gboolean connected) {
+ if (m_connected != connected) {
+ m_connected = connected;
+ if (m_connected) {
+ connectingLabel->hide();
+ notebook->show();
+ } else {
+ notebook->hide();
+ connectingLabel->show();
+ }
+ }
+}
+
void MainWindow::updateDeviceVisibility() {
if (idle_source)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 92db272..1d2f4b0 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -59,7 +59,7 @@ public:
Gtk::Notebook *notebook;
Gtk::VBox *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox;
- Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel;
+ Gtk::Label *noStreamsLabel, *noRecsLabel, *noSinksLabel, *noSourcesLabel, *noCardsLabel, *connectingLabel;
Gtk::ComboBox *sinkInputTypeComboBox, *sourceOutputTypeComboBox, *sinkTypeComboBox, *sourceTypeComboBox;
std::map<uint32_t, CardWidget*> cardWidgets;
@@ -79,6 +79,7 @@ public:
virtual void onSinkTypeComboBoxChanged();
virtual void onSourceTypeComboBoxChanged();
+ void setConnectionState(gboolean connected);
void updateDeviceVisibility();
void reallyUpdateDeviceVisibility();
void createMonitorStreamForSource(uint32_t source_idx);
@@ -97,6 +98,9 @@ public:
protected:
virtual void on_realize();
+
+private:
+ gboolean m_connected;
};
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index 1dd0147..0ad020d 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -61,8 +61,10 @@ static void dec_outstanding(MainWindow *w) {
if (n_outstanding <= 0)
return;
- if (--n_outstanding <= 0)
+ if (--n_outstanding <= 0) {
w->get_window()->set_cursor();
+ w->setConnectionState(true);
+ }
}
void card_cb(pa_context *, const pa_card_info *i, int eol, void *userdata) {
@@ -492,6 +494,8 @@ void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_FAILED:
g_debug(_("Connection failed, attempting reconnect"));
+ w->setConnectionState(false);
+
w->removeAllWidgets();
w->updateDeviceVisibility();
pa_context_unref(context);
@@ -536,7 +540,6 @@ gboolean connect_to_pulse(gpointer userdata) {
return false;
}
- g_debug(_("Initialised and connected our context"));
return false;
}
diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade
index 52fc6df..82aca34 100644
--- a/src/pavucontrol.glade
+++ b/src/pavucontrol.glade
@@ -484,6 +484,15 @@ Monitors</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="connectingLabel">
+ <property name="label" translatable="yes">&lt;i&gt;Establishing connection to PulseAudio. Please wait...&lt;/i&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>