From 93b52cc3e0f8109da21d109e249911d1a3bde671 Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Sat, 21 Jun 2014 16:41:39 +0200 Subject: Adapt to libmatemixer decibel changes --- mate-volume-control/src/gvc-stream-status-icon.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'mate-volume-control') diff --git a/mate-volume-control/src/gvc-stream-status-icon.c b/mate-volume-control/src/gvc-stream-status-icon.c index 51207ba..86cd947 100644 --- a/mate-volume-control/src/gvc-stream-status-icon.c +++ b/mate-volume-control/src/gvc-stream-status-icon.c @@ -30,20 +30,14 @@ #include "gvc-channel-bar.h" #include "gvc-stream-status-icon.h" -// XXX the gdk_spawn_command_line_on_screen causes compiler warnings, remove the GTK3 -// check and instead use GdkAppLaunchContext and GAppInfo which should work with -// both GDKs - +// XXX remove the #if and just use mate_gdk_spawn_command_line_on_screen after +// https://github.com/mate-desktop/mate-desktop/pull/120 #if GTK_CHECK_VERSION (3, 0, 0) #define MATE_DESKTOP_USE_UNSTABLE_API #include #define gdk_spawn_command_line_on_screen mate_gdk_spawn_command_line_on_screen #endif -// XXX this file uses PA_DECIBEL_MININFTY, figure out how to handle it through the -// library and change it -#include - #define GVC_STREAM_STATUS_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_STREAM_STATUS_ICON, GvcStreamStatusIconPrivate)) struct _GvcStreamStatusIconPrivate @@ -426,7 +420,7 @@ static void update_icon (GvcStreamStatusIcon *icon) { gint64 volume; - gdouble volume_db = 0; + gdouble decibel = 0; gint64 normal_volume; gboolean is_muted; guint n; @@ -444,7 +438,7 @@ update_icon (GvcStreamStatusIcon *icon) flags = mate_mixer_stream_get_flags (icon->priv->mixer_stream); if (flags & MATE_MIXER_STREAM_HAS_DECIBEL_VOLUME) { - volume_db = mate_mixer_stream_get_volume_db (icon->priv->mixer_stream); + decibel = mate_mixer_stream_get_decibel (icon->priv->mixer_stream); can_decibel = TRUE; } @@ -477,12 +471,12 @@ update_icon (GvcStreamStatusIcon *icon) icon->priv->display_name, _("Muted"), mate_mixer_stream_get_description (icon->priv->mixer_stream)); - } else if (can_decibel && (volume_db > PA_DECIBEL_MININFTY)) { + } else if (can_decibel && (decibel > -MATE_MIXER_INFINITY)) { markup = g_strdup_printf ( "%s: %.0f%%\n%0.2f dB\n%s", icon->priv->display_name, 100 * (float) volume / normal_volume, - volume_db, + decibel, mate_mixer_stream_get_description (icon->priv->mixer_stream)); } else if (can_decibel) { markup = g_strdup_printf ( -- cgit v1.2.1