diff options
-rw-r--r-- | doc/README.html.in | 2 | ||||
-rw-r--r-- | src/mainwindow.cc | 30 |
2 files changed, 22 insertions, 10 deletions
diff --git a/doc/README.html.in b/doc/README.html.in index 519bf40..8991692 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -10,7 +10,7 @@ <body> <h1><a name="top">PulseAudio Volume Control @PACKAGE_VERSION@</a></h1> -<p><i>Copyright 2006-2008 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> +<p><i>Copyright 2006-2009 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> <ul class="toc"> <li><a href="#license">License</a></li> diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 9d2a33d..4b56b61 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -37,8 +37,13 @@ /* 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;} + bool operator() (const pa_card_profile_info& lhs, const pa_card_profile_info& rhs) const { + + if (lhs.priority == rhs.priority) + return strcmp(lhs.name, rhs.name) > 0; + + return lhs.priority > rhs.priority; + } }; @@ -111,12 +116,17 @@ static void set_icon_name_fallback(Gtk::Image *i, const char *name, Gtk::IconSiz Gtk::IconSize::lookup(size, width, height); theme = Gtk::IconTheme::get_default(); - pixbuf = theme->load_icon(name, width, Gtk::ICON_LOOKUP_GENERIC_FALLBACK); - if (pixbuf) - i->set(pixbuf); - else + try { + pixbuf = theme->load_icon(name, width, Gtk::ICON_LOOKUP_GENERIC_FALLBACK); + + if (pixbuf) + i->set(pixbuf); + else + i->set(name); + } catch (Gtk::IconThemeError &e) { i->set(name); + } } void MainWindow::updateCard(const pa_card_info &info) { @@ -150,10 +160,12 @@ void MainWindow::updateCard(const pa_card_info &info) { w->hasSources = w->hasSources || (info.profiles[i].n_sources > 0); 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)); - } + + 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->updating = false; |