[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 03/21: Sort device lists
noreply at xfce.org
noreply at xfce.org
Sat Sep 23 21:27:29 CEST 2017
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit 75dea85c5bdea320e263e58263a8e955a274a203
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Sep 9 10:41:31 2017 -0400
Sort device lists
---
panel-plugin/pulseaudio-menu.c | 2 ++
panel-plugin/pulseaudio-volume.c | 31 +++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/panel-plugin/pulseaudio-menu.c b/panel-plugin/pulseaudio-menu.c
index f10650b..1bfee9a 100644
--- a/panel-plugin/pulseaudio-menu.c
+++ b/panel-plugin/pulseaudio-menu.c
@@ -507,6 +507,8 @@ pulseaudio_menu_new (PulseaudioVolume *volume,
}
g_list_free (sources);
+ group = NULL;
+
/* Input Devices */
sources = pulseaudio_volume_get_input_list (menu->volume);
if (g_list_length (sources) > 0) {
diff --git a/panel-plugin/pulseaudio-volume.c b/panel-plugin/pulseaudio-volume.c
index ce73b0c..3abcbc5 100644
--- a/panel-plugin/pulseaudio-volume.c
+++ b/panel-plugin/pulseaudio-volume.c
@@ -805,11 +805,31 @@ pulseaudio_volume_set_volume_mic (PulseaudioVolume *volume,
+static gint
+sort_device_list (gchar *a,
+ gchar *b,
+ void *hash_table)
+{
+ GHashTable *table = (GHashTable *)hash_table;
+ gchar *a_val = (gchar *) g_hash_table_lookup (table, a);
+ gchar *b_val = (gchar *) g_hash_table_lookup (table, b);
+ return g_strcmp0 (a_val, b_val);
+}
+
+
+
GList *
pulseaudio_volume_get_output_list (PulseaudioVolume *volume)
{
+ GList *list;
+ GList *sorted;
+
g_return_if_fail (IS_PULSEAUDIO_VOLUME (volume));
- return g_hash_table_get_keys (volume->sinks);
+
+ list = g_hash_table_get_keys (volume->sinks);
+ sorted = g_list_sort_with_data (list, (GCompareDataFunc) sort_device_list, volume->sinks);
+
+ return sorted;
}
@@ -827,8 +847,15 @@ pulseaudio_volume_get_output_by_name (PulseaudioVolume *volume,
GList *
pulseaudio_volume_get_input_list (PulseaudioVolume *volume)
{
+ GList *list;
+ GList *sorted;
+
g_return_if_fail (IS_PULSEAUDIO_VOLUME (volume));
- return g_hash_table_get_keys (volume->sources);
+
+ list = g_hash_table_get_keys (volume->sources);
+ sorted = g_list_sort_with_data (list, (GCompareDataFunc) sort_device_list, volume->sources);
+
+ return sorted;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list