Commit 6638e984 authored by William Jon McCann's avatar William Jon McCann

Initial import of sound panel

Copied from gnome-media.  See that module for git history.
parent d0d96529
......@@ -75,13 +75,19 @@ dnl ==============================================
dnl Check that we meet the dependencies
dnl ==============================================
COMMON_MODULES="gtk+-3.0 >= 2.90.0
glib-2.0 >= 2.25.11
GLIB_REQUIRED_VERSION=2.25.11
GTK_REQUIRED_VERSION=2.91.0
DESKTOP_SCHEMAS_REQUIRED_VERSION=0.0.2
PA_REQUIRED_VERSION=0.9.16
CANBERRA_REQUIRED_VERSION=0.13
COMMON_MODULES="gtk+-3.0 >= $GTK_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
gthread-2.0
gio-2.0
gconf-2.0
libxml-2.0
gsettings-desktop-schemas >= 0.0.2"
gsettings-desktop-schemas >= $DESKTOP_SCHEMAS_REQUIRED_VERSION"
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnome-menu gio-unix-2.0)
PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
......@@ -90,6 +96,14 @@ PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
PKG_CHECK_MODULES(GSD_DBUS, gnome-settings-daemon)
PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES(XML, libxml-2.0)
PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= $CANBERRA_REQUIRED_VERSION)
AC_SUBST(CANBERRA_CFLAGS)
AC_SUBST(CANBERRA_LIBS)
PKG_CHECK_MODULES(PULSEAUDIO,
libpulse >= $PA_REQUIRED_VERSION
libpulse-mainloop-glib >= $PA_REQUIRED_VERSION)
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)
gtk_lib_dir=`$PKG_CONFIG --variable libdir gtk+-3.0`
gtk_binary_version=`$PKG_CONFIG --variable gtk_binary_version gtk+-3.0`
......@@ -320,6 +334,31 @@ panels/mouse/Makefile
panels/mouse/gnome-mouse-panel.desktop.in
panels/network/Makefile
panels/network/gnome-network-panel.desktop.in
panels/sound/Makefile
panels/sound/data/Makefile
panels/sound/data/gnome-sound-panel.desktop.in
panels/sound/data/symbolic-icons/Makefile
panels/sound/data/symbolic-icons/scalable/Makefile
panels/sound/data/symbolic-icons/scalable/status/Makefile
panels/sound/data/icons/Makefile
panels/sound/data/icons/16x16/Makefile
panels/sound/data/icons/16x16/apps/Makefile
panels/sound/data/icons/16x16/status/Makefile
panels/sound/data/icons/22x22/Makefile
panels/sound/data/icons/22x22/apps/Makefile
panels/sound/data/icons/22x22/status/Makefile
panels/sound/data/icons/24x24/Makefile
panels/sound/data/icons/24x24/apps/Makefile
panels/sound/data/icons/24x24/status/Makefile
panels/sound/data/icons/32x32/Makefile
panels/sound/data/icons/32x32/apps/Makefile
panels/sound/data/icons/32x32/status/Makefile
panels/sound/data/icons/48x48/Makefile
panels/sound/data/icons/48x48/apps/Makefile
panels/sound/data/icons/scalable/Makefile
panels/sound/data/icons/scalable/apps/Makefile
panels/sound/data/icons/scalable/devices/Makefile
panels/sound/data/sounds/Makefile
panels/universal-access/Makefile
panels/universal-access/gnome-universal-access-panel.desktop.in
po/Makefile.in
......
......@@ -4,6 +4,7 @@ SUBDIRS= \
mouse \
keyboard \
network \
sound \
default-applications \
keybindings \
universal-access \
......
SUBDIRS = data
# This is used in GNOMECC_CAPPLETS_CFLAGS
cappletname = sound
NULL =
ccpanelsdir = $(PANELS_DIR)
ccpanels_LTLIBRARIES = libsound.la
bin_PROGRAMS = \
gnome-sound-applet \
$(NULL)
AM_CPPFLAGS = \
$(GNOMECC_CAPPLETS_CFLAGS) \
$(WARN_CFLAGS) \
$(CANBERRA_CFLAGS) \
$(PANEL_CFLAGS) \
$(DISABLE_DEPRECATED) \
$(PULSEAUDIO_CFLAGS) \
-DLOCALE_DIR=\""$(datadir)/locale"\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DGLADEDIR=\""$(pkgdatadir)"\" \
-DSOUND_DATA_DIR="\"$(datadir)/sounds\"" \
-DSOUND_SET_DIR="\"$(pkgdatadir)/sounds\"" \
-DICON_DATA_DIR="\"$(pkgdatadir)/icons\"" \
$(NULL)
noinst_LTLIBRARIES = libgnomevolumecontrol.la
libgnomevolumecontrol_la_SOURCES = \
gvc-mixer-card.h \
gvc-mixer-card.c \
gvc-mixer-card-private.h \
gvc-mixer-stream.h \
gvc-mixer-stream.c \
gvc-mixer-stream-private.h \
gvc-channel-map.h \
gvc-channel-map.c \
gvc-channel-map-private.h \
gvc-mixer-sink.h \
gvc-mixer-sink.c \
gvc-mixer-source.h \
gvc-mixer-source.c \
gvc-mixer-sink-input.h \
gvc-mixer-sink-input.c \
gvc-mixer-source-output.h \
gvc-mixer-source-output.c \
gvc-mixer-event-role.h \
gvc-mixer-event-role.c \
gvc-mixer-control.h \
gvc-mixer-control.c \
gvc-mixer-control-private.h \
gvc-channel-bar.h \
gvc-channel-bar.c \
gvc-log.h \
gvc-log.c \
gvc-pulseaudio-fake.h \
$(NULL)
gnome_sound_applet_LDADD = \
-lm \
libgnomevolumecontrol.la \
$(CANBERRA_LIBS) \
$(PULSEAUDIO_LIBS) \
$(NULL)
gnome_sound_applet_SOURCES = \
gvc-stream-status-icon.h \
gvc-stream-status-icon.c \
gvc-applet.h \
gvc-applet.c \
applet-main.c \
$(NULL)
libsound_la_LIBADD = \
-lm \
libgnomevolumecontrol.la \
$(PANEL_LIBS) \
$(PULSEAUDIO_LIBS) \
$(NULL)
libsound_la_LDFLAGS = \
$(PANEL_LDFLAGS) \
$(CANBERRA_LIBS) \
$(PULSEAUDIO_LIBS) \
$(NULL)
libsound_la_SOURCES = \
gvc-balance-bar.h \
gvc-balance-bar.c \
gvc-mixer-dialog.h \
gvc-mixer-dialog.c \
gvc-level-bar.h \
gvc-level-bar.c \
gvc-combo-box.h \
gvc-combo-box.c \
gvc-speaker-test.h \
gvc-speaker-test.c \
gvc-sound-theme-chooser.c \
gvc-sound-theme-chooser.h \
sound-theme-file-utils.c \
sound-theme-file-utils.h \
cc-sound-panel.c \
cc-sound-panel.h \
$(NULL)
EXTRA_DIST = gvc-sound-theme-editor.c gvc-sound-theme-editor.h
BUILT_SOURCES = \
$(NULL)
CLEANFILES = \
$(BUILT_SOURCES) \
$(NULL)
MAINTAINERCLEANFILES = \
*~ \
Makefile.in
-include $(top_srcdir)/git.mk
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include "gvc-applet.h"
#include "gvc-log.h"
#define GVCA_DBUS_NAME "org.gnome.VolumeControlApplet"
static gboolean show_version = FALSE;
static gboolean debug = FALSE;
int
main (int argc, char **argv)
{
GError *error;
GvcApplet *applet;
GApplication *app = NULL;
static GOptionEntry entries[] = {
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
gvc_log_init ();
error = NULL;
gtk_init_with_args (&argc, &argv,
(char *) _(" — GNOME Volume Control Applet"),
entries, GETTEXT_PACKAGE,
&error);
if (error != NULL) {
g_warning ("%s", error->message);
exit (1);
}
if (show_version) {
g_print ("%s %s\n", argv [0], VERSION);
exit (1);
}
gvc_log_set_debug (debug);
if (debug == FALSE) {
GError *error = NULL;
app = g_application_new (GVCA_DBUS_NAME,
G_APPLICATION_FLAGS_NONE);
if (!g_application_register (app, NULL, &error)) {
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
if (g_application_get_is_remote (app)) {
g_warning ("Applet is already running, exiting");
return 0;
}
}
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
ICON_DATA_DIR);
applet = gvc_applet_new ();
gvc_applet_start (applet);
gtk_main ();
if (applet != NULL) {
g_object_unref (applet);
}
if (app != NULL) {
g_object_unref (app);
}
return 0;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2008 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <glib/gi18n-lib.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <pulse/pulseaudio.h>
#include "cc-sound-panel.h"
#include "gvc-mixer-dialog.h"
#include "gvc-log.h"
G_DEFINE_DYNAMIC_TYPE (CcSoundPanel, cc_sound_panel, CC_TYPE_PANEL)
static void cc_sound_panel_finalize (GObject *object);
static void
cc_sound_panel_class_init (CcSoundPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = cc_sound_panel_finalize;
}
static void
cc_sound_panel_class_finalize (CcSoundPanelClass *klass)
{
}
static void
cc_sound_panel_finalize (GObject *object)
{
CcSoundPanel *panel = CC_SOUND_PANEL (object);
if (panel->dialog != NULL)
panel->dialog = NULL;
if (panel->connecting_label != NULL)
panel->connecting_label = NULL;
if (panel->control != NULL) {
g_object_unref (panel->control);
panel->control = NULL;
}
G_OBJECT_CLASS (cc_sound_panel_parent_class)->finalize (object);
}
static void
on_control_ready (GvcMixerControl *control,
CcSoundPanel *panel)
{
if (panel->dialog != NULL)
return;
if (panel->connecting_label) {
gtk_widget_destroy (panel->connecting_label);
panel->connecting_label = NULL;
}
panel->dialog = gvc_mixer_dialog_new (control);
gtk_container_add (GTK_CONTAINER (panel),
GTK_WIDGET (panel->dialog));
gtk_widget_show (GTK_WIDGET (panel->dialog));
}
static void
cc_sound_panel_init (CcSoundPanel *self)
{
gvc_log_init ();
gvc_log_set_debug (TRUE);
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
ICON_DATA_DIR);
gtk_window_set_default_icon_name ("multimedia-volume-control");
self->control = gvc_mixer_control_new ("GNOME Volume Control Dialog");
g_signal_connect (self->control,
"ready",
G_CALLBACK (on_control_ready),
self);
gvc_mixer_control_open (self->control);
self->connecting_label = gtk_label_new (_("Waiting for sound system to respond"));
gtk_container_add (GTK_CONTAINER (self), self->connecting_label);
gtk_widget_show (self->connecting_label);
}
void
cc_sound_panel_register (GIOModule *module)
{
cc_sound_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_SOUND_PANEL,
"sound", 0);
}
/* GIO extension stuff */
void
g_io_module_load (GIOModule *module)
{
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
/* register the panel */
cc_sound_panel_register (module);
}
void
g_io_module_unload (GIOModule *module)
{
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _CC_SOUND_PANEL_H
#define _CC_SOUND_PANEL_H
#include <libgnome-control-center/cc-panel.h>
#include "gvc-mixer-control.h"
#include "gvc-mixer-dialog.h"
G_BEGIN_DECLS
#define CC_TYPE_SOUND_PANEL cc_sound_panel_get_type()
#define CC_SOUND_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_SOUND_PANEL, CcSoundPanel))
#define CC_SOUND_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_SOUND_PANEL, CcSoundPanelClass))
#define CC_IS_SOUND_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_SOUND_PANEL))
#define CC_IS_SOUND_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_SOUND_PANEL))
#define CC_SOUND_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_SOUND_PANEL, CcSoundPanelClass))
typedef struct _CcSoundPanel CcSoundPanel;
typedef struct _CcSoundPanelClass CcSoundPanelClass;
typedef struct _CcSoundPanelPrivate CcSoundPanelPrivate;
struct _CcSoundPanel {
CcPanel parent;
GvcMixerControl *control;
GvcMixerDialog *dialog;
GtkWidget *connecting_label;
};
struct _CcSoundPanelClass {
CcPanelClass parent_class;
};
GType cc_sound_panel_get_type (void) G_GNUC_CONST;
void cc_sound_panel_register (GIOModule *module);
G_END_DECLS
#endif /* _CC_SOUND_PANEL_H */
NULL =
SUBDIRS = \
icons \
symbolic-icons \
sounds \
$(NULL)
@INTLTOOL_DESKTOP_RULE@
autostartdir = $(sysconfdir)/xdg/autostart
autostart_in_files = gnome-sound-applet.desktop.in
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
appsdir = $(datadir)/applications
apps_in_files = gnome-sound-panel.desktop.in
apps_DATA = $(apps_in_files:.desktop.in=.desktop)
EXTRA_DIST = \
$(autostart_in_files) \
gnome-sound-panel.desktop.in.in \
$(NULL)
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook: update-icon-cache
uninstall-hook: update-icon-cache
update-icon-cache:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After (un)install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
CLEANFILES = \
gnome-sound-panel.desktop \
$(NULL)
DISTCLEANFILES = \
gnome-sound-applet.desktop \
$(NULL)
-include $(top_srcdir)/git.mk
[Desktop Entry]
_Name=Volume Control
_Comment=Show desktop volume control
Icon=multimedia-volume-control
Exec=gnome-sound-applet
Terminal=false
Type=Application
Categories=
NoDisplay=true
OnlyShowIn=GNOME;XFCE;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=sound
# See http://bugzilla.gnome.org/show_bug.cgi?id=568320
#X-GNOME-Autostart-Phase=Panel
X-GNOME-Autostart-Notify=true
[Desktop Entry]
_Name=Sound
_Comment=Change sound volume and sound events
Exec=gnome-control-center sound
Icon=multimedia-volume-control
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;
OnlyShowIn=GNOME;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=sound
X-GNOME-Bugzilla-Version=@VERSION@
X-GNOME-Settings-Panel=sound
SUBDIRS = status apps
-include $(top_srcdir)/git.mk
NULL =
themedir = $(datadir)/icons/hicolor
size = 16x16
context = apps
iconsdir = $(themedir)/$(size)/$(context)
icons_DATA = \
multimedia-volume-control.png \
multimedia-volume-control.svg
$(NULL)
EXTRA_DIST = \
$(icons_DATA) \
$(NULL)
-include $(top_srcdir)/git.mk
NULL =
themedir = $(pkgdatadir)/icons/hicolor
size = 16x16
context = status
iconsdir = $(themedir)/$(size)/$(context)
icons_DATA = \
audio-input-microphone-high.png \
audio-input-microphone-low.png \
audio-input-microphone-medium.png \
audio-input-microphone-muted.png \
$(NULL)
EXTRA_DIST = \
$(icons_DATA) \
$(NULL)
-include $(top_srcdir)/git.mk
SUBDIRS = status apps
-include $(top_srcdir)/git.mk
NULL =
themedir = $(datadir)/icons/hicolor
size = 22x22
context = apps
iconsdir = $(themedir)/$(size)/$(context)
icons_DATA = \
multimedia-volume-control.png \
multimedia-volume-control.svg
$(NULL)
EXTRA_DIST = \
$(icons_DATA) \
$(NULL)
-include $(top_srcdir)/git.mk
NULL =
themedir = $(pkgdatadir)/icons/hicolor
size = 22x22
context = status
iconsdir = $(themedir)/$(size)/$(context)
icons_DATA = \
audio-input-microphone-high.png \