[Xfce4-commits] <parole:master> Skeleton MPRIS2 plugin added

Hakan Erduman noreply at xfce.org
Thu Dec 12 00:18:01 CET 2013


Updating branch refs/heads/master
         to d8ce4cfa839f47181c9f8905756b081504b9784b (commit)
       from f86c2e2b08382cc8869e8e7934011cd2991a9617 (commit)

commit d8ce4cfa839f47181c9f8905756b081504b9784b
Author: Hakan Erduman <smultimeter at gmail.com>
Date:   Tue Nov 5 10:32:45 2013 +0100

    Skeleton MPRIS2 plugin added

 src/plugins/{tray => mpris2}/Makefile.am           |   23 +++++-----
 .../sample-plugin.c => mpris2/mpris2-plugin.c}     |    6 +--
 .../sample-provider.c => mpris2/mpris2-provider.c} |   40 +++++++++---------
 src/plugins/mpris2/mpris2-provider.h               |   44 ++++++++++++++++++++
 src/plugins/mpris2/mpris2.desktop.in               |    6 +++
 5 files changed, 83 insertions(+), 36 deletions(-)

diff --git a/src/plugins/tray/Makefile.am b/src/plugins/mpris2/Makefile.am
similarity index 68%
copy from src/plugins/tray/Makefile.am
copy to src/plugins/mpris2/Makefile.am
index fd076c4..df747d1 100644
--- a/src/plugins/tray/Makefile.am
+++ b/src/plugins/mpris2/Makefile.am
@@ -2,7 +2,7 @@ INCLUDES =					\
 	-I$(top_builddir)			\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/src			\
-	-DG_LOG_DOMAIN=\"parole_tray\"    	\
+	-DG_LOG_DOMAIN=\"mpris2_plugin\"    	\
 	-DLIBEXECDIR=\"$(libexecdir)\"		\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
 
@@ -10,36 +10,33 @@ pluginsdir = 					\
 	$(libdir)/parole-$(PAROLE_VERSION_API)
 
 plugins_LTLIBRARIES =				\
-	tray-icon.la
+	parole-mpris2.la
 
-tray_icon_la_SOURCES =				\
-	tray-plugin.c				\
-	tray-provider.c				\
-	tray-provider.h
+parole_mpris2_la_SOURCES =			\
+	mpris2-plugin.c				\
+	mpris2-provider.c			\
+	mpris2-provider.h
 
-tray_icon_la_CFLAGS =				\
+parole_mpris2_la_CFLAGS =			\
 	$(PLATFORM_CFLAGS)			\
 	$(GTK_CFLAGS)				\
-	$(XFCONF_CFLAGS)     \
-	$(LIBXFCE4UI_CFLAGS)			\
 	$(LIBXFCE4UTIL_CFLAGS)
 
-tray_icon_la_LDFLAGS =				\
+parole_mpris2_la_LDFLAGS =			\
 	-avoid-version				\
 	-export-dynamic				\
 	-module					\
 	$(PLATFORM_LDFLAGS)
 
-tray_icon_la_LIBADD =				\
+parole_mpris2_la_LIBADD =				\
 	$(top_builddir)/src/misc/libparole.la	\
 	$(GTK_LIBS)				\
-	$(XFCONF_LIBS)    \
 	$(LIBXFCE4UTIL_LIBS)
 
 #
 # .desktop file
 #
-desktop_in_files = system-tray.desktop.in
+desktop_in_files = mpris2.desktop.in
 desktopdir = $(datadir)/parole/parole-plugins-$(PAROLE_VERSION_API)
 desktop_DATA =  $(desktop_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
diff --git a/src/plugins/sample/sample-plugin.c b/src/plugins/mpris2/mpris2-plugin.c
similarity index 92%
copy from src/plugins/sample/sample-plugin.c
copy to src/plugins/mpris2/mpris2-plugin.c
index f842459..80d70d1 100644
--- a/src/plugins/sample/sample-plugin.c
+++ b/src/plugins/mpris2/mpris2-plugin.c
@@ -24,7 +24,7 @@
 
 #include <src/misc/parole.h>
 
-#include "sample-provider.h"
+#include "mpris2-provider.h"
 
 G_MODULE_EXPORT GType   parole_plugin_initialize (ParoleProviderPlugin *plugin);
                           
@@ -34,8 +34,8 @@ G_MODULE_EXPORT GType
 parole_plugin_initialize (ParoleProviderPlugin *plugin)
 {
     xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-    sample_provider_register_type (plugin);
-    return SAMPLE_TYPE_PROVIDER;
+    mpris2_provider_register_type (plugin);
+    return MPRIS2_TYPE_PROVIDER;
 }
 
 G_MODULE_EXPORT void
diff --git a/src/plugins/sample/sample-provider.c b/src/plugins/mpris2/mpris2-provider.c
similarity index 58%
copy from src/plugins/sample/sample-provider.c
copy to src/plugins/mpris2/mpris2-provider.c
index b786155..43f8477 100644
--- a/src/plugins/sample/sample-provider.c
+++ b/src/plugins/mpris2/mpris2-provider.c
@@ -22,63 +22,63 @@
 #include <config.h>
 #endif
 
-#include "sample-provider.h"
+#include "mpris2-provider.h"
 
-static void   sample_provider_iface_init       (ParoleProviderPluginIface *iface);
-static void   sample_provider_finalize             (GObject                   *object);
+static void   mpris2_provider_iface_init       (ParoleProviderPluginIface *iface);
+static void   mpris2_provider_finalize             (GObject                   *object);
 
 
-struct _SampleProviderClass
+struct _Mpris2ProviderClass
 {
     GObjectClass parent_class;
 };
 
-struct _SampleProvider
+struct _Mpris2Provider
 {
     GObject                 parent;
     ParoleProviderPlayer   *player;
 };
 
-PAROLE_DEFINE_TYPE_WITH_CODE   (SampleProvider, 
-                                sample_provider, 
+PAROLE_DEFINE_TYPE_WITH_CODE   (Mpris2Provider, 
+                                mpris2_provider, 
                                 G_TYPE_OBJECT,
                                 PAROLE_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN, 
-                                sample_provider_iface_init));
+                                mpris2_provider_iface_init));
                               
