From e32a02e2dda8432572075e9134a9a04abdbecbae Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 11 Jul 2012 12:49:20 +0100 Subject: [PATCH] sound: Make sort_profiles public And rename it to gvc_mixer_card_profile_compare() https://bugzilla.gnome.org/show_bug.cgi?id=674831 --- panels/sound/gvc-mixer-card.c | 15 ++++++++++----- panels/sound/gvc-mixer-card.h | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/panels/sound/gvc-mixer-card.c b/panels/sound/gvc-mixer-card.c index 887220c19..a9b246f6d 100644 --- a/panels/sound/gvc-mixer-card.c +++ b/panels/sound/gvc-mixer-card.c @@ -290,9 +290,15 @@ gvc_mixer_card_get_ports (GvcMixerCard *card) return card->priv->ports; } -static int -sort_profiles (GvcMixerCardProfile *a, - GvcMixerCardProfile *b) +/** + * gvc_mixer_card_profile_compare: + * + * Return value: 1 if @a has a higher priority, -1 if @b has a higher + * priority, 0 if @a and @b have the same priority. + */ +int +gvc_mixer_card_profile_compare (GvcMixerCardProfile *a, + GvcMixerCardProfile *b) { if (a->priority == b->priority) return 0; @@ -301,7 +307,6 @@ sort_profiles (GvcMixerCardProfile *a, return -1; } - /** * gvc_mixer_card_set_profiles: * @profiles: (transfer full) (element-type GvcMixerCardProfile): @@ -313,7 +318,7 @@ gvc_mixer_card_set_profiles (GvcMixerCard *card, g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); g_return_val_if_fail (card->priv->profiles == NULL, FALSE); - card->priv->profiles = g_list_sort (profiles, (GCompareFunc) sort_profiles); + card->priv->profiles = g_list_sort (profiles, (GCompareFunc) gvc_mixer_card_profile_compare); return TRUE; } diff --git a/panels/sound/gvc-mixer-card.h b/panels/sound/gvc-mixer-card.h index f115a5c86..7fd6d4c93 100644 --- a/panels/sound/gvc-mixer-card.h +++ b/panels/sound/gvc-mixer-card.h @@ -81,6 +81,9 @@ gboolean gvc_mixer_card_change_profile (GvcMixerCard *card, const char *profile); GIcon * gvc_mixer_card_get_gicon (GvcMixerCard *card); +int gvc_mixer_card_profile_compare (GvcMixerCardProfile *a, + GvcMixerCardProfile *b); + /* private */ gboolean gvc_mixer_card_set_name (GvcMixerCard *card, const char *name);