[rhythmbox] vala: extend bindings a bit (bug #581076)



commit 7234c0966deaa3743b30547e722a633beb7e640e
Author: Andrea Del Signore <sejerpz tin it>
Date:   Wed Aug 18 18:50:46 2010 +1000

    vala: extend bindings a bit (bug #581076)

 bindings/vala/rb.deps       |    1 +
 bindings/vala/rb.vapi       |   95 ++++++++++++++++++++++-------
 bindings/vala/rhythmdb.vapi |  143 ++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 215 insertions(+), 24 deletions(-)
---
diff --git a/bindings/vala/rb.deps b/bindings/vala/rb.deps
index 9775fd6..26d4d69 100644
--- a/bindings/vala/rb.deps
+++ b/bindings/vala/rb.deps
@@ -1,2 +1,3 @@
 gtk+-2.0
 rhythmdb
+gstreamer-0.10
diff --git a/bindings/vala/rb.vapi b/bindings/vala/rb.vapi
index c23ee77..ad6ecbf 100644
--- a/bindings/vala/rb.vapi
+++ b/bindings/vala/rb.vapi
@@ -1,84 +1,133 @@
-[Import ()]
 [CCode (cprefix = "RB", lower_case_cprefix = "rb_")]
-
 namespace RB {
-	[CCode (cheader_filename = "rb-shell.h")]
-	public class Shell {
-		[CCode (array_length = false)]
+	[CCode (cprefix = "RB_SHELL_UI_LOCATION_", cheader_filename = "rb-shell.h")]
+	public enum ShellUILocation {
+		SIDEBAR,
+		MAIN_TOP,
+		MAIN_BOTTOM,
+		MAIN_NOTEBOOK
+	}
+
+	[CCode (cheader_filename = "rb-shell.h", ref_function = "g_object_ref", unref_function = "g_object_unref")]
+	public class Shell : GLib.Object
+	{
 		[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();
+		public void add_widget (Gtk.Widget widget, RB.ShellUILocation location);
+		public void remove_widget (Gtk.Widget widget, RB.ShellUILocation location);
+		public GLib.Object get_ui_manager ();
+
+		[NoAccessorMethod]
+		public RhythmDB.DB db { owned get; }
+
+		public void append_source (RB.Source source, RB.Source? parent = null);
+
+		public void register_entry_type_for_source(RB.Source source, RhythmDB.EntryType entry_type);
 	}
 
 	[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);
 	}
 
+	public class Source : GLib.Object
+	{
+		[NoAccessorMethod]
+		public string name {
+			owned get; set;
+		}
+
+		[NoAccessorMethod]
+		public Gdk.Pixbuf icon {
+			get; set;
+		}
+
+		[NoAccessorMethod]
+		public RB.Shell shell {
+			owned get; construct set;
+		}
+
+		[NoAccessorMethod]
+		public bool visibility {
+			get; set;
+		}
+
+		[NoAccessorMethod]
+		public RhythmDB.EntryType entry_type {
+			get; construct set;
+		}
+
+		[NoAccessorMethod]
+		public RB.Plugin plugin {
+			get; construct set;
+		}
+
+		[HasEmitter]
+		public virtual signal void notify_status_changed ();
+
+		public virtual void impl_activate ();
+
+		public virtual void impl_deactivate ();
+
+		public virtual void impl_get_status (out string text, out string progress_text, out float progress);
+
+		public virtual void delete_thyself ();
+
+	}
+
+	[CCode(cheader_filename="rb-browser-source.h")]
+	public class BrowserSource : RB.Source
+	{
+
+	}
+
 	[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);
 
diff --git a/bindings/vala/rhythmdb.vapi b/bindings/vala/rhythmdb.vapi
index 7ef3b78..81f4fd8 100644
--- a/bindings/vala/rhythmdb.vapi
+++ b/bindings/vala/rhythmdb.vapi
@@ -1,3 +1,144 @@
 [CCode (cheader_filename = "rhythmdb.h")]
-namespace RhythmDB {
+namespace RhythmDB
+{
+	[CCode(cprefix="RHYTHMDB_ENTRY_")]
+	public enum EntryCategory
+	{
+		NORMAL,		/* anything that doesn't match the other categories */
+		STREAM,		/* endless streams (eg shoutcast, last.fm) */
+		CONTAINER,	/* things that point to other entries (eg podcast feeds) */
+		VIRTUAL		/* import errors, ignored files */
+	}
+
+	[CCode(cprefix="RHYTHMDB_ENTRY_AVAIL_")]
+	public enum EntryAvailability
+	{
+		CHECKED,
+		MOUNTED,
+		UNMOUNTED,
+		NOT_FOUND
+	}
+
+	[CCode(cprefix="RHYTHMDB_PROP_")]
+	public enum EntryPropType
+	{
+		TYPE = 0,
+		ENTRY_ID,
+		TITLE,
+		GENRE,
+		ARTIST,
+		ALBUM,
+		TRACK_NUMBER,
+		DISC_NUMBER,
+		DURATION,
+		FILE_SIZE,
+		LOCATION,
+		MOUNTPOINT,
+		MTIME,
+		FIRST_SEEN,
+		LAST_SEEN,
+		RATING,
+		PLAY_COUNT,
+		LAST_PLAYED,
+		BITRATE,
+		DATE,
+		TRACK_GAIN,			/* obsolete */
+		TRACK_PEAK,			/* obsolete */
+		ALBUM_GAIN,			/* obsolete */
+		ALBUM_PEAK,			/* obsolete */
+		MIMETYPE,
+		TITLE_SORT_KEY,
+		GENRE_SORT_KEY,
+		ARTIST_SORT_KEY,
+		ALBUM_SORT_KEY,
+		TITLE_FOLDED,
+		GENRE_FOLDED,
+		ARTIST_FOLDED,
+		ALBUM_FOLDED,
+		LAST_PLAYED_STR,
+		HIDDEN,
+		PLAYBACK_ERROR,
+		FIRST_SEEN_STR,
+		LAST_SEEN_STR,
+
+		/* synthetic properties */
+		SEARCH_MATCH,
+		YEAR,
+		KEYWORD, /**/
+
+		/* Podcast properties */
+		STATUS,
+		DESCRIPTION,
+		SUBTITLE,
+		SUMMARY,
+		LANG,
+		COPYRIGHT,
+		IMAGE,
+		POST_TIME,
+
+		MUSICBRAINZ_TRACKID,
+		MUSICBRAINZ_ARTISTID,
+		MUSICBRAINZ_ALBUMID,
+		MUSICBRAINZ_ALBUMARTISTID,
+		ARTIST_SORTNAME,
+		ALBUM_SORTNAME,
+
+		ARTIST_SORTNAME_SORT_KEY,
+		ARTIST_SORTNAME_FOLDED,
+		ALBUM_SORTNAME_SORT_KEY,
+		ALBUM_SORTNAME_FOLDED,
+
+		RHYTHMDB_NUM_PROPERTIES
+	}
+
+	[Compact]
+	public class EntryChange
+	{
+		EntryPropType prop;
+		GLib.Value old;
+		GLib.Value new;
+	}
+
+	[CCode(cname="RhythmDBEntryType")]
+	public class EntryType : GLib.Object
+	{
+		public string get_name ();
+		public void entry_created (Entry entry);
+		public void destroy_entry (Entry entry);
+		public unowned string get_playback_uri (Entry entry);
+		public void update_availability (Entry entry, EntryAvailability avail);
+		public bool can_sync_metadata (Entry entry);
+		public void sync_metadata (Entry entry, GLib.SList<EntryChange> changes, ref GLib.Error? err = null);
+	}
+
+	[Compact]
+	public class Entry
+	{
+
+	}
+
+	[CCode(cname="RhythmDB")]
+	public class DB : GLib.Object
+	{
+		[CCode(cname="rhythmdb_register_entry_type")]
+		public void register_entry_type (EntryType type);
+
+		[CCode(cname="rhythmdb_entry_new")]
+		public unowned Entry entry_new (EntryType type, string url);
+
+		[CCode(cname="rhythmdb_entry_get")]
+		public void entry_get (Entry entry, EntryPropType propid, out GLib.Value @value);
+
+		[CCode(cname="rhythmdb_entry_set")]
+		public void entry_set (Entry entry, EntryPropType propid, GLib.Value @value);
+
+		[CCode(cname="rhythmdb_entry_delete")]
+		public void entry_delete (Entry entry);
+
+		[CCode(cname="rhythmdb_entry_delete_by_type")]
+		public void entry_delete_by_type (EntryType entry_type);
+
+		[CCode(cname="rhythmdb_commit")]
+		public void commit ();
+	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]