From 3e4404d51218d82bcbcf2cea52948441277a9cfe Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 15 Mar 2011 15:23:09 +0000 Subject: renamed those last few sink methods in device to give them proper context --- src/device.c | 62 ++++++++++++++++++++++++++-------------------------- src/device.h | 10 ++++----- src/pulseaudio-mgr.c | 24 ++++++++++---------- 3 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/device.c b/src/device.c index 353a2c6..79b7b50 100644 --- a/src/device.c +++ b/src/device.c @@ -90,7 +90,7 @@ device_finalize (GObject *object) } void -device_populate (Device* self, +device_sink_populate (Device* self, const pa_sink_info* update) { DevicePrivate* priv = DEVICE_GET_PRIVATE(self); @@ -106,33 +106,7 @@ device_populate (Device* self, } void -device_activate_voip_item (Device* self, gint sink_input_index, gint client_index) -{ - DevicePrivate* priv = DEVICE_GET_PRIVATE (self); - if (voip_input_menu_item_is_interested (priv->voip_input_menu_item, - sink_input_index, - client_index)){ - voip_input_menu_item_enable (priv->voip_input_menu_item, TRUE); - } -} - -void -device_deactivate_voip_source (Device* self, gboolean visible) -{ - DevicePrivate* priv = DEVICE_GET_PRIVATE (self); - visible &= voip_input_menu_item_is_active (priv->voip_input_menu_item); - voip_input_menu_item_deactivate_source (priv->voip_input_menu_item, visible); -} - -void -device_deactivate_voip_client (Device* self) -{ - DevicePrivate* priv = DEVICE_GET_PRIVATE (self); - voip_input_menu_item_deactivate_voip_client (priv->voip_input_menu_item); -} - -void -device_update (Device* self, +device_sink_update (Device* self, const pa_sink_info* update) { DevicePrivate* priv = DEVICE_GET_PRIVATE (self); @@ -222,22 +196,48 @@ device_determine_blocking_state (Device* self) } gint -device_get_index (Device* self) +device_get_sink_index (Device* self) { DevicePrivate* priv = DEVICE_GET_PRIVATE (self); return slider_menu_item_get_sink_index (priv->volume_slider_menuitem); } gboolean -device_is_populated (Device* self) +device_is_sink_populated (Device* self) { DevicePrivate* priv = DEVICE_GET_PRIVATE (self); return dbusmenu_menuitem_property_get_bool (DBUSMENU_MENUITEM (priv->volume_slider_menuitem), DBUSMENU_MENUITEM_PROP_ENABLED); } +void +device_activate_voip_item (Device* self, gint sink_input_index, gint client_index) +{ + DevicePrivate* priv = DEVICE_GET_PRIVATE (self); + if (voip_input_menu_item_is_interested (priv->voip_input_menu_item, + sink_input_index, + client_index)){ + voip_input_menu_item_enable (priv->voip_input_menu_item, TRUE); + } +} + +void +device_deactivate_voip_source (Device* self, gboolean visible) +{ + DevicePrivate* priv = DEVICE_GET_PRIVATE (self); + visible &= voip_input_menu_item_is_active (priv->voip_input_menu_item); + voip_input_menu_item_deactivate_source (priv->voip_input_menu_item, visible); +} + +void +device_deactivate_voip_client (Device* self) +{ + DevicePrivate* priv = DEVICE_GET_PRIVATE (self); + voip_input_menu_item_deactivate_voip_client (priv->voip_input_menu_item); +} + void -device_deactivate (Device* self) +device_sink_deactivated (Device* self) { DevicePrivate* priv = DEVICE_GET_PRIVATE (self); priv->current_sound_state = UNAVAILABLE; diff --git a/src/device.h b/src/device.h index 42d8189..9c74344 100644 --- a/src/device.h +++ b/src/device.h @@ -58,11 +58,11 @@ GType device_get_type (void) G_GNUC_CONST; */ // Sink related -void device_populate (Device* sink, const pa_sink_info* update); -void device_update (Device* sink, const pa_sink_info* update); -gboolean device_is_populated (Device* sink); -gint device_get_index (Device* self); -void device_deactivate (Device* self); +void device_sink_populate (Device* sink, const pa_sink_info* update); +void device_sink_update (Device* sink, const pa_sink_info* update); +gboolean device_is_sink_populated (Device* sink); +gint device_get_sink_index (Device* self); +void device_sink_deactivated (Device* self); void device_update_mute (Device* self, gboolean mute_update); void device_ensure_sink_is_unmuted (Device* self); diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 036b46b..8811bcf 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -226,11 +226,11 @@ pm_subscribed_events_callback (pa_context *c, case PA_SUBSCRIPTION_EVENT_SINK: // We don't care about any other sink other than the active one. - if (index != device_get_index (sink)) + if (index != device_get_sink_index (sink)) return; if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - device_deactivate (sink); + device_sink_deactivated (sink); } else{ @@ -308,7 +308,7 @@ pm_context_state_callback (pa_context *c, void *userdata) break; case PA_CONTEXT_FAILED: g_warning("PA_CONTEXT_FAILED - Is PulseAudio Daemon running ?"); - device_deactivate (DEVICE (userdata)); + device_sink_deactivated (DEVICE (userdata)); if (reconnect_idle_id == 0){ reconnect_idle_id = g_timeout_add_seconds (RECONNECT_DELAY, reconnect_to_pulse, @@ -362,7 +362,7 @@ pm_server_info_callback (pa_context *c, if (info == NULL) { g_warning("No PA server - get the hell out of here"); - device_deactivate (DEVICE (userdata)); + device_sink_deactivated (DEVICE (userdata)); return; } // Go for the default sink @@ -373,7 +373,7 @@ pm_server_info_callback (pa_context *c, pm_default_sink_info_callback, userdata) )) { g_warning("pa_context_get_sink_info_by_namet() failed"); - device_deactivate (DEVICE (userdata)); + device_sink_deactivated (DEVICE (userdata)); pa_operation_unref(operation); return; } @@ -382,7 +382,7 @@ pm_server_info_callback (pa_context *c, pm_sink_info_callback, userdata))) { g_warning("pa_context_get_sink_info_list() failed"); - device_deactivate (DEVICE (userdata)); + device_sink_deactivated (DEVICE (userdata)); pa_operation_unref(operation); return; } @@ -426,9 +426,9 @@ pm_sink_info_callback (pa_context *c, return; } Device* a_sink = DEVICE (userdata); - if (device_is_populated (a_sink) == FALSE && + if (device_is_sink_populated (a_sink) == FALSE && g_ascii_strncasecmp("auto_null", sink->name, 9) != 0){ - device_populate (a_sink, sink); + device_sink_populate (a_sink, sink); } } } @@ -448,11 +448,11 @@ pm_default_sink_info_callback (pa_context *c, return; } // Only repopulate if there is a change with regards the index - if (device_get_index (DEVICE (userdata)) == info->index) + if (device_get_sink_index (DEVICE (userdata)) == info->index) return; g_debug ("Pulse Server has handed us a new default sink"); - device_populate (DEVICE (userdata), info); + device_sink_populate (DEVICE (userdata), info); } } @@ -494,7 +494,7 @@ pm_sink_input_info_callback (pa_context *c, } // And finally check for the mute blocking state - if (device_get_index (a_sink) == info->sink){ + if (device_get_sink_index (a_sink) == info->sink){ device_determine_blocking_state (a_sink); } } @@ -514,7 +514,7 @@ pm_update_device (pa_context *c, g_warning ("update_device - our user data is not what we think it should be or the info parameter is null"); return; } - device_update (DEVICE(userdata), info); + device_sink_update (DEVICE(userdata), info); } } -- cgit v1.2.3