-static gboolean sample_provider_is_configurable (ParoleProviderPlugin *plugin)
+static gboolean mpris2_provider_is_configurable (ParoleProviderPlugin *plugin)
 {
     return FALSE;
 }
 
 static void
-sample_provider_set_player (ParoleProviderPlugin *plugin, ParoleProviderPlayer *player)
+mpris2_provider_set_player (ParoleProviderPlugin *plugin, ParoleProviderPlayer *player)
 {
-    SampleProvider *provider;
-    provider = SAMPLE_PROVIDER (plugin);
+    Mpris2Provider *provider;
+    provider = MPRIS2_PROVIDER (plugin);
     
     provider->player = player;
 }
 
 static void
-sample_provider_iface_init (ParoleProviderPluginIface *iface)
+mpris2_provider_iface_init (ParoleProviderPluginIface *iface)
 {
-    iface->get_is_configurable = sample_provider_is_configurable;
-    iface->set_player = sample_provider_set_player;
+    iface->get_is_configurable = mpris2_provider_is_configurable;
+    iface->set_player = mpris2_provider_set_player;
 }
 
-static void sample_provider_class_init (SampleProviderClass *klass)
+static void mpris2_provider_class_init (Mpris2ProviderClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     
-    gobject_class->finalize = sample_provider_finalize;
+    gobject_class->finalize = mpris2_provider_finalize;
 }
 
-static void sample_provider_init (SampleProvider *provider)
+static void mpris2_provider_init (Mpris2Provider *provider)
 {
     provider->player = NULL;
 }
 
-static void sample_provider_finalize (GObject *object)
+static void mpris2_provider_finalize (GObject *object)
 {
-    G_OBJECT_CLASS (sample_provider_parent_class)->finalize (object);
+    G_OBJECT_CLASS (mpris2_provider_parent_class)->finalize (object);
 }
diff --git a/src/plugins/mpris2/mpris2-provider.h b/src/plugins/mpris2/mpris2-provider.h
new file mode 100644
index 0000000..fd13f21
--- /dev/null
+++ b/src/plugins/mpris2/mpris2-provider.h
@@ -0,0 +1,44 @@
+/*
+ * * Copyright (C) 2009-2011 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef MPRIS2_PROVIDER_H_
+#define MPRIS2_PROVIDER_H_
+
+#include <src/misc/parole.h>
+
+G_BEGIN_DECLS
+
+typedef struct _Mpris2ProviderClass Mpris2ProviderClass;
+typedef struct _Mpris2Provider      Mpris2Provider;
+
+#define MPRIS2_TYPE_PROVIDER             (mpris2_provider_get_type ())
+#define MPRIS2_PROVIDER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), MPRIS2_TYPE_PROVIDER, Mpris2Provider))
+#define MPRIS2_PROVIDER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), MPRIS2_TYPE_PROVIDER, Mpris2ProviderClass))
+#define MPRIS2_IS_PROVIDER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MPRIS2_TYPE_PROVIDER))
+#define MPRIS2_IS_PROVIDER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), MPRIS2_TYPE_PROVIDER))
+#define MPRIS2_PROVIDER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), MPRIS2_TYPE_PROVIDER, Mpris2ProviderClass))
+
+GType mpris2_provider_get_type          (void) G_GNUC_CONST G_GNUC_INTERNAL;
+
+void  mpris2_provider_register_type (ParoleProviderPlugin *plugin);
+
+G_END_DECLS
+
+#endif /*MPRIS2_PROVIDER_H_*/
diff --git a/src/plugins/mpris2/mpris2.desktop.in b/src/plugins/mpris2/mpris2.desktop.in
new file mode 100644
index 0000000..55fb3c3
--- /dev/null
+++ b/src/plugins/mpris2/mpris2.desktop.in
@@ -0,0 +1,6 @@
+[Parole Plugin]
+Module=parole-mpris2
+_Name=MPRIS2
+_Description=Allow MPRIS2 remote control
+Authors=Hakan Erduman hakan at erduman.de
+Website=http://goodies.xfce.org/projects/applications/parole


More information about the Xfce4-commits mailing list