[Xfce4-commits] <parole:master> Expose macros for module type registration for the plugins.
Ali Abdallah
noreply at xfce.org
Tue Nov 24 14:04:02 CET 2009
Updating branch refs/heads/master
to 43734046b34b7da3241c2ef737fdd20b2ab3d10f (commit)
from d334dd46416008b13767c1cb1a9183002c161a6f (commit)
commit 43734046b34b7da3241c2ef737fdd20b2ab3d10f
Author: Ali Abdallah <ali at ali-xfce.org>
Date: Tue Nov 24 12:54:14 2009 +0100
Expose macros for module type registration for the plugins.
Some Gtk markups.
TODO | 3 +
configure.ac.in | 3 +-
docs/plugin-api/Parole-Plugins-docs.sgml | 29 +++++--
gst/parole-gst.c | 8 +-
parole/Makefile.am | 40 ++++-----
parole/parole-file.c | 26 +++---
parole/parole-provider-player.c | 107 ++++++++++++++++++++++-
parole/parole-provider-player.h | 4 +
parole/parole-provider-plugin.c | 40 ++++++++-
parole/parole-stream.c | 72 ++++++++++-----
plugins/properties/stream-properties-plugin.c | 1 +
plugins/properties/stream-properties-provider.c | 10 +-
plugins/properties/stream-properties-provider.h | 2 +
plugins/sample/sample-plugin.c | 1 +
plugins/sample/sample-provider.c | 10 +-
plugins/sample/sample-provider.h | 2 +
plugins/tray/tray-plugin.c | 3 +
plugins/tray/tray-provider.c | 12 ++-
plugins/tray/tray-provider.h | 2 +
plugins/window-title/window-title-plugin.c | 2 +
plugins/window-title/window-title-provider.c | 11 ++-
plugins/window-title/window-title-provider.h | 2 +
src/parole-medialist.c | 2 +-
src/parole-medialist.h | 2 +-
src/parole-module.c | 41 +++++++--
src/parole-module.h | 4 +
src/parole-player.c | 2 +-
src/parole-plugin-player.c | 88 +++++++++++++++++++
src/parole-plugins-manager.c | 13 +++-
29 files changed, 435 insertions(+), 107 deletions(-)
diff --git a/TODO b/TODO
index 7d6ddb4..472d6cc 100644
--- a/TODO
+++ b/TODO
@@ -6,4 +6,7 @@
=== Plugins ===
* Write a youtube plugin.
* Subtitle downloader.
+* Always on top.
+* Power manager inhibit while playing.
+* thumbnail.
* ...?
diff --git a/configure.ac.in b/configure.ac.in
index ff900c3..561c1d9 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -240,10 +240,11 @@ data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/mime/Makefile
data/desktop/Makefile
+parole/Makefile
+parole/parole.h
common/Makefile
gst/Makefile
dbus/Makefile
-parole/Makefile
src/Makefile
plugins/Makefile
plugins/sample/Makefile
diff --git a/docs/plugin-api/Parole-Plugins-docs.sgml b/docs/plugin-api/Parole-Plugins-docs.sgml
index c3a9272..95ab958 100644
--- a/docs/plugin-api/Parole-Plugins-docs.sgml
+++ b/docs/plugin-api/Parole-Plugins-docs.sgml
@@ -5,7 +5,6 @@
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY date "July 2009">
-
]>
<book id="index">
<bookinfo>
@@ -33,22 +32,36 @@
</bookinfo>
- <chapter>
+ <part id="Intro">
+ <title>Introduction</title>
+ <para>
+ Parole is a modern simple media player base on the
+
+ <ulink url="http://gstreamer.org">GStreamer</ulink> framework and written for
+ <ulink url="http://xfce.org">Xfce</ulink>.
+ </para>
+ </part>
+
+ <part id="tutorial">
+ <title>Plugin tutorial</title>
+ </part>
+
+ <part id="fundamentals">
+ <title>Fundamentals</title>
+
+ </part>
+
+ <part id="API">
<title>Parole Plugin Reference</title>
<xi:include href="xml/parole-provider-player.xml"/>
<xi:include href="xml/parole-provider-plugin.xml"/>
<xi:include href="xml/parole-file.xml"/>
<xi:include href="xml/parole-stream.xml"/>
+ </part>
- </chapter>
- <chapter id="object-tree">
- <title>Object Hierarchy</title>
- <xi:include href="xml/tree_index.sgml"/>
- </chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index 9017d58..c6fcecf 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -454,7 +454,6 @@ parole_gst_set_video_color_balance (ParoleGst *gst)
static void
parole_gst_set_x_overlay (ParoleGst *gst)
{
-
GstElement *video_sink;
g_object_get (G_OBJECT (gst->priv->playbin),
@@ -463,8 +462,9 @@ parole_gst_set_x_overlay (ParoleGst *gst)
g_assert (video_sink != NULL);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (video_sink),
- GDK_WINDOW_XWINDOW (GTK_WIDGET (gst)->window));
+ if ( GDK_IS_WINDOW (GTK_WIDGET (gst)->window) )
+ gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (video_sink),
+ GDK_WINDOW_XWINDOW (GTK_WIDGET (gst)->window));
gst_object_unref (video_sink);
@@ -1360,7 +1360,7 @@ parole_gst_construct (GObject *object)
parole_gst_load_logo (gst);
parole_gst_set_subtitle_encoding (gst);
parole_gst_set_subtitle_font (gst);
-
+ TRACE ("End");
}
static gboolean
diff --git a/parole/Makefile.am b/parole/Makefile.am
index 6c74c78..229c7c6 100644
--- a/parole/Makefile.am
+++ b/parole/Makefile.am
@@ -6,23 +6,32 @@ INCLUDES = \
-DLOCALEDIR=\"$(localedir)\" \
-DPAROLE_COMPILATION
+INST_HFILES = \
+ parole.h \
+ parole-file.h \
+ parole-stream.h \
+ parole-provider-player.h \
+ parole-provider-plugin.h
+
libparole_la_SOURCES = \
$(GENERATED_FILES) \
- parole.h \
+ $(INST_HFILES) \
parole-provider-plugin.c \
- parole-provider-plugin.h \
parole-provider-player.c \
- parole-provider-player.h \
parole-file.c \
- parole-file.h \
- parole-stream.c \
- parole-stream.h
+ parole-stream.c
libparole_la_CFLAGS = \
$(GIO_CFLAGS) \
$(GTK_CFLAGS) \
$(TAGLIBC_CFLAGS)
+paroleincludedir = \
+ $(includedir)/parole
+
+paroleinclude_HEADERS = \
+ $(INST_HFILES)
+
GENERATED_FILES = \
parole-marshal.c \
parole-marshal.h \
@@ -74,24 +83,9 @@ parole-enum-types.c: $(parole_glib_enum_headers) Makefile
endif
EXTRA_DIST = \
- parole-marshal.list
+ parole-marshal.list \
+ parole.h.in
DISTCLEANFILES = \
$(BUILT_SOURCES) \
stamp-enum-types.h
-
-INST_HFILES = \
- parole.h \
- parole-file.h \
- parole-stream.h \
- parole-provider-player.h \
- parole-provider-plugin.h
-
-libparole_headers = \
- $(INST_HFILES)
-
-libparole_includedir = \
- $(includedir)/parole
-
-libparole_include_HEADERS = \
- $(parole_headers)
\ No newline at end of file
diff --git a/parole/parole-file.c b/parole/parole-file.c
index 64b6845..00b1bec 100644
--- a/parole/parole-file.c
+++ b/parole/parole-file.c
@@ -230,14 +230,15 @@ parole_file_class_init (ParoleFileClass *klass)
/**
* ParoleFile:filename:
*
- * The filename of the file.
+ * The file name of the file.
*
- * Since: 0.1
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_PATH,
g_param_spec_string ("filename",
- NULL, NULL,
+ "File name",
+ "The file name",
NULL,
G_PARAM_CONSTRUCT_ONLY|
G_PARAM_READWRITE));
@@ -245,14 +246,15 @@ parole_file_class_init (ParoleFileClass *klass)
/**
* ParoleFile:display-name:
*
- * a UTF-8 name that can be displayed in the UI.
+ * A UTF-8 name that can be displayed in the UI.
*
- * Since: 0.1
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_DISPLAY_NAME,
g_param_spec_string ("display-name",
- NULL, NULL,
+ "Display name",
+ "A UTF-8 name that can be displayed in the UI",
NULL,
G_PARAM_CONSTRUCT_ONLY|
G_PARAM_READWRITE));
@@ -260,14 +262,15 @@ parole_file_class_init (ParoleFileClass *klass)
/**
* ParoleFile:uri:
*
- * The Uri of the file.
+ * The uri of the file.
*
- * Since: 0.1
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_URI,
g_param_spec_string ("uri",
- NULL, NULL,
+ "Uri",
+ "The uri of the file",
NULL,
G_PARAM_READABLE));
@@ -276,12 +279,13 @@ parole_file_class_init (ParoleFileClass *klass)
*
* The content type of the file.
*
- * Since: 0.1
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_CONTENT_TYPE,
g_param_spec_string ("content-type",
- NULL, NULL,
+ "Content type",
+ "The content type of the file",
NULL,
G_PARAM_READABLE));
diff --git a/parole/parole-provider-player.c b/parole/parole-provider-player.c
index 75be233..490e81b 100644
--- a/parole/parole-provider-player.c
+++ b/parole/parole-provider-player.c
@@ -65,8 +65,8 @@ static void parole_provider_player_base_init (gpointer klass)
if (G_UNLIKELY (!initialized))
{
/**
- * ParolePlugin::state-changed:
- * @plugin: the object which received the signal.
+ * ParoleProviderPlayerIface::state-changed:
+ * @player: the object which received the signal.
* @stream: a #ParoleStream.
* @state: the new state.
*
@@ -82,7 +82,7 @@ static void parole_provider_player_base_init (gpointer klass)
PAROLE_TYPE_STREAM, PAROLE_ENUM_TYPE_STATE);
/**
- * ParoleProviderPlayer::tag-message:
+ * ParoleProviderPlayerIface::tag-message:
* @player: the object which received the signal.
* @stream: a #ParoleStream.
*
@@ -104,6 +104,13 @@ static void parole_provider_player_class_init (gpointer klass)
{
}
+/**
+ * parole_provider_player_get_main_window:
+ * @player: a
+ *
+ *
+ * Returns:
+ **/
GtkWidget *parole_provider_player_get_main_window (ParoleProviderPlayer *player)
{
GtkWidget *window = NULL;
@@ -117,6 +124,14 @@ GtkWidget *parole_provider_player_get_main_window (ParoleProviderPlayer *player)
return window;
}
+/**
+ * parole_provider_player_pack:
+ * @player:
+ * @widget:
+ * @title:
+ * @container:
+ *
+ **/
void parole_provider_player_pack (ParoleProviderPlayer *player, GtkWidget *widget,
const gchar *title, ParolePluginContainer container)
{
@@ -127,7 +142,17 @@ void parole_provider_player_pack (ParoleProviderPlayer *player, GtkWidget *widge
(*PAROLE_PROVIDER_PLAYER_GET_INTERFACE (player)->pack) (player, widget, title, container);
}
}
-
+
+/**
+ * parole_provider_player_get_state:
+ * @player:
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
ParoleState parole_provider_player_get_state (ParoleProviderPlayer *player)
{
ParoleState state = PAROLE_STATE_STOPPED;
@@ -142,6 +167,17 @@ ParoleState parole_provider_player_get_state (ParoleProviderPlayer *player)
return state;
}
+/**
+ * parole_provider_player_play_uri:
+ * @player: a #ParoleProviderPlayer
+ * @uri: uri
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_player_play_uri (ParoleProviderPlayer *player, const gchar *uri)
{
gboolean ret = FALSE;
@@ -155,6 +191,17 @@ gboolean parole_provider_player_play_uri (ParoleProviderPlayer *player, const gc
return ret;
}
+
+/**
+ * parole_provider_player_pause:
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_player_pause (ParoleProviderPlayer *player)
{
gboolean ret = FALSE;
@@ -169,6 +216,17 @@ gboolean parole_provider_player_pause (ParoleProviderPlayer *player)
return ret;
}
+
+/**
+ * parole_provider_player_resume:
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_player_resume (ParoleProviderPlayer *player)
{
gboolean ret = FALSE;
@@ -183,6 +241,17 @@ gboolean parole_provider_player_resume (ParoleProviderPlayer *player)
return ret;
}
+
+/**
+ * parole_provider_player_stop:
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_player_stop (ParoleProviderPlayer *player)
{
gboolean ret = FALSE;
@@ -197,6 +266,17 @@ gboolean parole_provider_player_stop (ParoleProviderPlayer *player)
return ret;
}
+
+/**
+ * parole_provider_player_seek:
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ * Returns:
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_player_seek (ParoleProviderPlayer *player, gdouble pos)
{
gboolean ret = FALSE;
@@ -210,3 +290,22 @@ gboolean parole_provider_player_seek (ParoleProviderPlayer *player, gdouble pos)
return ret;
}
+
+
+/**
+ * parole_provider_player_open_media_chooser:
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ *
+ * Since: 0.2
+ **/
+void parole_provider_player_open_media_chooser (ParoleProviderPlayer *player)
+{
+ g_return_if_fail (PAROLE_IS_PROVIDER_PLAYER (player));
+
+ if ( PAROLE_PROVIDER_PLAYER_GET_INTERFACE (player)->open_media_chooser )
+ {
+ (*PAROLE_PROVIDER_PLAYER_GET_INTERFACE (player)->open_media_chooser) (player);
+ }
+}
diff --git a/parole/parole-provider-player.h b/parole/parole-provider-player.h
index c13b11f..69bd7e5 100644
--- a/parole/parole-provider-player.h
+++ b/parole/parole-provider-player.h
@@ -79,6 +79,8 @@ struct _ParoleProviderPlayerIface
gboolean (*seek) (ParoleProviderPlayer *player,
gdouble pos);
+ void (*open_media_chooser) (ParoleProviderPlayer *player);
+
/*< signals >*/
void (*tag_message) (ParoleProviderPlayer *player,
const ParoleStream *stream);
@@ -112,6 +114,8 @@ gboolean parole_provider_player_stop (ParoleProviderPlayer *player);
gboolean parole_provider_player_seek (ParoleProviderPlayer *player,
gdouble pos);
+void parole_provider_player_open_media_chooser (ParoleProviderPlayer *player);
+
G_END_DECLS
#endif /* __PAROLE_PLUGIN_IFACE_H__ */
diff --git a/parole/parole-provider-plugin.c b/parole/parole-provider-plugin.c
index cefa738..c6d12b0 100644
--- a/parole/parole-provider-plugin.c
+++ b/parole/parole-provider-plugin.c
@@ -51,6 +51,17 @@ parole_provider_plugin_get_type (void)
return type;
}
+/**
+ * parole_provider_plugin_get_is_configurable:
+ * @provider: a #ParoleProviderPlugin
+ *
+ * Get if the plugin is configurable.
+ *
+ * Returns: TRUE if the plugin is configurable, FALSE otherwise.
+ *
+ *
+ * Since: 0.2
+ **/
gboolean parole_provider_plugin_get_is_configurable (ParoleProviderPlugin *provider)
{
gboolean configurable = FALSE;
@@ -65,6 +76,16 @@ gboolean parole_provider_plugin_get_is_configurable (ParoleProviderPlugin *provi
return configurable;
}
+/**
+ * parole_provider_plugin_configure:
+ * @provider: a #ParoleProviderPlugin
+ * @parent: a #GtkWidget parent window
+ *
+ * Open the plugin configuration dialog
+ *
+ *
+ * Since: 0.2
+ **/
void parole_provider_plugin_configure (ParoleProviderPlugin *provider, GtkWidget *parent)
{
g_return_if_fail (PAROLE_IS_PROVIDER_PLUGIN (provider));
@@ -75,6 +96,14 @@ void parole_provider_plugin_configure (ParoleProviderPlugin *provider, GtkWidget
}
}
+/**
+ * parole_provider_plugin_set_player:
+ * @provider: a #ParoleProviderPlugin
+ * @player: a #ParoleProviderPlayer
+ *
+ *
+ * Since: 0.2
+ **/
void parole_provider_plugin_set_player (ParoleProviderPlugin *provider, ParoleProviderPlayer *player)
{
g_return_if_fail (PAROLE_IS_PROVIDER_PLUGIN (provider));
@@ -85,7 +114,16 @@ void parole_provider_plugin_set_player (ParoleProviderPlugin *provider, ParolePr
}
}
-gboolean parole_provider_plugin_get_is_active (ParoleProviderPlugin *provider)
+/**
+ * parole_provider_plugin_get_is_active:
+ * @provider: a #ParoleProviderPlugin
+ *
+ * Returns: TRUE is the plugin is currently active e.g. loaded by the player, FALSE otherwise.
+ *
+ *
+ * Since: 0.2
+ **/
+gboolean parole_provider_plugin_get_is_active (ParoleProviderPlugin *provider)
{
gboolean active = FALSE;
diff --git a/parole/parole-stream.c b/parole/parole-stream.c
index c0834e3..d563b76 100644
--- a/parole/parole-stream.c
+++ b/parole/parole-stream.c
@@ -323,21 +323,24 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_URI,
g_param_spec_string ("uri",
- NULL, NULL,
+ "Uri",
+ "Uri",
NULL,
G_PARAM_READWRITE));
/**
* ParoleStream:subtitles:
*
- * Subtitles path, this is only valid for local files
+ * Subtitles path, this is only valid if the property
+ * "media-type" has the value PAROLE_MEDIA_TYPE_LOCAL_FILE.
*
* Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_SUBTITLES,
g_param_spec_string ("subtitles",
- NULL, NULL,
+ "Subtitles",
+ "Subtitle file",
NULL,
G_PARAM_READWRITE));
@@ -351,7 +354,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_HAS_AUDIO,
g_param_spec_boolean ("has-audio",
- NULL, NULL,
+ "Has audio",
+ "Has audio",
FALSE,
G_PARAM_READWRITE));
/**
@@ -364,7 +368,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_HAS_VIDEO,
g_param_spec_boolean ("has-video",
- NULL, NULL,
+ "Has video",
+ "Has video",
FALSE,
G_PARAM_READWRITE));
@@ -378,21 +383,23 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_LIVE,
g_param_spec_boolean ("live",
- NULL, NULL,
+ "Live",
+ "Live",
FALSE,
G_PARAM_READWRITE));
/**
* ParoleStream:media-type:
*
- *
+ * The media type.
*
* Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_MEDIA_TYPE,
g_param_spec_enum ("media-type",
- NULL, NULL,
+ "Media type",
+ "Media type",
PAROLE_ENUM_TYPE_MEDIA_TYPE,
PAROLE_MEDIA_TYPE_UNKNOWN,
G_PARAM_READWRITE));
@@ -408,7 +415,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_SEEKABLE,
g_param_spec_boolean ("seekable",
- NULL, NULL,
+ "Seekable",
+ "Seekable",
FALSE,
G_PARAM_READWRITE));
@@ -422,7 +430,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_DURATION,
g_param_spec_double("duration",
- NULL, NULL,
+ "Duration",
+ "Duration",
0, G_MAXDOUBLE,
0,
G_PARAM_READWRITE));
@@ -437,7 +446,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_SEEKABLE,
g_param_spec_boolean ("tag-available",
- NULL, NULL,
+ "Tag available",
+ "Tag available",
FALSE,
G_PARAM_READWRITE));
@@ -451,7 +461,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_ABSOLUTE_DURATION,
g_param_spec_int64 ("absolute-duration",
- NULL, NULL,
+ "Absolution duration",
+ "Absolution duration",
0, G_MAXINT64,
0,
G_PARAM_READWRITE));
@@ -466,7 +477,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_DISP_PAR_N,
g_param_spec_uint ("disp-par-n",
- NULL, NULL,
+ "Disp par n",
+ "Disp par n",
1, G_MAXUINT,
1,
G_PARAM_READWRITE));
@@ -481,7 +493,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_DISP_PAR_D,
g_param_spec_uint ("disp-par-d",
- NULL, NULL,
+ "Disp par d",
+ "Disp par d",
1, G_MAXUINT,
1,
G_PARAM_READWRITE));
@@ -496,7 +509,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_VIDEO_WIDTH,
g_param_spec_int ("video-width",
- NULL, NULL,
+ "Video width",
+ "Video width",
0, G_MAXINT,
0,
G_PARAM_READWRITE));
@@ -511,7 +525,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_VIDEO_HEIGHT,
g_param_spec_int ("video-height",
- NULL, NULL,
+ "Video height",
+ "Video height",
0, G_MAXINT,
0,
G_PARAM_READWRITE));
@@ -527,7 +542,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_TRACKS,
g_param_spec_uint ("num-tracks",
- NULL, NULL,
+ "Num tracks",
+ "Number of tracks in the audio disc",
1, 99,
1,
G_PARAM_READWRITE));
@@ -535,13 +551,16 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:track:
*
+ * Currently playing track, this is only valid if
+ * #ParoleStream:media-type: is PAROLE_MEDIA_TYPE_CDDA.
*
* Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_TRACK,
g_param_spec_uint ("track",
- NULL, NULL,
+ "Track",
+ "Track",
1, 99,
1,
G_PARAM_READWRITE));
@@ -555,7 +574,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_TITLE,
g_param_spec_string ("title",
- NULL, NULL,
+ "Title",
+ "Title",
NULL,
G_PARAM_READWRITE));
@@ -570,7 +590,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_ARTIST,
g_param_spec_string ("artist",
- NULL, NULL,
+ "Artist",
+ "Artist",
NULL,
G_PARAM_READWRITE));
@@ -584,7 +605,8 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_YEAR,
g_param_spec_string ("year",
- NULL, NULL,
+ "Year",
+ "Year",
NULL,
G_PARAM_READWRITE));
@@ -598,21 +620,23 @@ parole_stream_class_init (ParoleStreamClass *klass)
g_object_class_install_property (object_class,
PROP_ALBUM,
g_param_spec_string ("album",
- NULL, NULL,
+ "Album",
+ "Album",
NULL,
G_PARAM_READWRITE));
/**
* ParoleStream:comment:
*
- *
+ * Extra comment block.
*
* Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_COMMENT,
g_param_spec_string ("comment",
- NULL, NULL,
+ "Comment",
+ "Comment",
NULL,
G_PARAM_READWRITE));
diff --git a/plugins/properties/stream-properties-plugin.c b/plugins/properties/stream-properties-plugin.c
index f74c680..6f1477c 100644
--- a/plugins/properties/stream-properties-plugin.c
+++ b/plugins/properties/stream-properties-plugin.c
@@ -34,6 +34,7 @@ G_MODULE_EXPORT GType
parole_plugin_initialize (ParoleProviderPlugin *plugin)
{
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ stream_properties_register_type (plugin);
return STREAM_TYPE_PROPERTIES_PROVIDER;
}
diff --git a/plugins/properties/stream-properties-provider.c b/plugins/properties/stream-properties-provider.c
index 6538c4e..5420be8 100644
--- a/plugins/properties/stream-properties-provider.c
+++ b/plugins/properties/stream-properties-provider.c
@@ -64,11 +64,11 @@ struct _StreamProperties
};
-G_DEFINE_TYPE_WITH_CODE (StreamProperties,
- stream_properties,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
- stream_properties_iface_init));
+PAROLE_DEFINE_TYPE_WITH_CODE (StreamProperties,
+ stream_properties,
+ G_TYPE_OBJECT,
+ PAROLE_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
+ stream_properties_iface_init));
enum
{
diff --git a/plugins/properties/stream-properties-provider.h b/plugins/properties/stream-properties-provider.h
index 1896757..b396fc3 100644
--- a/plugins/properties/stream-properties-provider.h
+++ b/plugins/properties/stream-properties-provider.h
@@ -37,6 +37,8 @@ typedef struct _StreamProperties StreamProperties;
GType stream_properties_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void stream_properties_register_type (ParoleProviderPlugin *plugin);
+
G_END_DECLS
#endif /*STREAM_PROPERTIES_PROVIDER_H_*/
diff --git a/plugins/sample/sample-plugin.c b/plugins/sample/sample-plugin.c
index 5d7b6a2..5e19a2e 100644
--- a/plugins/sample/sample-plugin.c
+++ b/plugins/sample/sample-plugin.c
@@ -34,6 +34,7 @@ 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;
}
diff --git a/plugins/sample/sample-provider.c b/plugins/sample/sample-provider.c
index 57bf2ee..320d440 100644
--- a/plugins/sample/sample-provider.c
+++ b/plugins/sample/sample-provider.c
@@ -41,11 +41,11 @@ struct _SampleProvider
ParoleProviderPlayer *player;
};
-G_DEFINE_TYPE_WITH_CODE (SampleProvider,
- sample_provider,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
- sample_provider_iface_init));
+PAROLE_DEFINE_TYPE_WITH_CODE (SampleProvider,
+ sample_provider,
+ G_TYPE_OBJECT,
+ PAROLE_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
+ sample_provider_iface_init));
static gboolean sample_provider_is_configurable (ParoleProviderPlugin *plugin)
{
diff --git a/plugins/sample/sample-provider.h b/plugins/sample/sample-provider.h
index 21e16c9..afed842 100644
--- a/plugins/sample/sample-provider.h
+++ b/plugins/sample/sample-provider.h
@@ -37,6 +37,8 @@ typedef struct _SampleProvider SampleProvider;
GType sample_provider_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void sample_provider_register_type (ParoleProviderPlugin *plugin);
+
G_END_DECLS
#endif /*SAMPLE_PROVIDER_H_*/
diff --git a/plugins/tray/tray-plugin.c b/plugins/tray/tray-plugin.c
index 595e5c6..9318232 100644
--- a/plugins/tray/tray-plugin.c
+++ b/plugins/tray/tray-plugin.c
@@ -34,6 +34,9 @@ G_MODULE_EXPORT GType
parole_plugin_initialize (ParoleProviderPlugin *plugin)
{
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+
+ tray_provider_register_type (plugin);
+
return TRAY_TYPE_PROVIDER;
}
diff --git a/plugins/tray/tray-provider.c b/plugins/tray/tray-provider.c
index 2c13ae1..70e003e 100644
--- a/plugins/tray/tray-provider.c
+++ b/plugins/tray/tray-provider.c
@@ -64,11 +64,11 @@ struct _TrayProvider
GtkWidget *menu;
};
-G_DEFINE_TYPE_WITH_CODE (TrayProvider,
- tray_provider,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
- tray_provider_iface_init));
+PAROLE_DEFINE_TYPE_WITH_CODE (TrayProvider,
+ tray_provider,
+ G_TYPE_OBJECT,
+ PAROLE_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
+ tray_provider_iface_init));
static void
menu_selection_done_cb (TrayProvider *tray)
@@ -587,6 +587,8 @@ static void tray_provider_finalize (GObject *object)
tray = TRAY_PROVIDER (object);
+ g_debug ("Finalize tray provider");
+
if ( GTK_IS_WIDGET (tray->window) && g_signal_handler_is_connected (tray->window, tray->sig) )
g_signal_handler_disconnect (tray->window, tray->sig);
diff --git a/plugins/tray/tray-provider.h b/plugins/tray/tray-provider.h
index fa429b4..f5ae4cc 100644
--- a/plugins/tray/tray-provider.h
+++ b/plugins/tray/tray-provider.h
@@ -37,6 +37,8 @@ typedef struct _TrayProvider TrayProvider;
GType tray_provider_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tray_provider_register_type (ParoleProviderPlugin *provider);
+
G_END_DECLS
#endif /*TRAY_PROVIDER_H_*/
diff --git a/plugins/window-title/window-title-plugin.c b/plugins/window-title/window-title-plugin.c
index 917fd5e..d702b13 100644
--- a/plugins/window-title/window-title-plugin.c
+++ b/plugins/window-title/window-title-plugin.c
@@ -35,6 +35,8 @@ parole_plugin_initialize (ParoleProviderPlugin *plugin)
{
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ window_title_provider_register_type (plugin);
+
return WINDOW_TYPE_TITLE_PROVIDER;
}
diff --git a/plugins/window-title/window-title-provider.c b/plugins/window-title/window-title-provider.c
index e2b92ea..4f79c64 100644
--- a/plugins/window-title/window-title-provider.c
+++ b/plugins/window-title/window-title-provider.c
@@ -44,11 +44,11 @@ struct _WindowTitleProvider
};
-G_DEFINE_TYPE_WITH_CODE (WindowTitleProvider,
- window_title_provider,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
- window_title_provider_iface_init));
+PAROLE_DEFINE_TYPE_WITH_CODE (WindowTitleProvider,
+ window_title_provider,
+ G_TYPE_OBJECT,
+ PAROLE_IMPLEMENT_INTERFACE (PAROLE_TYPE_PROVIDER_PLUGIN,
+ window_title_provider_iface_init));
@@ -129,6 +129,7 @@ static void window_title_provider_class_init (WindowTitleProviderClass *klass)
static void window_title_provider_init (WindowTitleProvider *provider)
{
provider->player = NULL;
+ g_debug ("Init");
}
static void window_title_provider_finalize (GObject *object)
diff --git a/plugins/window-title/window-title-provider.h b/plugins/window-title/window-title-provider.h
index dd0bdd0..aa9f14a 100644
--- a/plugins/window-title/window-title-provider.h
+++ b/plugins/window-title/window-title-provider.h
@@ -37,6 +37,8 @@ typedef struct _WindowTitleProvider WindowTitleProvider;
GType window_title_provider_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void window_title_provider_register_type (ParoleProviderPlugin *plugin);
+
G_END_DECLS
#endif /*WINDOW_TITLE_PROVIDER_H_*/
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 47f1622..5b63f20 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -1047,7 +1047,7 @@ parole_media_list_init (ParoleMediaList *list)
}
GtkWidget *
-parole_media_list_new (void)
+parole_media_list_get (void)
{
static gpointer list = NULL;
diff --git a/src/parole-medialist.h b/src/parole-medialist.h
index 17d7fb0..821dd11 100644
--- a/src/parole-medialist.h
+++ b/src/parole-medialist.h
@@ -64,7 +64,7 @@ typedef struct
GType parole_media_list_get_type (void) G_GNUC_CONST;
-GtkWidget *parole_media_list_new (void);
+GtkWidget *parole_media_list_get (void);
void parole_media_list_load (ParoleMediaList *list);
diff --git a/src/parole-module.c b/src/parole-module.c
index 5cad077..1cc3a2d 100644
--- a/src/parole-module.c
+++ b/src/parole-module.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <parole/parole-provider-plugin.h>
+#include <libxfce4util/libxfce4util.h>
#include "parole-module.h"
@@ -93,11 +94,9 @@ parole_module_load (GTypeModule *gtype_module)
return FALSE;
}
- module->player = parole_plugin_player_new ();
+ TRACE ("Loading module %s", gtype_module->name);
module->provider_type = (*module->initialize) (module);
- module->instance = g_object_new (module->provider_type, NULL);
- parole_provider_plugin_set_player (PAROLE_PROVIDER_PLUGIN (module->instance), PAROLE_PROVIDER_PLAYER (module->player));
module->active = TRUE;
return TRUE;
@@ -110,8 +109,7 @@ parole_module_unload (GTypeModule *gtype_module)
module = PAROLE_PROVIDER_MODULE (gtype_module);
- g_object_unref (G_OBJECT (module->instance));
- g_object_unref (module->player);
+ TRACE ("Unloading module %s", gtype_module->name);
(*module->shutdown) ();
@@ -123,8 +121,6 @@ parole_module_unload (GTypeModule *gtype_module)
module->provider_type = G_TYPE_INVALID;
module->active = FALSE;
- module->player = NULL;
- module->instance = NULL;
}
static gboolean
@@ -179,3 +175,34 @@ parole_provider_module_new (const gchar *filename, const gchar *desktop_file)
return module;
}
+
+
+void parole_provider_module_new_plugin (ParoleProviderModule *module)
+{
+ TRACE ("start");
+#ifdef debug
+ g_return_if_fail (module->active == TRUE);
+ g_return_if_fail (module->instance == NULL);
+ g_return_if_fail (module->player == NULL);
+#endif
+
+ module->instance = g_object_new (module->provider_type, NULL);
+ module->player = parole_plugin_player_new ();
+ parole_provider_plugin_set_player (PAROLE_PROVIDER_PLUGIN (module->instance), PAROLE_PROVIDER_PLAYER (module->player));
+}
+
+void parole_provider_module_free_plugin (ParoleProviderModule *module)
+{
+ TRACE ("start");
+ if ( module->instance )
+ {
+ g_object_unref (module->instance);
+ module->instance = NULL;
+ }
+
+ if ( module->player )
+ {
+ g_object_unref (module->player);
+ module->player = NULL;
+ }
+}
diff --git a/src/parole-module.h b/src/parole-module.h
index 1972fac..1f9603b 100644
--- a/src/parole-module.h
+++ b/src/parole-module.h
@@ -65,6 +65,10 @@ GType parole_provider_module_get_type (void) G_GNUC_CONST;
ParoleProviderModule *parole_provider_module_new (const gchar *filename,
const gchar *desktop_file);
+void parole_provider_module_new_plugin (ParoleProviderModule *module);
+
+void parole_provider_module_free_plugin (ParoleProviderModule *module);
+
G_END_DECLS
#endif /* __PAROLE_MODULE_H */
diff --git a/src/parole-player.c b/src/parole-player.c
index c174810..a4bcd5b 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -1691,7 +1691,7 @@ parole_player_init (ParolePlayer *player)
player->priv->disc_menu = parole_disc_menu_new ();
player->priv->screen_saver = parole_screen_saver_new ();
- player->priv->list = PAROLE_MEDIA_LIST (parole_media_list_new ());
+ player->priv->list = PAROLE_MEDIA_LIST (parole_media_list_get ());
player->priv->state = PAROLE_MEDIA_STATE_STOPPED;
player->priv->user_seeking = FALSE;
diff --git a/src/parole-plugin-player.c b/src/parole-plugin-player.c
index d154cd2..8d0a739 100644
--- a/src/parole-plugin-player.c
+++ b/src/parole-plugin-player.c
@@ -30,6 +30,7 @@
#include "parole-plugin-player.h"
#include "parole-plugins-manager.h"
+#include "parole-medialist.h"
#include "gst/parole-gst.h"
@@ -81,10 +82,97 @@ parole_plugin_player_pack_widget (ParoleProviderPlayer *provider, GtkWidget *wid
parole_plugins_manager_pack (manager, widget, title, container_type);
}
+static ParoleState
+parole_plugin_player_get_state (ParoleProviderPlayer *provider)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ return parole_gst_get_state (PAROLE_GST (player->priv->gst));
+}
+
+static gboolean
+parole_plugin_player_play_uri (ParoleProviderPlayer *provider, const gchar *uri)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ parole_gst_play_uri (PAROLE_GST (player->priv->gst), uri, NULL);
+
+ return TRUE;
+}
+
+static gboolean
+parole_plugin_player_pause (ParoleProviderPlayer *provider)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ parole_gst_pause (PAROLE_GST (player->priv->gst));
+
+ return TRUE;
+}
+
+static gboolean
+parole_plugin_player_resume (ParoleProviderPlayer *provider)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ parole_gst_resume (PAROLE_GST (player->priv->gst));
+
+ return TRUE;
+}
+
+static gboolean
+parole_plugin_player_stop (ParoleProviderPlayer *provider)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ parole_gst_stop (PAROLE_GST (player->priv->gst));
+
+ return TRUE;
+}
+
+static gboolean
+parole_plugin_player_seek (ParoleProviderPlayer *provider, gdouble pos)
+{
+ ParolePluginPlayer *player;
+
+ player = PAROLE_PLUGIN_PLAYER (provider);
+
+ parole_gst_seek (PAROLE_GST (player->priv->gst), pos);
+
+ return TRUE;
+}
+
+static void parole_plugin_player_open_media_chooser (ParoleProviderPlayer *provider)
+{
+ ParoleMediaList *list;
+
+ list = PAROLE_MEDIA_LIST (parole_media_list_get ());
+ parole_media_list_open (list);
+
+ g_object_unref (list);
+}
+
static void parole_plugin_player_iface_init (ParoleProviderPlayerIface *iface)
{
iface->get_main_window = parole_plugin_player_get_main_window;
iface->pack = parole_plugin_player_pack_widget;
+ iface->get_state = parole_plugin_player_get_state;
+ iface->play_uri = parole_plugin_player_play_uri;
+ iface->pause = parole_plugin_player_pause;
+ iface->resume = parole_plugin_player_resume;
+ iface->stop = parole_plugin_player_stop;
+ iface->seek = parole_plugin_player_seek;
+ iface->open_media_chooser = parole_plugin_player_open_media_chooser;
}
static void
diff --git a/src/parole-plugins-manager.c b/src/parole-plugins-manager.c
index 7db3689..1d73bf1 100644
--- a/src/parole-plugins-manager.c
+++ b/src/parole-plugins-manager.c
@@ -250,9 +250,15 @@ parole_plugins_manager_cell_toggled_cb (GtkCellRendererToggle *cell_renderer,
if ( pref->manager->priv->load_plugins )
{
if ( active )
+ {
g_type_module_use (G_TYPE_MODULE (module));
+ parole_provider_module_new_plugin (module);
+ }
else
+ {
+ parole_provider_module_free_plugin (module);
g_type_module_unuse (G_TYPE_MODULE (module));
+ }
}
gtk_list_store_set (GTK_LIST_STORE (pref->store), &iter,
@@ -313,9 +319,10 @@ parole_plugins_manager_unload_all (gpointer data, gpointer user_data)
module = PAROLE_PROVIDER_MODULE (data);
if ( parole_provider_plugin_get_is_active (PAROLE_PROVIDER_PLUGIN (module)) )
{
+ parole_provider_module_free_plugin (module);
g_type_module_unuse (G_TYPE_MODULE (data));
}
- g_object_unref (G_OBJECT (module));
+ //g_object_unref (module);
}
#if !GTK_CHECK_VERSION (2, 18, 0)
@@ -566,6 +573,10 @@ parole_plugins_manager_load_plugins (ParolePluginsManager *manager)
g_ptr_array_remove (manager->priv->array, module);
g_object_unref (module);
}
+ else
+ {
+ parole_provider_module_new_plugin (PAROLE_PROVIDER_MODULE (module));
+ }
break;
}
}
More information about the Xfce4-commits
mailing list