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),
|
showSourceOutputType(SOURCE_OUTPUT_CLIENT),
|
||||||
showSourceType(SOURCE_NO_MONITOR),
|
showSourceType(SOURCE_NO_MONITOR),
|
||||||
eventRoleWidget(NULL),
|
eventRoleWidget(NULL),
|
||||||
canRenameDevices(false) {
|
canRenameDevices(false),
|
||||||
|
m_connected(false) {
|
||||||
|
|
||||||
x->get_widget("cardsVBox", cardsVBox);
|
x->get_widget("cardsVBox", cardsVBox);
|
||||||
x->get_widget("streamsVBox", streamsVBox);
|
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("noRecsLabel", noRecsLabel);
|
||||||
x->get_widget("noSinksLabel", noSinksLabel);
|
x->get_widget("noSinksLabel", noSinksLabel);
|
||||||
x->get_widget("noSourcesLabel", noSourcesLabel);
|
x->get_widget("noSourcesLabel", noSourcesLabel);
|
||||||
|
x->get_widget("connectingLabel", connectingLabel);
|
||||||
x->get_widget("sinkInputTypeComboBox", sinkInputTypeComboBox);
|
x->get_widget("sinkInputTypeComboBox", sinkInputTypeComboBox);
|
||||||
x->get_widget("sourceOutputTypeComboBox", sourceOutputTypeComboBox);
|
x->get_widget("sourceOutputTypeComboBox", sourceOutputTypeComboBox);
|
||||||
x->get_widget("sinkTypeComboBox", sinkTypeComboBox);
|
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));
|
sourceOutputTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceOutputTypeComboBoxChanged));
|
||||||
sinkTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSinkTypeComboBoxChanged));
|
sinkTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSinkTypeComboBoxChanged));
|
||||||
sourceTypeComboBox->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::onSourceTypeComboBoxChanged));
|
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() {
|
MainWindow* MainWindow::create() {
|
||||||
|
@ -720,6 +726,19 @@ gboolean idle_cb(gpointer data) {
|
||||||
return FALSE;
|
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() {
|
void MainWindow::updateDeviceVisibility() {
|
||||||
|
|
||||||
if (idle_source)
|
if (idle_source)
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
|
|
||||||
Gtk::Notebook *notebook;
|
Gtk::Notebook *notebook;
|
||||||
Gtk::VBox *streamsVBox, *recsVBox, *sinksVBox, *sourcesVBox, *cardsVBox;
|
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;
|
Gtk::ComboBox *sinkInputTypeComboBox, *sourceOutputTypeComboBox, *sinkTypeComboBox, *sourceTypeComboBox;
|
||||||
|
|
||||||
std::map<uint32_t, CardWidget*> cardWidgets;
|
std::map<uint32_t, CardWidget*> cardWidgets;
|
||||||
|
@ -79,6 +79,7 @@ public:
|
||||||
virtual void onSinkTypeComboBoxChanged();
|
virtual void onSinkTypeComboBoxChanged();
|
||||||
virtual void onSourceTypeComboBoxChanged();
|
virtual void onSourceTypeComboBoxChanged();
|
||||||
|
|
||||||
|
void setConnectionState(gboolean connected);
|
||||||
void updateDeviceVisibility();
|
void updateDeviceVisibility();
|
||||||
void reallyUpdateDeviceVisibility();
|
void reallyUpdateDeviceVisibility();
|
||||||
void createMonitorStreamForSource(uint32_t source_idx);
|
void createMonitorStreamForSource(uint32_t source_idx);
|
||||||
|
@ -97,6 +98,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void on_realize();
|
virtual void on_realize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
gboolean m_connected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,10 @@ static void dec_outstanding(MainWindow *w) {
|
||||||
if (n_outstanding <= 0)
|
if (n_outstanding <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (--n_outstanding <= 0)
|
if (--n_outstanding <= 0) {
|
||||||
w->get_window()->set_cursor();
|
w->get_window()->set_cursor();
|
||||||
|
w->setConnectionState(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void card_cb(pa_context *, const pa_card_info *i, int eol, void *userdata) {
|
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:
|
case PA_CONTEXT_FAILED:
|
||||||
g_debug(_("Connection failed, attempting reconnect"));
|
g_debug(_("Connection failed, attempting reconnect"));
|
||||||
|
|
||||||
|
w->setConnectionState(false);
|
||||||
|
|
||||||
w->removeAllWidgets();
|
w->removeAllWidgets();
|
||||||
w->updateDeviceVisibility();
|
w->updateDeviceVisibility();
|
||||||
pa_context_unref(context);
|
pa_context_unref(context);
|
||||||
|
@ -536,7 +540,6 @@ gboolean connect_to_pulse(gpointer userdata) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug(_("Initialised and connected our context"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -484,6 +484,15 @@ Monitors</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Reference in New Issue