~ubuntu-branches/ubuntu/wily/mate-settings-daemon/wily

« back to all changes in this revision

Viewing changes to plugins/media-keys/msd-media-keys-plugin.c

  • Committer: Package Import Robot
  • Author(s): John Paul Adrian Glaubitz, Martin Wimpress, John Paul Adrian Glaubitz
  • Date: 2015-08-16 16:35:32 UTC
  • mfrom: (10.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20150816163532-34zcev57w1c1bbv6
Tags: 1.10.1-1
[ Martin Wimpress ]
* debian/rules:
  + Remove obsolete build options.

[ John Paul Adrian Glaubitz ]
* Fix minor typo in debian/control (missing hyphen).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
2
 *
3
3
 * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 
4
 * Copyright (C) 2014 Michal Ratajsky <michal.ratajsky@gmail.com>
4
5
 *
5
6
 * This program is free software; you can redistribute it and/or modify
6
7
 * it under the terms of the GNU General Public License as published by
20
21
 
21
22
#include "config.h"
22
23
 
 
24
#include <glib.h>
23
25
#include <glib/gi18n-lib.h>
24
 
#include <gmodule.h>
 
26
#include <glib-object.h>
 
27
 
 
28
#ifdef HAVE_LIBMATEMIXER
 
29
#include <libmatemixer/matemixer.h>
 
30
#endif
25
31
 
26
32
#include "mate-settings-plugin.h"
27
33
#include "msd-media-keys-plugin.h"
28
34
#include "msd-media-keys-manager.h"
29
35
 
30
 
struct MsdMediaKeysPluginPrivate {
 
36
struct _MsdMediaKeysPluginPrivate
 
37
{
31
38
        MsdMediaKeysManager *manager;
32
39
};
33
40
 
46
53
}
47
54
 
48
55
static void
49
 
msd_media_keys_plugin_finalize (GObject *object)
 
56
msd_media_keys_plugin_dispose (GObject *object)
50
57
{
51
58
        MsdMediaKeysPlugin *plugin;
52
59
 
53
 
        g_return_if_fail (object != NULL);
54
 
        g_return_if_fail (MSD_IS_MEDIA_KEYS_PLUGIN (object));
55
 
 
56
 
        g_debug ("MsdMediaKeysPlugin finalizing");
 
60
        g_debug ("MsdMediaKeysPlugin disposing");
57
61
 
58
62
        plugin = MSD_MEDIA_KEYS_PLUGIN (object);
59
63
 
60
 
        g_return_if_fail (plugin->priv != NULL);
61
 
 
62
 
        if (plugin->priv->manager != NULL) {
63
 
                g_object_unref (plugin->priv->manager);
64
 
        }
65
 
 
66
 
        G_OBJECT_CLASS (msd_media_keys_plugin_parent_class)->finalize (object);
 
64
        g_clear_object (&plugin->priv->manager);
 
65
 
 
66
        G_OBJECT_CLASS (msd_media_keys_plugin_parent_class)->dispose (object);
67
67
}
68
68
 
69
69
static void
70
70
impl_activate (MateSettingsPlugin *plugin)
71
71
{
72
72
        gboolean res;
73
 
        GError  *error;
 
73
        GError  *error = NULL;
74
74
 
75
75
        g_debug ("Activating media_keys plugin");
76
76
 
77
 
        error = NULL;
 
77
#ifdef HAVE_LIBMATEMIXER
 
78
        mate_mixer_init ();
 
79
#endif
78
80
        res = msd_media_keys_manager_start (MSD_MEDIA_KEYS_PLUGIN (plugin)->priv->manager, &error);
79
81
        if (! res) {
80
82
                g_warning ("Unable to start media_keys manager: %s", error->message);
92
94
static void
93
95
msd_media_keys_plugin_class_init (MsdMediaKeysPluginClass *klass)
94
96
{
95
 
        GObjectClass           *object_class = G_OBJECT_CLASS (klass);
 
97
        GObjectClass            *object_class = G_OBJECT_CLASS (klass);
96
98
        MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass);
97
99
 
98
 
        object_class->finalize = msd_media_keys_plugin_finalize;
 
100
        object_class->dispose = msd_media_keys_plugin_dispose;
99
101
 
100
102
        plugin_class->activate = impl_activate;
101
103
        plugin_class->deactivate = impl_deactivate;
107
109
msd_media_keys_plugin_class_finalize (MsdMediaKeysPluginClass *klass)
108
110
{
109
111
}
110