summaryrefslogtreecommitdiff
path: root/plugins/media-keys
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/media-keys')
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c123
-rw-r--r--plugins/media-keys/msd-media-keys-manager.h22
-rw-r--r--plugins/media-keys/msd-media-keys-plugin.c21
-rw-r--r--plugins/media-keys/msd-media-keys-plugin.h29
-rw-r--r--plugins/media-keys/msd-media-keys-window.c4
-rw-r--r--plugins/media-keys/test-media-keys.c6
6 files changed, 49 insertions, 156 deletions
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 6c12274..a0e3ace 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -2,6 +2,7 @@
*
* Copyright (C) 2001-2003 Bastien Nocera <[email protected]>
* Copyright (C) 2006-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
@@ -21,16 +22,6 @@
#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 <gdk/gdk.h>
@@ -75,7 +66,7 @@ typedef struct {
guint32 time;
} MediaPlayer;
-struct MsdMediaKeysManagerPrivate
+struct _MsdMediaKeysManagerPrivate
{
#ifdef HAVE_LIBMATEMIXER
/* Volume bits */
@@ -105,7 +96,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void msd_media_keys_manager_class_init (MsdMediaKeysManagerClass *klass);
static void msd_media_keys_manager_init (MsdMediaKeysManager *media_keys_manager);
-static void msd_media_keys_manager_finalize (GObject *object);
G_DEFINE_TYPE (MsdMediaKeysManager, msd_media_keys_manager, G_TYPE_OBJECT)
@@ -1181,89 +1171,20 @@ msd_media_keys_manager_stop (MsdMediaKeysManager *manager)
}
static void
-msd_media_keys_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- MsdMediaKeysManager *self;
-
- self = MSD_MEDIA_KEYS_MANAGER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-msd_media_keys_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- MsdMediaKeysManager *self;
-
- self = MSD_MEDIA_KEYS_MANAGER (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GObject *
-msd_media_keys_manager_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- MsdMediaKeysManager *media_keys_manager;
- MsdMediaKeysManagerClass *klass;
-
- klass = MSD_MEDIA_KEYS_MANAGER_CLASS (g_type_class_peek (MSD_TYPE_MEDIA_KEYS_MANAGER));
-
- media_keys_manager = MSD_MEDIA_KEYS_MANAGER (G_OBJECT_CLASS (msd_media_keys_manager_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
-
- return G_OBJECT (media_keys_manager);
-}
-
-static void
-msd_media_keys_manager_dispose (GObject *object)
-{
- MsdMediaKeysManager *media_keys_manager;
-
- media_keys_manager = MSD_MEDIA_KEYS_MANAGER (object);
-
- G_OBJECT_CLASS (msd_media_keys_manager_parent_class)->dispose (object);
-}
-
-static void
msd_media_keys_manager_class_init (MsdMediaKeysManagerClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = msd_media_keys_manager_get_property;
- object_class->set_property = msd_media_keys_manager_set_property;
- object_class->constructor = msd_media_keys_manager_constructor;
- object_class->dispose = msd_media_keys_manager_dispose;
- object_class->finalize = msd_media_keys_manager_finalize;
-
- signals[MEDIA_PLAYER_KEY_PRESSED] =
- g_signal_new ("media-player-key-pressed",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (MsdMediaKeysManagerClass, media_player_key_pressed),
- NULL,
- NULL,
- msd_marshal_VOID__STRING_STRING,
- G_TYPE_NONE,
- 2,
- G_TYPE_STRING,
- G_TYPE_STRING);
+ signals[MEDIA_PLAYER_KEY_PRESSED] =
+ g_signal_new ("media-player-key-pressed",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (MsdMediaKeysManagerClass, media_player_key_pressed),
+ NULL,
+ NULL,
+ msd_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
dbus_g_object_type_install_info (MSD_TYPE_MEDIA_KEYS_MANAGER, &dbus_glib_msd_media_keys_manager_object_info);
@@ -1274,22 +1195,6 @@ static void
msd_media_keys_manager_init (MsdMediaKeysManager *manager)
{
manager->priv = MSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
-
-}
-
-static void
-msd_media_keys_manager_finalize (GObject *object)
-{
- MsdMediaKeysManager *media_keys_manager;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (MSD_IS_MEDIA_KEYS_MANAGER (object));
-
- media_keys_manager = MSD_MEDIA_KEYS_MANAGER (object);
-
- g_return_if_fail (media_keys_manager->priv != NULL);
-
- G_OBJECT_CLASS (msd_media_keys_manager_parent_class)->finalize (object);
}
static gboolean
diff --git a/plugins/media-keys/msd-media-keys-manager.h b/plugins/media-keys/msd-media-keys-manager.h
index 1bcabf2..2afb5bc 100644
--- a/plugins/media-keys/msd-media-keys-manager.h
+++ b/plugins/media-keys/msd-media-keys-manager.h
@@ -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
@@ -21,11 +22,10 @@
#ifndef __MSD_MEDIA_KEYS_MANAGER_H
#define __MSD_MEDIA_KEYS_MANAGER_H
+#include <glib.h>
#include <glib-object.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define MSD_TYPE_MEDIA_KEYS_MANAGER (msd_media_keys_manager_get_type ())
#define MSD_MEDIA_KEYS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_MEDIA_KEYS_MANAGER, MsdMediaKeysManager))
@@ -34,21 +34,23 @@ extern "C" {
#define MSD_IS_MEDIA_KEYS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_MEDIA_KEYS_MANAGER))
#define MSD_MEDIA_KEYS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_MEDIA_KEYS_MANAGER, MsdMediaKeysManagerClass))
-typedef struct MsdMediaKeysManagerPrivate MsdMediaKeysManagerPrivate;
+typedef struct _MsdMediaKeysManager MsdMediaKeysManager;
+typedef struct _MsdMediaKeysManagerClass MsdMediaKeysManagerClass;
+typedef struct _MsdMediaKeysManagerPrivate MsdMediaKeysManagerPrivate;
-typedef struct
+struct _MsdMediaKeysManager
{
GObject parent;
MsdMediaKeysManagerPrivate *priv;
-} MsdMediaKeysManager;
+};
-typedef struct
+struct _MsdMediaKeysManagerClass
{
GObjectClass parent_class;
void (* media_player_key_pressed) (MsdMediaKeysManager *manager,
const char *application,
const char *key);
-} MsdMediaKeysManagerClass;
+};
GType msd_media_keys_manager_get_type (void);
@@ -65,8 +67,6 @@ gboolean msd_media_keys_manager_release_media_player_keys (MsdMedia
const char *application,
GError **error);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __MSD_MEDIA_KEYS_MANAGER_H */
diff --git a/plugins/media-keys/msd-media-keys-plugin.c b/plugins/media-keys/msd-media-keys-plugin.c
index 0b40418..28134b2 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
@@ -32,7 +33,8 @@
#include "msd-media-keys-plugin.h"
#include "msd-media-keys-manager.h"
-struct MsdMediaKeysPluginPrivate {
+struct _MsdMediaKeysPluginPrivate
+{
MsdMediaKeysManager *manager;
};
@@ -51,24 +53,17 @@ 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);
-
- if (plugin->priv->manager != NULL) {
- g_object_unref (plugin->priv->manager);
- }
+ g_clear_object (&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
@@ -106,7 +101,7 @@ msd_media_keys_plugin_class_init (MsdMediaKeysPluginClass *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;
diff --git a/plugins/media-keys/msd-media-keys-plugin.h b/plugins/media-keys/msd-media-keys-plugin.h
index dee322f..0662009 100644
--- a/plugins/media-keys/msd-media-keys-plugin.h
+++ b/plugins/media-keys/msd-media-keys-plugin.h
@@ -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
@@ -27,9 +28,7 @@
#include "mate-settings-plugin.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define MSD_TYPE_MEDIA_KEYS_PLUGIN (msd_media_keys_plugin_get_type ())
#define MSD_MEDIA_KEYS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_MEDIA_KEYS_PLUGIN, MsdMediaKeysPlugin))
@@ -38,26 +37,26 @@ extern "C" {
#define MSD_IS_MEDIA_KEYS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_MEDIA_KEYS_PLUGIN))
#define MSD_MEDIA_KEYS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_MEDIA_KEYS_PLUGIN, MsdMediaKeysPluginClass))
-typedef struct MsdMediaKeysPluginPrivate MsdMediaKeysPluginPrivate;
+typedef struct _MsdMediaKeysPlugin MsdMediaKeysPlugin;
+typedef struct _MsdMediaKeysPluginClass MsdMediaKeysPluginClass;
+typedef struct _MsdMediaKeysPluginPrivate MsdMediaKeysPluginPrivate;
-typedef struct
+struct _MsdMediaKeysPlugin
{
- MateSettingsPlugin parent;
- MsdMediaKeysPluginPrivate *priv;
-} MsdMediaKeysPlugin;
+ MateSettingsPlugin parent;
+ MsdMediaKeysPluginPrivate *priv;
+};
-typedef struct
+struct _MsdMediaKeysPluginClass
{
- MateSettingsPluginClass parent_class;
-} MsdMediaKeysPluginClass;
+ MateSettingsPluginClass parent_class;
+};
-GType msd_media_keys_plugin_get_type (void) G_GNUC_CONST;
+GType msd_media_keys_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __MSD_MEDIA_KEYS_PLUGIN_H__ */
diff --git a/plugins/media-keys/msd-media-keys-window.c b/plugins/media-keys/msd-media-keys-window.c
index 9281a9e..7dde696 100644
--- a/plugins/media-keys/msd-media-keys-window.c
+++ b/plugins/media-keys/msd-media-keys-window.c
@@ -683,12 +683,8 @@ msd_media_keys_window_class_init (MsdMediaKeysWindowClass *klass)
static void
msd_media_keys_window_init (MsdMediaKeysWindow *window)
{
- GdkScreen *screen;
-
window->priv = MSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window);
- screen = gtk_widget_get_screen (GTK_WIDGET (window));
-
if (!msd_osd_window_is_composited (MSD_OSD_WINDOW (window))) {
GtkBuilder *builder;
const gchar *objects[] = {"acme_box", NULL};
diff --git a/plugins/media-keys/test-media-keys.c b/plugins/media-keys/test-media-keys.c
index ce1e18a..51ea1e3 100644
--- a/plugins/media-keys/test-media-keys.c
+++ b/plugins/media-keys/test-media-keys.c
@@ -35,8 +35,7 @@ int
main (int argc,
char **argv)
{
- GError *error;
- gboolean res;
+ GError *error = NULL;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR);
@@ -46,7 +45,6 @@ main (int argc,
textdomain (GETTEXT_PACKAGE);
#endif
- error = NULL;
if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) {
fprintf (stderr, "%s", error->message);
g_error_free (error);
@@ -56,7 +54,7 @@ main (int argc,
manager = msd_media_keys_manager_new ();
error = NULL;
- res = msd_media_keys_manager_start (manager, &error);
+ msd_media_keys_manager_start (manager, &error);
gtk_main ();