diff options
Diffstat (limited to 'gnome-settings-daemon/actions')
20 files changed, 0 insertions, 1816 deletions
diff --git a/gnome-settings-daemon/actions/.cvsignore b/gnome-settings-daemon/actions/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/gnome-settings-daemon/actions/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/gnome-settings-daemon/actions/Makefile.am b/gnome-settings-daemon/actions/Makefile.am deleted file mode 100644 index c882b7bb8..000000000 --- a/gnome-settings-daemon/actions/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -INCLUDES = $(GNOME_CFLAGS) -I$(top_srcdir) $(GST_CFLAGS) - -noinst_LTLIBRARIES = libacme.la - -libacme_la_SOURCES = \ - acme-volume.c acme-volume.h - -libacme_la_LIBADD = - -if HAVE_GSTREAMER -INCLUDES += -DHAVE_GSTREAMER -libacme_la_SOURCES += acme-volume-gstreamer.c acme-volume-gstreamer.h -libacme_la_LIBADD += $(GST_LIBS) -else # HAVE_GSTREAMER -if HAVE_ALSA -INCLUDES += -DHAVE_ALSA -libacme_la_SOURCES += acme-volume-alsa.c acme-volume-alsa.h -libacme_la_LIBADD += $(ALSA_LIBS) -else # HAVE_ALSA -if HAVE_OSS -INCLUDES += -DHAVE_OSS -libacme_la_SOURCES += acme-volume-oss.c acme-volume-oss.h -else # HAVE_OSS -libacme_la_SOURCES += acme-volume-dummy.c acme-volume-dummy.h -endif # HAVE_OSS -endif # HAVE_ALSA -endif # HAVE_GSTREAMER - -if HAVE_FB -INCLUDES += -DHAVE_FB -libacme_la_SOURCES += acme-fb-level.c acme-fb-level.h -endif - -if HAVE_GSTREAMER -INCLUDES += -DHAVE_GSTREAMER -libacme_la_SOURCES += acme-volume-gstreamer.c acme-volume-gstreamer.h -libacme_la_LIBADD += $(GST_LIBS) -endif - -Datadir = $(datadir)/control-center-2.0/interfaces/ -Data_DATA = acme.glade - -pixmapsdir = $(GNOMECC_PIXMAPS_DIR) -pixmaps_DATA = acme-brightness.png acme-eject.png gnome-speakernotes-muted.png gnome-speakernotes.png - -EXTRA_DIST = \ - acme-volume-alsa.c acme-volume-alsa.h \ - acme-volume-gstreamer.c acme-volume-gstreamer.h \ - acme-volume-oss.c acme-volume-oss.h \ - acme-volume-dummy.c acme-volume-dummy.h \ - acme-fb-level.c acme-fb-level.h \ - acme.h \ - acme.glade \ - $(pixmaps_DATA) diff --git a/gnome-settings-daemon/actions/acme-brightness.png b/gnome-settings-daemon/actions/acme-brightness.png Binary files differdeleted file mode 100644 index 19577b1b7..000000000 --- a/gnome-settings-daemon/actions/acme-brightness.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/acme-eject.png b/gnome-settings-daemon/actions/acme-eject.png Binary files differdeleted file mode 100644 index 33ca8a4d7..000000000 --- a/gnome-settings-daemon/actions/acme-eject.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/acme-fb-level.c b/gnome-settings-daemon/actions/acme-fb-level.c deleted file mode 100644 index 85e715988..000000000 --- a/gnome-settings-daemon/actions/acme-fb-level.c +++ /dev/null @@ -1,177 +0,0 @@ -/* acme-fb-level.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-fb-level.h" - -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <sys/ioctl.h> -#include <linux/fb.h> -#include <linux/pmu.h> -#include <errno.h> - -#ifndef FBIOBLANK -#define FBIOBLANK 0x4611 /* 0 or vesa-level+1 */ -#endif - -#ifndef PMU_IOC_GRAB_BACKLIGHT -#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, 0) -#endif - -G_DEFINE_TYPE (AcmeFblevel, acme_fblevel, G_TYPE_OBJECT) - -struct AcmeFblevelPrivate { - int pmu_fd; - int saved_level; -}; - -static GObjectClass *parent_class = NULL; - -static void -acme_fblevel_finalize (GObject *obj_self) -{ - AcmeFblevel *self = ACME_FBLEVEL (obj_self); - gpointer priv = self->_priv; - - if (G_OBJECT_CLASS(parent_class)->finalize) - (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self); - g_free (priv); - - return; -} - -static void -acme_fblevel_class_init (AcmeFblevelClass *klass) -{ - GObjectClass *g_object_class = (GObjectClass*) klass; - parent_class = g_type_class_ref (G_TYPE_OBJECT); - g_object_class->finalize = acme_fblevel_finalize; - - return; -} - -static void -acme_fblevel_init (AcmeFblevel *fblevel) -{ - fblevel->_priv = g_new0 (AcmeFblevelPrivate, 1); - fblevel->level = 0; - fblevel->dim = FALSE; - fblevel->_priv->pmu_fd = -1; - fblevel->_priv->saved_level = 0; - - return; -} - -int -acme_fblevel_get_level (AcmeFblevel *self) -{ - int level; - ioctl (self->_priv->pmu_fd, - PMU_IOC_GET_BACKLIGHT, &level); - return level; -} - -void -acme_fblevel_set_level (AcmeFblevel *self, int val) -{ - int level; - - level = CLAMP (val, 0, 15); - - ioctl (self->_priv->pmu_fd, - PMU_IOC_SET_BACKLIGHT, &level); - self->level = level; -} - -gboolean -acme_fblevel_get_dim (AcmeFblevel *self) -{ - return self->dim; -} - -void -acme_fblevel_set_dim (AcmeFblevel *self, gboolean val) -{ - if (self->dim == FALSE && val == TRUE) - { - self->_priv->saved_level = acme_fblevel_get_level(self); - acme_fblevel_set_level (self, 1); - self->dim = TRUE; - } else if (self->dim == TRUE && val == FALSE) { - acme_fblevel_set_level (self, self->_priv->saved_level); - self->dim = FALSE; - } -} - -AcmeFblevel * -acme_fblevel_new (void) -{ - AcmeFblevel *self; - int fd, foo; - - if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == FALSE) - return NULL; - - if (acme_fblevel_is_powerbook () == FALSE) - return NULL; - - self = ACME_FBLEVEL (g_object_new (ACME_TYPE_FBLEVEL, NULL)); - /* This function switches the kernel backlight control off. - * This is part of the PPC kernel branch since version - * 2.4.18-rc2-benh. It does nothing with older kernels. - * For those kernels a separate kernel patch is nessecary to - * get backlight control in user space. - * - * Notice nicked from pbbuttons*/ - fd = open ("/dev/pmu", O_RDWR); - /* We can't emit the signal yet, the signal isn't connected! */ - if (fd < 0) - return NULL; - - foo = ioctl(fd, PMU_IOC_GRAB_BACKLIGHT, 0); - self->_priv->pmu_fd = fd; - return self; -} - -gboolean -acme_fblevel_is_powerbook (void) -{ - FILE *fd; - char str[2048]; - gboolean found = FALSE; - - fd = fopen ("/proc/cpuinfo", "r"); - while (!feof (fd) && found == FALSE) - { - fread (str, 1, 2048, fd); - if (strstr (str, "PowerBook") != NULL) - found = TRUE; - } - - fclose (fd); - - return found; -} - diff --git a/gnome-settings-daemon/actions/acme-fb-level.h b/gnome-settings-daemon/actions/acme-fb-level.h deleted file mode 100644 index a9525e9e3..000000000 --- a/gnome-settings-daemon/actions/acme-fb-level.h +++ /dev/null @@ -1,55 +0,0 @@ -/* acme-fb-level.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> - -#define ACME_TYPE_FBLEVEL (acme_fblevel_get_type ()) -#define ACME_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_FBLEVEL, AcmeFblevel)) -#define ACME_FBLEVEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_FBLEVEL, AcmeFblevelClass)) -#define ACME_IS_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_FBLEVEL)) -#define ACME_FBLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_FBLEVEL, AcmeFblevelClass)) - -typedef struct AcmeFblevelPrivate AcmeFblevelPrivate; -typedef struct AcmeFblevel AcmeFblevel; -typedef struct AcmeFblevelClass AcmeFblevelClass; - -struct AcmeFblevel { - GObject parent; - int level; - gboolean dim; - AcmeFblevelPrivate *_priv; -}; - -struct AcmeFblevelClass { - GObjectClass parent; -}; - -GType acme_fblevel_get_type (void); -int acme_fblevel_get_level (AcmeFblevel *self); -void acme_fblevel_set_level (AcmeFblevel *self, int val); -gboolean acme_fblevel_get_dim (AcmeFblevel *self); -void acme_fblevel_set_dim (AcmeFblevel *self, - gboolean val); -AcmeFblevel *acme_fblevel_new (void); -gboolean acme_fblevel_is_powerbook (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-alsa.c b/gnome-settings-daemon/actions/acme-volume-alsa.c deleted file mode 100644 index bb7096955..000000000 --- a/gnome-settings-daemon/actions/acme-volume-alsa.c +++ /dev/null @@ -1,314 +0,0 @@ -/* acme-volume-alsa.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-alsa.h" - -#include <alsa/asoundlib.h> - -#ifndef DEFAULT_CARD -#define DEFAULT_CARD "default" -#endif - -#undef LOG -#ifdef LOG -#define D(x...) g_message (x) -#else -#define D(x...) -#endif - -#define ROUND(x) ((x - (int)x > 0.5) ? x+1 : x) - -struct AcmeVolumeAlsaPrivate -{ - long pmin, pmax; - gboolean has_mute, has_master; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - int saved_volume; - guint timer_id; -}; - -static GObjectClass *parent_class = NULL; - -static int acme_volume_alsa_get_volume (AcmeVolume *self); -static void acme_volume_alsa_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_alsa_open (AcmeVolumeAlsa *self); -static void acme_volume_alsa_close (AcmeVolumeAlsa *self); -static gboolean acme_volume_alsa_close_real (AcmeVolumeAlsa *self); - -G_DEFINE_TYPE (AcmeVolumeAlsa, acme_volume_alsa, ACME_TYPE_VOLUME) - -static void -acme_volume_alsa_finalize (GObject *object) -{ - AcmeVolumeAlsa *self; - - self = ACME_VOLUME_ALSA (object); - - if (self->_priv) - { - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - } - - acme_volume_alsa_close_real (self); - g_free (self->_priv); - self->_priv = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_alsa_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - - if (acme_volume_alsa_open (self) == FALSE) - return; - - /* If we have a hardware mute */ - if (self->_priv->has_mute) - { - snd_mixer_selem_set_playback_switch_all - (self->_priv->elem, !val); - acme_volume_alsa_close (self); - return; - } - - acme_volume_alsa_close (self); - - /* If we don't */ - if (val == TRUE) - { - self->_priv->saved_volume = acme_volume_alsa_get_volume (vol); - acme_volume_alsa_set_volume (vol, 0); - } else { - if (self->_priv->saved_volume != -1) - acme_volume_alsa_set_volume (vol, - self->_priv->saved_volume); - } -} - -static gboolean -acme_volume_alsa_get_mute (AcmeVolume *vol) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - int ival; - - if (acme_volume_alsa_open (self) == FALSE) - return FALSE; - - if (self->_priv->has_mute) - { - snd_mixer_selem_get_playback_switch(self->_priv->elem, - SND_MIXER_SCHN_FRONT_LEFT, &ival); - - acme_volume_alsa_close (self); - - return !ival; - } else { - acme_volume_alsa_close (self); - - return (acme_volume_alsa_get_volume (vol) == 0); - } -} - -static int -acme_volume_alsa_get_volume (AcmeVolume *vol) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - long lval, rval; - int tmp; - float alsa_vol; - - if (acme_volume_alsa_open (self) == FALSE) - return 0; - - snd_mixer_selem_get_playback_volume(self->_priv->elem, - SND_MIXER_SCHN_FRONT_LEFT, &lval); - snd_mixer_selem_get_playback_volume(self->_priv->elem, - SND_MIXER_SCHN_FRONT_RIGHT, &rval); - - acme_volume_alsa_close (self); - - alsa_vol = (lval + rval) / 2; - alsa_vol = alsa_vol * 100 / (self->_priv->pmax - self->_priv->pmin); - tmp = ROUND (alsa_vol); - - return tmp; -} - -static void -acme_volume_alsa_set_volume (AcmeVolume *vol, int val) -{ - AcmeVolumeAlsa *self = (AcmeVolumeAlsa *) vol; - float volume; - int tmp; - - if (acme_volume_alsa_open (self) == FALSE) - return; - - volume = (float) val / 100 * (self->_priv->pmax - self->_priv->pmin); - volume = CLAMP (volume, self->_priv->pmin, self->_priv->pmax); - tmp = ROUND (volume); - - snd_mixer_selem_set_playback_volume_all (self->_priv->elem, tmp); - - acme_volume_alsa_close (self); -} - -static gboolean -acme_volume_alsa_close_real (AcmeVolumeAlsa *self) -{ - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->handle != NULL) - { - snd_mixer_detach (self->_priv->handle, DEFAULT_CARD); - snd_mixer_free (self->_priv->handle); - self->_priv->handle = NULL; - self->_priv->elem = NULL; - } - - self->_priv->timer_id = 0; - - return FALSE; -} - -static gboolean -acme_volume_alsa_open (AcmeVolumeAlsa *self) -{ - snd_mixer_selem_id_t *sid; - snd_mixer_t *handle; - snd_mixer_elem_t *elem; - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - return TRUE; - } - - /* open the mixer */ - if (snd_mixer_open (&handle, 0) < 0) - { - D("snd_mixer_open"); - return FALSE; - } - /* attach the handle to the default card */ - if (snd_mixer_attach (handle, DEFAULT_CARD) <0) - { - D("snd_mixer_attach"); - goto bail; - } - /* ? */ - if (snd_mixer_selem_register (handle, NULL, NULL) < 0) - { - D("snd_mixer_selem_register"); - goto bail; - } - if (snd_mixer_load (handle) < 0) - { - D("snd_mixer_load"); - goto bail; - } - - snd_mixer_selem_id_alloca (&sid); - snd_mixer_selem_id_set_name (sid, "Master"); - elem = snd_mixer_find_selem (handle, sid); - if (!elem) - { - snd_mixer_selem_id_alloca (&sid); - snd_mixer_selem_id_set_name (sid, "PCM"); - elem = snd_mixer_find_selem (handle, sid); - if (!elem) - { - D("snd_mixer_find_selem"); - goto bail; - } - } - - if (!snd_mixer_selem_has_playback_volume (elem)) - { - D("snd_mixer_selem_has_playback_volume"); - goto bail; - } - - snd_mixer_selem_get_playback_volume_range (elem, - &(self->_priv->pmin), - &(self->_priv->pmax)); - - self->_priv->has_mute = snd_mixer_selem_has_playback_switch (elem); - self->_priv->handle = handle; - self->_priv->elem = elem; - - return TRUE; - -bail: - acme_volume_alsa_close_real (self); - return FALSE; -} - -static void -acme_volume_alsa_close (AcmeVolumeAlsa *self) -{ - self->_priv->timer_id = g_timeout_add (4000, - (GSourceFunc) acme_volume_alsa_close_real, self); -} - -static void -acme_volume_alsa_init (AcmeVolumeAlsa *self) -{ - self->_priv = g_new0 (AcmeVolumeAlsaPrivate, 1); - - if (acme_volume_alsa_open (self) == FALSE) - { - g_free (self->_priv); - self->_priv = NULL; - return; - } - - if (self->_priv->handle != NULL) { - acme_volume_alsa_close_real (self); - return; - } -} - -static void -acme_volume_alsa_class_init (AcmeVolumeAlsaClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_alsa_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_alsa_set_volume; - volume_class->get_volume = acme_volume_alsa_get_volume; - volume_class->set_mute = acme_volume_alsa_set_mute; - volume_class->get_mute = acme_volume_alsa_get_mute; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-alsa.h b/gnome-settings-daemon/actions/acme-volume-alsa.h deleted file mode 100644 index 83746ffee..000000000 --- a/gnome-settings-daemon/actions/acme-volume-alsa.h +++ /dev/null @@ -1,47 +0,0 @@ -/* acme-volume-alsa.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_ALSA (acme_volume_get_type ()) -#define ACME_VOLUME_ALSA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsa)) -#define ACME_VOLUME_ALSA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsaClass)) -#define ACME_IS_VOLUME_ALSA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_ALSA)) -#define ACME_VOLUME_ALSA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_ALSA, AcmeVolumeAlsaClass)) - -typedef struct AcmeVolumeAlsa AcmeVolumeAlsa; -typedef struct AcmeVolumeAlsaClass AcmeVolumeAlsaClass; -typedef struct AcmeVolumeAlsaPrivate AcmeVolumeAlsaPrivate; - -struct AcmeVolumeAlsa { - AcmeVolume parent; - AcmeVolumeAlsaPrivate *_priv; -}; - -struct AcmeVolumeAlsaClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_alsa_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-dummy.c b/gnome-settings-daemon/actions/acme-volume-dummy.c deleted file mode 100644 index bd2f87924..000000000 --- a/gnome-settings-daemon/actions/acme-volume-dummy.c +++ /dev/null @@ -1,110 +0,0 @@ -/* acme-volume-dummy.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-dummy.h" - -static GObjectClass *parent_class = NULL; - -static int acme_volume_dummy_get_volume (AcmeVolume *self); -static void acme_volume_dummy_set_volume (AcmeVolume *self, int val); - -static void -acme_volume_dummy_finalize (GObject *object) -{ - AcmeVolumeDummy *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_DUMMY (object)); - - self = ACME_VOLUME_DUMMY (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_dummy_set_mute (AcmeVolume *vol, gboolean val) -{ -} - -static gboolean -acme_volume_dummy_get_mute (AcmeVolume *vol) -{ - return FALSE; -} - -static int -acme_volume_dummy_get_volume (AcmeVolume *vol) -{ - return 0; -} - -static void -acme_volume_dummy_set_volume (AcmeVolume *vol, int val) -{ -} - -static void -acme_volume_dummy_init (AcmeVolume *vol) -{ -} - -static void -acme_volume_dummy_class_init (AcmeVolumeDummyClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_dummy_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_dummy_set_volume; - volume_class->get_volume = acme_volume_dummy_get_volume; - volume_class->set_mute = acme_volume_dummy_set_mute; - volume_class->get_mute = acme_volume_dummy_get_mute; -} - -GType acme_volume_dummy_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - static const GTypeInfo object_info = - { - sizeof (AcmeVolumeDummyClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) acme_volume_dummy_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (AcmeVolumeDummy), - 0, /* n_preallocs */ - (GInstanceInitFunc) acme_volume_dummy_init - }; - - object_type = g_type_register_static (ACME_TYPE_VOLUME, - "AcmeVolumeDummy", &object_info, 0); - } - - return object_type; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-dummy.h b/gnome-settings-daemon/actions/acme-volume-dummy.h deleted file mode 100644 index 23bda10f5..000000000 --- a/gnome-settings-daemon/actions/acme-volume-dummy.h +++ /dev/null @@ -1,46 +0,0 @@ -/* acme-volume-dummy.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_DUMMY (acme_volume_get_type ()) -#define ACME_VOLUME_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummy)) -#define ACME_VOLUME_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummyClass)) -#define ACME_IS_VOLUME_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_DUMMY)) -#define ACME_VOLUME_DUMMY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_DUMMY, AcmeVolumeDummyClass)) - -typedef struct AcmeVolumeDummy AcmeVolumeDummy; -typedef struct AcmeVolumeDummyClass AcmeVolumeDummyClass; - -struct AcmeVolumeDummy { - AcmeVolume parent; -}; - -struct AcmeVolumeDummyClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_dummy_get_type (void); -AcmeVolume* acme_volume_dummy_new (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-gstreamer.c b/gnome-settings-daemon/actions/acme-volume-gstreamer.c deleted file mode 100644 index dbe652234..000000000 --- a/gnome-settings-daemon/actions/acme-volume-gstreamer.c +++ /dev/null @@ -1,367 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* acme-volume-gstreamer.c - - Copyright (C) 2002, 2003 Bastien Nocera - Copyright (C) 2004 Novell, Inc. - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - Jon Trowbridge <trow@ximian.com> - */ - -#include "config.h" -#include "acme-volume-gstreamer.h" - -#include <gst/gst.h> -#include <gst/mixer/mixer.h> -#include <gst/propertyprobe/propertyprobe.h> - -#include <string.h> - -#define TIMEOUT 4000 - -struct AcmeVolumeGStreamerPrivate -{ - GstMixer *mixer; - GstMixerTrack *track; - guint timer_id; - gint state; -}; - -static GObjectClass *parent_class = NULL; - -G_DEFINE_TYPE (AcmeVolumeGStreamer, acme_volume_gstreamer, ACME_TYPE_VOLUME) - -static int acme_volume_gstreamer_get_volume (AcmeVolume *self); -static void acme_volume_gstreamer_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_gstreamer_open (AcmeVolumeGStreamer *self); -static void acme_volume_gstreamer_close (AcmeVolumeGStreamer *self); -static gboolean acme_volume_gstreamer_close_real (AcmeVolumeGStreamer *self); - -static void -acme_volume_gstreamer_finalize (GObject *object) -{ - AcmeVolumeGStreamer *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_GSTREAMER (object)); - - self = ACME_VOLUME_GSTREAMER (object); - - g_return_if_fail (self->_priv != NULL); - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - } - acme_volume_gstreamer_close_real (self); - - g_free (self->_priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -acme_volume_gstreamer_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - - if (acme_volume_gstreamer_open (self) == FALSE) - return; - - gst_mixer_set_mute (self->_priv->mixer, - self->_priv->track, - val); - - if (val) - self->_priv->state |= 1; - else { - GstMixerTrack *track = self->_priv->track; - gint *volumes, n; - - self->_priv->state &= ~1; - volumes = g_new0 (gint, track->num_channels); - for (n = 0; n < track->num_channels; n++) - volumes[n] = (self->_priv->state >> 1) / - track->num_channels; - gst_mixer_set_volume (self->_priv->mixer, track, volumes); - g_free (volumes); - } - - acme_volume_gstreamer_close (self); -} - -static void -update_state (AcmeVolumeGStreamer * self) -{ - gint *volumes, vol = 0, n; - GstMixerTrack *track = self->_priv->track; - - /* update mixer by getting volume */ - volumes = g_new0 (gint, track->num_channels); - gst_mixer_get_volume (self->_priv->mixer, track, volumes); - for (n = 0; n < track->num_channels; n++) - vol += volumes[n]; - g_free (volumes); - - /* update mute flag, and volume if not muted */ - if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE) || - (vol == 0 && (self->_priv->state >> 1) != 0)) - self->_priv->state |= 1; - else - self->_priv->state = vol << 1; -} - -static gboolean -acme_volume_gstreamer_get_mute (AcmeVolume *vol) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - - if (acme_volume_gstreamer_open (self) == FALSE) - return FALSE; - - update_state (self); - acme_volume_gstreamer_close (self); - - return (self->_priv->state & 1); -} - -static int -acme_volume_gstreamer_get_volume (AcmeVolume *vol) -{ - double volume; - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - GstMixerTrack *track = self->_priv->track; - - if (acme_volume_gstreamer_open (self) == FALSE) - return 0; - - update_state (self); - - /* normalize to [0,100] scale that acme wants */ - volume = (self->_priv->state >> 1) / (double) track->num_channels; - volume = 100 * (volume - track->min_volume) / - (track->max_volume - track->min_volume); - - acme_volume_gstreamer_close (self); - - return (gint) volume; -} - -static void -acme_volume_gstreamer_set_volume (AcmeVolume *vol, int val) -{ - gint i, *volumes, volume; - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - GstMixerTrack *track; - - if (acme_volume_gstreamer_open (self) == FALSE) - return; - - track = self->_priv->track; - val = CLAMP (val, 0, 100); - - /* Rescale the volume from [0, 100] to [track min, track max]. */ - volume = (val / 100.0) * (track->max_volume - track->min_volume) + - track->min_volume; - - volumes = g_new (gint, track->num_channels); - for (i = 0; i < track->num_channels; ++i) - volumes[i] = (gint) volume; - gst_mixer_set_volume (self->_priv->mixer, track, volumes); - g_free (volumes); - - /* update state */ - self->_priv->state = (self->_priv->state & 1) | - ((volume * track->num_channels) << 1); - - acme_volume_gstreamer_close (self); -} - -static gboolean -acme_volume_gstreamer_close_real (AcmeVolumeGStreamer *self) -{ - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->mixer != NULL) - { - gst_element_set_state (GST_ELEMENT(self->_priv->mixer), GST_STATE_NULL); - gst_object_unref (GST_OBJECT (self->_priv->mixer)); - g_object_unref (G_OBJECT (self->_priv->track)); - self->_priv->mixer=NULL; - self->_priv->track=NULL; - } - - self->_priv->timer_id = 0; - return FALSE; -} - -/* This is a modified version of code from gnome-media's gst-mixer */ -static gboolean -acme_volume_gstreamer_open (AcmeVolumeGStreamer *vol) -{ - AcmeVolumeGStreamer *self = (AcmeVolumeGStreamer *) vol; - const GList *elements; - gint num = 0; - - if (self->_priv == NULL) - return FALSE; - - if (self->_priv->timer_id != 0) - { - g_source_remove (self->_priv->timer_id); - self->_priv->timer_id = 0; - return TRUE; - } - - /* Go through all elements of a certain class and check whether - * they implement a mixer. If so, walk through the tracks and look - * for first one named "volume". - * - * We should probably do something intelligent if we don't find an - * appropriate mixer/track. But now we do something stupid... everything - * just becomes a no-op. - */ - elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY); - for ( ; elements != NULL && self->_priv->mixer == NULL; elements = elements->next) { - GstElementFactory *factory = GST_ELEMENT_FACTORY (elements->data); - gchar *title = NULL; - const gchar *klass; - GstElement *element = NULL; - const GParamSpec *devspec; - GstPropertyProbe *probe; - GValueArray *array = NULL; - gint n; - const GList *tracks; - - /* check category */ - klass = gst_element_factory_get_klass (factory); - if (strcmp (klass, "Generic/Audio")) - goto next; - - /* create element */ - title = g_strdup_printf ("gst-mixer-%d", num); - element = gst_element_factory_create (factory, title); - if (!element) - goto next; - - if (!GST_IS_PROPERTY_PROBE (element)) - goto next; - - probe = GST_PROPERTY_PROBE (element); - devspec = gst_property_probe_get_property (probe, "device"); - if (devspec == NULL) - goto next; - array = gst_property_probe_probe_and_get_values (probe, devspec); - if (array == NULL) - goto next; - - /* set all devices and test for mixer */ - for (n = 0; n < array->n_values; n++) { - GValue *device = g_value_array_get_nth (array, n); - - /* set this device */ - g_object_set_property (G_OBJECT (element), "device", device); - if (gst_element_set_state (element, - GST_STATE_READY) == GST_STATE_FAILURE) - continue; - - /* Is this device a mixer? If so, add it to the list. */ - if (!GST_IS_MIXER (element)) { - gst_element_set_state (element, GST_STATE_NULL); - continue; - } - - tracks = gst_mixer_list_tracks (GST_MIXER (element)); - for (; tracks != NULL; tracks = tracks->next) { - GstMixerTrack *track = tracks->data; - - if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MASTER)) { - self->_priv->mixer = GST_MIXER (element); - self->_priv->track = track; - - g_object_ref (self->_priv->mixer); - g_object_ref (self->_priv->track); - if (array) - g_value_array_free (array); - return TRUE; - } - } - - num++; - - /* and recreate this object, since we give it to the mixer */ - title = g_strdup_printf ("gst-mixer-%d", num); - element = gst_element_factory_create (factory, title); - } - - next: - if (element) - gst_object_unref (GST_OBJECT (element)); - if (array) - g_value_array_free (array); - g_free (title); - } - return FALSE; -} - -static void -acme_volume_gstreamer_close (AcmeVolumeGStreamer *self) -{ - self->_priv->timer_id = g_timeout_add (TIMEOUT, - (GSourceFunc) acme_volume_gstreamer_close_real, self); -} - -static void -acme_volume_gstreamer_init (AcmeVolumeGStreamer *self) -{ - - self->_priv = g_new0 (AcmeVolumeGStreamerPrivate, 1); - - if (acme_volume_gstreamer_open (self) == FALSE) - { - g_free (self->_priv); - self->_priv = NULL; - return; - } - - if (self->_priv->mixer != NULL) { - acme_volume_gstreamer_close_real (self); - return; - } -} - - -static void -acme_volume_gstreamer_class_init (AcmeVolumeGStreamerClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_gstreamer_finalize; - - gst_init (NULL, NULL); - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_gstreamer_set_volume; - volume_class->get_volume = acme_volume_gstreamer_get_volume; - volume_class->set_mute = acme_volume_gstreamer_set_mute; - volume_class->get_mute = acme_volume_gstreamer_get_mute; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-gstreamer.h b/gnome-settings-daemon/actions/acme-volume-gstreamer.h deleted file mode 100644 index b7dd59a11..000000000 --- a/gnome-settings-daemon/actions/acme-volume-gstreamer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* acme-volume-gstreamer.h - - Copyright (C) 2002, 2003 Bastien Nocera - Copyright (C) 2004 Novell, Inc. - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - Jon Trowbridge <trow@ximian.com> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_GSTREAMER (acme_volume_get_type ()) -#define ACME_VOLUME_GSTREAMER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamer)) -#define ACME_VOLUME_GSTREAMER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamerClass)) -#define ACME_IS_VOLUME_GSTREAMER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_GSTREAMER)) -#define ACME_VOLUME_GSTREAMER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_GSTREAMER, AcmeVolumeGStreamerClass)) - -typedef struct AcmeVolumeGStreamer AcmeVolumeGStreamer; -typedef struct AcmeVolumeGStreamerClass AcmeVolumeGStreamerClass; -typedef struct AcmeVolumeGStreamerPrivate AcmeVolumeGStreamerPrivate; - -struct AcmeVolumeGStreamer { - AcmeVolume parent; - AcmeVolumeGStreamerPrivate *_priv; -}; - -struct AcmeVolumeGStreamerClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_gstreamer_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume-oss.c b/gnome-settings-daemon/actions/acme-volume-oss.c deleted file mode 100644 index 8c18c97ac..000000000 --- a/gnome-settings-daemon/actions/acme-volume-oss.c +++ /dev/null @@ -1,213 +0,0 @@ -/* acme-volume-oss.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume-oss.h" - -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -#ifdef __NetBSD__ -#include <sys/param.h> -#include <sys/sysctl.h> -#include <soundcard.h> -#else -#include <sys/soundcard.h> -#endif /* __NetBSD__ */ - -struct AcmeVolumeOssPrivate -{ - gboolean use_pcm; - gboolean mixerpb; - int volume; - int saved_volume; - gboolean pcm_avail; - gboolean mute; -}; - -static GObjectClass *parent_class = NULL; - -static int acme_volume_oss_get_volume (AcmeVolume *self); -static void acme_volume_oss_set_volume (AcmeVolume *self, int val); -static gboolean acme_volume_oss_mixer_check (AcmeVolumeOss *self, int fd); - -G_DEFINE_TYPE (AcmeVolumeOss, acme_volume_oss, ACME_TYPE_VOLUME) - -static void -acme_volume_oss_finalize (GObject *object) -{ - AcmeVolumeOss *self; - - g_return_if_fail (object != NULL); - g_return_if_fail (ACME_IS_VOLUME_OSS (object)); - - self = ACME_VOLUME_OSS (object); - - g_return_if_fail (self->_priv != NULL); - g_free (self->_priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static int -acme_volume_oss_vol_check (int volume) -{ - return CLAMP (volume, 0, 100); -} - -static void -acme_volume_oss_set_mute (AcmeVolume *vol, gboolean val) -{ - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - if (self->_priv->mute == FALSE) - { - self->_priv->saved_volume = - acme_volume_oss_get_volume (vol); - acme_volume_oss_set_volume (vol, 0); - self->_priv->mute = TRUE; - } else { - acme_volume_oss_set_volume (vol, self->_priv->saved_volume); - self->_priv->mute = FALSE; - } -} - -static gboolean -acme_volume_oss_get_mute (AcmeVolume *vol) -{ - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - /* somebody else might have changed the volume */ - if ((self->_priv->mute == TRUE) && (self->_priv->volume != 0)) - { - self->_priv->mute = FALSE; - } - - return self->_priv->mute; -} - -static int -acme_volume_oss_get_volume (AcmeVolume *vol) -{ - gint volume, r, l, fd; - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check(self, fd) == FALSE) - { - volume = 0; - } else { - if (self->_priv->use_pcm && self->_priv->pcm_avail) - ioctl (fd, MIXER_READ (SOUND_MIXER_PCM), &volume); - else - ioctl (fd, MIXER_READ (SOUND_MIXER_VOLUME), &volume); - close (fd); - - r = (volume & 0xff); - l = (volume & 0xff00) >> 8; - volume = (r + l) / 2; - volume = acme_volume_oss_vol_check (volume); - } - - return volume; -} - -static void -acme_volume_oss_set_volume (AcmeVolume *vol, int val) -{ - int fd, tvol, volume; - AcmeVolumeOss *self = (AcmeVolumeOss *) vol; - - volume = acme_volume_oss_vol_check (val); - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check (self, fd) == FALSE) - { - return; - } else { - tvol = (volume << 8) + volume; - if (self->_priv->use_pcm && self->_priv->pcm_avail) - ioctl (fd, MIXER_WRITE (SOUND_MIXER_PCM), &tvol); - else - ioctl (fd, MIXER_WRITE (SOUND_MIXER_VOLUME), &tvol); - close (fd); - self->_priv->volume = volume; - } -} - -static void -acme_volume_oss_init (AcmeVolumeOss *self) -{ - int fd; - - self->_priv = g_new0 (AcmeVolumeOssPrivate, 1); - - fd = open ("/dev/mixer", O_RDONLY); - if (acme_volume_oss_mixer_check(self, fd) == FALSE) - { - self->_priv->pcm_avail = FALSE; - } else { - int mask = 0; - - ioctl (fd, SOUND_MIXER_READ_DEVMASK, &mask); - if (mask & ( 1 << SOUND_MIXER_PCM)) - self->_priv->pcm_avail = TRUE; - else - self->_priv->pcm_avail = FALSE; - if (!(mask & ( 1 << SOUND_MIXER_VOLUME))) - self->_priv->use_pcm = TRUE; - - close (fd); - } -} - -static void -acme_volume_oss_class_init (AcmeVolumeOssClass *klass) -{ - AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass); - G_OBJECT_CLASS (klass)->finalize = acme_volume_oss_finalize; - - parent_class = g_type_class_peek_parent (klass); - - volume_class->set_volume = acme_volume_oss_set_volume; - volume_class->get_volume = acme_volume_oss_get_volume; - volume_class->set_mute = acme_volume_oss_set_mute; - volume_class->get_mute = acme_volume_oss_get_mute; -} - -static gboolean -acme_volume_oss_mixer_check (AcmeVolumeOss *self, int fd) -{ - gboolean retval; - - if (fd <0) { - if (self->_priv->mixerpb == FALSE) { - self->_priv->mixerpb = TRUE; - //FIXME - //volume_oss_fd_problem(self); - } - } - retval = (!self->_priv->mixerpb); - return retval; -} - diff --git a/gnome-settings-daemon/actions/acme-volume-oss.h b/gnome-settings-daemon/actions/acme-volume-oss.h deleted file mode 100644 index b8805afa5..000000000 --- a/gnome-settings-daemon/actions/acme-volume-oss.h +++ /dev/null @@ -1,47 +0,0 @@ -/* acme-volume-oss.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include <glib.h> -#include <glib-object.h> -#include "acme-volume.h" - -#define ACME_TYPE_VOLUME_OSS (acme_volume_get_type ()) -#define ACME_VOLUME_OSS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_OSS, AcmeVolumeOss)) -#define ACME_VOLUME_OSS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_OSS, AcmeVolumeOssClass)) -#define ACME_IS_VOLUME_OSS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_OSS)) -#define ACME_VOLUME_OSS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_OSS, AcmeVolumeOssClass)) - -typedef struct AcmeVolumeOss AcmeVolumeOss; -typedef struct AcmeVolumeOssClass AcmeVolumeOssClass; -typedef struct AcmeVolumeOssPrivate AcmeVolumeOssPrivate; - -struct AcmeVolumeOss { - AcmeVolume parent; - AcmeVolumeOssPrivate *_priv; -}; - -struct AcmeVolumeOssClass { - AcmeVolumeClass parent; -}; - -GType acme_volume_oss_get_type (void); - diff --git a/gnome-settings-daemon/actions/acme-volume.c b/gnome-settings-daemon/actions/acme-volume.c deleted file mode 100644 index 88cd1eab2..000000000 --- a/gnome-settings-daemon/actions/acme-volume.c +++ /dev/null @@ -1,120 +0,0 @@ -/* acme-volume.c - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#include "config.h" -#include "acme-volume.h" -#ifdef HAVE_OSS -#include "acme-volume-oss.h" -#endif -#ifdef HAVE_ALSA -#include "acme-volume-alsa.h" -#endif -#ifdef HAVE_GSTREAMER -#include "acme-volume-gstreamer.h" -#endif -#include "acme-volume-dummy.h" - -static GObjectClass *parent_class = NULL; - -G_DEFINE_TYPE (AcmeVolume, acme_volume, G_TYPE_OBJECT) - -static void -acme_volume_class_init (AcmeVolumeClass *klass) -{ - parent_class = g_type_class_peek_parent (klass); -}; - -static void -acme_volume_init (AcmeVolume *vol) -{ -} - -int -acme_volume_get_volume (AcmeVolume *self) -{ - g_return_val_if_fail (self != NULL, 0); - g_return_val_if_fail (ACME_IS_VOLUME (self), 0); - - return ACME_VOLUME_GET_CLASS (self)->get_volume (self); -} - -void -acme_volume_set_volume (AcmeVolume *self, int val) -{ - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - ACME_VOLUME_GET_CLASS (self)->set_volume (self, val); -} - -gboolean -acme_volume_get_mute (AcmeVolume *self) -{ - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (ACME_IS_VOLUME (self), FALSE); - - return ACME_VOLUME_GET_CLASS (self)->get_mute (self); -} - -void -acme_volume_set_mute (AcmeVolume *self, gboolean val) -{ - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - ACME_VOLUME_GET_CLASS (self)->set_mute (self, val); -} - -void -acme_volume_mute_toggle (AcmeVolume * self) -{ - gboolean muted; - - g_return_if_fail (self != NULL); - g_return_if_fail (ACME_IS_VOLUME (self)); - - muted = ACME_VOLUME_GET_CLASS (self)->get_mute (self); - ACME_VOLUME_GET_CLASS (self)->set_mute (self, !muted); -} - -AcmeVolume *acme_volume_new (void) -{ - AcmeVolume *vol; - -#ifdef HAVE_GSTREAMER - vol = ACME_VOLUME (g_object_new (acme_volume_gstreamer_get_type (), NULL)); - return vol; -#endif -#ifdef HAVE_ALSA - vol = ACME_VOLUME (g_object_new (acme_volume_alsa_get_type (), NULL)); - if (vol != NULL && ACME_VOLUME_ALSA (vol)->_priv != NULL) - return vol; - if (ACME_VOLUME_ALSA (vol)->_priv == NULL) - g_object_unref (vol); -#endif -#ifdef HAVE_OSS - vol = ACME_VOLUME (g_object_new (acme_volume_oss_get_type (), NULL)); - return vol; -#endif - return ACME_VOLUME (g_object_new (acme_volume_dummy_get_type (), NULL)); -} - diff --git a/gnome-settings-daemon/actions/acme-volume.h b/gnome-settings-daemon/actions/acme-volume.h deleted file mode 100644 index 00445b652..000000000 --- a/gnome-settings-daemon/actions/acme-volume.h +++ /dev/null @@ -1,61 +0,0 @@ -/* acme-volume.h - - Copyright (C) 2002, 2003 Bastien Nocera - - The Gnome Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Bastien Nocera <hadess@hadess.net> - */ - -#ifndef _ACME_VOLUME_H -#define _ACME_VOLUME_H - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define ACME_TYPE_VOLUME (acme_volume_get_type ()) -#define ACME_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME, AcmeVolume)) -#define ACME_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME, AcmeVolumeClass)) -#define ACME_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME)) -#define ACME_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME, AcmeVolumeClass)) - -typedef struct { - GObject parent; -} AcmeVolume; - -typedef struct { - GObjectClass parent; - - void (* set_volume) (AcmeVolume *self, int val); - int (* get_volume) (AcmeVolume *self); - void (* set_mute) (AcmeVolume *self, gboolean val); - int (* get_mute) (AcmeVolume *self); -} AcmeVolumeClass; - -GType acme_volume_get_type (void); -int acme_volume_get_volume (AcmeVolume *self); -void acme_volume_set_volume (AcmeVolume *self, int val); -gboolean acme_volume_get_mute (AcmeVolume *self); -void acme_volume_set_mute (AcmeVolume *self, - gboolean val); -void acme_volume_mute_toggle (AcmeVolume * self); -AcmeVolume *acme_volume_new (void); - -G_END_DECLS - -#endif /* _ACME_VOLUME_H */ diff --git a/gnome-settings-daemon/actions/acme.glade b/gnome-settings-daemon/actions/acme.glade deleted file mode 100644 index d6a1545af..000000000 --- a/gnome-settings-daemon/actions/acme.glade +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="dialog"> - <property name="title" translatable="yes">Volume</property> - <property name="type">GTK_WINDOW_POPUP</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> - - <child> - <widget class="GtkVBox" id="vbox2"> - <property name="border_width">5</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkProgressBar" id="progressbar"> - <property name="visible">True</property> - <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> - <property name="fraction">0</property> - <property name="pulse_step">0.1</property> - <property name="activity_mode">False</property> - <property name="show_text">False</property> - <property name="text_xalign">0.5</property> - <property name="text_yalign">0.5</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/gnome-settings-daemon/actions/acme.h b/gnome-settings-daemon/actions/acme.h deleted file mode 100644 index 05a5e2182..000000000 --- a/gnome-settings-daemon/actions/acme.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ACME - * Copyright (C) 2001 Bastien Nocera <hadess@hadess.net> - * - * acme.h - * - * 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 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 __ACME_H__ -#define __ACME_H__ - -#define GCONF_BINDING_DIR "/apps/gnome_settings_daemon/keybindings" -#define GCONF_MISC_DIR "/apps/gnome_settings_daemon" - -enum { - MUTE_KEY, - VOLUME_DOWN_KEY, - VOLUME_UP_KEY, - POWER_KEY, - EJECT_KEY, - HOME_KEY, - SEARCH_KEY, - EMAIL_KEY, - SLEEP_KEY, - SCREENSAVER_KEY, - HELP_KEY, - WWW_KEY, -#ifdef USE_FBLEVEL - BRIGHT_DOWN_KEY, - BRIGHT_UP_KEY, -#endif - PLAY_KEY, - PAUSE_KEY, - STOP_KEY, - PREVIOUS_KEY, - NEXT_KEY, - HANDLED_KEYS -}; - -typedef struct { - guint keysym; - guint state; - guint keycode; -} Key; - -static struct { - int key_type; - const char *gconf_key; - Key *key; -} keys[HANDLED_KEYS] = { - { MUTE_KEY, GCONF_BINDING_DIR "/volume_mute",NULL }, - { VOLUME_DOWN_KEY, GCONF_BINDING_DIR "/volume_down", NULL }, - { VOLUME_UP_KEY, GCONF_BINDING_DIR "/volume_up", NULL }, - { POWER_KEY, GCONF_BINDING_DIR "/power", NULL }, - { EJECT_KEY, GCONF_BINDING_DIR "/eject", NULL }, - { HOME_KEY, GCONF_BINDING_DIR "/home", NULL }, - { SEARCH_KEY, GCONF_BINDING_DIR "/search", NULL }, - { EMAIL_KEY, GCONF_BINDING_DIR "/email", NULL }, - { SLEEP_KEY, GCONF_BINDING_DIR "/sleep", NULL }, - { SCREENSAVER_KEY, GCONF_BINDING_DIR "/screensaver", NULL }, - { HELP_KEY, GCONF_BINDING_DIR "/help", NULL }, - { WWW_KEY, GCONF_BINDING_DIR "/www", NULL }, -#ifdef USE_FBLEVEL - { BRIGHT_DOWN_KEY, GCONF_BINDING_DIR "/brightness_down", NULL }, - { BRIGHT_UP_KEY, GCONF_BINDING_DIR "/brightness_up", NULL }, -#endif - { PLAY_KEY, GCONF_BINDING_DIR "/play", NULL }, - { PAUSE_KEY, GCONF_BINDING_DIR "/pause", NULL }, - { STOP_KEY, GCONF_BINDING_DIR "/stop", NULL }, - { PREVIOUS_KEY, GCONF_BINDING_DIR "/previous", NULL }, - { NEXT_KEY, GCONF_BINDING_DIR "/next", NULL }, -}; - -#endif /* __ACME_H__ */ - diff --git a/gnome-settings-daemon/actions/gnome-speakernotes-muted.png b/gnome-settings-daemon/actions/gnome-speakernotes-muted.png Binary files differdeleted file mode 100644 index 91f97ca08..000000000 --- a/gnome-settings-daemon/actions/gnome-speakernotes-muted.png +++ /dev/null diff --git a/gnome-settings-daemon/actions/gnome-speakernotes.png b/gnome-settings-daemon/actions/gnome-speakernotes.png Binary files differdeleted file mode 100644 index 12a18763b..000000000 --- a/gnome-settings-daemon/actions/gnome-speakernotes.png +++ /dev/null |