1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
4  * Copyright (C) 2014 Michal Ratajsky <michal.ratajsky@gmail.com>
5  * Copyright (C) 2012-2021 MATE Developers
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef __MSD_MEDIA_KEYS_MANAGER_H
24 #define __MSD_MEDIA_KEYS_MANAGER_H
25 
26 #include <glib.h>
27 #include <glib-object.h>
28 
29 G_BEGIN_DECLS
30 
31 #define MSD_TYPE_MEDIA_KEYS_MANAGER         (msd_media_keys_manager_get_type ())
32 #define MSD_MEDIA_KEYS_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_MEDIA_KEYS_MANAGER, MsdMediaKeysManager))
33 #define MSD_MEDIA_KEYS_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_MEDIA_KEYS_MANAGER, MsdMediaKeysManagerClass))
34 #define MSD_IS_MEDIA_KEYS_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_MEDIA_KEYS_MANAGER))
35 #define MSD_IS_MEDIA_KEYS_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_MEDIA_KEYS_MANAGER))
36 #define MSD_MEDIA_KEYS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_MEDIA_KEYS_MANAGER, MsdMediaKeysManagerClass))
37 
38 typedef struct _MsdMediaKeysManager         MsdMediaKeysManager;
39 typedef struct _MsdMediaKeysManagerClass    MsdMediaKeysManagerClass;
40 typedef struct _MsdMediaKeysManagerPrivate  MsdMediaKeysManagerPrivate;
41 
42 struct _MsdMediaKeysManager
43 {
44         GObject                     parent;
45         MsdMediaKeysManagerPrivate *priv;
46 };
47 
48 struct _MsdMediaKeysManagerClass
49 {
50         GObjectClass   parent_class;
51         void          (* media_player_key_pressed) (MsdMediaKeysManager *manager,
52                                                     const char          *application,
53                                                     const char          *key);
54 };
55 
56 GType                 msd_media_keys_manager_get_type                  (void);
57 
58 MsdMediaKeysManager * msd_media_keys_manager_new                       (void);
59 gboolean              msd_media_keys_manager_start                     (MsdMediaKeysManager *manager,
60                                                                         GError             **error);
61 void                  msd_media_keys_manager_stop                      (MsdMediaKeysManager *manager);
62 
63 gboolean              msd_media_keys_manager_grab_media_player_keys    (MsdMediaKeysManager *manager,
64                                                                         const char          *application,
65                                                                         guint32              time,
66                                                                         GError             **error);
67 gboolean              msd_media_keys_manager_release_media_player_keys (MsdMediaKeysManager *manager,
68                                                                         const char          *application,
69                                                                         GError             **error);
70 
71 G_END_DECLS
72 
73 #endif /* __MSD_MEDIA_KEYS_MANAGER_H */
74