diff options
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | rhythmbox-libzg/Makefile.am | 44 | ||||
-rw-r--r-- | rhythmbox-libzg/headers/rb-plugin.h | 215 | ||||
-rw-r--r-- | rhythmbox-libzg/headers/rb-shell.h | 171 | ||||
-rw-r--r-- | rhythmbox-libzg/rhythmbox-recent-plugin.vala | 23 | ||||
-rw-r--r-- | rhythmbox-libzg/vapi/rb.deps | 3 | ||||
-rw-r--r-- | rhythmbox-libzg/vapi/rb.vapi | 93 | ||||
-rw-r--r-- | rhythmbox-libzg/vapi/rhythmdb.deps | 1 | ||||
-rw-r--r-- | rhythmbox-libzg/vapi/rhythmdb.vapi | 3 | ||||
-rw-r--r-- | rhythmbox-libzg/zeitgeist-recent.rb-plugin | 8 |
10 files changed, 577 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index bfbea94..8c828f3 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,7 @@ AC_ARG_ENABLE([all-plugins], AC_MSG_RESULT($all_plugins) # The full list of plugins -allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg" +allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox rhythmbox-libzg totem-libzg" # currently disabled = "epiphany tomboy" # npapi-plugin has a template Makefile.am, but don't use it directly @@ -131,6 +131,20 @@ for plugin in ${used_plugins}; do ;; rhythmbox) ;; + rhythmbox-libzg) + if test "${with_vala}" != "yes" ; then + plugin_error_or_ignore "you need vala installed to use the ${plugin} plugin" + continue + fi + if test "${HAVE_LIBZG}" != "yes" ; then + plugin_error_or_ignore "libzeitgeist not found" + continue + fi + if test "${HAVE_GTK}" != "yes" ; then + plugin_error_or_ignore "gtk+-2.0 not found" + continue + fi + ;; tomboy) # not supported atm continue @@ -189,6 +203,7 @@ firefox-libzg/extension/components/Makefile geany/Makefile gedit/Makefile rhythmbox/Makefile +rhythmbox-libzg/Makefile totem-libzg/Makefile ]) diff --git a/rhythmbox-libzg/Makefile.am b/rhythmbox-libzg/Makefile.am new file mode 100644 index 0000000..9cb1719 --- /dev/null +++ b/rhythmbox-libzg/Makefile.am @@ -0,0 +1,44 @@ +totemplugindir = $(libdir)/rhythmbox/plugins/zeitgeist-recent +totemplugin_DATA = zeitgeist-recent.rb-plugin +totemplugin_LTLIBRARIES = libzeitgeist-recent-plugin.la + +AM_VALAFLAGS = \ + --pkg zeitgeist-1.0 \ + --vapidir=./vapi \ + --pkg rb \ + --pkg rhythmdb \ + $(NULL) + +libzeitgeist_recent_plugin_la_SOURCES = \ + rhythmbox-recent-plugin.vala +libzeitgeist_recent_plugin_la_CFLAGS = \ + -fPIC -Wall -std=c99 \ + $(ZEITGEIST_CFLAGS) \ + $(GTK_CFLAGS) \ + -I./headers \ + $(NULL) + +libzeitgeist_recent_plugin_la_LIBADD = \ + $(ZEITGEIST_LIBS) \ + $(GTK_LIBS) \ + $(NULL) +libzeitgeist_recent_plugin_la_LDFLAGS = \ + -module -avoid-version \ + $(NULL) + + +# we want to allow also local install +PLUGIN_FILES = \ + zeitgeist-recent.rb-plugin \ + ./.libs/libzeitgeist-recent-plugin.so + +TOTEM_PLUGIN_HOME_DIR = ~/.local/share/totem/plugins/zeitgeist-recent + +local-install: + mkdir -p $(TOTEM_PLUGIN_HOME_DIR) + cp $(PLUGIN_FILES) $(TOTEM_PLUGIN_HOME_DIR) + +local-uninstall: + echo Removing $(TOTEM_PLUGIN_HOME_DIR) + rm -rf $(TOTEM_PLUGIN_HOME_DIR) + diff --git a/rhythmbox-libzg/headers/rb-plugin.h b/rhythmbox-libzg/headers/rb-plugin.h new file mode 100644 index 0000000..d94195e --- /dev/null +++ b/rhythmbox-libzg/headers/rb-plugin.h @@ -0,0 +1,215 @@ +/* + * heavily based on code from Gedit + * + * Copyright (C) 2002-2005 - Paolo Maggi + * + * 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. + * + * The Rhythmbox authors hereby grant permission for non-GPL compatible + * GStreamer plugins to be used and distributed together with GStreamer + * and Rhythmbox. This permission is above and beyond the permissions granted + * by the GPL license by which Rhythmbox is covered. If you modify this code + * you may extend this exception to your version of the code, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your 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 St, Fifth Floor, + * Boston, MA 02110-1301 USA. + */ + +#ifndef __RB_PLUGIN_H__ +#define __RB_PLUGIN_H__ + +#include <glib-object.h> + +#include <shell/rb-shell.h> + +G_BEGIN_DECLS + +/* + * Type checking and casting macros + */ +#define RB_TYPE_PLUGIN (rb_plugin_get_type()) +#define RB_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RB_TYPE_PLUGIN, RBPlugin)) +#define RB_PLUGIN_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RB_TYPE_PLUGIN, RBPlugin const)) +#define RB_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RB_TYPE_PLUGIN, RBPluginClass)) +#define RB_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RB_TYPE_PLUGIN)) +#define RB_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RB_TYPE_PLUGIN)) +#define RB_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RB_TYPE_PLUGIN, RBPluginClass)) + +/* + * Main object structure + */ + +typedef struct _RBPlugin RBPlugin; +typedef struct _RBPluginClass RBPluginClass; + +struct _RBPlugin +{ + GObject parent; +}; + +typedef void (*RBPluginActivationFunc) (RBPlugin *plugin, RBShell *shell); +typedef GtkWidget * (*RBPluginWidgetFunc) (RBPlugin *plugin); +typedef gboolean (*RBPluginBooleanFunc) (RBPlugin *plugin); + +/* + * Class definition + */ +struct _RBPluginClass +{ + GObjectClass parent_class; + + /* Virtual public methods */ + + RBPluginActivationFunc activate; + RBPluginActivationFunc deactivate; + RBPluginWidgetFunc create_configure_dialog; + + /* Plugins should not override this, it's handled automatically by + the RbPluginClass */ + RBPluginBooleanFunc is_configurable; +}; + +/* + * Public methods + */ +GType rb_plugin_get_type (void) G_GNUC_CONST; + +void rb_plugin_activate (RBPlugin *plugin, + RBShell *shell); +void rb_plugin_deactivate (RBPlugin *plugin, + RBShell *shell); + +gboolean rb_plugin_is_configurable (RBPlugin *plugin); +GtkWidget *rb_plugin_create_configure_dialog + (RBPlugin *plugin); + +char * rb_plugin_find_file (RBPlugin *plugin, + const char *file); + +GList * rb_get_plugin_paths (void); + +/* + * Utility macro used to register plugins + * + * use: RB_PLUGIN_REGISTER(RBSamplePlugin, rb_sample_plugin) + */ + +#define RB_PLUGIN_REGISTER(PluginName, plugin_name) \ + \ +static GType plugin_name##_type = 0; \ +static GTypeModule *plugin_module_type = 0; \ + \ +GType \ +plugin_name##_get_type (void) \ +{ \ + return plugin_name##_type; \ +} \ + \ +static void plugin_name##_init (PluginName *self); \ +static void plugin_name##_class_init (PluginName##Class *klass); \ +static gpointer plugin_name##_parent_class = NULL; \ +static void plugin_name##_class_intern_init (gpointer klass) \ +{ \ + plugin_name##_parent_class = g_type_class_peek_parent (klass); \ + plugin_name##_class_init ((PluginName##Class *) klass); \ +} \ + \ +G_MODULE_EXPORT GType \ +register_rb_plugin (GTypeModule *module) \ +{ \ + const GTypeInfo our_info = \ + { \ + sizeof (PluginName##Class), \ + NULL, /* base_init */ \ + NULL, /* base_finalize */ \ + (GClassInitFunc) plugin_name##_class_intern_init, \ + NULL, \ + NULL, /* class_data */ \ + sizeof (PluginName), \ + 0, /* n_preallocs */ \ + (GInstanceInitFunc) plugin_name##_init \ + }; \ + \ + rb_debug ("Registering plugin %s", #PluginName); \ + \ + /* Initialise the i18n stuff */ \ + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \ + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \ + \ + plugin_module_type = module; \ + plugin_name##_type = g_type_module_register_type (module, \ + RB_TYPE_PLUGIN, \ + #PluginName, \ + &our_info, \ + 0); \ + return plugin_name##_type; \ +} + +#define RB_PLUGIN_REGISTER_TYPE(type_name) \ + type_name##_register_type (plugin_module_type) + +#define RB_PLUGIN_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \ +static void type_name##_init (TypeName *self); \ +static void type_name##_class_init (TypeName##Class *klass); \ +static gpointer type_name##_parent_class = ((void *)0); \ +static GType type_name##_type_id = 0; \ + \ +static void \ +type_name##_class_intern_init (gpointer klass) \ +{ \ + type_name##_parent_class = g_type_class_peek_parent (klass); \ + type_name##_class_init ((TypeName##Class*) klass); \ +} \ + \ + \ +GType \ +type_name##_get_type (void) \ +{ \ + g_assert (type_name##_type_id != 0); \ + \ + return type_name##_type_id; \ +} \ + \ +GType \ +type_name##_register_type (GTypeModule *module) \ +{ \ + \ + if ((type_name##_type_id == 0)) { \ + const GTypeInfo g_define_type_info = { \ + sizeof (TypeName##Class), \ + (GBaseInitFunc) ((void *)0), \ + (GBaseFinalizeFunc) ((void *)0), \ + (GClassInitFunc) type_name##_class_intern_init, \ + (GClassFinalizeFunc) ((void *)0), \ + ((void *)0), \ + sizeof (TypeName), \ + 0, \ + (GInstanceInitFunc) type_name##_init, \ + ((void *)0) \ + }; \ + type_name##_type_id = \ + g_type_module_register_type (module, \ + TYPE_PARENT, \ + #TypeName, \ + &g_define_type_info, \ + (GTypeFlags) 0); \ + } \ + \ + return type_name##_type_id; \ +} + +G_END_DECLS + +#endif /* __RB_PLUGIN_H__ */ diff --git a/rhythmbox-libzg/headers/rb-shell.h b/rhythmbox-libzg/headers/rb-shell.h new file mode 100644 index 0000000..945c9f4 --- /dev/null +++ b/rhythmbox-libzg/headers/rb-shell.h @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2002 Jorn Baayen + * Copyright (C) 2004 Colin Walters <walters@redhat.com> + * + * 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, or (at your option) + * any later version. + * + * The Rhythmbox authors hereby grant permission for non-GPL compatible + * GStreamer plugins to be used and distributed together with GStreamer + * and Rhythmbox. This permission is above and beyond the permissions granted + * by the GPL license by which Rhythmbox is covered. If you modify this code + * you may extend this exception to your version of the code, but you are not + * obligated to do so. If you do not wish to do so, delete this exception + * statement from your 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 St, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __RB_SHELL_H +#define __RB_SHELL_H + +#include <sources/rb-source.h> +#include <rhythmdb/rhythmdb.h> +#include <widgets/rb-song-info.h> + +G_BEGIN_DECLS + +#define RB_TYPE_SHELL (rb_shell_get_type ()) +#define RB_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_SHELL, RBShell)) +#define RB_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_SHELL, RBShellClass)) +#define RB_IS_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_SHELL)) +#define RB_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SHELL)) +#define RB_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SHELL, RBShellClass)) + +enum +{ + RB_SHELL_ERROR_NO_SUCH_URI, + RB_SHELL_ERROR_NO_SUCH_PROPERTY, + RB_SHELL_ERROR_IMMUTABLE_PROPERTY, + RB_SHELL_ERROR_INVALID_PROPERTY_TYPE, + RB_SHELL_ERROR_NO_SOURCE_FOR_URI +}; + +#define RB_SHELL_ERROR rb_shell_error_quark () + +GQuark rb_shell_error_quark (void); + +typedef enum +{ + RB_SHELL_UI_LOCATION_SIDEBAR, + RB_SHELL_UI_LOCATION_RIGHT_SIDEBAR, + RB_SHELL_UI_LOCATION_MAIN_TOP, + RB_SHELL_UI_LOCATION_MAIN_BOTTOM, + RB_SHELL_UI_LOCATION_MAIN_NOTEBOOK +} RBShellUILocation; + +GType rb_shell_ui_location_get_type (void); +#define RB_TYPE_SHELL_UI_LOCATION (rb_shell_ui_location_get_type()) + +typedef struct _RBShell RBShell; +typedef struct _RBShellClass RBShellClass; +typedef struct _RBShellPrivate RBShellPrivate; + +struct _RBShell +{ + GObject parent; + + RBShellPrivate *priv; +}; + +struct _RBShellClass +{ + GObjectClass parent_class; + + /* signals */ + gboolean (*visibility_changing) (RBShell *shell, gboolean initial, gboolean visible); + void (*visibility_changed) (RBShell *shell, gboolean visible); + void (*create_song_info) (RBShell *shell, RBSongInfo *song_info, gboolean multi); + void (*removable_media_scan_finished) (RBShell *shell); +}; + +GType rb_shell_get_type (void); + +RBShell * rb_shell_new (gboolean no_registration, + gboolean no_update, + gboolean dry_run, + char *rhythmdb, + char *playlists); + +gboolean rb_shell_present (RBShell *shell, guint32 timestamp, GError **error); + +RBSource * rb_shell_guess_source_for_uri (RBShell *shell, const char *uri); + +gboolean rb_shell_add_uri (RBShell *shell, + const char *uri, + const char *title, + const char *genre, + GError **error); + +gboolean rb_shell_load_uri (RBShell *shell, const char *uri, gboolean play, GError **error); + +GObject * rb_shell_get_player (RBShell *shell); +const char * rb_shell_get_player_path(RBShell *shell); +GObject * rb_shell_get_playlist_manager (RBShell *shell); +const char * rb_shell_get_playlist_manager_path (RBShell *shell); +GObject * rb_shell_get_ui_manager (RBShell *shell); + +void rb_shell_toggle_visibility (RBShell *shell); + +gboolean rb_shell_get_song_properties (RBShell *shell, + const char *uri, + GHashTable **properties, + GError **error); + +gboolean rb_shell_set_song_property (RBShell *shell, + const char *uri, + const char *propname, + const GValue *value, + GError **error); + +gboolean rb_shell_add_to_queue (RBShell *shell, + const gchar *uri, + GError **error); + +gboolean rb_shell_remove_from_queue (RBShell *shell, + const gchar *uri, + GError **error); + +gboolean rb_shell_clear_queue (RBShell *shell, + GError **error); + +gboolean rb_shell_quit (RBShell *shell, + GError **error); + +void rb_shell_notify_custom (RBShell *shell, + guint timeout, + const char *primary, + const char *secondary, + GdkPixbuf *pixbuf, + gboolean requested); +gboolean rb_shell_do_notify (RBShell *shell, + gboolean requested, + GError **error); + +void rb_shell_register_entry_type_for_source (RBShell *shell, + RBSource *source, + RhythmDBEntryType type); +RBSource * rb_shell_get_source_by_entry_type (RBShell *shell, + RhythmDBEntryType type); + +gboolean rb_shell_get_party_mode (RBShell *shell); + +void rb_shell_append_source (RBShell *shell, RBSource *source, RBSource *parent); + +void rb_shell_add_widget (RBShell *shell, GtkWidget *widget, RBShellUILocation location, gboolean expand, gboolean fill); +void rb_shell_remove_widget (RBShell *shell, GtkWidget *widget, RBShellUILocation location); +void rb_shell_notebook_set_page (RBShell *shell, GtkWidget *widget); + +G_END_DECLS + +#endif /* __RB_SHELL_H */ diff --git a/rhythmbox-libzg/rhythmbox-recent-plugin.vala b/rhythmbox-libzg/rhythmbox-recent-plugin.vala new file mode 100644 index 0000000..1b56fd4 --- /dev/null +++ b/rhythmbox-libzg/rhythmbox-recent-plugin.vala @@ -0,0 +1,23 @@ +using RB; + +class ZeitgeistRecentPlugin: RB.Plugin { + private Zeitgeist.Log zg_log; + private unowned RB.Shell rb_shell; + + public override void activate (RB.Shell shell) { + zg_log = new Zeitgeist.Log (); + rb_shell = shell; + } + + public override void deactivate (RB.Shell shell) { + rb_shell = null; + } + +} + +[ModuleInit] +public GLib.Type register_rb_plugin (GLib.TypeModule module) +{ + return typeof (ZeitgeistRecentPlugin); +} + diff --git a/rhythmbox-libzg/vapi/rb.deps b/rhythmbox-libzg/vapi/rb.deps new file mode 100644 index 0000000..82116cf --- /dev/null +++ b/rhythmbox-libzg/vapi/rb.deps @@ -0,0 +1,3 @@ +gtk+-2.0 +gstreamer-0.10 +rhythmdb diff --git a/rhythmbox-libzg/vapi/rb.vapi b/rhythmbox-libzg/vapi/rb.vapi new file mode 100644 index 0000000..c23ee77 --- /dev/null +++ b/rhythmbox-libzg/vapi/rb.vapi @@ -0,0 +1,93 @@ +[Import ()] +[CCode (cprefix = "RB", lower_case_cprefix = "rb_")] + +namespace RB { + [CCode (cheader_filename = "rb-shell.h")] + public class Shell { + [CCode (array_length = false)] + [CCode (cname = "rb_shell_get_type")] + public static GLib.Type get_type (); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_get_player")] + public unowned ShellPlayer get_player (); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_get_ui_manager")] + public unowned GLib.Object get_ui_manager(); + } + + [CCode (cheader_filename = "rb-plugin.h")] + public abstract class Plugin : GLib.Object { + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_get_type")] + public static GLib.Type get_type (); + + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_activate")] + public abstract void activate (RB.Shell shell); + + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_deactivate")] + public abstract void deactivate (RB.Shell shell); + + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_is_configurable")] + public virtual bool is_configurable (); + + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_create_configure_dialog")] + public virtual Gtk.Widget create_configure_dialog (); + + [CCode (array_length = false)] + [CCode (cname = "rb_plugin_find_file")] + public virtual unowned string find_file (string file); + } + + [CCode (cheader_filename = "rb-player-gst-filter.h")] + public interface PlayerGstFilter : GLib.Object { + [CCode (array_length = false)] + [CCode (cname = "rb_player_gst_filter_add_filter")] + public virtual bool add_filter(Gst.Element e); + + [CCode (array_length = false)] + [CCode (cname = "rb_player_gst_filter_remove_filter")] + public virtual bool remove_filter(Gst.Element e); + } + + [NoCompact, CCode (cheader_filename = "rb-shell-player.h")] + public class ShellPlayer : Gtk.HBox { + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_pause")] + public bool pause(ref GLib.Error? err = null); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_play")] + public bool play(ref GLib.Error? err = null); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_stop")] + public bool stop(); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_get_playing")] + public bool get_playing(ref bool playing, ref GLib.Error? err = null); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_do_next")] + public bool do_next(ref GLib.Error? err = null); + + [CCode (array_length = false)] + [CCode (cname = "rb_shell_player_do_previous")] + public bool do_previous(ref GLib.Error? err = null); + + public virtual signal void playing_changed(bool playing); + } + + [CCode (cheader_filename = "rb-player.h")] + public interface Player : GLib.Object { + [CCode (cname = "rb_player_opened")] + public bool opened(); + } +} diff --git a/rhythmbox-libzg/vapi/rhythmdb.deps b/rhythmbox-libzg/vapi/rhythmdb.deps new file mode 100644 index 0000000..24a2237 --- /dev/null +++ b/rhythmbox-libzg/vapi/rhythmdb.deps @@ -0,0 +1 @@ +gtk+-2.0 diff --git a/rhythmbox-libzg/vapi/rhythmdb.vapi b/rhythmbox-libzg/vapi/rhythmdb.vapi new file mode 100644 index 0000000..7ef3b78 --- /dev/null +++ b/rhythmbox-libzg/vapi/rhythmdb.vapi @@ -0,0 +1,3 @@ +[CCode (cheader_filename = "rhythmdb.h")] +namespace RhythmDB { +} diff --git a/rhythmbox-libzg/zeitgeist-recent.rb-plugin b/rhythmbox-libzg/zeitgeist-recent.rb-plugin new file mode 100644 index 0000000..f13fd86 --- /dev/null +++ b/rhythmbox-libzg/zeitgeist-recent.rb-plugin @@ -0,0 +1,8 @@ +[RB Plugin] +Module=zeitgeist-recent-plugin +IAge=1 +Name=Zeitgeist Recent +Description=Show playlist populated by Zeitgeist +Authors=Markus Korn <thekorn@gmx.de> +Copyright=Copyright © 2010 Markus Korn +Website=http://launchpad.net/~thekorn |