Add volume indicator
Add volume control indicator which uses API from gnome-volume-control to interact with PulseAudio and shows both input and output volumes. Also adds a small wrapper around libcanberra in ShellGlobal, used by the volume indicator to provide auditive feedback. https://bugzilla.gnome.org/show_bug.cgi?id=629455
This commit is contained in:

committed by
Giovanni Campagna

parent
a1389a0730
commit
0547a582d1
@ -24,6 +24,7 @@
|
||||
#include <math.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <gjs/gjs.h>
|
||||
#include <canberra.h>
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
@ -67,6 +68,9 @@ struct _ShellGlobal {
|
||||
guint work_count;
|
||||
GSList *leisure_closures;
|
||||
guint leisure_function_id;
|
||||
|
||||
/* For sound notifications */
|
||||
ca_context *sound_context;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -214,6 +218,10 @@ shell_global_init (ShellGlobal *global)
|
||||
|
||||
global->last_change_screen_width = 0;
|
||||
global->last_change_screen_height = 0;
|
||||
|
||||
ca_context_create (&global->sound_context);
|
||||
ca_context_change_props (global->sound_context, CA_PROP_APPLICATION_NAME, PACKAGE_NAME, CA_PROP_APPLICATION_ID, "org.gnome.Shell", NULL);
|
||||
ca_context_open (global->sound_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1788,3 +1796,18 @@ shell_global_run_at_leisure (ShellGlobal *global,
|
||||
if (global->work_count == 0)
|
||||
schedule_leisure_functions (global);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_play_theme_sound:
|
||||
* @global: the #ShellGlobal
|
||||
* @name: the sound name
|
||||
*
|
||||
* Plays a simple sound picked according to Freedesktop sound theme.
|
||||
* Really just a workaround for libcanberra not being introspected.
|
||||
*/
|
||||
void
|
||||
shell_global_play_theme_sound (ShellGlobal *global,
|
||||
const char *name)
|
||||
{
|
||||
ca_context_play (global->sound_context, 0, CA_PROP_EVENT_ID, name, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user