summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-11-09 18:24:46 +0100
committerBenjamin Berg <bberg@redhat.com>2018-11-09 18:24:46 +0100
commitc831fc201a7489b0412c02ea39c3618c2540b688 (patch)
tree219ba9e3078f7d8780701c1e4c93a382ee9b6725
parentf16cd2a7fa3e3dcc7bca85ff84ce8ee388d3267a (diff)
downloadgnome-settings-daemon-wip/benzea/delayed-device-selection-prompt.tar.gz
media-keys: Prompt for audio selection when DBus endpoint appearswip/benzea/delayed-device-selection-prompt
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
-rw-r--r--plugins/media-keys/gsd-media-keys-manager.c29
1 files 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