diff options
author | Stefano Karapetsas <[email protected]> | 2014-10-15 17:02:11 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-10-15 17:02:11 +0200 |
commit | e2d9b565b92a0ddb8d1ff8c316d780993ec2838b (patch) | |
tree | d819c42fb795727c8b6e48819dc42ae0afd6c11b /plugins/media-keys/msd-media-keys-plugin.c | |
parent | 5381223e7e40031fe3dc033816629b20edb534d1 (diff) | |
parent | be56b0f8f8ef77296fe12c73985785874dc896c2 (diff) | |
download | mate-settings-daemon-e2d9b565b92a0ddb8d1ff8c316d780993ec2838b.tar.bz2 mate-settings-daemon-e2d9b565b92a0ddb8d1ff8c316d780993ec2838b.tar.xz |
Merge branch 'libmatemixer'
Diffstat (limited to 'plugins/media-keys/msd-media-keys-plugin.c')
-rw-r--r-- | plugins/media-keys/msd-media-keys-plugin.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/plugins/media-keys/msd-media-keys-plugin.c b/plugins/media-keys/msd-media-keys-plugin.c index 93a805f..3cce9d2 100644 --- a/plugins/media-keys/msd-media-keys-plugin.c +++ b/plugins/media-keys/msd-media-keys-plugin.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2007 William Jon McCann <[email protected]> + * Copyright (C) 2014 Michal Ratajsky <[email protected]> * * 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 @@ -20,14 +21,20 @@ #include "config.h" +#include <glib.h> #include <glib/gi18n-lib.h> -#include <gmodule.h> +#include <glib-object.h> + +#ifdef HAVE_LIBMATEMIXER +#include <libmatemixer/matemixer.h> +#endif #include "mate-settings-plugin.h" #include "msd-media-keys-plugin.h" #include "msd-media-keys-manager.h" -struct MsdMediaKeysPluginPrivate { +struct _MsdMediaKeysPluginPrivate +{ MsdMediaKeysManager *manager; }; @@ -46,35 +53,30 @@ msd_media_keys_plugin_init (MsdMediaKeysPlugin *plugin) } static void -msd_media_keys_plugin_finalize (GObject *object) +msd_media_keys_plugin_dispose (GObject *object) { MsdMediaKeysPlugin *plugin; - g_return_if_fail (object != NULL); - g_return_if_fail (MSD_IS_MEDIA_KEYS_PLUGIN (object)); - - g_debug ("MsdMediaKeysPlugin finalizing"); + g_debug ("MsdMediaKeysPlugin disposing"); plugin = MSD_MEDIA_KEYS_PLUGIN (object); - g_return_if_fail (plugin->priv != NULL); + g_clear_object (&plugin->priv->manager); - if (plugin->priv->manager != NULL) { - g_object_unref (plugin->priv->manager); - } - - G_OBJECT_CLASS (msd_media_keys_plugin_parent_class)->finalize (object); + G_OBJECT_CLASS (msd_media_keys_plugin_parent_class)->dispose (object); } static void impl_activate (MateSettingsPlugin *plugin) { gboolean res; - GError *error; + GError *error = NULL; g_debug ("Activating media_keys plugin"); - error = NULL; +#ifdef HAVE_LIBMATEMIXER + mate_mixer_init (); +#endif res = msd_media_keys_manager_start (MSD_MEDIA_KEYS_PLUGIN (plugin)->priv->manager, &error); if (! res) { g_warning ("Unable to start media_keys manager: %s", error->message); @@ -92,10 +94,10 @@ impl_deactivate (MateSettingsPlugin *plugin) static void msd_media_keys_plugin_class_init (MsdMediaKeysPluginClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass); - object_class->finalize = msd_media_keys_plugin_finalize; + object_class->dispose = msd_media_keys_plugin_dispose; plugin_class->activate = impl_activate; plugin_class->deactivate = impl_deactivate; @@ -107,4 +109,3 @@ static void msd_media_keys_plugin_class_finalize (MsdMediaKeysPluginClass *klass) { } - |