connection: Show a nice label when connecting to PA.
This commit is contained in:
parent
84dc67b395
commit
7de18201a3
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -484,6 +484,15 @@ Monitors</property>
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="connectingLabel">
|
||||
<property name="label" translatable="yes"><i>Establishing connection to PulseAudio. Please wait...</i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue