diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | configure.ac | 24 | ||||
-rw-r--r-- | data/gnome-settings-daemon.schemas.in | 4 | ||||
-rw-r--r-- | plugins/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/sound/Makefile.am | 42 | ||||
-rw-r--r-- | plugins/sound/gsd-sound-manager.c | 432 | ||||
-rw-r--r-- | plugins/sound/gsd-sound-manager.h | 57 | ||||
-rw-r--r-- | plugins/sound/gsd-sound-plugin.c | 100 | ||||
-rw-r--r-- | plugins/sound/gsd-sound-plugin.h | 59 | ||||
-rw-r--r-- | plugins/sound/sound.gnome-settings-plugin.in | 8 | ||||
-rw-r--r-- | po/ChangeLog | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
12 files changed, 744 insertions, 2 deletions
@@ -1,5 +1,19 @@ 2009-01-08 Jens Granseuer <jensgr@gmx.net> + Based on a patch by: Lennart Poettering <lennart@poettering.net> + + * configure.ac: + * data/gnome-settings-daemon.schemas.in: + * plugins/Makefile.am: + * plugins/sound/Makefile.am: + * plugins/sound/gsd-sound-manager.c: + * plugins/sound/gsd-sound-plugin.h: + * plugins/sound/sound.gnome-settings-plugin.in: + Add a new sound plugin that tells PulseAudio to drop its sample + cache when the sound theme changes (bug #545386). + +2009-01-08 Jens Granseuer <jensgr@gmx.net> + * plugins/media-keys/gsd-media-keys-manager.c: (gsd_media_keys_manager_grab_media_player_keys), (gsd_media_keys_manager_release_media_player_keys): add a little diff --git a/configure.ac b/configure.ac index 4b967c08..21b7e341 100644 --- a/configure.ac +++ b/configure.ac @@ -221,6 +221,29 @@ AC_SUBST(GIOUNIX_CFLAGS) AC_SUBST(GIOUNIX_LIBS) dnl ============================================== +dnl PulseAudio section +dnl ============================================== + +AC_ARG_ENABLE(pulse, + AC_HELP_STRING([--disable-pulse], + [turn off PulseAudio support]), + [case "${enableval}" in + yes) WANT_PULSE=yes ;; + no) WANT_PULSE=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-pulse) ;; + esac], + [WANT_PULSE=yes]) dnl Default value + +if test x$WANT_PULSE = xyes ; then + PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.11, + AC_DEFINE(HAVE_PULSE, 1, [Define if PULSE sound server should be used]), + [have_pulse=false]) +fi + +AC_SUBST(PULSE_CFLAGS) +AC_SUBST(PULSE_LIBS) + +dnl ============================================== dnl GStreamer section dnl ============================================== GST_MAJORMINOR=auto @@ -410,6 +433,7 @@ plugins/media-keys/Makefile plugins/media-keys/actions/Makefile plugins/mouse/Makefile plugins/screensaver/Makefile +plugins/sound/Makefile plugins/typing-break/Makefile plugins/xrandr/Makefile plugins/xrdb/Makefile diff --git a/data/gnome-settings-daemon.schemas.in b/data/gnome-settings-daemon.schemas.in index 530751b4..930027c7 100644 --- a/data/gnome-settings-daemon.schemas.in +++ b/data/gnome-settings-daemon.schemas.in @@ -240,7 +240,7 @@ <default>TRUE</default> <locale name="C"> <short>Enable sound plugin</short> - <long>Set to True to enable the plugin to manage sound settings.</long> + <long>Set to True to enable the plugin to manage sound sample caches.</long> </locale> </schema> <schema> @@ -248,7 +248,7 @@ <applyto>/apps/gnome_settings_daemon/plugins/sound/priority</applyto> <owner>gnome-settings-daemon</owner> <type>int</type> - <default>3</default> + <default>5</default> <locale name="C"> <short></short> <long></long> diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 6796dcdb..2d33061d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -13,6 +13,7 @@ SUBDIRS = \ media-keys \ mouse \ screensaver \ + sound \ typing-break \ xrandr \ xrdb \ diff --git a/plugins/sound/Makefile.am b/plugins/sound/Makefile.am new file mode 100644 index 00000000..29056aeb --- /dev/null +++ b/plugins/sound/Makefile.am @@ -0,0 +1,42 @@ +plugin_LTLIBRARIES = \ + libsound.la + +libsound_la_SOURCES = \ + gsd-sound-plugin.h \ + gsd-sound-plugin.c \ + gsd-sound-manager.h \ + gsd-sound-manager.c + +libsound_la_CPPFLAGS = \ + -I$(top_srcdir)/gnome-settings-daemon \ + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libsound_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(GNOME_CFLAGS) \ + $(PULSE_CFLAGS) \ + $(AM_CFLAGS) + +libsound_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) + +libsound_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(PULSE_LIBS) + +plugin_in_files = \ + sound.gnome-settings-plugin.in + +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) + +CLEANFILES = \ + $(plugin_DATA) + +DISTCLEANFILES = \ + $(plugin_DATA) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/sound/gsd-sound-manager.c b/plugins/sound/gsd-sound-manager.c new file mode 100644 index 00000000..4628276b --- /dev/null +++ b/plugins/sound/gsd-sound-manager.c @@ -0,0 +1,432 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering <lennart@poettering.net> + * + * 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. + * + */ + +#include "config.h" + +#include <sys/types.h> +#include <sys/wait.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <locale.h> + +#include <glib.h> +#include <glib/gi18n.h> +#include <gconf/gconf-client.h> +#include <gtk/gtk.h> + +#ifdef HAVE_PULSE +#include <pulse/pulseaudio.h> +#endif + +#include "gsd-sound-manager.h" +#include "gnome-settings-profile.h" + +#define GSD_SOUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerPrivate)) + +struct GsdSoundManagerPrivate +{ + guint gconf_notify; + GList* monitors; + guint timeout; +}; + +#define GCONF_SOUND_DIR "/desktop/gnome/sound" + +static void gsd_sound_manager_class_init (GsdSoundManagerClass *klass); +static void gsd_sound_manager_init (GsdSoundManager *sound_manager); +static void gsd_sound_manager_finalize (GObject *object); + +G_DEFINE_TYPE (GsdSoundManager, gsd_sound_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +#ifdef HAVE_PULSE + +static void +sample_info_cb (pa_context *c, const pa_sample_info *i, int eol, void *userdata) +{ + pa_operation *o; + + if (!i) + return; + + g_debug ("Found sample %s", i->name); + + /* We only flush those samples which have an XDG sound name + * attached, because only those originate from themeing */ + if (!(pa_proplist_gets (i->proplist, PA_PROP_EVENT_ID))) + return; + + g_debug ("Dropping sample %s from cache", i->name); + + if (!(o = pa_context_remove_sample (c, i->name, NULL, NULL))) { + g_debug ("pa_context_remove_sample (): %s", pa_strerror (pa_context_errno (c))); + return; + } + + pa_operation_unref (o); + + /* We won't wait until the operation is actually executed to + * speed things up a bit.*/ +} + +static void +flush_cache (void) +{ + pa_mainloop *ml = NULL; + pa_context *c = NULL; + pa_proplist *pl = NULL; + pa_operation *o = NULL; + + g_debug ("Flushing sample cache"); + + if (!(ml = pa_mainloop_new ())) { + g_debug ("Failed to allocate pa_mainloop"); + goto fail; + } + + if (!(pl = pa_proplist_new ())) { + g_debug ("Failed to allocate pa_proplist"); + goto fail; + } + + pa_proplist_sets (pl, PA_PROP_APPLICATION_NAME, PACKAGE_NAME); + pa_proplist_sets (pl, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); + pa_proplist_sets (pl, PA_PROP_APPLICATION_ID, "org.gnome.SettingsDaemon"); + + if (!(c = pa_context_new_with_proplist (pa_mainloop_get_api (ml), PACKAGE_NAME, pl))) { + g_debug ("Failed to allocate pa_context"); + goto fail; + } + + pa_proplist_free (pl); + pl = NULL; + + if (pa_context_connect (c, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) { + g_debug ("pa_context_connect(): %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + /* Wait until the connection is established */ + while (pa_context_get_state (c) != PA_CONTEXT_READY) { + + if (!PA_CONTEXT_IS_GOOD (pa_context_get_state (c))) { + g_debug ("Connection failed: %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + if (pa_mainloop_iterate (ml, TRUE, NULL) < 0) { + g_debug ("pa_mainloop_iterate() failed"); + goto fail; + } + } + + /* Enumerate all cached samples */ + if (!(o = pa_context_get_sample_info_list (c, sample_info_cb, NULL))) { + g_debug ("pa_context_get_sample_info_list(): %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + /* Wait until our operation is finished and there's nothing + * more queued to send to the server */ + while (pa_operation_get_state (o) == PA_OPERATION_RUNNING || pa_context_is_pending (c)) { + + if (!PA_CONTEXT_IS_GOOD (pa_context_get_state (c))) { + g_debug ("Connection failed: %s", pa_strerror (pa_context_errno (c))); + goto fail; + } + + if (pa_mainloop_iterate (ml, TRUE, NULL) < 0) { + g_debug ("pa_mainloop_iterate() failed"); + goto fail; + } + } + + g_debug ("Sample cache flushed"); + +fail: + if (o) { + pa_operation_cancel (o); + pa_operation_unref (o); + } + + if (c) { + pa_context_disconnect (c); + pa_context_unref (c); + } + + if (pl) + pa_proplist_free (pl); + + if (ml) + pa_mainloop_free (ml); +} + +static gboolean +flush_cb (GsdSoundManager *manager) +{ + flush_cache (); + manager->priv->timeout = 0; + return FALSE; +} + +static void +trigger_flush (GsdSoundManager *manager) +{ + + if (manager->priv->timeout) + g_source_remove (manager->priv->timeout); + + /* We delay the flushing a bit so that we can coalesce + * multiple changes into a single cache flush */ + manager->priv->timeout = g_timeout_add (500, (GSourceFunc) flush_cb, manager); +} + +static void +gconf_client_notify_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + GsdSoundManager *manager) +{ + trigger_flush (manager); +} + +static gboolean +register_config_callback (GsdSoundManager *manager, GError **error) +{ + GConfClient *client; + gboolean succ; + + client = gconf_client_get_default (); + + gconf_client_add_dir (client, GCONF_SOUND_DIR, GCONF_CLIENT_PRELOAD_NONE, error); + succ = !error || !*error; + + if (!err) { + manager->priv->gconf_notify = gconf_client_notify_add (client, GCONF_SOUND_DIR, (GConfClientNotifyFunc) gconf_client_notify_cb, manager, NULL, error); + succ = !error || !*error; + } + + g_object_unref (client); + + return succ; +} + +static void +file_monitor_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event, + GsdSoundManager *manager) +{ + g_debug ("Theme dir changed"); + trigger_flush (manager); +} + +static gboolean +register_directory_callback (GsdSoundManager *manager, + const char *path, + GError **error) +{ + GFile *f; + GFileMonitor *m; + gboolean succ = FALSE; + + g_debug ("Registering directory monitor for %s", path); + + f = g_file_new_for_path (path); + + m = g_file_monitor_directory (f, 0, NULL, error); + + if (m != NULL) { + g_signal_connect (m, "changed", G_CALLBACK (file_monitor_changed_cb), manager); + + manager->priv->monitors = g_list_prepend (manager->priv->monitors, m); + + succ = TRUE; + } + + g_object_unref (f); + + return succ; +} + +#endif + +gboolean +gsd_sound_manager_start (GsdSoundManager *manager, + GError **error) +{ + +#ifdef HAVE_PULSE + char *p, **ps, **k; + const char *env, *dd; +#endif + + g_debug ("Starting sound manager"); + gnome_settings_profile_start (NULL); + +#ifdef HAVE_PULSE + + /* We listen for change of the selected theme ... */ + register_config_callback (manager, NULL); + + /* ... and we listen to changes of the theme base directories + * in $HOME ...*/ + + if ((env = g_getenv ("XDG_DATA_HOME")) && *env == '/') + p = g_build_filename (env, "sounds", NULL); + else if (((env = g_getenv ("HOME")) && *env == '/') || (env = g_get_home_dir ())) + p = g_build_filename (env, ".local", "share", "sounds", NULL); + else + p = NULL; + + if (p) { + register_directory_callback (manager, p, NULL); + g_free (p); + } + + /* ... and globally. */ + if (!(dd = g_getenv ("XDG_DATA_DIRS")) || *dd == 0) + dd = "/usr/local/share:/usr/share"; + + ps = g_strsplit (dd, ":", 0); + + for (k = ps; *k; ++k) + register_directory_callback (manager, *k, NULL); + + g_strfreev (ps); +#endif + + gnome_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_sound_manager_stop (GsdSoundManager *manager) +{ + g_debug ("Stopping sound manager"); + +#ifdef HAVE_PULSE + if (manager->priv->gconf_notify != 0) { + GConfClient *client = gconf_client_get_default (); + + gconf_client_remove_dir (client, GCONF_SOUND_DIR, NULL); + + gconf_client_notify_remove (client, manager->priv->gconf_notify); + manager->priv->gconf_notify = 0; + + g_object_unref (client); + } + + if (manager->priv->timeout) { + g_source_remove (manager->priv->timeout); + manager->priv->timeout = 0; + } + + while (manager->priv->monitors) { + g_file_monitor_cancel (G_FILE_MONITOR (manager->priv->monitors->data)); + g_object_unref (manager->priv->monitors->data); + manager->priv->monitors = g_list_delete_link (manager->priv->monitors, manager->priv->monitors); + } +#endif +} + +static GObject * +gsd_sound_manager_constructor ( + GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdSoundManager *m; + GsdSoundManagerClass *klass; + + klass = GSD_SOUND_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_SOUND_MANAGER)); + + m = GSD_SOUND_MANAGER (G_OBJECT_CLASS (gsd_sound_manager_parent_class)->constructor ( + type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (m); +} + +static void +gsd_sound_manager_dispose (GObject *object) +{ + GsdSoundManager *manager; + + manager = GSD_SOUND_MANAGER (object); + + gsd_sound_manager_stop (manager); + + G_OBJECT_CLASS (gsd_sound_manager_parent_class)->dispose (object); +} + +static void +gsd_sound_manager_class_init (GsdSoundManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->constructor = gsd_sound_manager_constructor; + object_class->dispose = gsd_sound_manager_dispose; + object_class->finalize = gsd_sound_manager_finalize; + + g_type_class_add_private (klass, sizeof (GsdSoundManagerPrivate)); +} + +static void +gsd_sound_manager_init (GsdSoundManager *manager) +{ + manager->priv = GSD_SOUND_MANAGER_GET_PRIVATE (manager); +} + +static void +gsd_sound_manager_finalize (GObject *object) +{ + GsdSoundManager *sound_manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SOUND_MANAGER (object)); + + sound_manager = GSD_SOUND_MANAGER (object); + + g_return_if_fail (sound_manager->priv); + + G_OBJECT_CLASS (gsd_sound_manager_parent_class)->finalize (object); +} + +GsdSoundManager * +gsd_sound_manager_new (void) +{ + if (manager_object) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_SOUND_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, (gpointer *) &manager_object); + } + + return GSD_SOUND_MANAGER (manager_object); +} diff --git a/plugins/sound/gsd-sound-manager.h b/plugins/sound/gsd-sound-manager.h new file mode 100644 index 00000000..bfcef5c2 --- /dev/null +++ b/plugins/sound/gsd-sound-manager.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering <lennart@poettering.net> + * + * 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 __GSD_SOUND_MANAGER_H +#define __GSD_SOUND_MANAGER_H + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GSD_TYPE_SOUND_MANAGER (gsd_sound_manager_get_type ()) +#define GSD_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManager)) +#define GSD_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerClass)) +#define GSD_IS_SOUND_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SOUND_MANAGER)) +#define GSD_IS_SOUND_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SOUND_MANAGER)) +#define GSD_SOUND_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SOUND_MANAGER, GsdSoundManagerClass)) + +typedef struct GsdSoundManagerPrivate GsdSoundManagerPrivate; + +typedef struct +{ + GObject parent; + GsdSoundManagerPrivate *priv; +} GsdSoundManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdSoundManagerClass; + +GType gsd_sound_manager_get_type (void) G_GNUC_CONST; + +GsdSoundManager *gsd_sound_manager_new (void); +gboolean gsd_sound_manager_start (GsdSoundManager *manager, GError **error); +void gsd_sound_manager_stop (GsdSoundManager *manager); + +G_END_DECLS + +#endif /* __GSD_SOUND_MANAGER_H */ diff --git a/plugins/sound/gsd-sound-plugin.c b/plugins/sound/gsd-sound-plugin.c new file mode 100644 index 00000000..941dc904 --- /dev/null +++ b/plugins/sound/gsd-sound-plugin.c @@ -0,0 +1,100 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering <lennart@poettering.net> + * + * 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, 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. + * + */ + +#include "config.h" + +#include <glib/gi18n-lib.h> +#include <gmodule.h> + +#include "gnome-settings-plugin.h" +#include "gsd-sound-plugin.h" +#include "gsd-sound-manager.h" + +struct GsdSoundPluginPrivate { + GsdSoundManager *manager; +}; + +#define GSD_SOUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginPrivate)) + +GNOME_SETTINGS_PLUGIN_REGISTER (GsdSoundPlugin, gsd_sound_plugin) + +static void +gsd_sound_plugin_init (GsdSoundPlugin *plugin) +{ + plugin->priv = GSD_SOUND_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdSoundPlugin initializing"); + + plugin->priv->manager = gsd_sound_manager_new (); +} + +static void +gsd_sound_plugin_finalize (GObject *object) +{ + GsdSoundPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_SOUND_PLUGIN (object)); + + g_debug ("GsdSoundPlugin finalizing"); + + plugin = GSD_SOUND_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) + g_object_unref (plugin->priv->manager); + + G_OBJECT_CLASS (gsd_sound_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (GnomeSettingsPlugin *plugin) +{ + GError *error = NULL; + + g_debug ("Activating sound plugin"); + + if (!gsd_sound_manager_start (GSD_SOUND_PLUGIN (plugin)->priv->manager, &error)) { + g_warning ("Unable to start sound manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (GnomeSettingsPlugin *plugin) +{ + g_debug ("Deactivating sound plugin"); + gsd_sound_manager_stop (GSD_SOUND_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_sound_plugin_class_init (GsdSoundPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_sound_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdSoundPluginPrivate)); +} diff --git a/plugins/sound/gsd-sound-plugin.h b/plugins/sound/gsd-sound-plugin.h new file mode 100644 index 00000000..3a172616 --- /dev/null +++ b/plugins/sound/gsd-sound-plugin.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Lennart Poettering <lennart@poettering.net> + * + * 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, 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 __GSD_SOUND_PLUGIN_H__ +#define __GSD_SOUND_PLUGIN_H__ + +#include <glib.h> +#include <glib-object.h> +#include <gmodule.h> + +#include "gnome-settings-plugin.h" + +G_BEGIN_DECLS + +#define GSD_TYPE_SOUND_PLUGIN (gsd_sound_plugin_get_type ()) +#define GSD_SOUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_SOUND_PLUGIN, GsdSoundPlugin)) +#define GSD_SOUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginClass)) +#define GSD_IS_SOUND_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_SOUND_PLUGIN)) +#define GSD_IS_SOUND_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_SOUND_PLUGIN)) +#define GSD_SOUND_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_SOUND_PLUGIN, GsdSoundPluginClass)) + +typedef struct GsdSoundPluginPrivate GsdSoundPluginPrivate; + +typedef struct +{ + GnomeSettingsPlugin parent; + GsdSoundPluginPrivate *priv; +} GsdSoundPlugin; + +typedef struct +{ + GnomeSettingsPluginClass parent_class; +} GsdSoundPluginClass; + +GType gsd_sound_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GSD_SOUND_PLUGIN_H__ */ diff --git a/plugins/sound/sound.gnome-settings-plugin.in b/plugins/sound/sound.gnome-settings-plugin.in new file mode 100644 index 00000000..79ec2d01 --- /dev/null +++ b/plugins/sound/sound.gnome-settings-plugin.in @@ -0,0 +1,8 @@ +[GNOME Settings Plugin] +Module=sound +IAge=0 +_Name=Sound +_Description=Sound Sample Cache plugin +Authors=Lennart Poettering +Copyright=Copyright © 2008 +Website= diff --git a/po/ChangeLog b/po/ChangeLog index d2a18583..2078704b 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2009-01-08 Jens Granseuer <jensgr@gmx.net> + + * POTFILES.in: update files list + 2009-01-05 Kjartan Maraas <kmaraas@gnome.org> * nb.po: Updated Norwegian bokmål translation. diff --git a/po/POTFILES.in b/po/POTFILES.in index 599bc85a..fa22157e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,6 +30,7 @@ plugins/mouse/gsd-mouse-manager.c [type: gettext/ini]plugins/mouse/mouse.gnome-settings-plugin.in plugins/screensaver/gsd-screensaver-manager.c [type: gettext/ini]plugins/screensaver/screensaver.gnome-settings-plugin.in +[type: gettext/ini]plugins/sound/sound.gnome-settings-plugin.in [type: gettext/ini]plugins/typing-break/typing-break.gnome-settings-plugin.in [type: gettext/ini]plugins/xrandr/xrandr.gnome-settings-plugin.in plugins/xrandr/gsd-xrandr-manager.c |