[gnome-settings-daemon/wip/benzea/delayed-device-selection-prompt] media-keys: Prompt for audio selection when DBus endpoint appears
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/benzea/delayed-device-selection-prompt] media-keys: Prompt for audio selection when DBus endpoint appears
- Date: Fri, 9 Nov 2018 17:26:49 +0000 (UTC)
commit c831fc201a7489b0412c02ea39c3618c2540b688
Author: Benjamin Berg <bberg redhat com>
Date: Fri Nov 9 18:24:46 2018 +0100
media-keys: Prompt for audio selection when DBus endpoint appears
The signal to prompt for the audio device selection may be fired before
we have resolved the DBus audio selection endpoint. So save the fact
that we should show the prompt and do so immediately if the DBus
endpoint appears.
Fixes #112
plugins/media-keys/gsd-media-keys-manager.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index ed91831e..0071d593 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -169,11 +169,14 @@ struct GsdMediaKeysManagerPrivate
GHashTable *streams; /* key = X device ID, value = stream id */
GUdevClient *udev_client;
#endif /* HAVE_GUDEV */
- guint audio_selection_watch_id;
- guint audio_selection_signal_id;
- GDBusConnection *audio_selection_conn;
- gboolean audio_selection_requested;
- guint audio_selection_device_id;
+
+ guint audio_selection_watch_id;
+ guint audio_selection_signal_id;
+ GDBusConnection *audio_selection_conn;
+ gboolean audio_selection_requested;
+ gboolean audio_selection_pending;
+ guint audio_selection_device_id;
+ GvcHeadsetPortChoice audio_selection_choices;
GSettings *settings;
GHashTable *custom_settings;
@@ -2688,8 +2691,12 @@ audio_selection_needed (GvcMixerControl *control,
gchar *args[G_N_ELEMENTS (audio_selection_choices) + 1];
guint i, n;
- if (!priv->audio_selection_conn)
+ if (!priv->audio_selection_conn) {
+ priv->audio_selection_pending = show_dialog;
+ priv->audio_selection_device_id = id;
+ priv->audio_selection_choices = choices;
return;
+ }
if (priv->audio_selection_requested) {
g_dbus_connection_call (priv->audio_selection_conn,
@@ -2744,6 +2751,16 @@ audio_selection_appeared (GDBusConnection *connection,
audio_selection_done,
manager,
NULL);
+
+ if (manager->priv->audio_selection_pending) {
+ manager->priv->audio_selection_pending = FALSE;
+ /* Emulate audio_selection_needed call */
+ audio_selection_needed (manager->priv->volume,
+ manager->priv->audio_selection_device_id,
+ TRUE,
+ manager->priv->audio_selection_choices,
+ manager);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]