aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-04 12:17:06 +0000
committerConor Curran <conor.curran@canonical.com>2011-02-04 12:17:06 +0000
commitad214980e84c32ac93b43301f54406c6952c0819 (patch)
tree8c3bbbefda06165a5ff296c89ad9acbe7dd47f17
parent33689fcba482b5c0d16fa318836457bcb4ae83bd (diff)
downloadayatana-indicator-sound-ad214980e84c32ac93b43301f54406c6952c0819.tar.gz
ayatana-indicator-sound-ad214980e84c32ac93b43301f54406c6952c0819.tar.bz2
ayatana-indicator-sound-ad214980e84c32ac93b43301f54406c6952c0819.zip
active-sink api beginning to emerge
-rw-r--r--src/active-sink.c11
-rw-r--r--src/active-sink.h4
-rw-r--r--src/pulseaudio-mgr.c14
3 files changed, 24 insertions, 5 deletions
diff --git a/src/active-sink.c b/src/active-sink.c
index 7e84b58..e85aab8 100644
--- a/src/active-sink.c
+++ b/src/active-sink.c
@@ -101,4 +101,13 @@ active_sink_get_index (ActiveSink* self)
{
return 0;
}
- \ No newline at end of file
+
+void
+active_sink_update_volume (ActiveSink* self, gdouble percent)
+{
+}
+
+void
+active_sink_update_mute (ActiveSink* self, gboolean muted)
+{
+}
diff --git a/src/active-sink.h b/src/active-sink.h
index 051da85..251d0a7 100644
--- a/src/active-sink.h
+++ b/src/active-sink.h
@@ -61,6 +61,10 @@ void active_sink_update_details (ActiveSink* sink, sink_details* details);
gboolean active_sink_is_populated (ActiveSink* sink);
gboolean active_sink_is_muted (ActiveSink* self);
gint active_sink_get_index (ActiveSink* self);
+void active_sink_update_volume (ActiveSink* self, gdouble vol_percent);
+void active_sink_update_mute (ActiveSink* self, gboolean muted);
+
+
G_END_DECLS
#endif
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index 5f128eb..5089e23 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -30,7 +30,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <pulse/glib-mainloop.h>
#include <pulse/error.h>
-#include "pulse-manager.h"
+#include "pulseaudio-mgr.h"
#define RECONNECT_DELAY 5
@@ -376,8 +376,8 @@ pm_sink_input_info_callback (pa_context *c,
}
ActiveSink* a_sink = ACTIVE_SINK (userdata);
- if (active_sink_get_index (a_sink) == info->sink->index &&
- active_sink_is_muted () == TRUE) {
+ if (active_sink_get_index (a_sink) == info->sink &&
+ active_sink_is_muted (a_sink) == TRUE) {
// TODO fire off blocking signal
}
}
@@ -393,7 +393,13 @@ pm_update_active_sink (pa_context *c,
return;
}
else{
-
+ if (IS_ACTIVE_SINK (userdata) == FALSE){
+ g_warning ("update_active_sink - our user data is not what we think it should be");
+ return;
+ }
+ pa_volume_t vol = pa_cvolume_max (&info->volume);
+ gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM;
+ active_sink_update_volume (ACTIVE_SINK(userdata), volume_percent);
}
}