Merge commit 'coling/master'
This commit is contained in:
commit
98aab64c36
|
@ -55,11 +55,11 @@ void CardWidget::prepareMenu() {
|
||||||
|
|
||||||
treeModel->clear();
|
treeModel->clear();
|
||||||
/* Fill the ComboBox's Tree Model */
|
/* Fill the ComboBox's Tree Model */
|
||||||
for (std::map<Glib::ustring, Glib::ustring>::iterator i = profiles.begin(); i != profiles.end(); ++i) {
|
for (uint32_t i = 0; i < profiles.size(); ++i) {
|
||||||
Gtk::TreeModel::Row row = *(treeModel->append());
|
Gtk::TreeModel::Row row = *(treeModel->append());
|
||||||
row[profileModel.name] = i->first;
|
row[profileModel.name] = profiles[i].first;
|
||||||
row[profileModel.desc] = i->second;
|
row[profileModel.desc] = profiles[i].second;
|
||||||
if (i->first == activeProfile)
|
if (profiles[i].first == activeProfile)
|
||||||
active_idx = idx;
|
active_idx = idx;
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
bool updating;
|
bool updating;
|
||||||
|
|
||||||
std::map<Glib::ustring,Glib::ustring> profiles;
|
std::vector< std::pair<Glib::ustring,Glib::ustring> > profiles;
|
||||||
Glib::ustring activeProfile;
|
Glib::ustring activeProfile;
|
||||||
bool hasSinks;
|
bool hasSinks;
|
||||||
bool hasSources;
|
bool hasSources;
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "cardwidget.h"
|
#include "cardwidget.h"
|
||||||
|
@ -33,7 +35,12 @@
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
/*** MainWindow ***/
|
/* Used for profile sorting */
|
||||||
|
struct profile_prio_compare {
|
||||||
|
bool operator() (const pa_card_profile_info& lhs, const pa_card_profile_info& rhs) const
|
||||||
|
{return lhs.priority>rhs.priority;}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
|
MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
|
||||||
Gtk::Window(cobject),
|
Gtk::Window(cobject),
|
||||||
|
@ -116,6 +123,7 @@ void MainWindow::updateCard(const pa_card_info &info) {
|
||||||
CardWidget *w;
|
CardWidget *w;
|
||||||
bool is_new = false;
|
bool is_new = false;
|
||||||
const char *description, *icon;
|
const char *description, *icon;
|
||||||
|
std::set<pa_card_profile_info,profile_prio_compare> profile_priorities;
|
||||||
|
|
||||||
if (cardWidgets.count(info.index))
|
if (cardWidgets.count(info.index))
|
||||||
w = cardWidgets[info.index];
|
w = cardWidgets[info.index];
|
||||||
|
@ -136,11 +144,15 @@ void MainWindow::updateCard(const pa_card_info &info) {
|
||||||
set_icon_name_fallback(w->iconImage, icon ? icon : "audio-card", Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
set_icon_name_fallback(w->iconImage, icon ? icon : "audio-card", Gtk::ICON_SIZE_SMALL_TOOLBAR);
|
||||||
|
|
||||||
w->hasSinks = w->hasSources = false;
|
w->hasSinks = w->hasSources = false;
|
||||||
w->profiles.clear();
|
profile_priorities.clear();
|
||||||
for (uint32_t i=0; i<info.n_profiles; ++i) {
|
for (uint32_t i=0; i<info.n_profiles; ++i) {
|
||||||
w->hasSinks = w->hasSinks || (info.profiles[i].n_sinks > 0);
|
w->hasSinks = w->hasSinks || (info.profiles[i].n_sinks > 0);
|
||||||
w->hasSources = w->hasSources || (info.profiles[i].n_sources > 0);
|
w->hasSources = w->hasSources || (info.profiles[i].n_sources > 0);
|
||||||
w->profiles.insert(std::pair<Glib::ustring,Glib::ustring>(info.profiles[i].name, info.profiles[i].description));
|
profile_priorities.insert(info.profiles[i]);
|
||||||
|
}
|
||||||
|
w->profiles.clear();
|
||||||
|
for (std::set<pa_card_profile_info>::iterator i=profile_priorities.begin(); i != profile_priorities.end(); ++i) {
|
||||||
|
w->profiles.push_back(std::pair<Glib::ustring,Glib::ustring>(i->name,i->description));
|
||||||
}
|
}
|
||||||
w->activeProfile = info.active_profile->name;
|
w->activeProfile = info.active_profile->name;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ void server_info_cb(pa_context *, const pa_server_info *i, void *userdata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ext_stream_restore_read_cb(
|
void ext_stream_restore_read_cb(
|
||||||
pa_context *c,
|
pa_context *,
|
||||||
const pa_ext_stream_restore_info *i,
|
const pa_ext_stream_restore_info *i,
|
||||||
int eol,
|
int eol,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
Loading…
Reference in New Issue