diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/CMakeLists.txt noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/CMakeLists.txt --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/CMakeLists.txt 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/CMakeLists.txt 2015-07-20 19:59:51.000000000 +0000 @@ -86,12 +86,10 @@ set (DEPS_PACKAGES ${CORE_LIBRARY_NAME} ${CORE_PACKAGES} # this is needed until we provide a ${CORE_LIBRARY_NAME}.deps file - libgda-5.0 taglib_c ) set (DEPS_PKG - libgda-5.0 taglib_c ) @@ -115,6 +113,26 @@ ) # +# SQLHeavy: Use version 0.2 if it is available; otherwise, fall back to 0.1 +# +pkg_check_modules (SQLHEAVY2 QUIET sqlheavy-0.2) +if (SQLHEAVY2_FOUND) + message ("-- Will use sqlheavy-0.2") + set (DEPS_PACKAGES ${DEPS_PACKAGES} sqlheavy-0.2) + set (SQLHEAVY_CFLAGS ${SQLHEAVY2_CFLAGS}) + set (SQLHEAVY_LIBRARY_DIRS ${SQLHEAVY2_LIBRARY_DIRS}) + set (SQLHEAVY_LIBRARIES ${SQLHEAVY2_LIBRARIES}) +else () + message ("-- Will use sqlheavy-0.1") + pkg_check_modules (SQLHEAVY REQUIRED sqlheavy-0.1) + set (DEPS_PACKAGES ${DEPS_PACKAGES} sqlheavy-0.1) +endif () + +set (DEPS_CFLAGS ${DEPS_CFLAGS} ${SQLHEAVY_CFLAGS}) +set (DEPS_LIBRARIES ${DEPS_LIBRARIES} ${SQLHEAVY_LIBRARIES}) +set (DEPS_LIBRARY_DIRS ${DEPS_LIBRARY_DIRS} ${SQLHEAVY_LIBRARY_DIRS}) + +# # Libnotify # pkg_check_modules (LIBNOTIFY QUIET libnotify) diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/CMakeLists.txt noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/CMakeLists.txt --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/CMakeLists.txt 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/CMakeLists.txt 2015-07-20 19:59:51.000000000 +0000 @@ -29,6 +29,7 @@ Devices/Device.vala Devices/NetworkDevice.vala Devices/DeviceManager.vala + Devices/DevicePreferences.vala Playlists/Playlist.vala Playlists/StaticPlaylist.vala Playlists/SmartPlaylist.vala diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/DeviceManager.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/DeviceManager.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/DeviceManager.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/DeviceManager.vala 2015-07-20 19:59:51.000000000 +0000 @@ -39,6 +39,7 @@ public signal void mount_added (Mount mount); public signal void mount_removed (Mount mount); + private Gee.TreeSet device_preferences; private Gee.TreeSet initialized_devices; private Gee.TreeSet mounts_availables; private Gee.TreeSet local_playlists; @@ -52,6 +53,7 @@ } private DeviceManager () { + device_preferences = new Gee.TreeSet (); initialized_devices = new Gee.TreeSet (); mounts_availables = new Gee.TreeSet (); local_playlists = new Gee.TreeSet (); @@ -65,6 +67,10 @@ get_pre_existing_mounts.begin (); } + public void set_device_preferences (Gee.Collection device_preferences) { + this.device_preferences.add_all (device_preferences); + } + public async void get_pre_existing_mounts () { var mounts = new Gee.TreeSet (); var volumes = new Gee.TreeSet (); @@ -112,6 +118,15 @@ //message ("mount_preunmount:%s\n", mount.get_uuid()); } + public DevicePreferences? get_device_preferences (string id) { + foreach (var device in device_preferences) { + if (device.id == id) + return device; + } + + return null; + } + public Gee.Collection get_initialized_devices () { return initialized_devices; } @@ -119,4 +134,10 @@ public Gee.Collection get_available_mounts () { return mounts_availables; } + + public void add_device_preferences (DevicePreferences dp) { + lock (device_preferences) { + device_preferences.add (dp); + } + } } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/DevicePreferences.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/DevicePreferences.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/DevicePreferences.vala 1970-01-01 00:00:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/DevicePreferences.vala 2015-07-20 19:59:51.000000000 +0000 @@ -0,0 +1,53 @@ +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- +/*- + * Copyright (c) 2012-2015 Noise Developers (https://launchpad.net/noise) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * The Noise authors hereby grant permission for non-GPL compatible + * GStreamer plugins to be used and distributed together with GStreamer + * and Noise. This permission is above and beyond the permissions granted + * by the GPL license by which Noise 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. + * + * Authored by: Scott Ringwelski + * Corentin Noël + */ + +public class Noise.DevicePreferences : GLib.Object { + public string id { get; construct set; } + + public bool sync_when_mounted { get; set; } + public int last_sync_time { get; set; } + + public bool sync_music { get; set; default=true; } + public bool sync_podcasts { get; set; default=false; } + public bool sync_audiobooks { get; set; default=false; } + + public bool sync_all_music { get; set; default=true;} + public bool sync_all_podcasts { get; set; default=true; } + public bool sync_all_audiobooks { get; set; default=true; } + + public unowned Playlist music_playlist { get; set; } + public unowned Playlist podcast_playlist { get; set; } // must only contain podcasts. if not, will ignore others + public unowned Playlist audiobook_playlist { get; set; } // must only contain audiobooks. if not, will ignore others + + public DevicePreferences (string id) { + this.id = id; + } +} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/Device.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/Device.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Devices/Device.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Devices/Device.vala 2015-07-20 19:59:51.000000000 +0000 @@ -34,7 +34,8 @@ public signal void initialized (Device d); public signal void device_unmounted (); public signal void infobar_message (string message, Gtk.MessageType type); - + + public abstract DevicePreferences get_preferences(); public abstract bool start_initialization(); public abstract void finish_initialization(); public abstract string getContentType(); @@ -112,9 +113,9 @@ return get_capacity () > (list_size - without_size); } } - - public virtual string get_unique_identifier () { - Mount? m = get_mount (); + + public string get_unique_identifier() { + Mount? m = get_mount(); if (m != null) { string uuid = m.get_uuid(); File root = m.get_root(); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Library.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Library.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Library.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Library.vala 2015-07-20 19:59:51.000000000 +0000 @@ -66,9 +66,9 @@ public abstract Media? find_media (Media to_find); public abstract Media? media_from_file (File file); public abstract Media? media_from_uri (string uri); - public abstract Media? media_from_id (int64 id); + public abstract Media? media_from_id (int id); public abstract Gee.Collection medias_from_uris (Gee.Collection uris); - public abstract Gee.Collection medias_from_ids (Gee.Collection ids); + public abstract Gee.Collection medias_from_ids (Gee.Collection ids); public abstract void update_media (Media s, bool updateMeta, bool record_time); public abstract void update_medias (Gee.Collection updates, bool updateMeta, bool record_time); public abstract void remove_media (Media s, bool trash); @@ -76,14 +76,14 @@ public abstract bool support_smart_playlists (); public abstract void add_smart_playlist (SmartPlaylist p); - public abstract void remove_smart_playlist (int64 id); - public abstract SmartPlaylist? smart_playlist_from_id (int64 id); + public abstract void remove_smart_playlist (int id); + public abstract SmartPlaylist? smart_playlist_from_id (int id); public abstract SmartPlaylist? smart_playlist_from_name (string name); public abstract bool support_playlists (); public abstract void add_playlist (StaticPlaylist p); - public abstract void remove_playlist (int64 id); - public abstract StaticPlaylist? playlist_from_id (int64 id); + public abstract void remove_playlist (int id); + public abstract StaticPlaylist? playlist_from_id (int id); public abstract StaticPlaylist? playlist_from_name (string name); public abstract bool start_file_operations (string? message); @@ -99,7 +99,7 @@ return i; } - public void media_from_name (Gee.Collection tests, Gee.Collection found, Gee.Collection not_found) { + public void media_from_name (Gee.Collection tests, Gee.Collection found, Gee.Collection not_found) { foreach (Media test in tests) { var media_found = find_media (test); if (media_found != null) { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Media.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Media.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Media.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Media.vala 2015-07-20 19:59:51.000000000 +0000 @@ -33,7 +33,7 @@ /// Used for unknown titles, artists, or album names. protected static string UNKNOWN = _("Unknown"); - public int64 rowid { get; set; } + public int rowid { get; set; } public virtual string uri { owned get { return file.get_uri (); } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/Playlist.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/Playlist.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/Playlist.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/Playlist.vala 2015-07-20 19:59:51.000000000 +0000 @@ -32,10 +32,10 @@ public signal void request_play (); public virtual Gee.ArrayQueue medias { get; internal set; } - public int64 rowid { get; set; } + public int rowid { get; set; } public GLib.Icon icon; - internal string _name = ""; - public virtual string name { + private string _name = ""; + public string name { get { return _name; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/SmartPlaylist.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/SmartPlaylist.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/SmartPlaylist.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/SmartPlaylist.vala 2015-07-20 19:59:51.000000000 +0000 @@ -35,12 +35,12 @@ ANY = false } - public virtual ConditionalType conditional { get; set; default = ConditionalType.ALL; } + public ConditionalType conditional { get; set; default = ConditionalType.ALL; } public Gee.TreeSet queries; public int query_count { get; set; default = 0; } - public virtual bool limit { get; set; default = false; } - public virtual uint limit_amount { get; set; default = 50; } + public bool limit { get; set; default = false; } + public int limit_amount { get; set; default = 50; } private Noise.Library library; @@ -142,112 +142,112 @@ switch (q.field) { case Noise.SmartQuery.FieldType.ALBUM : if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down () == s.album.down(); + return q.value.down() == s.album.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.album.down()); + return (q.value.down() in s.album.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.album.down()); + return !(q.value.down() in s.album.down()); break; case Noise.SmartQuery.FieldType.ARTIST: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.artist.down(); + return q.value.down() == s.artist.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.artist.down()); + return (q.value.down() in s.artist.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.artist.down()); + return !(q.value.down() in s.artist.down()); break; case Noise.SmartQuery.FieldType.COMPOSER: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.composer.down(); + return q.value.down() == s.composer.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.composer.down()); + return (q.value.down() in s.composer.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.composer.down()); + return !(q.value.down() in s.composer.down()); break; case Noise.SmartQuery.FieldType.COMMENT: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.comment.down(); + return q.value.down() == s.comment.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.comment.down()); + return (q.value.down() in s.comment.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.comment.down()); + return !(q.value.down() in s.comment.down()); break; case Noise.SmartQuery.FieldType.GENRE: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.genre.down(); + return q.value.down() == s.genre.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.genre.down()); + return (q.value.down() in s.genre.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.genre.down()); + return !(q.value.down() in s.genre.down()); break; case Noise.SmartQuery.FieldType.GROUPING: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.grouping.down(); + return q.value.down() == s.grouping.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.grouping.down()); + return (q.value.down() in s.grouping.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.grouping.down()); + return !(q.value.down() in s.grouping.down()); break; case Noise.SmartQuery.FieldType.TITLE: if(q.comparator == SmartQuery.ComparatorType.IS) - return q.value.get_string ().down() == s.title.down(); + return q.value.down() == s.title.down(); else if(q.comparator == SmartQuery.ComparatorType.CONTAINS) - return (q.value.get_string ().down() in s.title.down()); + return (q.value.down() in s.title.down()); else if(q.comparator == SmartQuery.ComparatorType.NOT_CONTAINS) - return !(q.value.get_string ().down() in s.title.down()); + return !(q.value.down() in s.title.down()); break; case Noise.SmartQuery.FieldType.BITRATE: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.bitrate; + return int.parse(q.value) == s.bitrate; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.bitrate <= q.value.get_int ()); + return (s.bitrate <= int.parse(q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.bitrate >= q.value.get_int ()); + return (s.bitrate >= int.parse(q.value)); break; case Noise.SmartQuery.FieldType.PLAYCOUNT: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.play_count; + return int.parse(q.value) == s.play_count; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.play_count <= q.value.get_int ()); + return (s.play_count <= int.parse(q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.play_count >= q.value.get_int ()); + return (s.play_count >= int.parse(q.value)); break; case Noise.SmartQuery.FieldType.SKIPCOUNT: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.skip_count; + return int.parse(q.value) == s.skip_count; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.skip_count <= q.value.get_int ()); + return (s.skip_count <= int.parse(q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.skip_count >= q.value.get_int ()); + return (s.skip_count >= int.parse(q.value)); break; case Noise.SmartQuery.FieldType.YEAR: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.year; + return int.parse (q.value) == s.year; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.year <= q.value.get_int ()); + return (s.year <= int.parse (q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.year >= q.value.get_int ()); + return (s.year >= int.parse (q.value)); break; case Noise.SmartQuery.FieldType.LENGTH: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.length; + return int.parse (q.value) == s.length; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.length <= q.value.get_int ()); + return (s.length <= int.parse (q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.length >= q.value.get_int ()); + return (s.length >= int.parse (q.value)); break; case Noise.SmartQuery.FieldType.RATING: if(q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) - return q.value.get_int () == s.rating; + return int.parse(q.value) == s.rating; else if(q.comparator == SmartQuery.ComparatorType.IS_AT_MOST) - return (s.rating <= q.value.get_int ()); + return (s.rating <= int.parse (q.value)); else if(q.comparator == SmartQuery.ComparatorType.IS_AT_LEAST) - return (s.rating >= q.value.get_int ()); + return (s.rating >= int.parse (q.value)); break; case Noise.SmartQuery.FieldType.DATE_ADDED: var now = new DateTime.now_local (); var played = new DateTime.from_unix_local (s.date_added); - played = played.add_days (q.value.get_int ()); + played = played.add_days (int.parse (q.value)); if (q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) { return (now.get_day_of_year () == played.get_day_of_year () && now.get_year () == played.get_year ()); @@ -279,7 +279,7 @@ var now = new DateTime.now_local(); var played = new DateTime.from_unix_local (s.last_played); - played = played.add_days (q.value.get_int ()); + played = played.add_days (int.parse (q.value)); if (q.comparator == SmartQuery.ComparatorType.IS_EXACTLY) { return (now.get_day_of_year () == played.get_day_of_year () && now.get_year () == played.get_year ()); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/SmartQuery.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/SmartQuery.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Playlists/SmartQuery.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Playlists/SmartQuery.vala 2015-07-20 19:59:51.000000000 +0000 @@ -64,13 +64,13 @@ public int rowid { get; set; default = 0; } public FieldType field { get; set; default = FieldType.ALBUM; } public ComparatorType comparator { get; set; default = ComparatorType.IS; } - public GLib.Value value { get; set; default = GLib.Value (typeof (string)); } + public string value { get; set; default = ""; } //internally this often holds numbers, but that's ok. public SmartQuery () { } - public SmartQuery.with_info (FieldType field, ComparatorType comparator, GLib.Value value) { + public SmartQuery.with_info (FieldType field, ComparatorType comparator, string value) { this.field = field; this.comparator = comparator; this.value = value; diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Settings.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Settings.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Settings.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Settings.vala 2015-07-20 19:59:51.000000000 +0000 @@ -67,8 +67,8 @@ public bool write_metadata_to_file { get; set; } public bool copy_imported_music { get; set; } public bool close_while_playing { get; set; } - public int64 last_media_playing { get; set; } - public int64 last_playlist_playing { get; set; } + public int last_media_playing { get; set; } + public int last_playlist_playing { get; set; } public int last_media_position { get; set; } public Shuffle shuffle_mode { get; set; } public Repeat repeat_mode { get; set; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Utils/Search.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Utils/Search.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Utils/Search.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Utils/Search.vala 2015-07-20 19:59:51.000000000 +0000 @@ -109,19 +109,18 @@ * " " * "**a" */ - public inline uint? get_rating_from_string (string rating_string) - ensures (result != 0) + public inline int get_rating_from_string (string rating_string) + ensures (result != 0 || result == -1) { - int i = 0; + int i; unichar c; - uint rating; - for (rating = 0; rating_string.get_next_char (ref i, out c); rating++) { + for (i = 0; rating_string.get_next_char (ref i, out c);) { if (c != '*') - return null; + return -1; } - return rating; + return i > 0 ? i : -1; } public inline bool match_string_to_media (Media m, string search) { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Utils/String.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Utils/String.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/core/Utils/String.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/core/Utils/String.vala 2015-07-20 19:59:51.000000000 +0000 @@ -178,7 +178,7 @@ * @param parsed_search_string location where the canonicalized version of the * search string is stored. Should be passed to the methods in Noise.Search. */ - public static void base_search_method (string search, out uint parsed_rating, + public static void base_search_method (string search, out int parsed_rating, out string parsed_search_string) { parsed_rating = Search.get_rating_from_string (search.strip ()); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/bzr-builder.manifest noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/bzr-builder.manifest --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/bzr-builder.manifest 2015-07-20 12:15:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/bzr-builder.manifest 2015-07-20 19:59:53.000000000 +0000 @@ -1,4 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}+r1822+pkg91+gda1825~daily +# bzr-builder format 0.3 deb-version {debupstream}+r1823+pkg90~daily lp:noise revid:launchpad_translations_on_behalf_of_elementary-apps-20150713052950-oct14t4dh1oo1yzw -merge noise-gda lp:~tintou/noise/noise-gda revid:corentin@elementary.io-20150715125058-u61ym0s3jo8cu7af -nest-part packaging lp:~elementary-os/noise/deb-packaging-gda debian debian revid:cody@elementary.io-20150720101515-fot8uqg56upvupbc +nest-part packaging lp:~elementary-os/noise/deb-packaging debian debian revid:cody@elementary.io-20150713120125-nnr055ra1k5pyxyo diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/changelog noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/changelog --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/changelog 2015-07-20 12:15:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/changelog 2015-07-20 19:59:53.000000000 +0000 @@ -1,8 +1,8 @@ -noise (0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1) vivid; urgency=low +noise (0.3.1+r1823+pkg90~daily~ubuntu15.04.1) vivid; urgency=low * Auto build. - -- Cody Garver Mon, 20 Jul 2015 12:15:00 +0000 + -- Cody Garver Mon, 20 Jul 2015 19:59:53 +0000 noise (0.3.1) trusty; urgency=low diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/control noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/control --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/debian/control 2015-07-20 12:15:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/debian/control 2015-07-20 19:59:52.000000000 +0000 @@ -8,7 +8,6 @@ libdbus-glib-1-dev, libdbusmenu-glib-dev (>= 0.4), libdbusmenu-gtk3-dev, - libgda-5.0-dev, libgee-0.8-dev, libglib2.0-dev, libgpod-dev, @@ -22,6 +21,7 @@ libnotify-dev (>= 0.5.0), libpeas-dev (>= 1.2.0), libsoup2.4-dev (>= 2.25.2), + libsqlheavy-dev (>= 0.1.1-2), libtagc0-dev (>= 1.6.3), libzeitgeist-2.0-dev, quilt, diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerDevice.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerDevice.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerDevice.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerDevice.vala 2015-07-20 19:59:51.000000000 +0000 @@ -24,20 +24,31 @@ Mount mount; GLib.Icon icon; + Noise.DevicePreferences pref; bool is_androphone = false; Gee.LinkedList music_folders; - + private AudioPlayerLibrary library; - + + public AudioPlayerDevice(Mount mount, bool is_androphone) { this.mount = mount; this.is_androphone = is_androphone; music_folders = new Gee.LinkedList (); library = new AudioPlayerLibrary (this); libraries_manager.add_library (library); - icon = new GLib.ThemedIcon (is_androphone ? "phone" : "music-player"); + icon = new Icon (is_androphone ? "phone" : "music-player").gicon; + var device_manager = DeviceManager.get_default (); + pref = device_manager.get_device_preferences (get_unique_identifier()); + if(pref == null) { + pref = new Noise.DevicePreferences (get_unique_identifier()); + device_manager.add_device_preferences (pref); + } + } + + public Noise.DevicePreferences get_preferences() { + return pref; } - public void finish_initialization() { device_unmounted.connect( () => { @@ -220,7 +231,7 @@ } public void synchronize () { - + library.sync_medias (); } public bool only_use_custom_view () { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerLibrary.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerLibrary.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerLibrary.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/AudioPlayers/AudioPlayerLibrary.vala 2015-07-20 19:59:51.000000000 +0000 @@ -110,7 +110,7 @@ return; } - uint parsed_rating; + int parsed_rating; string parsed_search_string; String.base_search_method (search, out parsed_rating, out parsed_search_string); bool rating_search = parsed_rating > 0; @@ -118,7 +118,7 @@ lock (medias) { foreach (var m in medias) { if (rating_search) { - if (m.rating == parsed_rating) + if (m.rating == (uint) parsed_rating) searched_medias.add (m); } else if (Search.match_string_to_media (m, parsed_search_string)) { searched_medias.add (m); @@ -185,8 +185,96 @@ } return; } + + public void sync_medias () { + if(doing_file_operations ()) { + warning("Tried to add when already syncing\n"); + return; + } + Playlist playlist = null; + if (device.get_preferences().sync_all_music == false) { + playlist = device.get_preferences().music_playlist; + if (playlist == null) + return; + } + + + libraries_manager.current_operation = _("Syncing %s…").printf (device.getDisplayName ()); + + is_doing_file_operations = true; + Timeout.add(500, libraries_manager.do_progress_notification_with_timeout); + if (playlist == null) + sync_medias_async.begin (libraries_manager.local_library.get_medias ()); + else + sync_medias_async.begin (playlist.medias); + return; + } + + public async void sync_medias_async (Gee.Collection songs) { + var medias_to_remove = new Gee.LinkedList (); + medias_to_remove.add_all (device.delete_doubles (medias, songs)); + + var medias_to_sync = new Gee.LinkedList (); + medias_to_sync.add_all (device.delete_doubles (songs, medias)); + + int total_medias = medias_to_remove.size + medias_to_sync.size; + + int sub_index = 0; + if (total_medias > 0) { + if (device.will_fit_without (medias_to_sync, medias_to_remove)) { + foreach(var m in medias_to_remove) { + if(!operation_cancelled) { + remove_media(m, true); + } + ++sub_index; + libraries_manager.progress = (double)(sub_index/total_medias); + } + sub_index = 0; + imported_files = new Gee.LinkedList (); + foreach(var m in medias_to_sync) { + if(!operation_cancelled) { + add_media (m); + } + ++sub_index; + libraries_manager.progress = (double)(sub_index/total_medias); + } + tagger.discoverer_import_media (imported_files); + + if(!operation_cancelled) { + // sync playlists + /* TODO: add support for podcasts & playlists + if (pref.sync_all_music == true) { + sync_playlists(); + } + if (pref.sync_all_podcasts == true) { + sync_podcasts(); + }*/ + + libraries_manager.current_operation = _("Finishing sync process…"); + + } else { + libraries_manager.current_operation = _("Cancelling Sync…"); + libraries_manager.progress = 1; + } + } else { + device.infobar_message (_("There is not enough space on Device to complete the Sync…"), Gtk.MessageType.INFO); + libraries_manager.current_operation = _("There is not enough space on Device to complete the Sync…"); + } + } - public override Media? media_from_id (int64 id) { + Idle.add( () => { + libraries_manager.progress = 1; + device.get_preferences().last_sync_time = (int)time_t(); + is_doing_file_operations = false; + + file_operations_done (); + operation_cancelled = false; + + return false; + }); + } + + public override Media? media_from_id (int id) { lock (medias) { foreach (var m in medias) { if (m.rowid == id) { @@ -196,8 +284,7 @@ } return null; } - - public override Gee.Collection medias_from_ids (Gee.Collection ids) { + public override Gee.Collection medias_from_ids (Gee.Collection ids) { var media_collection = new Gee.LinkedList (); lock (medias) { @@ -319,10 +406,10 @@ public override void add_smart_playlist (SmartPlaylist p) { } - public override void remove_smart_playlist (int64 id) { + public override void remove_smart_playlist (int id) { } - public override SmartPlaylist? smart_playlist_from_id (int64 id) { + public override SmartPlaylist? smart_playlist_from_id (int id) { return null; } public override SmartPlaylist? smart_playlist_from_name (string name) { @@ -342,18 +429,14 @@ p.media_removed.connect(() => {keep_playlist_synchronized (p);}); p.updated.connect ((old_name) => {remove_playlist_from_name (old_name); keep_playlist_synchronized (p);}); } - public override void remove_playlist (int64 id) { + public override void remove_playlist (int id) { if (id < get_playlists ().size) { var array_v = new Gee.ArrayList (); array_v.add_all (playlists); - foreach (var p in array_v) { - if (p.rowid == id) { - remove_playlist_from_name (p.name); - playlist_removed (p); - playlists.remove (p); - return; - } - } + var p = array_v.get (id); + remove_playlist_from_name (p.name); + playlist_removed (p); + playlists.remove (p); } } @@ -392,14 +475,11 @@ } } - public override StaticPlaylist? playlist_from_id (int64 id) { + public override StaticPlaylist? playlist_from_id (int id) { if (id < get_playlists ().size) { var array = new Gee.ArrayList (); array.add_all (get_playlists ()); - foreach (var playlist in array) { - if (playlist.rowid == id) - return playlist; - } + return array.get (id); } return null; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/CDRom/CDRomDevice.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/CDRom/CDRomDevice.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/CDRom/CDRomDevice.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/CDRom/CDRomDevice.vala 2015-07-20 19:59:51.000000000 +0000 @@ -48,7 +48,7 @@ public CDRomDevice(Mount mount) { this.mount = mount; - this.icon = new GLib.ThemedIcon ("media-cdrom-audio"); + this.icon = new Icon ("media-cdrom-audio").gicon; this.display_name = mount.get_name(); list = new Gee.LinkedList(); @@ -58,7 +58,11 @@ cdplayer = new CDPlayer (mount); Noise.App.player.add_playback (cdplayer); } - + + public Noise.DevicePreferences get_preferences() { + return new Noise.DevicePreferences(get_unique_identifier()); + } + public bool start_initialization() { return true; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodDevice.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodDevice.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodDevice.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodDevice.vala 2015-07-20 19:59:51.000000000 +0000 @@ -21,6 +21,7 @@ */ public class Noise.Plugins.iPodDevice : GLib.Object, Noise.Device { + Noise.DevicePreferences pref; GPod.iTunesDB db; public Mount mount; GLib.Icon icon; @@ -31,7 +32,17 @@ public iPodDevice (Mount mount) { this.mount = mount; is_new = mount.get_default_location ().get_parse_name ().has_prefix ("afc://"); - icon = new GLib.ThemedIcon (is_new ? "phone" : "multimedia-player"); + var device_manager = DeviceManager.get_default (); + pref = device_manager.get_device_preferences (get_unique_identifier ()); + icon = new Icon (is_new ? "phone" : "multimedia-player").gicon; + if (pref == null) { + pref = new Noise.DevicePreferences (get_unique_identifier ()); + device_manager.add_device_preferences (pref); + } + } + + public Noise.DevicePreferences get_preferences () { + return pref; } public bool start_initialization () { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodLibrary.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodLibrary.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodLibrary.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodLibrary.vala 2015-07-20 19:59:51.000000000 +0000 @@ -96,7 +96,7 @@ return; } - uint parsed_rating; + int parsed_rating; string parsed_search_string; String.base_search_method (search, out parsed_rating, out parsed_search_string); bool rating_search = parsed_rating > 0; @@ -104,7 +104,7 @@ lock (medias) { foreach (var m in medias.values) { if (rating_search) { - if (m.rating == parsed_rating) + if (m.rating == (uint) parsed_rating) searched_medias.add (m); } else if (Search.match_string_to_media (m, parsed_search_string)) { searched_medias.add (m); @@ -242,11 +242,11 @@ }); } - public override Media? media_from_id (int64 id) { + public override Media? media_from_id (int id) { return null; } - public override Gee.Collection medias_from_ids (Gee.Collection ids) { + public override Gee.Collection medias_from_ids (Gee.Collection ids) { var media_collection = new Gee.LinkedList (); lock (medias) { foreach (var m in medias.values) { @@ -406,11 +406,11 @@ return false; } - public override void remove_smart_playlist (int64 id) { + public override void remove_smart_playlist (int id) { } - public override SmartPlaylist? smart_playlist_from_id (int64 id) { + public override SmartPlaylist? smart_playlist_from_id (int id) { return null; } @@ -439,27 +439,24 @@ p.media_removed.connect((list) => {keep_playlist_synchronized (p, list, false);}); } - public override void remove_playlist (int64 id) { - unowned GPod.Playlist to_unset = null; - foreach (var entry in playlists.entries) { - if (entry.value.rowid == id) { - playlist_removed (entry.value); - to_unset = entry.key; + public override void remove_playlist (int id) { + if (id < get_playlists ().size) { + var array = new Gee.ArrayList (); + array.add_all (playlists.keys); + var array_v = new Gee.ArrayList (); + array_v.add_all (playlists.values); + playlist_removed (array_v.get (id)); + playlists.unset (array.get (id)); + db.start_sync (); + array.get (id).remove (); + try { + db.write (); + } catch (Error err) { + critical ("Error when writing iPod database. iPod contents may be incorrect: %s", err.message); } - } - - if (to_unset != null) - playlists.unset (to_unset); - db.start_sync (); - to_unset.remove (); - try { - db.write (); - } catch (Error err) { - critical ("Error when writing iPod database. iPod contents may be incorrect: %s", err.message); + db.stop_sync (); } - - db.stop_sync (); } private void keep_playlist_synchronized (StaticPlaylist p, Gee.Collection m, bool to_add) { @@ -491,13 +488,12 @@ db.stop_sync (); } - public override StaticPlaylist? playlist_from_id (int64 id) { - foreach (var p in playlists.values) { - if (p.rowid == id) { - return p; - } + public override StaticPlaylist? playlist_from_id (int id) { + if (id < get_playlists ().size) { + var array = new Gee.ArrayList (); + array.add_all (get_playlists ()); + return array.get (id); } - return null; } @@ -566,6 +562,157 @@ } } + public bool sync_medias (Gee.Collection medias) { + if (is_doing_file_operations) { + warning("Tried to sync when already syncing\n"); + return false; + } + + libraries_manager.current_operation = _("Syncing %s…").printf (device.getDisplayName ()); + is_doing_file_operations = true; + Timeout.add(500, libraries_manager.do_progress_notification_with_timeout); + sync_medias_async.begin (medias); + return true; + } + + public async void sync_medias_async (Gee.Collection given_medias) { + bool error_occurred = false; + int sub_index = 0; + debug ("Found %d medias to sync.", given_medias.size); + var medias_to_remove = device.delete_doubles (medias.values, given_medias); + debug ("Found %d medias to remove.", medias_to_remove.size); + var medias_to_sync = device.delete_doubles (given_medias, medias.values); + debug ("Found %d medias to add.", medias_to_sync.size); + int total_medias = medias_to_remove.size + medias_to_sync.size; + if (total_medias > 0) { + if (device.will_fit_without(medias_to_sync, medias_to_remove)) { + db.start_sync(); + foreach (var m in medias_to_remove) { + if (!operation_cancelled) { + foreach (var e in medias.entries) { + if (e.value == m) { + remove_media_from_ipod (e.key); + break; + } + } + } + + ++sub_index; + libraries_manager.progress = (double)(sub_index/total_medias); + } + + foreach (var m in medias_to_sync) { + if (!operation_cancelled) { + add_media (m); + } + + ++sub_index; + libraries_manager.progress = (double)(sub_index/total_medias); + } + + if (!operation_cancelled) { + // sync playlists + /* TODO: add support for podcasts & playlists + if (pref.sync_all_music == true) { + sync_playlists(); + } + if (pref.sync_all_podcasts == true) { + sync_podcasts(); + }*/ + + libraries_manager.current_operation = _("Finishing sync process…"); + try { + db.write (); + } catch (GLib.Error err) { + error_occurred = true; + operation_cancelled = true; + } + + /// Clean up unused files + debug ("Cleaning up iPod File System\n"); + var music_folder = File.new_for_uri (device.get_uri () + GPod.Device.get_music_dir (device.get_mount ().get_default_location ().get_path ()).replace (device.get_mount ().get_default_location ().get_path (), "")); + var used_paths = new Gee.LinkedList (); + foreach (unowned GPod.Track t in medias.keys) { + used_paths.add (device.get_uri () + GPod.iTunesDB.filename_ipod2fs (t.ipod_path)); + } + + cleanup_files (music_folder, used_paths); + libraries_manager.progress = 1; + db.stop_sync (); + } else { + libraries_manager.current_operation = _("Cancelling Sync…"); + try { + db.write (); + } catch (Error err) { + critical ("Error when writing iPod database. iPod contents may be incorrect: %s", err.message); + } + db.stop_sync (); + libraries_manager.progress = 1; + } + } else { + device.infobar_message (_("There is not enough space on Device to complete the Sync…"), Gtk.MessageType.INFO); + libraries_manager.current_operation = _("There is not enough space on Device to complete the Sync…"); + } + } + + Idle.add (() => { + libraries_manager.progress = 1; + device.get_preferences ().last_sync_time = (int)time_t (); + is_doing_file_operations = false; + file_operations_done (); + operation_cancelled = false; + return false; + }); + } + + public async void sync_playlists_async (Gee.Collection spls) { + + /*current_operation = _("Syncing playlists"); + // first remove all playlists from db + var all_playlists = new Gee.LinkedList(); + foreach (unowned GPod.Playlist p in db.playlists) { + if (!p.is_mpl() && !p.is_podcasts() && !p.is_audiobooks()) { + all_playlists.add(p); + } + } + foreach (unowned GPod.Playlist p in all_playlists) { + p.remove(); + } + + int sub_index = 0; + foreach (var playlist in pls) { + GPod.Playlist p = iPodPlaylistHelper.get_gpod_playlist_from_playlist (playlist); + db.playlist_add((owned)p, -1); + + unowned GPod.Playlist added = db.playlists.nth_data(db.playlists.length() - 1); + foreach (var entry in medias.entries) { + foreach (var e in playlist.medias) { + if (entry.value == e) { + added.add_track(entry.key, -1); + ++sub_index; + //index = (int)(78.0 + (double)(7.0 * (double)((double)sub_index/(double)pls.size))); + break; + } + } + } + } + + foreach (var smart_playlist in spls) { + GPod.Playlist p = iPodPlaylistHelper.get_gpod_playlist_from_smart_playlist (smart_playlist); + + db.playlist_add((owned)p, -1); + + ++sub_index; + //index = (int)(85.0 + (double)(5.0 * (double)((double)sub_index/(double)spls.size))); + } + db.spl_update_live(); + + Idle.add( () => { + + return false; + });*/ + } + void cleanup_files(GLib.File music_folder, Gee.LinkedList used_uris) { GLib.FileInfo file_info = null; try { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodPlaylistHelper.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodPlaylistHelper.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodPlaylistHelper.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/Devices/iPod/iPodPlaylistHelper.vala 2015-07-20 19:59:51.000000000 +0000 @@ -115,57 +115,57 @@ message("adding rule\n"); if (q.field == SmartQuery.FieldType.ALBUM) { // strings rule.field = GPod.SPLField.ALBUM; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.ARTIST) { rule.field = GPod.SPLField.ARTIST; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.COMPOSER) { rule.field = GPod.SPLField.COMPOSER; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.COMMENT) { rule.field = GPod.SPLField.COMMENT; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.GENRE) { rule.field = GPod.SPLField.GENRE; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.GROUPING) { rule.field = GPod.SPLField.GROUPING; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.TITLE) { rule.field = GPod.SPLField.SONG_NAME; - rule.@string = q.value.get_string (); + rule.@string = q.value; } else if (q.field == SmartQuery.FieldType.BITRATE) { // ints rule.field = GPod.SPLField.BITRATE; - rule.fromvalue = (uint64)q.value.get_int (); - rule.tovalue = (uint64)q.value.get_int (); + rule.fromvalue = uint64.parse (q.value); + rule.tovalue = uint64.parse (q.value); } else if (q.field == SmartQuery.FieldType.PLAYCOUNT) { rule.field = GPod.SPLField.PLAYCOUNT; - rule.fromvalue =(uint64)q.value.get_int (); - rule.tovalue = (uint64)q.value.get_int (); + rule.fromvalue = uint64.parse (q.value); + rule.tovalue = uint64.parse (q.value); } else if (q.field == SmartQuery.FieldType.SKIPCOUNT) { rule.field = GPod.SPLField.SKIPCOUNT; - rule.fromvalue = (uint64)q.value.get_int (); - rule.tovalue = (uint64)q.value.get_int (); + rule.fromvalue = uint64.parse (q.value); + rule.tovalue = uint64.parse (q.value); } else if (q.field == SmartQuery.FieldType.YEAR) { rule.field = GPod.SPLField.YEAR; - rule.fromvalue = (uint64)q.value.get_int (); - rule.tovalue = (uint64)q.value.get_int (); + rule.fromvalue = uint64.parse (q.value); + rule.tovalue = uint64.parse (q.value); } else if (q.field == SmartQuery.FieldType.LENGTH) { rule.field = GPod.SPLField.TIME; - rule.fromvalue = (uint64)q.value.get_int () * 1000; - rule.tovalue = (uint64)q.value.get_int () * 1000; + rule.fromvalue = uint64.parse (q.value) * 1000; + rule.tovalue = uint64.parse (q.value) * 1000; } else if (q.field == SmartQuery.FieldType.RATING) { rule.field = GPod.SPLField.RATING; - rule.fromvalue = (uint64)q.value.get_int () * 20; - rule.tovalue = (uint64)q.value.get_int () * 20; + rule.fromvalue = uint64.parse (q.value) * 20; + rule.tovalue = uint64.parse (q.value) * 20; } else if (q.field == SmartQuery.FieldType.DATE_ADDED) { rule.field = GPod.SPLField.DATE_ADDED; - rule.fromvalue = (uint64)q.value.get_int () * 1000; - rule.tovalue = (uint64)q.value.get_int () * 1000; + rule.fromvalue = uint64.parse (q.value) * 1000; + rule.tovalue = uint64.parse (q.value) * 1000; } else if (q.field == SmartQuery.FieldType.LAST_PLAYED) { rule.field = GPod.SPLField.LAST_PLAYED; - rule.fromvalue = (uint64)q.value.get_int () * 20; - rule.tovalue = (uint64)q.value.get_int () * 20; + rule.fromvalue = uint64.parse (q.value) * 20; + rule.tovalue = uint64.parse (q.value) * 20; } else if (q.field == SmartQuery.FieldType.DATE_RELEASED) { // no equivalant } @@ -220,85 +220,85 @@ switch (field) { case SmartQuery.FieldType.ALBUM: rule.field = GPod.SPLField.ALBUM; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.ARTIST: rule.field = GPod.SPLField.ARTIST; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.COMPOSER: rule.field = GPod.SPLField.COMPOSER; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.COMMENT: rule.field = GPod.SPLField.COMMENT; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.GENRE: rule.field = GPod.SPLField.GENRE; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.GROUPING: rule.field = GPod.SPLField.GROUPING; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.TITLE: rule.field = GPod.SPLField.SONG_NAME; - rule.@string = value.get_string (); + rule.@string = value; break; case SmartQuery.FieldType.BITRATE: rule.field = GPod.SPLField.BITRATE; - rule.fromvalue = (uint64)value.get_int (); - rule.tovalue = (uint64)value.get_int (); + rule.fromvalue = uint64.parse (value); + rule.tovalue = uint64.parse (value); rule.tounits = 1; rule.fromunits = 1; break; case SmartQuery.FieldType.PLAYCOUNT: rule.field = GPod.SPLField.PLAYCOUNT; - rule.fromvalue = (uint64)value.get_int (); - rule.tovalue = (uint64)value.get_int (); + rule.fromvalue = uint64.parse (value); + rule.tovalue = uint64.parse (value); rule.tounits = 1; rule.fromunits = 1; break; case SmartQuery.FieldType.SKIPCOUNT: rule.field = GPod.SPLField.SKIPCOUNT; - rule.fromvalue = (uint64)value.get_int (); - rule.tovalue = (uint64)value.get_int (); + rule.fromvalue = uint64.parse (value); + rule.tovalue = uint64.parse (value); rule.tounits = 1; break; case SmartQuery.FieldType.YEAR: rule.field = GPod.SPLField.YEAR; - rule.fromvalue = (uint64)value.get_int (); - rule.tovalue = (uint64)value.get_int (); + rule.fromvalue = uint64.parse (value); + rule.tovalue = uint64.parse (value); rule.tounits = 1; rule.fromunits = 1; break; case SmartQuery.FieldType.LENGTH: rule.field = GPod.SPLField.TIME; - rule.fromvalue = (uint64)value.get_int () * 1000; - rule.tovalue = (uint64)value.get_int () * 1000; + rule.fromvalue = uint64.parse (value) * 1000; + rule.tovalue = uint64.parse (value) * 1000; rule.tounits = 1; rule.fromunits = 1; break; case SmartQuery.FieldType.RATING: - message("rating rule is %d\n", value.get_int ()); + message("rating rule is %s\n", value); rule.field = GPod.SPLField.RATING; - rule.fromvalue = (uint64)value.get_int () * 20; - rule.tovalue = (uint64)value.get_int () * 20; + rule.fromvalue = uint64.parse (value) * 20; + rule.tovalue = uint64.parse (value) * 20; rule.tounits = 1;//20; rule.fromunits = 1;//20; break; case SmartQuery.FieldType.DATE_ADDED: rule.field = GPod.SPLField.DATE_ADDED; - rule.fromvalue = (uint64)value.get_int () * 60 * 60 * 24; - rule.tovalue = (uint64)value.get_int () * 60 * 60 * 24; + rule.fromvalue = uint64.parse (value) * 60 * 60 * 24; + rule.tovalue = uint64.parse (value) * 60 * 60 * 24; rule.tounits = 1;//60 * 60 * 24; rule.fromunits = 1;//60 * 60 * 24; break; case SmartQuery.FieldType.LAST_PLAYED: rule.field = GPod.SPLField.LAST_PLAYED; - rule.fromvalue = (uint64)value.get_int () * 60 * 60 * 24; - rule.tovalue = (uint64)value.get_int () * 60 * 60 * 24; + rule.fromvalue = uint64.parse (value) * 60 * 60 * 24; + rule.tovalue = uint64.parse (value) * 60 * 60 * 24; rule.tounits = 1;//60 * 60 * 24; rule.fromunits = 1;//60 * 60 * 24; break; diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/LastFM/SimilarMedia.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/LastFM/SimilarMedia.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/LastFM/SimilarMedia.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/LastFM/SimilarMedia.vala 2015-07-20 19:59:51.000000000 +0000 @@ -31,7 +31,7 @@ public Noise.StaticPlaylist similar_playlist; private Gee.LinkedList similar_medias; - public signal void similar_retrieved (Gee.LinkedList similarIDs, Gee.LinkedList similarDont); + public signal void similar_retrieved (Gee.LinkedList similarIDs, Gee.LinkedList similarDont); public class SimilarMedias () { working = false; @@ -67,7 +67,7 @@ public void similar_async (Noise.Media s) { debug ("In the similar thread"); - var similarIDs = new Gee.LinkedList (); + var similarIDs = new Gee.LinkedList (); var similarDont = new Gee.LinkedList (); similar_medias.add_all (Core.get_default ().getSimilarTracks (s.title, s.artist)); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/MPRIS/MPRIS.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/MPRIS/MPRIS.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/plugins/MPRIS/MPRIS.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/plugins/MPRIS/MPRIS.vala 2015-07-20 19:59:51.000000000 +0000 @@ -232,7 +232,7 @@ } private ObjectPath get_track_id (Noise.Media m) { - return new ObjectPath ("/org/pantheon/noise/Track/%lld".printf (m.rowid)); + return new ObjectPath ("/org/pantheon/noise/Track/%d".printf (m.rowid)); } private bool send_property_change() { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/schemas/org.pantheon.noise.gschema.xml noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/schemas/org.pantheon.noise.gschema.xml --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/schemas/org.pantheon.noise.gschema.xml 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/schemas/org.pantheon.noise.gschema.xml 2015-07-20 19:59:51.000000000 +0000 @@ -51,12 +51,12 @@ List of desktop shells for which the player's window will be minimized instead of hidden when the close-while-playing option is set to false. For the Pantheon and GNOME desktop shells, the player's window is simply minimized due to the lack of a minimize button; the window is hidden for all the rest of desktop shells, unless they are added to this key. In fact, any dock-based shell should be part of this key, except those that lack a sound menu or in which the dock space is often limited (e.g. Unity). See the description of close-while-playing for more information. - + -1 ID of last playlist playing ID of last playlist playing - + 0 ID of last media playing ID of last media playing diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/CMakeLists.txt noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/CMakeLists.txt --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/CMakeLists.txt 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/CMakeLists.txt 2015-07-20 19:59:51.000000000 +0000 @@ -10,9 +10,6 @@ Objects/MediaKeyListener.vala LocalBackend/LocalLibrary.vala LocalBackend/LocalMedia.vala - LocalBackend/LocalSmartPlaylist.vala - LocalBackend/LocalStaticPlaylist.vala - LocalBackend/DevicePreferences.vala Widgets/NavigationArrows.vala Widgets/TopDisplay.vala Widgets/InfoPanel.vala @@ -33,7 +30,9 @@ Widgets/FastView/FastGridModel.vala Widgets/FastView/FastList.vala Widgets/FastView/FastListModel.vala - DataBase.vala + DataBase/DataBaseManager.vala + DataBase/DataBaseUpdater.vala + DataBase/Tables.vala GStreamer/GStreamerTagger.vala GStreamer/Streamer.vala GStreamer/CoverImport.vala diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/DataBaseManager.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/DataBaseManager.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/DataBaseManager.vala 1970-01-01 00:00:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/DataBaseManager.vala 2015-07-20 19:59:51.000000000 +0000 @@ -0,0 +1,937 @@ +/* + * Copyright (c) 2012 Noise Developers + * + * This library 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 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; see the file COPYING. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authored by: Scott Ringwelski , + * Victor Eduardo + */ + +using SQLHeavy; + +public class Noise.DataBaseManager : GLib.Object { + public SQLHeavy.Database database; + private Transaction transaction; // the current sql transaction + + private int index = 0; + private int item_count = 0; + + private static DataBaseManager? dbm = null; + + public static DataBaseManager get_default () { + if (dbm == null) + dbm = new DataBaseManager (); + return dbm; + } + + /** Creates a new DatabaseManager **/ + private DataBaseManager () { + init_database (); + } + + /** Creates/Reads the database file and folder **/ + private void init_database () { + assert (database == null); + + var database_dir = FileUtils.get_data_directory (); + + try { + database_dir.make_directory_with_parents (null); + } + catch (GLib.Error err) { + if (!(err is IOError.EXISTS)) + error ("Could not create data directory: %s", err.message); + } + + string database_path = Path.build_filename (database_dir.get_path (), "database_0_3_0.db"); + var database_file = File.new_for_path (database_path); + + bool new_db = !database_file.query_exists (); + + try { + const SQLHeavy.FileMode flags = SQLHeavy.FileMode.READ + | SQLHeavy.FileMode.WRITE + | SQLHeavy.FileMode.CREATE; + database = new SQLHeavy.Database (database_file.get_path (), flags); + } + catch (SQLHeavy.Error err) { + error ("Could not read/create database file: %s", err.message); + } + + // Disable synchronized commits for performance reasons + database.synchronous = SQLHeavy.SynchronousMode.OFF; + + load_table (Database.Tables.PLAYLISTS); + load_table (Database.Tables.SMART_PLAYLISTS); + load_table (Database.Tables.COLUMNS); + load_table (Database.Tables.MEDIA); + load_table (Database.Tables.DEVICES); + + if (new_db) + add_default_smart_playlists (); + } + + private void load_table (string table) { + try { + database.execute (table); + } + catch (SQLHeavy.Error err) { + warning ("Error while executing %s: %s", table, err.message); + } + } + + public void resetProgress (int items) { + index = 0; + item_count = items; + } + + /** + * Loads media from db + */ + public Gee.TreeSet load_media () { + assert (database != null); + var rv = new Gee.TreeSet(); + + try { + Query query = new Query (database, "SELECT `rowid` FROM `media`"); + for (var results = query.execute (); !results.finished; results.next()) { + var m = new LocalMedia (results.fetch_int ()); + rv.add (m); + } + } + catch (SQLHeavy.Error err) { + warning ("Could not load media from db: %s\n", err.message); + } + + return rv; + } + + public void clear_media () { + assert (database != null); + try { + database.execute ("DELETE FROM `media`"); + } + catch(SQLHeavy.Error err) { + warning ("Could not clear media: %s \n", err.message); + } + } + + public Gee.TreeSet add_media (Gee.Collection media) { + assert (database != null); + var tree_set = new Gee.TreeSet (); + try { + Query query = new Query (database, """INSERT INTO `media` (`uri`, `file_size`, `title`, `artist`, `composer`, `album_artist`, +`album`, `grouping`, `genre`, `comment`, `lyrics`, `has_embedded`, `year`, `track`, `track_count`, `album_number`, `album_count`, +`bitrate`, `length`, `samplerate`, `rating`, `playcount`, `skipcount`, `dateadded`, `lastplayed`, `lastmodified`) +VALUES (:uri, :file_size, :title, :artist, :composer, :album_artist, :album, :grouping, +:genre, :comment, :lyrics, :has_embedded, :year, :track, :track_count, :album_number, :album_count, :bitrate, :length, :samplerate, +:rating, :playcount, :skipcount, :dateadded, :lastplayed, :lastmodified);"""); + + foreach (var s in media) { + if (!s.isTemporary) { + query.set_string(":uri", s.uri); + query.set_int(":file_size", (int)s.file_size); + query.set_string(":title", s.title); + query.set_string(":artist", s.artist); + query.set_string(":composer", s.composer); + query.set_string(":album_artist", s.album_artist); + query.set_string(":album", s.album); + query.set_string(":grouping", s.grouping); + query.set_string(":genre", s.genre); + query.set_string(":comment", s.comment); + query.set_string(":lyrics", s.lyrics); + query.set_int(":has_embedded", s.has_embedded ? 1 : 0); + query.set_int(":year", (int)s.year); + query.set_int(":track", (int)s.track); + query.set_int(":track_count", (int)s.track_count); + query.set_int(":album_number", (int)s.album_number); + query.set_int(":album_count", (int)s.album_count); + query.set_int(":bitrate", (int)s.bitrate); + query.set_int(":length", (int)s.length); + query.set_int(":samplerate", (int)s.samplerate); + query.set_int(":rating", (int)s.rating); + query.set_int(":playcount", (int)s.play_count); + query.set_int(":skipcount", (int)s.skip_count); + query.set_int(":dateadded", (int)s.date_added); + query.set_int(":lastplayed", (int)s.last_played); + query.set_int(":lastmodified", (int)s.last_modified); + query.execute (); + var local_media = new LocalMedia ((int)database.last_insert_id); + tree_set.add (local_media); + } + } + } + catch (SQLHeavy.Error err) { + warning ("Could not save media: %s \n", err.message); + } + return tree_set; + } + + public void remove_media (Gee.Collection media) { + assert (database != null); + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare ("DELETE FROM `media` WHERE rowid=:rowid"); + + foreach (var m in media) { + query.set_int (":rowid", m.rowid); + query.execute (); + } + + transaction.commit (); + } + catch (SQLHeavy.Error err) { + warning ("Could not remove media from db: %s\n", err.message); + } + } + + /** COLUMNS STATE ** + * load_columns_state() loads the state of each columns from db + * + */ + public Gee.HashMap load_columns_state () { + debug ("load columns"); + assert (database != null); + var rv = new Gee.HashMap(); + + try { + string script = "SELECT * FROM `columns`"; + Query query = new Query(database, script); + + for (var results = query.execute(); !results.finished; results.next() ) { + if (results.fetch_int(0) == 0) { + StaticPlaylist p = libraries_manager.local_library.playlist_from_name (results.fetch_string(1)); + var tvs = new TreeViewSetup (results.fetch_int(2), Gtk.SortType.ASCENDING, ViewWrapper.Hint.PLAYLIST); + tvs.set_sort_direction_from_string(results.fetch_string(3)); + tvs.import_columns(results.fetch_string(4)); + rv.set (p, tvs); + } else { + SmartPlaylist p = libraries_manager.local_library.smart_playlist_from_name (results.fetch_string(1)); + var tvs = new TreeViewSetup (results.fetch_int(2), Gtk.SortType.ASCENDING, ViewWrapper.Hint.SMART_PLAYLIST); + tvs.set_sort_direction_from_string(results.fetch_string(3)); + tvs.import_columns(results.fetch_string(4)); + rv.set (p, tvs); + } + } + } + catch (SQLHeavy.Error err) { + warning ("Could not load columns from db: %s\n", err.message); + } + + return rv; + } + + public void save_columns_state (Gee.Collection? playlists = null, Gee.Collection? smart_playlists = null) { + debug ("save columns"); + assert (database != null); + try { + database.execute("DELETE FROM `columns`"); + transaction = database.begin_transaction(); + Query query = transaction.prepare ("""INSERT INTO `columns` (`is_smart`, `name`, `sort_column_id`, `sort_direction`, `columns`) + VALUES (:is_smart, :name, :sort_column_id, :sort_direction, :columns);"""); + + if (playlists != null) { + foreach(StaticPlaylist p in playlists) { + if (p.read_only == false) { + var tvs = App.main_window.get_treeviewsetup_from_playlist (p); + + query.set_int (":is_smart", 0); + query.set_string (":name", p.name); + query.set_int (":sort_column_id", tvs.sort_column_id); + query.set_string (":sort_direction", tvs.sort_direction_to_string()); + query.set_string (":columns", tvs.columns_to_string()); + + query.execute(); + } + } + } + + if (smart_playlists != null) { + foreach(SmartPlaylist p in smart_playlists) { + var tvs = App.main_window.get_treeviewsetup_from_playlist (p); + + query.set_int (":is_smart", 1); + query.set_string (":name", p.name); + query.set_int (":sort_column_id", tvs.sort_column_id); + query.set_string (":sort_direction", tvs.sort_direction_to_string()); + query.set_string (":columns", tvs.columns_to_string()); + + query.execute(); + } + } + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not save playlists: %s \n", err.message); + } + } + + public void add_columns_state (StaticPlaylist? p = null, SmartPlaylist? sp = null) { + debug ("add columns"); + assert (database != null); + + string name = ""; + int is_smart = 0; + TreeViewSetup tvs; + if (sp == null) { + if (p == null) + return; + if (p.read_only == true) + return; + name = p.name; + tvs = App.main_window.get_treeviewsetup_from_playlist (p); + } else { + if (sp == null) + return; + is_smart = 1; + name = sp.name; + tvs = App.main_window.get_treeviewsetup_from_playlist (sp); + } + + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare ("""INSERT INTO `columns` (`is_smart`, `name`, `sort_column_id`, `sort_direction`, `columns`) + VALUES (:is_smart, :name, :sort_column_id, :sort_direction, :columns);"""); + + query.set_int (":is_smart", is_smart); + query.set_string (":name", name); + query.set_int (":sort_column_id", tvs.sort_column_id); + query.set_string (":sort_direction", tvs.sort_direction_to_string()); + query.set_string (":columns", tvs.columns_to_string()); + query.execute(); + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not add columns: %s \n", err.message); + } + } + + public void remove_columns_state (StaticPlaylist? p = null, SmartPlaylist? sp = null) { + debug ("remove columns"); + assert (database != null); + + string name = ""; + if (sp == null) { + if (p == null) + return; + if (p.read_only == true) + return; + name = p.name; + } else { + if (sp == null) + return; + name = sp.name; + } + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("""DELETE FROM `columns` WHERE name=:name"""); + + query.set_string(":name", name); + query.execute(); + + transaction.commit(); + } + catch (SQLHeavy.Error err) { + warning ("Could not remove column from db: %s\n", err.message); + } + } + + public void add_default_columns () { + assert (database != null); + try { + + TreeViewSetup tvs = new TreeViewSetup (ListColumn.ARTIST, Gtk.SortType.ASCENDING, ViewWrapper.Hint.SMART_PLAYLIST); + + transaction = database.begin_transaction(); + Query query = transaction.prepare ("""INSERT INTO `columns` (`is_smart`, `name`, `sort_column_id`, `sort_direction`, `columns`) + VALUES (:is_smart, :name, :sort_column_id, :sort_direction, :columns);"""); + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Favorite Songs")); + query.set_int (":sort_column_id", ListColumn.RATING); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Recently Added")); + query.set_int (":sort_column_id", ListColumn.ARTIST); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + /* + query.set_int (":is_smart", 1); + query.set_string (":name", _("Recently Played")); + query.set_int (":sort_column_id", ListColumn.LAST_PLAYED); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + */ + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Recent Favorites")); + query.set_int (":sort_column_id", ListColumn.RATING); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Never Played")); + query.set_int (":sort_column_id", ListColumn.ARTIST); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Over Played")); + query.set_int (":sort_column_id", ListColumn.PLAY_COUNT); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + query.set_int (":is_smart", 1); + query.set_string (":name", _("Not Recently Played")); + query.set_int (":sort_column_id", ListColumn.NUMBER); + query.set_string (":sort_direction", tvs.sort_direction_to_string ()); + query.set_string (":columns", tvs.columns_to_string ()); + query.execute (); + + transaction.commit(); + } + catch (SQLHeavy.Error err) { + warning ("Could not initialize columns: %s\n", err.message); + } + } + + /** PLAYLISTS ** + * load_playlists() loads playlists from db + * + * playlist_from_id loads playlist of given rowid + * + * playlist_from_name() loads playlsit given a name + */ + public Gee.ArrayList load_playlists () { + var rv = new Gee.ArrayList(); + assert (database != null); + + try { + string script = "SELECT * FROM `playlists`"; + Query query = new Query(database, script); + + for (var results = query.execute(); !results.finished; results.next() ) { + var p = new StaticPlaylist.with_info(0, results.fetch_string(0)); + + string media = results.fetch_string(1); + + string[] media_strings = media.split("", 0); + int index; + var uris = new Gee.LinkedList (); + for (index = 0; index < media_strings.length - 1; ++index) { + uris.add (media_strings[index]); + } + p.add_medias (libraries_manager.local_library.medias_from_uris (uris)); + + if (!rv.contains (p)) + rv.add(p); + } + } + catch (SQLHeavy.Error err) { + warning ("Could not load playlists from db: %s\n", err.message); + } + + return rv; + } + + public void save_playlists (Gee.Collection playlists) { + assert (database != null); + try { + database.execute("DELETE FROM `playlists`"); + transaction = database.begin_transaction(); + Query query = transaction.prepare ("INSERT INTO `playlists` (`name`, `media`) VALUES (:name, :media);"); + + foreach (var p in playlists) { + if (p.read_only == false || p.name == C_("Name of the playlist", "Queue") || p.name == _("History")) { + string rv = ""; + + foreach (var m in p.medias) { + if (m != null) + rv += m.uri + ""; + } + query.set_string(":name", p.name); + query.set_string(":media", rv); + + query.execute(); + } + } + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not save playlists: %s \n", err.message); + } + } + + public void save_playlist (StaticPlaylist p, string? old_name = null) { + assert (database != null); + try { + if (p.read_only == true) + return; + + if (old_name == null) { + remove_playlist (p); + } else { + var pl = new StaticPlaylist.with_info (0, old_name); + remove_playlist (pl); + } + transaction = database.begin_transaction(); + Query query = transaction.prepare ("INSERT INTO `playlists` (`name`, `media`) VALUES (:name, :media);"); + + string rv = ""; + + foreach (var m in p.medias) { + if (m != null) + rv += m.uri + ""; + } + query.set_string(":name", p.name); + query.set_string(":media", rv); + + query.execute(); + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not save playlists: %s \n", err.message); + } + } + + public void add_playlist (StaticPlaylist p) { + assert (database != null); + if (p.read_only == true) + return; + string rv = ""; + + foreach (var m in p.medias) { + if (m != null) + rv += m.uri + ""; + } + + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare ("""INSERT INTO `playlists` (`name`, `media`) + VALUES (:name, :media);"""); + + query.set_string(":name", p.name); + query.set_string(":media", rv); + + query.execute(); + + transaction.commit(); + + debug ("playlist %s stored into database", p.name); + } + catch(SQLHeavy.Error err) { + warning ("Could not add playlists: %s \n", err.message); + } + } + + /*public void update_playlists(LinkedList playlists) { + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("UPDATE `playlists` SET name=:name, media=:media, sort_column_id=:sort_column_id, sort_direction=:sort_direction, columns=:columns WHERE name=:name"); + + foreach (var p in playlists) { + query.set_string(":name", p.name); + query.set_string(":media", p.media_to_string(App.library_manager)); + query.set_int(":sort_column_id", p.tvs.sort_column_id); + query.set_string(":sort_direction", p.tvs.sort_direction_to_string()); + query.set_string(":columns", p.tvs.columns_to_string()); + + query.execute(); + } + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not update playlist: %s \n", err.message); + } + }*/ + + public void remove_playlist (StaticPlaylist p) { + assert (database != null); + if (p.read_only == true) + return; + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("""DELETE FROM `playlists` WHERE name=:name"""); + + query.set_string(":name", p.name); + query.execute(); + + transaction.commit(); + } + catch (SQLHeavy.Error err) { + warning ("Could not remove playlist from db: %s\n", err.message); + } + } + + /** SMART PLAYLISTS **/ + + private static const string QUERY_SEPARATOR = ""; + private static const string VALUE_SEPARATOR = ""; + + /** temp_playlist should be in format of #,#,#,#,#, **/ + public static Gee.LinkedList queries_from_string (string q) { + string[] queries_in_string = q.split(QUERY_SEPARATOR, 0); + int index; + + var queries = new Gee.LinkedList (); + for(index = 0; index < queries_in_string.length - 1; index++) { + string[] pieces_of_query = queries_in_string[index].split(VALUE_SEPARATOR, 3); + pieces_of_query.resize (3); + + SmartQuery sq = new SmartQuery(); + sq.field = (SmartQuery.FieldType)int.parse(pieces_of_query[0]); + sq.comparator = (SmartQuery.ComparatorType)int.parse(pieces_of_query[1]); + sq.value = pieces_of_query[2]; + + queries.add (sq); + } + + return queries; + } + + // FIXME: This is an implementation detail and should not be present in the core. + public static string queries_to_string (Gee.Collection queries) { + string rv = ""; + foreach (SmartQuery q in queries) { + rv += ((int)q.field).to_string () + VALUE_SEPARATOR + ((int)q.comparator).to_string() + VALUE_SEPARATOR + q.value + QUERY_SEPARATOR; + } + + return rv; + } + + public void add_default_smart_playlists () { + assert (database != null); + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare ("""INSERT INTO `smart_playlists` (`name`, `and_or`, `queries`, `limit`, `limit_amount`) VALUES (:name, :and_or, :queries, :limit, :limit_amount);"""); + + query.set_string(":name", _("Favorite Songs")); + query.set_int(":and_or", 1); + query.set_string(":queries", "112413001263"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + query.set_string(":name", _("Recently Added")); + query.set_int(":and_or", 1); + query.set_string(":queries", "577"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + /* + query.set_string(":name", _("Recently Played")); + query.set_int(":and_or", 1); + query.set_string(":queries", "977"); + query.set_int(":limit", 0); + query.set_int(":limit_amount", 50); + query.execute(); + */ + + query.set_string(":name", _("Recent Favorites")); + query.set_int(":and_or", 1); + query.set_string(":queries", "11241300977"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + query.set_string(":name", _("Never Played")); + query.set_int(":and_or", 0); + query.set_string(":queries", "1100"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + query.set_string(":name", _("Over Played")); + query.set_int(":and_or", 1); + query.set_string(":queries", "11410"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + query.set_string(":name", _("Not Recently Played")); + query.set_int(":and_or", 1); + query.set_string(":queries", "987"); + query.set_int(":limit", 1); + query.set_int(":limit_amount", 50); + query.execute(); + + transaction.commit(); + } + catch (SQLHeavy.Error err) { + warning ("Could not initialize smart playlists: %s\n", err.message); + } + } + + public Gee.ArrayList load_smart_playlists() { + var rv = new Gee.ArrayList(); + assert (database != null); + + try { + string script = "SELECT * FROM `smart_playlists`"; + Query query = new Query(database, script); + + for (var results = query.execute(); !results.finished; results.next() ) { + SmartPlaylist p = new SmartPlaylist (libraries_manager.local_library); + + p.name = results.fetch_string(0); + p.conditional = (SmartPlaylist.ConditionalType)results.fetch_int(1); + p.add_queries (queries_from_string(results.fetch_string (2))); + p.limit = ( results.fetch_string(3) == "1") ? true : false; + p.limit_amount = results.fetch_int(4); + + rv.add(p); + } + } + catch (SQLHeavy.Error err) { + warning ("Could not load smart playlists from db: %s\n", err.message); + } + + return rv; + } + + public void save_smart_playlists(Gee.Collection smarts) { + assert (database != null); + try { + database.execute("DELETE FROM `smart_playlists`"); + transaction = database.begin_transaction(); + Query query = transaction.prepare ("INSERT INTO `smart_playlists` (`name`, `and_or`, `queries`, `limit`, `limit_amount`) VALUES (:name, :and_or, :queries, :limit, :limit_amount);"); + + foreach(SmartPlaylist s in smarts) { + query.set_string(":name", s.name); + query.set_int(":and_or", (int)s.conditional); + query.set_string(":queries", queries_to_string (s.get_queries ())); + query.set_int(":limit", ( s.limit ) ? 1 : 0); + query.set_int(":limit_amount", s.limit_amount); + + query.execute(); + } + + transaction.commit(); + } catch (SQLHeavy.Error err) { + warning ("Could not save smart playlists: %s \n", err.message); + } + } + + public void save_smart_playlist (SmartPlaylist p, string? old_name = null) { + assert (database != null); + if (old_name == null) { + remove_smart_playlist (p); + } else { + var sp = new SmartPlaylist (libraries_manager.local_library); + sp.name = old_name; + remove_smart_playlist (sp); + } + + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("""INSERT INTO `smart_playlists` (`name`, `and_or`, `queries`, `limit`, `limit_amount`) VALUES (:name, :and_or, :queries, :limit, :limit_amount);"""); + + query.set_string(":name", p.name); + query.set_int(":and_or", (int)p.conditional); + query.set_string(":queries", queries_to_string (p.get_queries ())); + query.set_int(":limit", ( p.limit ) ? 1 : 0); + query.set_int(":limit_amount", p.limit_amount); + + query.execute(); + transaction.commit(); + } catch(SQLHeavy.Error err) { + warning ("Could not update smart playlist: %s \n", err.message); + } + } + + public void remove_smart_playlist (SmartPlaylist p) { + assert (database != null); + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("""DELETE FROM `smart_playlists` WHERE name=:name"""); + + query.set_string(":name", p.name); + query.execute(); + + transaction.commit(); + } catch (SQLHeavy.Error err) { + warning ("Could not remove smart playlist from db: %s\n", err.message); + } + } + + public Gee.Collection load_devices() { + assert (database != null); + var rv = new Gee.ArrayList(); + + try { + string script = """SELECT rowid,* FROM `devices`"""; + Query query = new Query(database, script); + + for (var results = query.execute(); !results.finished; results.next() ) { + DevicePreferences dp = new DevicePreferences(results.fetch_string(1)); + + dp.sync_when_mounted = (results.fetch_int(2) == 1); + dp.sync_music = (results.fetch_int(3) == 1); + dp.sync_podcasts = (results.fetch_int(4) == 1); + dp.sync_audiobooks = (results.fetch_int(5) == 1); + dp.sync_all_music = (results.fetch_int(6) == 1); + dp.sync_all_podcasts = (results.fetch_int(7) == 1); + dp.sync_all_audiobooks = (results.fetch_int(8) == 1); + if (results.fetch_string(9) != null) { + dp.music_playlist = libraries_manager.local_library.playlist_from_name (results.fetch_string(9)); + if (dp.music_playlist == null) + dp.music_playlist = libraries_manager.local_library.smart_playlist_from_name (results.fetch_string(9)); + } + if (results.fetch_string(10) != null) { + dp.podcast_playlist = libraries_manager.local_library.playlist_from_name (results.fetch_string(10)); + if (dp.podcast_playlist == null) + dp.podcast_playlist = libraries_manager.local_library.smart_playlist_from_name (results.fetch_string(10)); + } + if (results.fetch_string(11) != null) { + dp.audiobook_playlist = libraries_manager.local_library.playlist_from_name (results.fetch_string(11)); + if (dp.audiobook_playlist == null) + dp.audiobook_playlist = libraries_manager.local_library.smart_playlist_from_name (results.fetch_string(11)); + } + dp.last_sync_time = results.fetch_int(12); + + rv.add (dp); + } + } catch (SQLHeavy.Error err) { + warning ("Could not load devices from db: %s\n", err.message); + } + + return rv; + } + + public void save_devices(Gee.Collection devices) { + assert (database != null); + try { + database.execute("DELETE FROM `devices`"); + transaction = database.begin_transaction(); + Query query = transaction.prepare("""INSERT INTO `devices` (`unique_id`, `sync_when_mounted`, `sync_music`, + `sync_podcasts`, `sync_audiobooks`, `sync_all_music`, `sync_all_podcasts`, `sync_all_audiobooks`, `music_playlist`, + `podcast_playlist`, `audiobook_playlist`, `last_sync_time`) VALUES (:unique_id, :sync_when_mounted, :sync_music, :sync_podcasts, :sync_audiobooks, + :sync_all_music, :sync_all_podcasts, :sync_all_audiobooks, :music_playlist, :podcast_playlist, :audiobook_playlist, :last_sync_time);"""); + + foreach(DevicePreferences dp in devices) { + query.set_string(":unique_id", dp.id); + query.set_int(":sync_when_mounted", dp.sync_when_mounted ? 1 : 0); + + query.set_int(":sync_music", dp.sync_music ? 1 : 0); + query.set_int(":sync_podcasts", dp.sync_podcasts ? 1 : 0); + query.set_int(":sync_audiobooks", dp.sync_audiobooks ? 1 : 0); + + query.set_int(":sync_all_music", dp.sync_all_music ? 1 : 0); + query.set_int(":sync_all_podcasts", dp.sync_all_podcasts ? 1 : 0); + query.set_int(":sync_all_audiobooks", dp.sync_all_audiobooks ? 1 : 0); + + string music_playlist = ""; + string podcast_playlist = ""; + string audiobook_playlist = ""; + + if (dp.music_playlist != null) + music_playlist = dp.music_playlist.name; + if (dp.podcast_playlist != null) + podcast_playlist = dp.podcast_playlist.name; + if (dp.audiobook_playlist != null) + audiobook_playlist = dp.audiobook_playlist.name; + + query.set_string(":music_playlist", music_playlist); + query.set_string(":podcast_playlist", podcast_playlist); + query.set_string(":audiobook_playlist", audiobook_playlist); + query.set_int(":last_sync_time", dp.last_sync_time); + + query.execute(); + } + + transaction.commit(); + } catch (SQLHeavy.Error err) { + warning ("Could not save devices: %s\n", err.message); + } + } + + public void save_device (DevicePreferences dp) { + assert (database != null); + try { + remove_device (dp); + transaction = database.begin_transaction(); + Query query = transaction.prepare("""INSERT INTO `devices` (`unique_id`, `sync_when_mounted`, `sync_music`, + `sync_podcasts`, `sync_audiobooks`, `sync_all_music`, `sync_all_podcasts`, `sync_all_audiobooks`, `music_playlist`, + `podcast_playlist`, `audiobook_playlist`, `last_sync_time`) VALUES (:unique_id, :sync_when_mounted, :sync_music, :sync_podcasts, :sync_audiobooks, + :sync_all_music, :sync_all_podcasts, :sync_all_audiobooks, :music_playlist, :podcast_playlist, :audiobook_playlist, :last_sync_time);"""); + + query.set_string(":unique_id", dp.id); + query.set_int(":sync_when_mounted", dp.sync_when_mounted ? 1 : 0); + + query.set_int(":sync_music", dp.sync_music ? 1 : 0); + query.set_int(":sync_podcasts", dp.sync_podcasts ? 1 : 0); + query.set_int(":sync_audiobooks", dp.sync_audiobooks ? 1 : 0); + + query.set_int(":sync_all_music", dp.sync_all_music ? 1 : 0); + query.set_int(":sync_all_podcasts", dp.sync_all_podcasts ? 1 : 0); + query.set_int(":sync_all_audiobooks", dp.sync_all_audiobooks ? 1 : 0); + + string music_playlist = ""; + string podcast_playlist = ""; + string audiobook_playlist = ""; + + if (dp.music_playlist != null) + music_playlist = dp.music_playlist.name; + if (dp.podcast_playlist != null) + podcast_playlist = dp.podcast_playlist.name; + if (dp.audiobook_playlist != null) + audiobook_playlist = dp.audiobook_playlist.name; + + query.set_string(":music_playlist", music_playlist); + query.set_string(":podcast_playlist", podcast_playlist); + query.set_string(":audiobook_playlist", audiobook_playlist); + query.set_int(":last_sync_time", dp.last_sync_time); + + query.execute(); + + transaction.commit(); + } + catch(SQLHeavy.Error err) { + warning ("Could not save device: %s\n", err.message); + } + } + + public void remove_device (DevicePreferences device) { + assert (database != null); + try { + transaction = database.begin_transaction(); + Query query = transaction.prepare("""DELETE FROM `devices` WHERE unique_id=:unique_id"""); + + query.set_string(":unique_id", device.id); + query.execute(); + + transaction.commit(); + } + catch (SQLHeavy.Error err) { + warning ("Could not remove smart playlist from db: %s\n", err.message); + } + } +} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/DataBaseUpdater.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/DataBaseUpdater.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/DataBaseUpdater.vala 1970-01-01 00:00:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/DataBaseUpdater.vala 2015-07-20 19:59:51.000000000 +0000 @@ -0,0 +1,87 @@ +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- +/*- + * Copyright (c) 2012 Noise Developers (http://launchpad.net/noise) + * + * This software is licensed under the GNU General Public License + * (version 2 or later). See the COPYING file in this distribution. + * + * The Noise authors hereby grant permission for non-GPL compatible + * GStreamer plugins to be used and distributed together with GStreamer + * and Noise. This permission is above and beyond the permissions granted + * by the GPL license by which Noise 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. + * + * Authored by: Scott Ringwelski , + * Victor Eduardo + */ + +public class Noise.DataBaseUpdater : Object { + + private Gee.LinkedList to_remove; + + public DataBaseUpdater () { + + to_remove = new Gee.LinkedList (); + + // Save on a regular basis and before exit + var app = (Noise.App) GLib.Application.get_default (); + app.shutdown.connect_after (() => on_close_ui_save ()); + app.shutdown.connect_after (update_db_sync); + } + + public async void removeItem (Object item) { + if (!to_remove.contains (item)) + to_remove.offer (item); + + update_db_sync (); + } + + private void update_db_sync () { + var dbm = DataBaseManager.get_default (); + for (Object? next = to_remove.poll (); next != null; next = to_remove.poll ()) { + if (next is Gee.Collection) { + dbm.remove_media (next as Gee.Collection); + } else if (next is StaticPlaylist) { + dbm.remove_playlist (next as StaticPlaylist); + dbm.remove_columns_state (next as StaticPlaylist, null); + } else if (next is SmartPlaylist) { + dbm.remove_smart_playlist (next as SmartPlaylist); + dbm.remove_columns_state (null, next as SmartPlaylist); + } else + assert_not_reached (); + } + } + + private bool on_close_ui_save () { + var playlists_and_queue = new Gee.TreeSet (); + playlists_and_queue.add_all (libraries_manager.local_library.get_playlists ()); + + playlists_and_queue.add (((LocalLibrary)libraries_manager.local_library).p_music); + + debug ("-- Saving columns state preferences DB."); + + var dbm = DataBaseManager.get_default (); + dbm.save_playlist (((LocalLibrary)libraries_manager.local_library).p_music); + dbm.save_columns_state (playlists_and_queue, libraries_manager.local_library.get_smart_playlists ()); + + debug ("-- Finished columns state preferences DB."); + + return true; + } + // If the name of the playlist changed, it provides the old name to remove it from database + public void save_device (DevicePreferences device) { + DataBaseManager.get_default ().save_device (device); + } + + // If the name of the playlist changed, it provides the old name to remove it from database + public void save_playlist (StaticPlaylist p, string? old_name = null) { + DataBaseManager.get_default ().save_playlist (p, old_name); + } + + // If the name of the playlist changed, it provides the old name to remove it from database + public void save_smart_playlist (SmartPlaylist p, string? old_name = null) { + DataBaseManager.get_default ().save_smart_playlist (p, old_name); + } +} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/Tables.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/Tables.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase/Tables.vala 1970-01-01 00:00:00.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase/Tables.vala 2015-07-20 19:59:51.000000000 +0000 @@ -0,0 +1,63 @@ +// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- +/*- + * Copyright (c) 2012 Noise Developers (http://launchpad.net/noise) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * The Noise authors hereby grant permission for non-GPL compatible + * GStreamer plugins to be used and distributed together with GStreamer + * and Noise. This permission is above and beyond the permissions granted + * by the GPL license by which Noise 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. + */ + +namespace Noise.Database.Tables { + +public const string PLAYLISTS = """ +CREATE TABLE IF NOT EXISTS playlists (`name` TEXT, `media` TEXT, +`sort_column_id` INT, `sort_direction` TEXT, `columns` TEXT) +"""; + +public const string SMART_PLAYLISTS = """ +CREATE TABLE IF NOT EXISTS smart_playlists (`name` TEXT, `and_or` INT, `queries` TEXT, +`limit` INT, `limit_amount` INT) +"""; + +public const string COLUMNS = """ +CREATE TABLE IF NOT EXISTS columns (`is_smart` INT, `name` TEXT, `sort_column_id` INT, `sort_direction` TEXT, +`columns` TEXT) +"""; + +public const string MEDIA = """ +CREATE TABLE IF NOT EXISTS media (`uri` TEXT, `file_size` INT, `title` TEXT, +`artist` TEXT, `composer` TEXT, `album_artist` TEXT, `album` TEXT, +`grouping` TEXT, `genre` TEXT,`comment` TEXT, `lyrics` TEXT, `has_embedded` INT, +`year` INT, `track` INT, `track_count` INT, `album_number` INT, +`album_count` INT, `bitrate` INT, `length` INT, `samplerate` INT, `rating` INT, +`playcount` INT, `skipcount` INT, `dateadded` INT, `lastplayed` INT, +`lastmodified` INT, `rowid` INTEGER PRIMARY KEY AUTOINCREMENT) +"""; + +public const string DEVICES = """ +CREATE TABLE IF NOT EXISTS devices (`unique_id` TEXT, `sync_when_mounted` INT, +`sync_music` INT, `sync_podcasts` INT, `sync_audiobooks` INT, `sync_all_music` INT, +`sync_all_podcasts` INT, `sync_all_audiobooks` INT, `music_playlist` STRING, +`podcast_playlist` STRING, `audiobook_playlist` STRING, `last_sync_time` INT) +"""; + +} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/DataBase.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/DataBase.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- -/*- - * Copyright (c) 2012-2015 Noise Developers (https://launchpad.net/noise) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * The Noise authors hereby grant permission for non-GPL compatible - * GStreamer plugins to be used and distributed together with GStreamer - * and Noise. This permission is above and beyond the permissions granted - * by the GPL license by which Noise 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. - */ - -namespace Noise.Database { - namespace Tables { - public const string PLAYLISTS = """CREATE TABLE IF NOT EXISTS playlists (name TEXT, media TEXT, - sort_column_id INT, sort_direction TEXT, columns TEXT, rowid INTEGER PRIMARY KEY AUTOINCREMENT)"""; - - public const string SMART_PLAYLISTS = """CREATE TABLE IF NOT EXISTS smart_playlists (name TEXT, - and_or INT, queries TEXT, limited INT, limit_amount INT, rowid INTEGER PRIMARY KEY AUTOINCREMENT)"""; - - public const string COLUMNS = """CREATE TABLE IF NOT EXISTS columns (is_smart INT, name TEXT, - sort_column_id INT, sort_direction TEXT, columns TEXT)"""; - - public const string MEDIA = """CREATE TABLE IF NOT EXISTS media (uri TEXT, file_size INT, - title TEXT, artist TEXT, composer TEXT, album_artist TEXT, album TEXT, - grouping TEXT, genre TEXT,comment TEXT, lyrics TEXT, has_embedded INT, - year INT, track INT, track_count INT, album_number INT, - album_count INT, bitrate INT, length INT, samplerate INT, rating INT, - playcount INT, skipcount INT, dateadded INT, lastplayed INT, - lastmodified INT, rowid INTEGER PRIMARY KEY AUTOINCREMENT)"""; - - public const string DEVICES = """CREATE TABLE IF NOT EXISTS devices (unique_id TEXT, - sync_when_mounted INT, sync_music INT, sync_all_music INT, music_playlist STRING, - last_sync_time INT)"""; - } - - /* - * NOTE: - * Update those constants when you change the order of columns. - */ - namespace Playlists { - public static const string TABLE_NAME = "playlists"; - public static const string NAME = "+0"; - public static const string MEDIA = "+1"; - public static const string SORT_COLUMN_ID = "+2"; - public static const string SORT_DIRECTION = "+3"; - public static const string COLUMNS = "+4"; - public static const string ROWID = "+5"; - } - - namespace SmartPlaylists { - public static const string TABLE_NAME = "smart_playlists"; - public static const string NAME = "+0"; - public static const string AND_OR = "+1"; - public static const string QUERIES = "+2"; - public static const string LIMITED = "+3"; - public static const string LIMIT_AMOUNT = "+4"; - public static const string ROWID = "+5"; - } - - namespace Media { - public static const string TABLE_NAME = "media"; - public static const string URI = "+0"; - public static const string FILE_SIZE = "+1"; - public static const string TITLE = "+2"; - public static const string ARTIST = "+3"; - public static const string COMPOSER = "+4"; - public static const string ALBUM_ARTIST = "+5"; - public static const string ALBUM = "+6"; - public static const string GROUPING = "+7"; - public static const string GENRE = "+8"; - public static const string COMMENT = "+9"; - public static const string LYRICS = "+10"; - public static const string HAS_EMBEDDED = "+11"; - public static const string YEAR = "+12"; - public static const string TRACK = "+13"; - public static const string TRACK_COUNT = "+14"; - public static const string ALBUM_NUMBER = "+15"; - public static const string ALBUM_COUNT = "+16"; - public static const string BITRATE = "+17"; - public static const string LENGTH = "+18"; - public static const string SAMPLERATE = "+19"; - public static const string RATING = "+20"; - public static const string PLAYCOUNT = "+21"; - public static const string SKIPCOUNT = "+22"; - public static const string DATEADDED = "+23"; - public static const string LASTPLAYED = "+24"; - public static const string LASTMODIFIED = "+25"; - public static const string ROWID = "+26"; - } - - namespace Devices { - public static const string TABLE_NAME = "devices"; - public static const string UNIQUE_ID = "+0"; - public static const string SYNC_WHEN_MOUNTED = "+1"; - public static const string SYNC_MUSIC = "+2"; - public static const string SYNC_ALL_MUSIC = "+3"; - public static const string MUSIC_PLAYLIST = "+4"; - public static const string LAST_SYNC_TIME = "+5"; - } - - /* - * Helper functions. - */ - private static Value make_string_value (string str) { - var val = Value (typeof(string)); - val.set_string (str); - return val; - } - - private static Value make_bool_value (bool bl) { - var val = Value (typeof(bool)); - val.set_boolean (bl); - return val; - } - - private static Value make_uint_value (uint u) { - var val = Value (typeof(uint)); - val.set_uint (u); - return val; - } - - private static Value make_int_value (int u) { - var val = Value (typeof(int)); - val.set_int (u); - return val; - } - - private static Value make_int64_value (int64 u) { - var val = Value (typeof(int64)); - val.set_int64 (u); - return val; - } - - private static Value make_uint64_value (uint64 u) { - var val = Value (typeof(uint64)); - val.set_uint64 (u); - return val; - } - - private static GLib.Value? query_field (int64 rowid, Gda.Connection connection, string table, string field) { - try { - var sql = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - sql.select_add_target (table, null); - sql.add_field_value_id (sql.add_id (field), 0); - var id_field = sql.add_id ("rowid"); - var id_param = sql.add_expr_value (null, Database.make_int64_value (rowid)); - var id_cond = sql.add_cond (Gda.SqlOperatorType.EQ, id_field, id_param, 0); - sql.set_where (id_cond); - var data_model = connection.statement_execute_select (sql.get_statement (), null); - return data_model.get_value_at (data_model.get_column_index (field), 0); - } catch (Error e) { - critical ("Could not query field %s: %s", field, e.message); - return null; - } - } - - private static void set_field (int64 rowid, Gda.Connection connection, string table, string field, GLib.Value value) { - try { - var rowid_value = GLib.Value (typeof (int64)); - rowid_value.set_int64 (rowid); - var col_names = new GLib.SList (); - col_names.append (field); - var values = new GLib.SList (); - values.append (value); - connection.update_row_in_table_v (table, "rowid", rowid_value, col_names, values); - } catch (Error e) { - critical ("Could not set field %s: %s", field, e.message); - } - } -} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Dialogs/FileNotFoundDialog.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Dialogs/FileNotFoundDialog.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Dialogs/FileNotFoundDialog.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Dialogs/FileNotFoundDialog.vala 2015-07-20 19:59:51.000000000 +0000 @@ -118,7 +118,7 @@ void locate_media_clicked () { Media m = media_list.get (0); - int64 media_id = m.rowid; + int media_id = m.rowid; string file = ""; var file_chooser = new Gtk.FileChooserDialog (_("Choose Music Folder"), this, diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Dialogs/SmartPlaylistEditor.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Dialogs/SmartPlaylistEditor.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Dialogs/SmartPlaylistEditor.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Dialogs/SmartPlaylistEditor.vala 2015-07-20 19:59:51.000000000 +0000 @@ -281,11 +281,11 @@ comparator_combobox.set_active ((int)q.comparator); if (needs_value (q.field)) { - value_entry.text = q.value.get_string (); + value_entry.text = q.value; } else if (q.field == SmartQuery.FieldType.RATING) { - _valueRating.rating = q.value.get_int (); + _valueRating.rating = int.parse (q.value); } else { - _valueNumerical.set_value (q.value.get_int ()); + _valueNumerical.set_value (int.parse (q.value)); } _units = new Gtk.Label (""); @@ -313,11 +313,11 @@ rv.field = (SmartQuery.FieldType)field_combobox.get_active (); rv.comparator = comparators.get (comparator_combobox.get_active ()); if (needs_value ((SmartQuery.FieldType)field_combobox.get_active ())) - rv.value.set_string (value_entry.text); + rv.value = value_entry.text; else if (field_combobox.get_active () == SmartQuery.FieldType.RATING) - rv.value.set_int (_valueRating.rating); + rv.value = _valueRating.rating.to_string (); else - rv.value.set_int ((int)_valueNumerical.value); + rv.value = _valueNumerical.value.to_string (); return rv; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/FileOperator.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/FileOperator.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/FileOperator.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/FileOperator.vala 2015-07-20 19:59:51.000000000 +0000 @@ -309,7 +309,7 @@ App.main_window.show_notification (_("Import Complete"), _("%s has imported your library.").printf (((Noise.App) GLib.Application.get_default ()).get_name ())); if (import_type == ImportType.PLAYLIST) { - var to_add = new Gee.LinkedList (); + var to_add = new Gee.LinkedList (); foreach (var s in all_new_imports) to_add.add (s.rowid); new_playlist.add_medias (to_add); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LibraryWindow.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LibraryWindow.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LibraryWindow.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LibraryWindow.vala 2015-07-20 19:59:51.000000000 +0000 @@ -510,21 +510,16 @@ initialization_finished = true; // Set the focus on the current view - if (main_settings.last_playlist_playing > 0) { + if (main_settings.last_playlist_playing != -1) { for (int i =0; i< view_container.get_n_pages (); i++) { var parent = view_container.get_nth_page (i) as ViewWrapper; if (parent.relative_id == main_settings.last_playlist_playing) { - switch (parent.hint) { - case (Noise.ViewWrapper.Hint.PLAYLIST): - case (Noise.ViewWrapper.Hint.READ_ONLY_PLAYLIST): - show_playlist_view (libraries_manager.local_library.playlist_from_id (parent.relative_id)); - break; - case (Noise.ViewWrapper.Hint.SMART_PLAYLIST): - show_playlist_view (libraries_manager.local_library.smart_playlist_from_id (parent.relative_id)); - break; - } + if (parent.hint == Noise.ViewWrapper.Hint.PLAYLIST || parent.hint == Noise.ViewWrapper.Hint.READ_ONLY_PLAYLIST) + show_playlist_view (libraries_manager.local_library.playlist_from_id (parent.relative_id)); + else if (parent.hint == Noise.ViewWrapper.Hint.SMART_PLAYLIST) + show_playlist_view (libraries_manager.local_library.smart_playlist_from_id (parent.relative_id)); + break; } - show_playlist_view (library_manager.p_music); } } else { @@ -543,7 +538,8 @@ debug ("DONE WITH USER INTERFACE"); - int64 last_playing_id = main_settings.last_media_playing; + int last_playing_id = main_settings.last_media_playing; + if (last_playing_id > 0) { var last_playing_media = library_manager.media_from_id (last_playing_id); if (last_playing_media != null && last_playing_media.file.query_exists ()) @@ -659,19 +655,21 @@ private void load_playlists () { debug ("Loading playlists"); - //match_tvs.set_all (DataBaseManager.get_default ().load_columns_state ()); + + library_manager.add_playlist (App.player.queue_playlist); + library_manager.add_playlist (App.player.history_playlist); + + match_tvs.set_all (DataBaseManager.get_default ().load_columns_state ()); foreach (SmartPlaylist p in library_manager.get_smart_playlists()) { add_smartplaylist (p); } foreach (StaticPlaylist p in library_manager.get_playlists()) { - add_playlist (p); + if (p.name != App.player.queue_playlist.name && p.name != App.player.history_playlist.name) + add_playlist (p); } - - add_playlist (App.player.queue_playlist); - add_playlist (App.player.history_playlist); - + TreeViewSetup? music_tvs = null; foreach (var entry in match_tvs.entries) { if (entry.key.name == MUSIC_PLAYLIST) { @@ -774,15 +772,14 @@ match_devices.unset (device.get_unique_identifier()); remove_view_and_update (page_number); } - + private void create_device_source_list (Device d) { lock (match_devices) { SourceListEntry? entry; - var pref = library_manager.get_preferences_for_device (d); - var dv = new DeviceView (d, pref); + var dv = new DeviceView (d); int view_number = view_container.add_view (dv); - match_devices.set (d.get_unique_identifier (), view_number); - if(d.only_use_custom_view ()) { + match_devices.set (d.get_unique_identifier(), view_number); + if(d.only_use_custom_view()) { message("new custom device (probably a CD) added with %d songs.\n", d.get_library ().get_medias().size); entry = source_list_view.add_item (view_number, d.getDisplayName(), ViewWrapper.Hint.DEVICE, d.get_icon(), new ThemedIcon ("media-eject-symbolic"), null, d); @@ -843,29 +840,43 @@ SourceListEntry? entry; int view_number; if (p.read_only == false) { - var view = new PlaylistViewWrapper (p, ViewWrapper.Hint.PLAYLIST, null, library); + var view = new PlaylistViewWrapper (p.rowid, ViewWrapper.Hint.PLAYLIST, null, library); view_number = view_container.add_view (view); entry = source_list_view.add_item (view_number, p.name, ViewWrapper.Hint.PLAYLIST, p.icon, null, into_expandable); } else { - var view = new PlaylistViewWrapper (p, ViewWrapper.Hint.READ_ONLY_PLAYLIST, match_tvs.get (p), library); - if (p == App.player.queue_playlist) { - view.set_no_media_alert_message (_("No songs in Queue"), _("To add songs to the queue, use the secondary click on an item and choose Queue. When a song finishes, the queued songs will be played first before the next song in the currently playing list.")); - App.player.queue_media (p.medias); - } else if (p == App.player.history_playlist) { - view.set_no_media_alert_message (_("No songs in History"), _("After a part of a song has been played, it is added to the history list.\nYou can use this list to see all the songs you have played during the current session.")); - } - view_number = view_container.add_view (view); - entry = source_list_view.add_item (view_number, p.name, ViewWrapper.Hint.READ_ONLY_PLAYLIST, p.icon, null, into_expandable); - - if (p.show_badge == true) { + if (p.name == C_("Name of the playlist", "Queue")) { + var queue_view = new PlaylistViewWrapper (App.player.queue_playlist.rowid, ViewWrapper.Hint.READ_ONLY_PLAYLIST, + match_tvs.get (App.player.queue_playlist), library); + queue_view.set_no_media_alert_message (_("No songs in Queue"), + _("To add songs to the queue, use the secondary click on an item and choose Queue. When a song finishes, the queued songs will be played first before the next song in the currently playing list.")); + view_number = view_container.add_view (queue_view); + entry = source_list_view.add_item (view_number, App.player.queue_playlist.name, + ViewWrapper.Hint.READ_ONLY_PLAYLIST, new ThemedIcon ("playlist-queue")); update_badge_on_playlist_update (p, entry); + App.player.queue_media (p.medias); + } else if (p.name == _("History")) { + var history_view = new PlaylistViewWrapper (App.player.history_playlist.rowid, ViewWrapper.Hint.READ_ONLY_PLAYLIST, + match_tvs.get(App.player.history_playlist), library); + history_view.set_no_media_alert_message (_("No songs in History"), + _("After a part of a song has been played, it is added to the history list.\nYou can use this list to see all the songs you have played during the current session.")); + view_number = view_container.add_view (history_view); + entry = source_list_view.add_item (view_number, App.player.history_playlist.name, + ViewWrapper.Hint.READ_ONLY_PLAYLIST, new ThemedIcon ("document-open-recent")); + App.player.history_playlist.add_medias (p.medias); + } else { + var view = new PlaylistViewWrapper (p.rowid, ViewWrapper.Hint.READ_ONLY_PLAYLIST, match_tvs.get(p), library); + view_number = view_container.add_view (view); + entry = source_list_view.add_item (view_number, p.name, ViewWrapper.Hint.READ_ONLY_PLAYLIST, p.icon, null, into_expandable); + if (p.show_badge == true) { + update_badge_on_playlist_update (p, entry); + } } } - - match_playlist_entry.set (p, entry); - match_playlists.set (p, view_number); - - if (newly_created_playlist == true && p.read_only == false) { + lock (match_playlists) { + match_playlist_entry.set (p, entry); + match_playlists.set (p, view_number); + } + if (newly_created_playlist == true) { newly_created_playlist = false; show_playlist_view (p); @@ -914,12 +925,11 @@ } } } - private void create_smartplaylist_source_list (SmartPlaylist p, SourceListExpandableItem? into_expandable = null, Library? library = library_manager) { SourceListEntry? entry; int view_number; - var view = new PlaylistViewWrapper (p, ViewWrapper.Hint.SMART_PLAYLIST, match_tvs.get(p), library_manager); + var view = new PlaylistViewWrapper (p.rowid, ViewWrapper.Hint.SMART_PLAYLIST, match_tvs.get(p), library_manager); view.button_clicked.connect ((playlist_id) => { show_smart_playlist_dialog(library_manager.smart_playlist_from_id(playlist_id)); }); @@ -986,7 +996,7 @@ } - public virtual void playback_stopped (int64 was_playing) { + public virtual void playback_stopped (int was_playing) { playButton.set_image (new Gtk.Image.from_icon_name ("media-playback-start-symbolic", Gtk.IconSize.LARGE_TOOLBAR)); //reset some booleans tested_for_video = false; diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/DevicePreferences.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/DevicePreferences.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/DevicePreferences.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/DevicePreferences.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- -/*- - * Copyright (c) 2012-2015 Noise Developers (https://launchpad.net/noise) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * The Noise authors hereby grant permission for non-GPL compatible - * GStreamer plugins to be used and distributed together with GStreamer - * and Noise. This permission is above and beyond the permissions granted - * by the GPL license by which Noise 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. - * - * Authored by: Scott Ringwelski - * Corentin Noël - */ - -public class Noise.DevicePreferences : GLib.Object { - private string id; - - public bool? _sync_when_mounted = null; - public bool sync_when_mounted { - get { - common_bool_getter ("sync_when_mounted", ref _sync_when_mounted); - return _sync_when_mounted; - } - set { - common_bool_setter ("sync_when_mounted", value, ref _sync_when_mounted); - } - } - - public uint? _last_sync_time = null; - public uint last_sync_time { - get { - common_uint_getter ("last_sync_time", ref _last_sync_time); - return _last_sync_time; - } - set { - common_uint_setter ("last_sync_time", value, ref _last_sync_time); - } - } - - public bool? _sync_music = null; - public bool sync_music { - get { - common_bool_getter ("sync_music", ref _sync_music); - return _sync_music; - } - set { - common_bool_setter ("sync_music", value, ref _sync_music); - } - } - - public bool? _sync_all_music = null; - public bool sync_all_music { - get { - common_bool_getter ("sync_all_music", ref _sync_all_music); - return _sync_all_music; - } - set { - common_bool_setter ("sync_all_music", value, ref _sync_all_music); - } - } - - public Playlist? music_playlist { - owned get { - var result = query_field ("music_playlist"); - if (result.type () == typeof (Gda.Null)) { - return null; - } - - string playlist_string = result.get_string (); - if (playlist_string == ""|| playlist_string == null) - return null; - if ("p" in playlist_string) { - playlist_string = playlist_string.replace ("p", ""); - return Noise.libraries_manager.local_library.playlist_from_id (int64.parse (playlist_string)); - } else { - playlist_string = playlist_string.replace ("s", ""); - return Noise.libraries_manager.local_library.smart_playlist_from_id (int64.parse (playlist_string)); - } - } - set { - string playlist_string = ""; - if (value != null) { - if (value is StaticPlaylist) { - playlist_string = "p%lld".printf (value.rowid); - } else { - playlist_string = "s%lld".printf (value.rowid); - } - } - - set_field ("music_playlist", Database.make_string_value (playlist_string)); - } - } - - private Gda.Connection connection; - - public DevicePreferences (Noise.Device device, Gda.Connection connection) { - this.id = device.get_unique_identifier (); - this.connection = connection; - if (query_field ("sync_music") == null) { - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.INSERT); - builder.set_table (Database.Devices.TABLE_NAME); - builder.add_field_value_as_gvalue ("unique_id", Database.make_string_value (id)); - connection.statement_execute_non_select (builder.get_statement (), null, null); - } catch (Error e) { - warning ("Could not save media: %s", e.message); - } - } - } - - private uint common_uint_getter (string field, ref uint? temp) { - if (temp != null) - return temp; - - var result = query_field (field); - if (result.type () == typeof (Gda.Null)) { - temp = 0; - return temp; - } - - temp = (uint)result.get_int (); - return temp; - } - - private void common_uint_setter (string field, uint value, ref uint? temp) { - temp = value; - set_field (field, Database.make_uint_value (value)); - } - - private bool common_bool_getter (string field, ref bool? temp) { - if (temp != null) - return temp; - - var result = query_field (field); - if (result.type () == typeof (Gda.Null)) { - temp = false; - return temp; - } - - temp = result.get_int () == 1; - return temp; - } - - private void common_bool_setter (string field, bool value, ref bool? temp) { - temp = value; - set_field (field, Database.make_bool_value (value)); - } - - private GLib.Value? query_field (string field) { - try { - var sql = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - sql.select_add_target (Database.Devices.TABLE_NAME, null); - sql.add_field_value_id (sql.add_id (field), 0); - var id_field = sql.add_id ("unique_id"); - var id_param = sql.add_expr_value (null, Database.make_string_value (id)); - var id_cond = sql.add_cond (Gda.SqlOperatorType.EQ, id_field, id_param, 0); - sql.set_where (id_cond); - var data_model = connection.statement_execute_select (sql.get_statement (), null); - return data_model.get_value_at (data_model.get_column_index (field), 0); - } catch (Error e) { - critical ("Could not query field %s: %s", field, e.message); - return null; - } - } - - private void set_field (string field, GLib.Value value) { - try { - var col_names = new GLib.SList (); - col_names.append (field); - var values = new GLib.SList (); - values.append (value); - connection.update_row_in_table_v (Database.Devices.TABLE_NAME, "unique_id", Database.make_string_value (id), col_names, values); - } catch (Error e) { - critical ("Could not set field %s: %s", field, e.message); - } - } -} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalLibrary.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalLibrary.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalLibrary.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalLibrary.vala 2015-07-20 19:59:51.000000000 +0000 @@ -36,13 +36,16 @@ * the visual representation of this class */ public class Noise.LocalLibrary : Library { + public DataBaseUpdater dbu; + private FileOperator fo; private GStreamerTagger tagger; private Gee.TreeSet _playlists; private Gee.TreeSet _smart_playlists; - private Gee.HashMap _medias; + private Gee.TreeSet _medias; private Gee.TreeSet _searched_medias; + private int playlists_rowid = 0; public StaticPlaylist p_music; @@ -51,135 +54,64 @@ } private Gee.TreeSet open_media_list; - private bool _doing_file_operations = false; - - private Gda.Connection connection; - private Gda.SqlParser parser; - private static const string DB_FILE = "database_0_3_1"; + private bool _doing_file_operations = false; public LocalLibrary () { libraries_manager.local_library = this; _playlists = new Gee.TreeSet (); _smart_playlists = new Gee.TreeSet (); - _medias = new Gee.HashMap ((Gee.HashDataFunc)GLib.int64_hash, (Gee.EqualDataFunc?)GLib.int64_equal, null); + _medias = new Gee.TreeSet (); _searched_medias = new Gee.TreeSet (); tagger = new GStreamerTagger(); open_media_list = new Gee.TreeSet (); p_music = new StaticPlaylist (); p_music.name = MUSIC_PLAYLIST; + this.dbu = new DataBaseUpdater (); this.fo = new FileOperator (); } public override void initialize_library () { - init_database (); + var dbm = DataBaseManager.get_default (); fo.connect_to_manager (); - // Load all media from database - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - builder.select_add_target (Database.Media.TABLE_NAME, null); - builder.select_add_field ("rowid", null, null); - var data_model = connection.statement_execute_select (builder.get_statement (), null); - for (int i = 0; i < data_model.get_n_rows (); i++) { - var rowid = data_model.get_value_at (data_model.get_column_index ("rowid"), i); - var m = new LocalMedia (rowid.get_int64 (), connection); - _medias.set (m.rowid, m); - } - } catch (Error e) { - // TODO: Expose errors to the user ! - critical ("Could not query media: %s", e.message); - } - - // Load all smart playlists from database - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - builder.select_add_target (Database.SmartPlaylists.TABLE_NAME, null); - builder.select_add_field ("rowid", null, null); - var data_model = connection.statement_execute_select (builder.get_statement (), null); - for (int i = 0; i < data_model.get_n_rows (); i++) { - var rowid = data_model.get_value_at (data_model.get_column_index ("rowid"), i); - var p = new LocalSmartPlaylist (rowid.get_int64 (), connection); - _smart_playlists.add (p); + lock (_medias) { + foreach (var m in dbm.load_media ()) { + _medias.add (m); } - } catch (Error e) { - // TODO: Expose errors to the user ! - critical ("Could not query smart playlists: %s", e.message); } - // Load all static playlists from database - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - builder.select_add_target (Database.Playlists.TABLE_NAME, null); - builder.select_add_field ("rowid", null, null); - var data_model = connection.statement_execute_select (builder.get_statement (), null); - for (int i = 0; i < data_model.get_n_rows (); i++) { - var rowid = data_model.get_value_at (data_model.get_column_index ("rowid"), i); - var p = new LocalStaticPlaylist (rowid.get_int64 (), connection); - _playlists.add (p); - } - } catch (Error e) { - // TODO: Expose errors to the user ! - critical ("Could not query playlists: %s", e.message); + // Load smart playlists from database + lock (_smart_playlists) { + foreach (var p in dbm.load_smart_playlists ()) { + _smart_playlists.add (p); + p.rowid = playlists_rowid; + playlists_rowid++; + p.updated.connect ((old_name) => {smart_playlist_updated (p, old_name);}); + } } - load_media_art_cache.begin (); - } + // Load all static playlists from database - /* - * Database interaction - */ - private void init_database () { - var database_dir = FileUtils.get_data_directory (); - try { - database_dir.make_directory_with_parents (null); - } catch (GLib.Error err) { - if (err is IOError.EXISTS == false) - error ("Could not create data directory: %s", err.message); - } - - var db_file = database_dir.get_child (DB_FILE + ".db"); - bool new_db = !db_file.query_exists (); - if (new_db) { - try { - db_file.create (FileCreateFlags.PRIVATE); - } catch (Error e) { - critical ("Error: %s", e.message); + lock (_playlists) { + foreach (var p in dbm.load_playlists ()) { + if (p.name == C_("Name of the playlist", "Queue") || p.name == _("History")) { + continue; + } else if (p.name != MUSIC_PLAYLIST) { + _playlists.add (p); + p.rowid = playlists_rowid; + playlists_rowid++; + p.updated.connect ((old_name) => {playlist_updated (p, old_name);}); + continue; + } } } - try { - connection = new Gda.Connection.from_string ("SQLite", "DB_DIR=%s;DB_NAME=%s".printf (database_dir.get_path (), DB_FILE), null, Gda.ConnectionOptions.NONE); - connection.open (); - } catch (Error e) { - error (e.message); - } - - parser = connection.create_parser (); - - if (new_db) { - load_table (Database.Tables.PLAYLISTS); - load_table (Database.Tables.SMART_PLAYLISTS); - load_table (Database.Tables.COLUMNS); - load_table (Database.Tables.MEDIA); - load_table (Database.Tables.DEVICES); - LocalSmartPlaylist.add_defaults (connection); - } - } - - private void load_table (string table) { - try { - var statement = parser.parse_string (table, null); - connection.statement_execute_non_select (statement, null, null); - } catch (Error e) { - critical (e.message); - } + DeviceManager.get_default ().set_device_preferences (dbm.load_devices ()); + load_media_art_cache.begin (); } - /* - * Media art utilities. - */ private async void load_media_art_cache () { lock (_medias) { yield CoverartCache.instance.load_for_media_async (get_medias ()); @@ -203,7 +135,7 @@ } public void remove_all_static_playlists () { - var list = new Gee.TreeSet (); + var list = new Gee.TreeSet (); lock (_playlists) { foreach (var p in _playlists) { if (p.read_only == false) @@ -226,7 +158,7 @@ clear_medias (); - App.player.unqueue_media (_medias.values); + App.player.unqueue_media (_medias); App.player.reset_already_played (); // FIXME: these are library window's internals. Shouldn't be here @@ -407,7 +339,7 @@ return result; } - public override StaticPlaylist? playlist_from_id (int64 id) { + public override StaticPlaylist? playlist_from_id (int id) { lock (_playlists) { foreach (var p in get_playlists ()) { if (p.rowid == id) { @@ -435,54 +367,34 @@ } public override void add_playlist (StaticPlaylist p) { - string rv = ""; - foreach (var m in p.medias) { - if (rv == "") { - rv = "%lld".printf (m.rowid); - } else { - rv += ";%lld".printf (m.rowid); - } - } - - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.INSERT); - builder.set_table (Database.Playlists.TABLE_NAME); - builder.add_field_value_as_gvalue ("name", Database.make_string_value (p.name)); - builder.add_field_value_as_gvalue ("media", Database.make_string_value (rv)); - var statement = builder.get_statement (); - Gda.Set last_insert_row; - var result = connection.statement_execute_non_select (statement, null, out last_insert_row); - var local_p = new LocalStaticPlaylist (last_insert_row.get_holder_value (Database.Playlists.ROWID).get_int64 (), connection); - - lock (_playlists) { - _playlists.add (local_p); - } - - playlist_added (local_p); - debug ("playlist %s added", local_p.name); - } catch (Error e) { - critical (e.message); + lock (_playlists) { + _playlists.add (p); } + p.rowid = playlists_rowid; + playlists_rowid++; + p.updated.connect ((old_name) => {playlist_updated (p, old_name);}); + DataBaseManager.get_default ().add_playlist (p); + playlist_added (p); + debug ("playlist %s added",p.name); } - public override void remove_playlist (int64 id) { + public override void remove_playlist (int id) { lock (_playlists) { foreach (var playlist in get_playlists ()) { if (playlist.rowid == id) { _playlists.remove (playlist); + dbu.removeItem.begin (playlist); playlist_removed (playlist); break; } } - - try { - connection.delete_row_from_table (Database.Playlists.TABLE_NAME, "rowid", Database.make_int64_value (id)); - } catch (Error e) { - critical (e.message); - } } } + public void playlist_updated (StaticPlaylist p, string? old_name = null) { + dbu.save_playlist (p, old_name); + } + /* * Smart playlists */ @@ -497,7 +409,7 @@ return result; } - public override SmartPlaylist? smart_playlist_from_id (int64 id) { + public override SmartPlaylist? smart_playlist_from_id (int id) { lock (_smart_playlists) { foreach (var p in get_smart_playlists ()) { if (p.rowid == id) { @@ -521,50 +433,40 @@ return null; } - public override void add_smart_playlist (SmartPlaylist p) { - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.INSERT); - builder.set_table (Database.SmartPlaylists.TABLE_NAME); - builder.add_field_value_as_gvalue ("name", Database.make_string_value (p.name)); - var statement = builder.get_statement (); - Gda.Set last_insert_row; - connection.statement_execute_non_select (statement, null, out last_insert_row); - if (last_insert_row != null) { - var local_sp = new LocalSmartPlaylist (last_insert_row.get_holder_value (Database.SmartPlaylists.ROWID).get_int64 (), connection); - local_sp.conditional = p.conditional; - local_sp.limit = p.limit; - local_sp.limit_amount = p.limit_amount; - local_sp.add_queries (p.get_queries ()); - - lock (_smart_playlists) { - _smart_playlists.add (local_sp); - } + public async void save_smart_playlists () { + lock (_smart_playlists) { + DataBaseManager.get_default ().save_smart_playlists (get_smart_playlists ()); + } + } - smartplaylist_added (local_sp); - } - } catch (Error e) { - critical (e.message); + public override void add_smart_playlist (SmartPlaylist p) { + lock (_smart_playlists) { + _smart_playlists.add (p); } + + p.rowid = playlists_rowid; + playlists_rowid++; + DataBaseManager.get_default ().save_smart_playlist (p); + p.updated.connect ((old_name) => {smart_playlist_updated (p, old_name);}); + smartplaylist_added (p); } - public override void remove_smart_playlist (int64 id) { + public override void remove_smart_playlist (int id) { lock (_smart_playlists) { foreach (var p in get_smart_playlists ()) { if (p.rowid == id) { _smart_playlists.remove (p); smartplaylist_removed (p); + dbu.removeItem.begin (p); break; } } } - - try { - connection.delete_row_from_table (Database.SmartPlaylists.TABLE_NAME, "rowid", Database.make_int64_value (id)); - } catch (Error e) { - critical (e.message); - } } + public void smart_playlist_updated (SmartPlaylist p, string? old_name = null) { + dbu.save_smart_playlist (p, old_name); + } /******************** Media stuff ******************/ @@ -572,19 +474,19 @@ lock (_searched_medias) { _searched_medias.clear (); if (search == "") { - _searched_medias.add_all (_medias.values); + _searched_medias.add_all (_medias); search_finished (); return; } - uint parsed_rating; + int parsed_rating; string parsed_search_string; String.base_search_method (search, out parsed_rating, out parsed_search_string); bool rating_search = parsed_rating > 0; lock (_medias) { - foreach (var m in _medias.values) { + foreach (var m in _medias) { if (rating_search) { - if (m.rating == parsed_rating) + if (m.rating == (uint) parsed_rating) _searched_medias.add (m); } else if (Search.match_string_to_media (m, parsed_search_string)) { _searched_medias.add (m); @@ -608,7 +510,7 @@ // We really only want to clear the songs that are permanent and on the file system // Dont clear podcasts that link to a url, device media, temporary media, previews, songs var unset = new Gee.LinkedList (); - foreach (var s in _medias.values) { + foreach (var s in _medias) { if (!s.isTemporary && !s.isPreview) unset.add (s); } @@ -619,7 +521,7 @@ public override Gee.Collection get_medias () { var result = new Gee.TreeSet (); - result.add_all (_medias.values); + result.add_all (_medias); return result; } @@ -651,14 +553,21 @@ * consistency */ - public override Media? media_from_id (int64 id) { - return _medias.get (id); + public override Media? media_from_id (int id) { + lock (_medias) { + foreach (var m in _medias) { + if (m.rowid == id) + return m; + } + } + + return null; } public override Media? find_media (Media to_find) { Media? found = null; lock (_medias) { - foreach (var m in _medias.values) { + foreach (var m in _medias) { if (to_find.title.down () == m.title.down () && to_find.artist.down () == m.artist.down ()) { found = m; break; @@ -671,7 +580,7 @@ public override Media? media_from_file (File file) { lock (_medias) { - foreach (var m in _medias.values) { + foreach (var m in _medias) { if (m != null && m.file.equal (file)) return m; } @@ -682,7 +591,7 @@ public override Media? media_from_uri (string uri) { lock (_medias) { - foreach (var m in _medias.values) { + foreach (var m in _medias) { if (m != null && m.uri == uri) return m; } @@ -691,13 +600,15 @@ return null; } - public override Gee.Collection medias_from_ids (Gee.Collection ids) { + public override Gee.Collection medias_from_ids (Gee.Collection ids) { var media_collection = new Gee.TreeSet (); - foreach (var id in ids) { - var m = _medias.get (id); - warning ("%lld", id); - if (m != null) { - media_collection.add (m); + lock (_medias) { + foreach (var m in _medias) { + if (ids.contains (m.rowid)) + media_collection.add (m); + + if (media_collection.size == ids.size) + break; } } @@ -707,7 +618,7 @@ public override Gee.Collection medias_from_uris (Gee.Collection uris) { var media_collection = new Gee.LinkedList (); lock (_medias) { - foreach (var m in _medias.values) { + foreach (var m in _medias) { if (uris.contains (m.uri)) media_collection.add (m); if (media_collection.size == uris.size) @@ -725,7 +636,7 @@ } public override void add_medias (Gee.Collection new_media) { - if (new_media.is_empty) // happens more often than you would think + if (new_media.size < 1) // happens more often than you would think return; // make a copy of the media list so that it doesn't get modified before @@ -733,26 +644,21 @@ var media = new Gee.TreeSet (); media.add_all (new_media); - var local_media = new Gee.HashMap (); - foreach (var m in media) { - var local_m = new LocalMedia.from_media (connection, m); - local_media.set (local_m.rowid, local_m); - } - - _medias.set_all (local_media); - media_added (local_media.values.read_only_view); + var local_media = DataBaseManager.get_default ().add_media (media); + _medias.add_all (local_media); + media_added (local_media.read_only_view); // Update search results if (App.main_window.searchField.text == "") { - _searched_medias.add_all (local_media.values); + _searched_medias.add_all (local_media); } else { - uint parsed_rating; + int parsed_rating; string parsed_search_string; String.base_search_method (App.main_window.searchField.text, out parsed_rating, out parsed_search_string); bool rating_search = parsed_rating > 0; - foreach (var m in local_media.values) { + foreach (var m in local_media) { if (rating_search) { - if (m.rating == parsed_rating) + if (m.rating == (uint) parsed_rating) _searched_medias.add (m); } else if (Search.match_string_to_media (m, parsed_search_string)) { _searched_medias.add (m); @@ -772,8 +678,10 @@ public override void remove_medias (Gee.Collection to_remove, bool trash) { var toRemove = new Gee.TreeSet (); toRemove.add_all (to_remove); - if (App.player.current_media in toRemove) - App.player.stop_playback (); + foreach (var s in toRemove) { + if (s == App.player.current_media) + App.player.stop_playback (); + } if (trash) fo.remove_media (toRemove); @@ -781,11 +689,12 @@ // Emit signal before actually removing the media because otherwise // media_from_id () and media_from_ids () wouldn't work. media_removed (toRemove.read_only_view); + dbu.removeItem.begin (toRemove); lock (_medias) { foreach (Media s in toRemove) { _searched_medias.remove (s); - _medias.unset (s.rowid); + _medias.remove (s); } } @@ -794,25 +703,17 @@ p.remove_medias (toRemove); } - foreach (var m in toRemove) { - try { - connection.delete_row_from_table (Database.Media.TABLE_NAME, "rowid", Database.make_int64_value (m.rowid)); - } catch (Error e) { - critical (e.message); - } - } - + DataBaseManager.get_default ().remove_media (toRemove); search_finished (); } public Gee.TreeSet answer_to_device_sync (Device device) { var medias_to_sync = new Gee.TreeSet (); - var prefs = get_preferences_for_device (device); - if (prefs.sync_music == true) { - if (prefs.sync_all_music == true) { + if (device.get_preferences ().sync_music == true) { + if (device.get_preferences ().sync_all_music == true) { medias_to_sync.add_all (get_medias ()); } else { - medias_to_sync.add_all (prefs.music_playlist.medias); + medias_to_sync.add_all (device.get_preferences ().music_playlist.medias); } } @@ -843,16 +744,4 @@ file_operations_done (); update_media_art_cache.begin (); } - - Gee.HashMap preferences = new Gee.HashMap ((Gee.HashDataFunc)GLib.str_hash, (Gee.EqualDataFunc)GLib.str_equal); - public DevicePreferences get_preferences_for_device (Device d) { - var key = d.get_unique_identifier (); - if (preferences.has_key (key)) { - return preferences.get (key); - } else { - var pref = new DevicePreferences (d, connection); - preferences.set (key, pref); - return pref; - } - } } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalMedia.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalMedia.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalMedia.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalMedia.vala 2015-07-20 19:59:51.000000000 +0000 @@ -29,6 +29,8 @@ */ public class Noise.LocalMedia : Noise.Media { + private SQLHeavy.Database database = Noise.DataBaseManager.get_default ().database; + private uint64? _file_size = null; public override uint64 file_size { get { @@ -64,7 +66,6 @@ common_uint_setter ("track", value, ref _track); } } - private uint? _track_count = null; public override uint track_count { get { @@ -75,7 +76,6 @@ common_uint_setter ("track_count", value, ref _track_count); } } - private string _composer = null; public override string composer { get { @@ -86,7 +86,6 @@ common_string_setter ("composer", value, ref _composer); } } - private string _artist = null; public override string artist { get { @@ -97,7 +96,6 @@ common_string_setter ("artist", value, ref _artist); } } - private string _album_artist = null; public override string album_artist { get { @@ -108,7 +106,6 @@ common_string_setter ("album_artist", value, ref _album_artist); } } - private string _album = null; public override string album { get { @@ -119,7 +116,6 @@ common_string_setter ("album", value, ref _album); } } - private uint? _album_number = null; public override uint album_number { get { @@ -130,7 +126,6 @@ common_uint_setter ("album_number", value, ref _album_number); } } - private uint? _album_count = null; public override uint album_count { get { @@ -141,7 +136,6 @@ common_uint_setter ("album_count", value, ref _album_count); } } - public override unowned Album album_info { get; set; default = null; } private string _grouping = null; public override string grouping { @@ -153,7 +147,6 @@ common_string_setter ("grouping", value, ref _grouping); } } - private string _genre = null; public override string genre { get { @@ -164,7 +157,6 @@ common_string_setter ("genre", value, ref _genre); } } - private string _comment = null; public override string comment { get { @@ -175,7 +167,6 @@ common_string_setter ("comment", value, ref _comment); } } - private string _lyrics = null; public override string lyrics { get { @@ -186,7 +177,6 @@ common_string_setter ("lyrics", value, ref _lyrics); } } - public uint? _year = null; public override uint year { get { @@ -197,7 +187,6 @@ common_uint_setter ("year", value, ref _year); } } - public uint? _bitrate = null; public override uint bitrate { get { @@ -208,7 +197,6 @@ common_uint_setter ("bitrate", value, ref _bitrate); } } - public uint? _samplerate = null; public override uint samplerate { get { @@ -254,7 +242,6 @@ common_uint_setter ("playcount", value, ref _play_count); } } - public uint? _skip_count = null; public override uint skip_count { get { @@ -265,7 +252,6 @@ common_uint_setter ("skipcount", value, ref _skip_count); } } - public uint? _date_added = null; public override uint date_added { get { @@ -276,7 +262,6 @@ common_uint_setter ("dateadded", value, ref _date_added); } } - public uint? _last_played = null; public override uint last_played { get { @@ -287,7 +272,6 @@ common_uint_setter ("lastplayed", value, ref _last_played); } } - public uint? _last_modified = null; public override uint last_modified { get { @@ -301,89 +285,12 @@ public override int resume_pos { get; set; default = 0; } - private Gda.Connection connection; - - // To use this method, the rowid should exist in the database. - public LocalMedia (int64 rowid, Gda.Connection connection) { - Object (rowid: rowid); - this.connection = connection; - var query = Database.query_field (rowid, connection, Database.Media.TABLE_NAME, "uri"); + public LocalMedia (int rowid) { + base (""); + this.rowid = rowid; + var query = query_field ("uri"); if (query != null) { - uri = query.dup_string (); - } - } - - // To use this method, the rowid should exist in the database. - public LocalMedia.from_media (Gda.Connection connection, Media m) { - try { - var builder = new Gda.SqlBuilder (Gda.SqlStatementType.INSERT); - builder.set_table (Database.Media.TABLE_NAME); - builder.add_field_value_as_gvalue ("uri", Database.make_string_value (m.uri)); - Gda.Set last_insert_row; - connection.statement_execute_non_select (builder.get_statement (), null, out last_insert_row); - var _rowid = last_insert_row.get_holder_value (Database.Media.ROWID).get_int64 (); - Object (rowid: _rowid); - this.connection = connection; - var col_names = new GLib.SList (); - col_names.append ("file_size"); - col_names.append ("title"); - col_names.append ("artist"); - col_names.append ("composer"); - col_names.append ("album_artist"); - col_names.append ("album"); - col_names.append ("grouping"); - col_names.append ("genre"); - col_names.append ("comment"); - col_names.append ("lyrics"); - col_names.append ("has_embedded"); - col_names.append ("year"); - col_names.append ("track"); - col_names.append ("track_count"); - col_names.append ("album_number"); - col_names.append ("album_count"); - col_names.append ("bitrate"); - col_names.append ("length"); - col_names.append ("samplerate"); - col_names.append ("rating"); - col_names.append ("playcount"); - col_names.append ("skipcount"); - col_names.append ("dateadded"); - col_names.append ("lastplayed"); - col_names.append ("lastmodified"); - var values = new GLib.SList (); - values.append (Database.make_uint64_value (m.file_size)); - values.append (Database.make_string_value (m.title)); - values.append (Database.make_string_value (m.artist)); - values.append (Database.make_string_value (m.composer)); - values.append (Database.make_string_value (m.album_artist)); - values.append (Database.make_string_value (m.album)); - values.append (Database.make_string_value (m.grouping)); - values.append (Database.make_string_value (m.genre)); - values.append (Database.make_string_value (m.comment)); - values.append (Database.make_string_value (m.lyrics)); - values.append (Database.make_bool_value (m.has_embedded)); - values.append (Database.make_uint_value (m.year)); - values.append (Database.make_uint_value (m.track)); - values.append (Database.make_uint_value (m.track_count)); - values.append (Database.make_uint_value (m.album_number)); - values.append (Database.make_uint_value (m.album_count)); - values.append (Database.make_uint_value (m.bitrate)); - values.append (Database.make_uint_value (m.length)); - values.append (Database.make_uint_value (m.samplerate)); - values.append (Database.make_uint_value (m.rating)); - values.append (Database.make_uint_value (m.play_count)); - values.append (Database.make_uint_value (m.skip_count)); - values.append (Database.make_uint_value (m.date_added)); - values.append (Database.make_uint_value (m.last_played)); - values.append (Database.make_uint_value (m.last_modified)); - connection.update_row_in_table_v (Database.Media.TABLE_NAME, "rowid", last_insert_row.get_holder_value (Database.Media.ROWID), col_names, values); - } catch (Error e) { - warning ("Could not save media: %s", e.message); - } - - var query = Database.query_field (rowid, connection, Database.Media.TABLE_NAME, "uri"); - if (query != null) { - uri = query.dup_string (); + this.uri = query.dup_string (); } } @@ -394,9 +301,9 @@ if (temp != null) return temp; - var query = Database.query_field (rowid, connection, Database.Media.TABLE_NAME, field); + var query = query_field (field); if (query != null) { - temp = (uint64)query.get_int (); + temp = (uint64)query.get_int64 (); return temp; } else return 0; @@ -406,16 +313,16 @@ temp = value; var val = GLib.Value (typeof (uint64)); val.set_uint64 (value); - Database.set_field (rowid, connection, Database.Media.TABLE_NAME, field, val); + set_field.begin (field, val); } private uint common_uint_getter (string field, ref uint? temp) { if (temp != null) return temp; - var query = Database.query_field (rowid, connection, Database.Media.TABLE_NAME, field); + var query = query_field (field); if (query != null) { - temp = query.get_int (); + temp = (uint)query.get_int64 (); return temp; } else return 0; @@ -425,14 +332,14 @@ temp = value; var val = GLib.Value (typeof (uint)); val.set_uint (value); - Database.set_field (rowid, connection, Database.Media.TABLE_NAME, field, val); + set_field.begin (field, val); } private string common_string_getter (string field, ref string? temp) { if (temp != null) return temp; - var query = Database.query_field (rowid, connection, Database.Media.TABLE_NAME, field); + var query = query_field (field); if (query != null) { temp = query.dup_string (); return _composer; @@ -444,7 +351,53 @@ temp = value; var val = GLib.Value (typeof (string)); val.set_string (value); - Database.set_field (rowid, connection, Database.Media.TABLE_NAME, field, val); + set_field.begin (field, val); + } + + /* + * These functions allows the LocalMedia to interact with the database. + */ + + private GLib.Value? query_field (string field) { + assert (database != null); + try { + var query = new SQLHeavy.Query (database, "SELECT `%s` FROM `media` WHERE rowid=:rowid".printf (field)); + query.set_int (":rowid", rowid); + var result = query.execute (); + var val = result.fetch (); + if (val.type () != typeof (void*)) + return val; + else + return null; + } catch (SQLHeavy.Error err) { + warning ("Could not query field %s: %s", field, err.message); + return null; + } } + private async void set_field (string field, GLib.Value value) { + assert (database != null); + try { + var query = new SQLHeavy.Query (database, "UPDATE `media` SET %s=:value WHERE rowid=:rowid".printf (field)); + query.set_int (":rowid", rowid); + var type = value.type (); + if (type == typeof (string)) { + query.set_string (":value", value.get_string ()); + } else if (type == typeof (int)) { + query.set_int (":value", value.get_int ()); + } else if (type == typeof (uint)) { + query.set_int (":value", (int)value.get_uint ()); + } else if (type == typeof (uint64)) { + query.set_int64 (":value", (int64)value.get_uint64 ()); + } else if (type == typeof (bool)) { + query.set_int (":value", value.get_boolean () ? 1 : 0); + } else { + return; + } + + query.execute (); + } catch (SQLHeavy.Error err) { + warning ("Could not query field %s: %s", field, err.message); + } + } } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalSmartPlaylist.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalSmartPlaylist.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalSmartPlaylist.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalSmartPlaylist.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,244 +0,0 @@ -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- -/*- - * Copyright (c) 2012-2015 Noise Developers (https://launchpad.net/noise) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * The Noise authors hereby grant permission for non-GPL compatible - * GStreamer plugins to be used and distributed together with GStreamer - * and Noise. This permission is above and beyond the permissions granted - * by the GPL license by which Noise 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. - * - * Authored by: Corentin Noël - */ - -public class Noise.LocalSmartPlaylist : SmartPlaylist { - private static const string QUERY_SEPARATOR = ""; - private static const string VALUE_SEPARATOR = ""; - private Gda.Connection connection; - - /** - * Metadata Fields - */ - private string _name = null; - public override string name { - get { - if (_name != null) - return _name; - - _name = Database.query_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "name").dup_string (); - return _name; - } - set { - _name = value; - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "name", Database.make_string_value (value)); - } - } - - - public override SmartPlaylist.ConditionalType conditional { - get { - return (SmartPlaylist.ConditionalType) Database.query_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "and_or").get_int (); - } - set { - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "and_or", Database.make_int_value (value)); - } - } - - public override uint limit_amount { - get { - return (uint)Database.query_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "limit_amount").get_int (); - } - set { - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "limit_amount", Database.make_uint_value (value)); - } - } - - public override bool limit { - get { - var val = Database.query_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "limited"); - return (bool)val.get_int (); - } - set { - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "limited", Database.make_bool_value (value)); - } - } - - public LocalSmartPlaylist (int64 rowid, Gda.Connection connection) { - base (libraries_manager.local_library); - this.connection = connection; - this.rowid = rowid; - var queries_str = Database.query_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "queries").get_string (); - queries_from_string (queries_str); - } - - //TODO: override this to search directly into the database. - /*public override void analyse_all () { - if (queries.is_empty) { - var meds = library.get_media (); - medias.add_all (meds); - media_added (meds); - return; - } - - foreach (var q in queries) { - try { - var sql = new Gda.SqlBuilder (Gda.SqlStatementType.SELECT); - sql.select_add_target (table, null); - sql.add_field_value_id (sql.add_id (field), 0); - var id_field = sql.add_id ("rowid"); - var id_param = sql.add_expr_value (null, Database.make_int64_value (rowid)); - var id_cond = sql.add_cond (Gda.SqlOperatorType.EQ, id_field, id_param, 0); - sql.set_where (id_cond); - var data_model = connection.statement_execute_select (sql.get_statement (), null); - return data_model.get_value_at (data_model.get_column_index (field), 0); - } catch (Error e) { - critical ("Could not query field %s: %s", field, e.message); - return null; - } - } - }*/ - - public override void clear_queries () { - base.clear_queries (); - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "queries", Database.make_string_value ("")); - } - - public override void add_query (SmartQuery s) { - base.add_query (s); - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "queries", Database.make_string_value (queries_to_string ())); - } - - public override void add_queries (Gee.Collection queries) { - base.add_queries (queries); - Database.set_field (rowid, connection, Database.SmartPlaylists.TABLE_NAME, "queries", Database.make_string_value (queries_to_string ())); - } - - private string queries_to_string () { - string rv = ""; - foreach (SmartQuery q in queries) { - var str_val = Value (typeof (string)); - q.value.transform (ref str_val); - string query_str = ((int)q.field).to_string () + VALUE_SEPARATOR + ((int)q.comparator).to_string () + VALUE_SEPARATOR + str_val.get_string (); - if (rv == "") { - rv = query_str; - } else { - rv += QUERY_SEPARATOR + query_str; - } - } - - return rv; - } - - public void queries_from_string (string q) { - string[] queries_in_string = q.split(QUERY_SEPARATOR, 0); - foreach (var query_string in queries_in_string) { - if (query_string == "") - continue; - - string[] pieces_of_query = query_string.split (VALUE_SEPARATOR, 3); - pieces_of_query.resize (3); - - SmartQuery sq = new SmartQuery(); - sq.field = (SmartQuery.FieldType)int.parse (pieces_of_query[0]); - sq.comparator = (SmartQuery.ComparatorType)int.parse (pieces_of_query[1]); - switch (sq.field) { - case SmartQuery.FieldType.ALBUM: - case SmartQuery.FieldType.ARTIST: - case SmartQuery.FieldType.COMPOSER: - case SmartQuery.FieldType.COMMENT: - case SmartQuery.FieldType.GENRE: - case SmartQuery.FieldType.GROUPING: - case SmartQuery.FieldType.TITLE: - var val = Value (typeof (string)); - val.set_string (pieces_of_query[2]); - sq.value = val; - break; - default: - var val = Value (typeof (int)); - val.set_int (int.parse (pieces_of_query[2])); - sq.value = val; - break; - } - - queries.add (sq); - } - } - - public static void add_defaults (Gda.Connection connection) { - try { - var col_names = new GLib.SList (); - col_names.append ("name"); - col_names.append ("queries"); - col_names.append ("and_or"); - col_names.append ("limited"); - col_names.append ("limit_amount"); - - var values = new GLib.SList (); - values.append (Database.make_string_value (_("Favorite Songs"))); - values.append (Database.make_string_value ("112413001263")); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - - values = new GLib.SList (); - values.append (Database.make_string_value (_("Recently Added"))); - values.append (Database.make_string_value ("577")); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - - values = new GLib.SList (); - values.append (Database.make_string_value (_("Recent Favorites"))); - values.append (Database.make_string_value ("11241300977")); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - - values = new GLib.SList (); - values.append (Database.make_string_value (_("Never Played"))); - values.append (Database.make_string_value ("1100")); - values.append (Database.make_int_value (0)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - - values = new GLib.SList (); - values.append (Database.make_string_value (_("Over Played"))); - values.append (Database.make_string_value ("11610")); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - - values = new GLib.SList (); - values.append (Database.make_string_value (_("Not Recently Played"))); - values.append (Database.make_string_value ("987")); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (1)); - values.append (Database.make_int_value (50)); - connection.insert_row_into_table_v (Database.SmartPlaylists.TABLE_NAME, col_names, values); - } catch (Error e) { - critical ("Could not initialize smart playlists: %s", e.message); - } - } -} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalStaticPlaylist.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalStaticPlaylist.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/LocalBackend/LocalStaticPlaylist.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/LocalBackend/LocalStaticPlaylist.vala 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- -/*- - * Copyright (c) 2012-2015 Noise Developers (https://launchpad.net/noise) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * The Noise authors hereby grant permission for non-GPL compatible - * GStreamer plugins to be used and distributed together with GStreamer - * and Noise. This permission is above and beyond the permissions granted - * by the GPL license by which Noise 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. - * - * Authored by: Corentin Noël - */ - -public class Noise.LocalStaticPlaylist : StaticPlaylist { - private Gda.Connection connection; - - /** - * Metadata Fields - */ - private string _name = null; - public override string name { - get { - if (_name != null) - return _name; - - _name = Database.query_field (rowid, connection, Database.Playlists.TABLE_NAME, "name").dup_string (); - return _name; - } - set { - _name = value; - Database.set_field (rowid, connection, Database.Playlists.TABLE_NAME, "name", Database.make_string_value (value)); - } - } - - public LocalStaticPlaylist (int64 rowid, Gda.Connection connection) { - this.rowid = rowid; - this.connection = connection; - var all = Database.query_field (rowid, connection, Database.Playlists.TABLE_NAME, "media").dup_string (); - foreach (var id in all.split (";")) { - medias.add (libraries_manager.local_library.media_from_id (int64.parse (id))); - } - } - - construct { - updated.connect ((old_name) => { - update_database (); - }); - } - - private void update_database () { - var rowid_value = GLib.Value (typeof (int64)); - rowid_value.set_int64 (rowid); - var col_names = new GLib.SList (); - col_names.append ("name"); - col_names.append ("media"); - var values = new GLib.SList (); - string rv = ""; - foreach (var m in medias) { - if (rv == "") { - rv = "%lld".printf (m.rowid); - } else { - rv += ";%lld".printf (m.rowid); - } - } - - values.append (Database.make_string_value (name)); - values.append (Database.make_string_value (rv)); - try { - connection.update_row_in_table_v (Database.Playlists.TABLE_NAME, "rowid", rowid_value, col_names, values); - } catch (Error e) { - critical (e.message); - } - } -} diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/main.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/main.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/main.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/main.vala 2015-07-20 19:59:51.000000000 +0000 @@ -18,7 +18,6 @@ int main (string[] args) { Gtk.init (ref args); - Gda.init (); try { Gst.init_check (ref args); diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/PlaybackManager.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/PlaybackManager.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/PlaybackManager.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/PlaybackManager.vala 2015-07-20 19:59:51.000000000 +0000 @@ -41,7 +41,7 @@ public signal void media_queued (Gee.Collection queued); public signal void media_played (Media played_media); - public signal void playback_stopped (int64 was_playing); + public signal void playback_stopped (int was_playing); public signal void playback_started (); public signal void playback_paused (); public signal void changing_player (); @@ -55,8 +55,8 @@ //list of id's yet to be played while on shuffle private Gee.HashMap _current_shuffled = new Gee.HashMap(); - public StaticPlaylist queue_playlist; - public StaticPlaylist history_playlist; + public StaticPlaylist queue_playlist = new StaticPlaylist (); + public StaticPlaylist history_playlist = new StaticPlaylist (); // TODO: REWRITE IT USING THE LIBRARY public Library library { get { return libraries_manager.local_library; } } @@ -88,19 +88,11 @@ file_player = new Streamer (); playbacks.add (file_player); player = file_player; - } - - construct { - history_playlist = new StaticPlaylist (); history_playlist.name = _("History"); history_playlist.read_only = true; - history_playlist.icon = new ThemedIcon ("playlist-queue"); - queue_playlist = new StaticPlaylist (); queue_playlist.name = C_("Name of the playlist", "Queue"); queue_playlist.read_only = true; queue_playlist.allow_duplicate = true; - queue_playlist.show_badge = true; - queue_playlist.icon = new ThemedIcon ("document-open-recent"); } public void add_playback (Noise.Playback playback) { @@ -488,7 +480,7 @@ public void playMedia (Media m, bool use_resume_pos) { - int64 old_id = -1; + int old_id = -1; // save previous media's id if (current_media != null) @@ -647,7 +639,7 @@ player.pause (); playing = false; - int64 was_playing = 0; + int was_playing = 0; if (current_media != null) was_playing = current_media.rowid; diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/DeviceSummaryWidget.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/DeviceSummaryWidget.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/DeviceSummaryWidget.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/DeviceSummaryWidget.vala 2015-07-20 19:59:51.000000000 +0000 @@ -22,7 +22,6 @@ public class Noise.DeviceSummaryWidget : Gtk.EventBox { Device dev; - DevicePreferences preferences; Gtk.Grid main_grid; @@ -32,16 +31,20 @@ Gtk.CheckButton sync_music_check; Gtk.ComboBox sync_music_combobox; Gtk.ListStore music_list; + /*Gtk.CheckButton sync_audiobooks_check; + Gtk.ComboBox sync_audiobooks_combobox; + Gtk.ListStore audiobook_list;*/ Gtk.Image device_image; SpaceWidget space_widget; int files_index; int music_index; + int podcast_index; + //int audiobook_index; - public DeviceSummaryWidget (Device d, DevicePreferences preferences) { + public DeviceSummaryWidget (Device d) { this.dev = d; - this.preferences = preferences; build_ui (); } @@ -88,7 +91,7 @@ sync_music_check = new Gtk.CheckButton (); sync_music_combobox = new Gtk.ComboBox (); - music_list = new Gtk.ListStore (3, typeof (GLib.Object), typeof (string), typeof (GLib.Icon)); + music_list = new Gtk.ListStore (3, typeof (GLib.Object), typeof (string), typeof (string)); device_image = new Gtk.Image.from_gicon (dev.get_icon (), Gtk.IconSize.DIALOG); space_widget = new SpaceWidget (dev.get_capacity()); @@ -97,6 +100,8 @@ files_index = space_widget.add_item (_("Other Files"), 0, SpaceWidget.ItemColor.GREEN); music_index = space_widget.add_item (_("Music"), 0, SpaceWidget.ItemColor.BLUE); + podcast_index = space_widget.add_item (_("Podcasts"), 0, SpaceWidget.ItemColor.PURPLE); + //audiobook_index = space_widget.add_item (_("Audiobooks"), 0, SpaceWidget.ItemColor.GREEN); refresh_space_widget (); @@ -141,17 +146,18 @@ refresh_lists(); /* set initial values*/ - auto_sync_switch.active = preferences.sync_when_mounted; - sync_music_check.active = preferences.sync_music; + auto_sync_switch.active = dev.get_preferences ().sync_when_mounted; + sync_music_check.active = dev.get_preferences ().sync_music; + //syncAudiobooks.active = dev.get_preferences ().sync_audiobooks; - if(preferences.sync_all_music || preferences.music_playlist == null) + if(dev.get_preferences ().sync_all_music || dev.get_preferences().music_playlist == null) sync_music_combobox.set_active (0); else { - bool success = sync_music_combobox.set_active_id (preferences.music_playlist.name); + bool success = sync_music_combobox.set_active_id (dev.get_preferences().music_playlist.name); if (!success) { - //NotificationManager.get_default ().show_alert ("Missing Sync Playlist", "The playlist named " + preferences.music_playlist + " is used to sync device " + dev.getDisplayName() + ", but could not be found."); - preferences.music_playlist = null; - preferences.sync_all_music = true; + //NotificationManager.get_default ().show_alert ("Missing Sync Playlist", "The playlist named " + dev.get_preferences().music_playlist + " is used to sync device " + dev.getDisplayName() + ", but could not be found."); + dev.get_preferences ().music_playlist = null; + dev.get_preferences ().sync_all_music = true; sync_music_combobox.set_active (0); } } @@ -184,6 +190,7 @@ space_widget.update_item_size (music_index, music_size); space_widget.update_item_size (files_index, other_files_size); + //spaceWidget.update_item_size (audiobook_index, audiobook_size); } private void setup_lists() { @@ -216,18 +223,22 @@ } private void save_preferences () { - preferences.sync_when_mounted = auto_sync_switch.active; - preferences.sync_music = sync_music_check.active; - preferences.sync_all_music = sync_music_combobox.get_active () == 0; + var pref = dev.get_preferences (); + + pref.sync_when_mounted = auto_sync_switch.active; + pref.sync_music = sync_music_check.active; + pref.sync_all_music = sync_music_combobox.get_active () == 0; Gtk.TreeIter iter; if (sync_music_combobox.get_active ()-2 >= 0) { sync_music_combobox.get_active_iter (out iter); GLib.Value value; music_list.get_value (iter, 0, out value); - preferences.music_playlist = (Noise.Playlist)value.dup_object (); + pref.music_playlist = (Noise.Playlist)value.dup_object (); } sync_music_combobox.sensitive = sync_music_check.active; + + ((LocalLibrary)libraries_manager.local_library).dbu.save_device (pref); } public bool all_medias_selected () { @@ -279,7 +290,7 @@ sync_music_combobox.set_active(0); message ("setting sensitivity\n"); - sync_music_combobox.sensitive = preferences.sync_music; + sync_music_combobox.sensitive = dev.get_preferences().sync_music; } private void sync_finished () { @@ -289,15 +300,16 @@ public void sync_clicked () { var list = new Gee.TreeSet(); + var pref = dev.get_preferences (); - if (preferences.sync_music) { - if (preferences.sync_all_music) { + if (pref.sync_music) { + if (pref.sync_all_music) { foreach (var s in libraries_manager.local_library.get_medias ()) { if (s.isTemporary == false) list.add (s); } } else { - var p = preferences.music_playlist; + var p = pref.music_playlist; if (p != null) { foreach (var m in p.medias) { @@ -305,10 +317,10 @@ list.add (m); } } else { - NotificationManager.get_default ().show_alert (_("Sync Failed"), _("The playlist named %s is used to sync device %s, but could not be found.").printf("" + preferences.music_playlist.name + "", "" + dev.getDisplayName() + "")); + NotificationManager.get_default ().show_alert (_("Sync Failed"), _("The playlist named %s is used to sync device %s, but could not be found.").printf("" + pref.music_playlist.name + "", "" + dev.getDisplayName() + "")); - preferences.music_playlist = null; - preferences.sync_all_music = true; + pref.music_playlist = null; + pref.sync_all_music = true; sync_music_combobox.set_active(0); return; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/DeviceView.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/DeviceView.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/DeviceView.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/DeviceView.vala 2015-07-20 19:59:51.000000000 +0000 @@ -27,12 +27,13 @@ Gtk.InfoBar infobar; Gtk.Label infobar_label; - public DeviceView (Noise.Device device, DevicePreferences preferences) { + public DeviceView (Device d) { this.orientation = Gtk.Orientation.VERTICAL; - this.d = device; - buildUI (preferences); + this.d = d; + buildUI (); + ulong connector = NotificationManager.get_default ().progress_canceled.connect ( () => { if (d.get_library ().doing_file_operations ()) { NotificationManager.get_default ().show_alert (_("Cancelling…"), _("Device operation has been cancelled and will stop after this media.")); @@ -43,11 +44,11 @@ d.disconnect (connector); }); - if (preferences.sync_when_mounted) + if (d.get_preferences ().sync_when_mounted) syncClicked (); } - - void buildUI (DevicePreferences preferences) { + + void buildUI () { /* create infobar */ @@ -60,7 +61,7 @@ infobar.response.connect ( (self, response) => { infobar.hide (); }); - summary = new DeviceSummaryWidget (d, preferences); + summary = new DeviceSummaryWidget (d); attach (infobar, 0, 0, 1, 1); if (d.get_custom_view () != null) { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/GridView/PopupListView.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/GridView/PopupListView.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/GridView/PopupListView.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/GridView/PopupListView.vala 2015-07-20 19:59:51.000000000 +0000 @@ -222,12 +222,12 @@ } private void view_search_func (string search, Gee.HashMap table, Gee.HashMap showing) { - uint parsed_rating; + int parsed_rating; string parsed_search_string; String.base_search_method (search, out parsed_rating, out parsed_search_string); - bool rating_search = parsed_rating != 0; + bool rating_search = parsed_rating > 0; // If an external refiltering is going on, we cannot obey the column browser filter // because it wil be refreshed after this search based on the new 'showing' table diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/CellDataFunctionHelper.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/CellDataFunctionHelper.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/CellDataFunctionHelper.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/CellDataFunctionHelper.vala 2015-07-20 19:59:51.000000000 +0000 @@ -44,7 +44,7 @@ if (renderer.visible) { Value icon; model.get_value (iter, ListColumn.ICON, out icon); // ICON column is same for all - image_renderer.gicon = icon.get_object () as GLib.Icon; + image_renderer.gicon = icon as GLib.Icon; } } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/GenericList.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/GenericList.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/GenericList.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/GenericList.vala 2015-07-20 19:59:51.000000000 +0000 @@ -28,7 +28,7 @@ protected ViewWrapper parent_wrapper; protected TreeViewSetup tvs; - protected int64 relative_id; + protected int relative_id; protected bool is_current_list; protected bool dragging; @@ -390,11 +390,11 @@ return tvs.get_hint (); } - public void set_relative_id (int64 id) { + public void set_relative_id (int id) { this.relative_id = id; } - public int64 get_relative_id () { + public int get_relative_id () { return relative_id; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/MusicListView.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/MusicListView.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/Lists/MusicListView.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/Lists/MusicListView.vala 2015-07-20 19:59:51.000000000 +0000 @@ -369,7 +369,7 @@ /** media menu popup clicks **/ void mediaMenuEditClicked () { - var to_edit = new Gee.LinkedList (); + var to_edit = new Gee.LinkedList (); var to_edit_med = new Gee.TreeSet (); foreach (Media m in get_selected_medias ()) { @@ -381,7 +381,7 @@ if (to_edit.size == 0) return; - int64 id = to_edit.get (0); + int id = to_edit.get (0); string music_folder_uri = File.new_for_path (Settings.Main.get_default ().music_folder).get_uri (); if (to_edit.size == 1 && !File.new_for_uri (parent_wrapper.library.media_from_id (id).uri).query_exists () && parent_wrapper.library.media_from_id(id).uri.has_prefix(music_folder_uri)) { @@ -389,7 +389,7 @@ FileNotFoundDialog fnfd = new FileNotFoundDialog (to_edit_med); fnfd.present (); } else { - var list = new Gee.TreeSet (); + var list = new Gee.TreeSet (); for(int i = 0; i < get_visible_table ().size; ++i) { list.add (get_object_from_index (i).rowid); } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/ListView.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/ListView.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/ListView/ListView.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/ListView/ListView.vala 2015-07-20 19:59:51.000000000 +0000 @@ -254,7 +254,7 @@ return list_view.get_hint (); } - public int64 get_relative_id () { + public int get_relative_id () { return list_view.get_relative_id (); } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/Wrappers/PlaylistViewWrapper.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/Wrappers/PlaylistViewWrapper.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/Wrappers/PlaylistViewWrapper.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/Wrappers/PlaylistViewWrapper.vala 2015-07-20 19:59:51.000000000 +0000 @@ -21,27 +21,31 @@ */ public class Noise.PlaylistViewWrapper : ViewWrapper { - public int64 playlist_id { get; construct set; default = -1; } - private Playlist playlist; + public int playlist_id { get; construct set; default = -1; } public TreeViewSetup tvs; - public signal void button_clicked (int64 playlist_id); + public signal void button_clicked (int playlist_id); private Gtk.Action[] actions = null; private string message_head; private string message_body; - public PlaylistViewWrapper (Playlist playlist, ViewWrapper.Hint hint, TreeViewSetup? tvs = null, Library library) { + public PlaylistViewWrapper (int playlist_id, ViewWrapper.Hint hint, TreeViewSetup? tvs = null, Library library) { base (hint, library); if (tvs == null) this.tvs = new TreeViewSetup(ListColumn.NUMBER, Gtk.SortType.ASCENDING, hint); else this.tvs = tvs; - this.playlist = playlist; - playlist_id = playlist.rowid; - relative_id = playlist.rowid; + this.playlist_id = playlist_id; + relative_id = playlist_id; + build_async.begin (); + } + + private async void build_async () { + Idle.add_full (VIEW_CONSTRUCT_PRIORITY, build_async.callback); + yield; - list_view = new ListView (this, this.tvs); + list_view = new ListView (this, tvs); embedded_alert = new Granite.Widgets.EmbeddedAlert (); // Refresh view layout @@ -53,10 +57,12 @@ case Hint.READ_ONLY_PLAYLIST: message_head = _("No Songs"); message_body = _("Updating playlist. Please wait."); + yield set_media_async (library.playlist_from_id (playlist_id).medias); break; case Hint.PLAYLIST: message_head = _("No Songs"); message_body = _("To add songs to this playlist, use the secondary click on an item and choose Add to Playlist."); + yield set_media_async (library.playlist_from_id (playlist_id).medias); break; case Hint.SMART_PLAYLIST: var action = new Gtk.Action ("smart-playlist-rules-edit", @@ -65,7 +71,7 @@ null); // Connect to the 'activate' signal action.activate.connect ( () => { - button_clicked (playlist.rowid); + button_clicked (playlist_id); //lw.sideTree.playlistMenuEditClicked (); // Show this playlist's edit dialog }); @@ -74,13 +80,12 @@ message_head = _("No Songs"); message_body = _("This playlist will be automatically populated with songs that match its rules. To modify these rules, use the secondary click on it in the sidebar and click on Edit. Optionally, you can click on the button below."); + yield set_media_async (library.smart_playlist_from_id (playlist_id).medias); break; default: assert_not_reached (); } - - set_media_async.begin (playlist.medias); connect_data_signals (); } @@ -88,7 +93,7 @@ switch (hint) { case Hint.READ_ONLY_PLAYLIST: case Hint.PLAYLIST: - var p = (StaticPlaylist)playlist; + var p = library.playlist_from_id (playlist_id); // Connect to playlist signals if (p != null) { @@ -100,7 +105,7 @@ break; case Hint.SMART_PLAYLIST: - var p = (SmartPlaylist)playlist; + var p = library.smart_playlist_from_id (playlist_id); // Connect to smart playlist signals if (p != null) { diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/Wrappers/ViewWrapper.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/Wrappers/ViewWrapper.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Views/Wrappers/ViewWrapper.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Views/Wrappers/ViewWrapper.vala 2015-07-20 19:59:51.000000000 +0000 @@ -109,7 +109,7 @@ public int index { get { return App.main_window.view_container.get_view_index (this); } } - public int64 relative_id { get; protected set; default = -1; } + public int relative_id { get; protected set; default = -1; } public int media_count { get { return (int) list_view.n_media; } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Widgets/TopDisplay.vala noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Widgets/TopDisplay.vala --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/src/Widgets/TopDisplay.vala 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/src/Widgets/TopDisplay.vala 2015-07-20 19:59:51.000000000 +0000 @@ -269,7 +269,7 @@ } } - private void media_updated (Gee.Collection ids) { + private void media_updated (Gee.Collection ids) { if (App.player.current_media != null && ids.contains (App.player.current_media.rowid)) { update_current_media (); } diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/vapi/libgda-5.0.deps noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/vapi/libgda-5.0.deps --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/vapi/libgda-5.0.deps 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/vapi/libgda-5.0.deps 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -libxml-2.0 diff -Nru noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/vapi/libgda-5.0.vapi noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/vapi/libgda-5.0.vapi --- noise-0.3.1+r1822+pkg91+gda1825~daily~ubuntu15.04.1/vapi/libgda-5.0.vapi 2015-07-20 12:14:58.000000000 +0000 +++ noise-0.3.1+r1823+pkg90~daily~ubuntu15.04.1/vapi/libgda-5.0.vapi 1970-01-01 00:00:00.000000000 +0000 @@ -1,2171 +0,0 @@ -/* libgda-5.0.vapi generated by vapigen-0.28, do not modify. */ - -[CCode (cprefix = "Gda", gir_namespace = "Gda", gir_version = "5.0", lower_case_cprefix = "gda_")] -namespace Gda { - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_batch_get_type ()")] - public class Batch : GLib.Object { - [CCode (has_construct_function = false)] - public Batch (); - public void add_statement (Gda.Statement stmt); - public Gda.Batch copy (); - public static GLib.Quark error_quark (); - public bool get_parameters (out Gda.Set out_params) throws GLib.Error; - public unowned GLib.SList get_statements (); - public void remove_statement (Gda.Statement stmt); - public string serialize (); - public virtual signal void changed (GLib.Object changed_stmt); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_binary_get_type ()")] - [Compact] - public class Binary { - public long binary_length; - public uint8 data; - public static void* copy (void* boxed); - public static void free (owned void* boxed); - public string to_string (uint maxlen); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_blob_get_type ()")] - [Compact] - public class Blob { - public weak Gda.Binary data; - public weak Gda.BlobOp op; - public static void* copy (void* boxed); - public static void free (owned void* boxed); - public void set_op (Gda.BlobOp? op); - public string to_string (uint maxlen); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_blob_op_get_type ()")] - public abstract class BlobOp : GLib.Object { - public void* _gda_reserved1; - [CCode (has_construct_function = false)] - protected BlobOp (); - public long get_length (); - public long read (Gda.Blob blob, long offset, long size); - public bool read_all (Gda.Blob blob); - public long write (Gda.Blob blob, long offset); - public bool write_all (Gda.Blob blob); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_column_get_type ()")] - public class Column : GLib.Object { - [CCode (has_construct_function = false)] - public Column (); - public Gda.Column copy (); - public bool get_allow_null (); - public unowned GLib.Value? get_attribute (string attribute); - public bool get_auto_increment (); - public unowned string get_dbms_type (); - public unowned GLib.Value? get_default_value (); - public unowned string get_description (); - public GLib.Type get_g_type (); - public unowned string get_name (); - public int get_position (); - public void set_allow_null (bool allow); - public void set_attribute (string attribute, GLib.Value? value, GLib.DestroyNotify? destroy); - public void set_auto_increment (bool is_auto); - public void set_dbms_type (string dbms_type); - public void set_default_value (GLib.Value? default_value); - public void set_description (string title); - public void set_g_type (GLib.Type type); - public void set_name (string name); - public void set_position (int position); - [NoAccessorMethod] - public string id { owned get; set; } - public virtual signal void g_type_changed (GLib.Type old_type, GLib.Type new_type); - public virtual signal void name_changed (string old_name); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_config_get_type ()")] - public class Config : GLib.Object { - [CCode (has_construct_function = false)] - protected Config (); - public static bool can_modify_system_config (); - public static bool define_dsn (Gda.DsnInfo info) throws GLib.Error; - public static bool dsn_needs_authentication (string dsn_name); - public static GLib.Quark error_quark (); - public static Gda.Config @get (); - public static unowned Gda.DsnInfo get_dsn_info (string dsn_name); - public static unowned Gda.DsnInfo get_dsn_info_at_index (int index); - public static int get_dsn_info_index (string dsn_name); - public static int get_nb_dsn (); - public static unowned Gda.ServerProvider get_provider (string provider_name) throws GLib.Error; - public static unowned Gda.ProviderInfo? get_provider_info (string provider_name); - public static Gda.DataModel list_dsn (); - public static Gda.DataModel list_providers (); - public static bool remove_dsn (string dsn_name) throws GLib.Error; - [NoAccessorMethod] - public string system_filename { owned get; set; } - [NoAccessorMethod] - public string user_filename { owned get; set; } - public virtual signal void dsn_added (void* new_dsn); - public virtual signal void dsn_changed (void* dsn); - public virtual signal void dsn_removed (void* old_dsn); - public virtual signal void dsn_to_be_removed (void* old_dsn); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_connection_get_type ()")] - public class Connection : GLib.Object, Gda.Lockable { - [CCode (has_construct_function = false)] - protected Connection (); - public void add_event (owned Gda.ConnectionEvent event); - public void add_prepared_statement (Gda.Statement gda_stmt, Gda.PStmt prepared_stmt); - public bool add_savepoint (string? name) throws GLib.Error; - public GLib.SList batch_execute (Gda.Batch batch, Gda.Set? @params, Gda.StatementModelUsage model_usage) throws GLib.Error; - public bool begin_transaction (string? name, Gda.TransactionIsolation level) throws GLib.Error; - public void clear_events_list (); - public bool close () throws GLib.Error; - public bool commit_transaction (string? name) throws GLib.Error; - public Gda.ServerOperation create_operation (Gda.ServerOperationType type, Gda.Set? options) throws GLib.Error; - public Gda.SqlParser create_parser (); - public void del_prepared_statement (Gda.Statement gda_stmt); - public bool delete_row_from_table (string table, string condition_column_name, GLib.Value condition_value) throws GLib.Error; - public bool delete_savepoint (string? name) throws GLib.Error; - public static GLib.Quark error_quark (); - public int execute_non_select_command (string sql) throws GLib.Error; - public Gda.DataModel execute_select_command (string sql) throws GLib.Error; - [CCode (has_construct_function = false)] - public Connection.from_dsn (string dsn, string? auth_string, Gda.ConnectionOptions options) throws GLib.Error; - [CCode (has_construct_function = false)] - public Connection.from_string (string? provider_name, string cnc_string, string? auth_string, Gda.ConnectionOptions options) throws GLib.Error; - public unowned string get_authentication (); - public unowned string get_cnc_string (); - public bool get_date_format (out GLib.DateDMY out_first, out GLib.DateDMY out_second, out GLib.DateDMY out_third, out string out_sep) throws GLib.Error; - public unowned string get_dsn (); - public unowned GLib.List get_events (); - public unowned GLib.MainContext get_main_context (GLib.Thread? thread); - public unowned Gda.MetaStore get_meta_store (); - public Gda.DataModel get_meta_store_data_v (Gda.ConnectionMetaType meta_type, GLib.List filters) throws GLib.Error; - public Gda.ConnectionOptions get_options (); - public unowned Gda.PStmt get_prepared_statement (Gda.Statement gda_stmt); - public unowned Gda.ServerProvider get_provider (); - public unowned string get_provider_name (); - public Gda.ConnectionStatus get_status (); - public unowned Gda.TransactionStatus get_transaction_status (); - public bool insert_row_into_table_v (string table, GLib.SList col_names, GLib.SList values) throws GLib.Error; - public bool is_opened (); - public bool open () throws GLib.Error; - public uint open_async (Gda.ConnectionOpenFunc callback) throws GLib.Error; - public static Gda.Connection open_from_dsn (string dsn, string? auth_string, Gda.ConnectionOptions options) throws GLib.Error; - public static Gda.Connection open_from_string (string? provider_name, string cnc_string, string? auth_string, Gda.ConnectionOptions options) throws GLib.Error; - public static Gda.Connection open_sqlite (string? directory, string filename, bool auto_unlink); - public Gda.Statement parse_sql_string (string sql, out Gda.Set @params) throws GLib.Error; - public bool perform_operation (Gda.ServerOperation op) throws GLib.Error; - public Gda.ConnectionEvent point_available_event (Gda.ConnectionEventType type); - public string quote_sql_identifier (string id); - public GLib.SList repetitive_statement_execute (Gda.RepetitiveStatement rstmt, Gda.StatementModelUsage model_usage, [CCode (array_length = false)] GLib.Type[]? col_types, bool stop_on_error) throws GLib.Error; - public bool rollback_savepoint (string? name) throws GLib.Error; - public bool rollback_transaction (string? name) throws GLib.Error; - public void set_main_context (GLib.Thread? thread, GLib.MainContext? context); - public GLib.Object statement_execute (Gda.Statement stmt, Gda.Set? @params, Gda.StatementModelUsage model_usage, out Gda.Set last_insert_row) throws GLib.Error; - public int statement_execute_non_select (Gda.Statement stmt, Gda.Set? @params, out Gda.Set last_insert_row) throws GLib.Error; - public Gda.DataModel statement_execute_select (Gda.Statement stmt, Gda.Set? @params) throws GLib.Error; - public Gda.DataModel statement_execute_select_full (Gda.Statement stmt, Gda.Set? @params, Gda.StatementModelUsage model_usage, [CCode (array_length = false)] GLib.Type[]? col_types) throws GLib.Error; - public bool statement_prepare (Gda.Statement stmt) throws GLib.Error; - public string statement_to_sql (Gda.Statement stmt, Gda.Set? @params, Gda.StatementSqlFlag flags, out GLib.SList params_used) throws GLib.Error; - [NoWrapper] - public virtual void status_changed (Gda.ConnectionStatus status); - public static void string_split (string string, string out_cnc_params, string out_provider, string out_username, string? out_password); - public bool supports_feature (Gda.ConnectionFeature feature); - public bool update_meta_store (Gda.MetaContext? context) throws GLib.Error; - public bool update_row_in_table_v (string table, string condition_column_name, GLib.Value condition_value, GLib.SList col_names, GLib.SList values) throws GLib.Error; - public string value_to_sql_string (GLib.Value from); - [NoAccessorMethod] - public string auth_string { owned get; set; } - [NoAccessorMethod] - public string cnc_string { owned get; set; } - [NoAccessorMethod] - public string dsn { owned get; set; } - [NoAccessorMethod] - public int events_history_size { get; set; } - [NoAccessorMethod] - public uint execution_slowdown { get; set; } - [NoAccessorMethod] - public bool execution_timer { get; set; } - [NoAccessorMethod] - public Gda.MetaStore meta_store { owned get; set; } - [NoAccessorMethod] - public Gda.ServerProvider provider { owned get; set; } - public virtual signal void closed (); - public virtual signal void dsn_changed (); - public virtual signal void error (Gda.ConnectionEvent error); - public virtual signal void opened (); - public virtual signal void transaction_status_changed (); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_connection_event_get_type ()")] - public class ConnectionEvent : GLib.Object { - [CCode (has_construct_function = false)] - protected ConnectionEvent (); - public long get_code (); - public unowned string get_description (); - public Gda.ConnectionEventType get_event_type (); - public Gda.ConnectionEventCode get_gda_code (); - public unowned string get_source (); - public unowned string get_sqlstate (); - public void set_code (long code); - public void set_description (string? description); - public void set_event_type (Gda.ConnectionEventType type); - public void set_gda_code (Gda.ConnectionEventCode code); - public void set_source (string source); - public void set_sqlstate (string sqlstate); - [NoAccessorMethod] - public int type { get; set; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_access_wrapper_get_type ()")] - public class DataAccessWrapper : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false)] - protected DataAccessWrapper (); - public static Gda.DataModel @new (Gda.DataModel model); - public bool set_mapping ([CCode (array_length_cname = "mapping_size", array_length_pos = 1.1)] int[]? mapping); - [NoAccessorMethod] - public Gda.DataModel model { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_comparator_get_type ()")] - public class DataComparator : GLib.Object { - [CCode (has_construct_function = false, type = "GObject*")] - public DataComparator (Gda.DataModel old_model, Gda.DataModel new_model); - public bool compute_diff () throws GLib.Error; - public static GLib.Quark error_quark (); - public unowned Gda.Diff? get_diff (int pos); - public int get_n_diffs (); - public void set_key_columns ([CCode (array_length_cname = "nb_cols", array_length_pos = 1.1)] int[] col_numbers); - [NoAccessorMethod] - public Gda.DataModel new_model { owned get; set; } - [NoAccessorMethod] - public Gda.DataModel old_model { owned get; set; } - public virtual signal bool diff_computed (void* diff); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_array_get_type ()")] - public class DataModelArray : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false)] - protected DataModelArray (); - public void clear (); - public unowned Gda.Row get_row (int row) throws GLib.Error; - public static Gda.DataModel @new (int cols); - public static Gda.DataModel new_with_g_types_v (int cols, [CCode (array_length = false)] GLib.Type[] types); - public void set_n_columns (int cols); - [NoAccessorMethod] - public uint n_columns { get; set; } - [NoAccessorMethod] - public bool read_only { get; set; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_dir_get_type ()")] - public class DataModelDir : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false)] - protected DataModelDir (); - public void clean_errors (); - public unowned GLib.SList get_errors (); - public static Gda.DataModel @new (string basedir); - [NoAccessorMethod] - public string basedir { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_import_get_type ()")] - public class DataModelImport : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false)] - protected DataModelImport (); - public void clean_errors (); - public unowned GLib.SList get_errors (); - public static Gda.DataModel new_file (string filename, bool random_access, Gda.Set? options); - public static Gda.DataModel new_mem (string data, bool random_access, Gda.Set? options); - public static Gda.DataModel new_xml_node ([CCode (type = "xmlNodePtr")] Xml.Node* node); - [NoAccessorMethod] - public string data_string { owned get; construct; } - [NoAccessorMethod] - public string filename { owned get; construct; } - [NoAccessorMethod] - public Gda.Set options { owned get; construct; } - [NoAccessorMethod] - public bool random_access { get; construct; } - [NoAccessorMethod] - public bool strict { get; set construct; } - [NoAccessorMethod] - public void* xml_node { get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_iter_get_type ()")] - public class DataModelIter : Gda.Set { - [CCode (has_construct_function = false)] - protected DataModelIter (); - public static GLib.Quark error_quark (); - [Deprecated (since = "5.2")] - public int get_column_for_param (Gda.Holder param); - public unowned Gda.Holder get_holder_for_field (int col); - public int get_row (); - public unowned GLib.Value? get_value_at (int col); - public unowned GLib.Value? get_value_at_e (int col) throws GLib.Error; - public unowned GLib.Value? get_value_for_field (string field_name); - public void invalidate_contents (); - public bool is_valid (); - public bool move_next (); - public bool move_prev (); - public bool move_to_row (int row); - public bool set_value_at (int col, GLib.Value value) throws GLib.Error; - [NoAccessorMethod] - public int current_row { get; set; } - [NoAccessorMethod] - public Gda.DataModel data_model { owned get; set construct; } - [NoAccessorMethod] - public Gda.DataModel forced_model { owned get; set; } - [NoAccessorMethod] - public bool update_model { get; set; } - public virtual signal void end_of_data (); - public virtual signal void row_changed (int row); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_pivot_get_type ()")] - public class DataPivot : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false)] - protected DataPivot (); - public bool add_data (Gda.DataPivotAggregate aggregate_type, string field, string? alias) throws GLib.Error; - public bool add_field (Gda.DataPivotFieldType field_type, string field, string? alias) throws GLib.Error; - public static GLib.Quark error_quark (); - public static Gda.DataModel @new (Gda.DataModel? model); - public bool populate () throws GLib.Error; - [NoAccessorMethod] - public Gda.DataModel model { owned get; set; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_proxy_get_type ()")] - public class DataProxy : GLib.Object, Gda.DataModel { - [CCode (has_construct_function = false, type = "GObject*")] - public DataProxy (Gda.DataModel model); - public void alter_value_attributes (int proxy_row, int col, Gda.ValueAttribute alter_flags); - public bool apply_all_changes () throws GLib.Error; - public bool apply_row_changes (int proxy_row) throws GLib.Error; - public bool cancel_all_changes (); - public void cancel_row_changes (int proxy_row, int col); - public void @delete (int proxy_row); - public static GLib.Quark error_quark (); - public unowned string get_filter_expr (); - public int get_filtered_n_rows (); - public int get_n_modified_rows (); - public int get_n_new_rows (); - public unowned Gda.DataModel get_proxied_model (); - public int get_proxied_model_n_cols (); - public int get_proxied_model_n_rows (); - public int get_proxied_model_row (int proxy_row); - public int get_sample_end (); - public int get_sample_size (); - public int get_sample_start (); - public Gda.ValueAttribute get_value_attributes (int proxy_row, int col); - public GLib.SList get_values (int proxy_row, [CCode (array_length_cname = "n_cols", array_length_pos = 2.1)] int[] cols_index); - public bool has_changed (); - public bool is_read_only (); - public bool row_has_changed (int proxy_row); - public bool row_is_deleted (int proxy_row); - public bool row_is_inserted (int proxy_row); - public bool set_filter_expr (string? filter_expr) throws GLib.Error; - public bool set_ordering_column (int col) throws GLib.Error; - public void set_sample_size (int sample_size); - public void set_sample_start (int sample_start); - public void undelete (int proxy_row); - [CCode (has_construct_function = false)] - public DataProxy.with_data_model (Gda.DataModel model); - [NoAccessorMethod] - public bool cache_changes { get; set; } - [NoAccessorMethod] - public bool defer_sync { get; set; } - [NoAccessorMethod] - public Gda.DataModel model { owned get; set construct; } - [NoAccessorMethod] - public bool prepend_null_entry { get; set; } - public int sample_size { get; set construct; } - public virtual signal void filter_changed (); - public virtual signal void row_changes_applied (int row, int proxied_row); - public virtual signal void row_delete_changed (int row, bool to_be_deleted); - public virtual signal void sample_changed (int sample_start, int sample_end); - public virtual signal void sample_size_changed (int sample_size); - public virtual signal GLib.Error validate_row_changes (int row, int proxied_row); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_select_get_type ()")] - public abstract class DataSelect : GLib.Object, Gda.DataModel { - public int advertized_nrows; - public int nb_stored_rows; - public weak Gda.PStmt prep_stmt; - [CCode (has_construct_function = false)] - protected DataSelect (); - public bool compute_columns_attributes () throws GLib.Error; - public bool compute_modification_statements () throws GLib.Error; - public bool compute_modification_statements_ext (Gda.DataSelectConditionType cond_type) throws GLib.Error; - public bool compute_row_selection_condition () throws GLib.Error; - public static GLib.Quark error_quark (); - [NoWrapper] - public virtual bool fetch_at (Gda.Row prow, int rownum) throws GLib.Error; - [NoWrapper] - public virtual int fetch_nb_rows (); - [NoWrapper] - public virtual bool fetch_next (Gda.Row prow, int rownum) throws GLib.Error; - [NoWrapper] - public virtual bool fetch_prev (Gda.Row prow, int rownum) throws GLib.Error; - [NoWrapper] - public virtual bool fetch_random (Gda.Row prow, int rownum) throws GLib.Error; - public unowned Gda.Connection get_connection (); - public bool prepare_for_offline () throws GLib.Error; - public bool rerun () throws GLib.Error; - public bool set_modification_statement (Gda.Statement mod_stmt) throws GLib.Error; - public bool set_modification_statement_sql (string sql) throws GLib.Error; - public bool set_row_selection_condition_sql (string sql_where) throws GLib.Error; - [NoWrapper] - public virtual bool store_all () throws GLib.Error; - [NoAccessorMethod] - public bool auto_reset { get; set; } - public Gda.Connection connection { get; construct; } - [NoAccessorMethod] - public Gda.Statement delete_stmt { owned get; set; } - [NoAccessorMethod] - public Gda.Set exec_params { owned get; construct; } - [NoAccessorMethod] - public double execution_delay { get; set; } - [NoAccessorMethod] - public Gda.Statement insert_stmt { owned get; set; } - [NoAccessorMethod] - public uint model_usage { get; construct; } - [NoAccessorMethod] - public Gda.PStmt prepared_stmt { owned get; set; } - [NoAccessorMethod] - public Gda.Statement select_stmt { owned get; } - [NoAccessorMethod] - public bool store_all_rows { get; set; } - [NoAccessorMethod] - public Gda.Statement update_stmt { owned get; set; } - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_default_get_type ()")] - [Compact] - public class Default { - public static string escape_string (string string); - public static string unescape_string (string string); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_dsn_info_get_type ()")] - [Compact] - public class DsnInfo { - public weak string auth_string; - public weak string cnc_string; - public weak string description; - public bool is_system; - public weak string name; - public weak string provider; - [CCode (has_construct_function = false)] - public DsnInfo (); - public Gda.DsnInfo copy (); - public void free (); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", lower_case_csuffix = "geometricpoint", type_id = "gda_geometricpoint_get_type ()")] - [Compact] - public class GeometricPoint { - public double x; - public double y; - public static void* copy (void* boxed); - public static void free (void* boxed); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_bin_get_type ()")] - public class HandlerBin : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerBin (); - public static Gda.DataHandler @new (); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerBinPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_boolean_get_type ()")] - public class HandlerBoolean : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerBoolean (); - public static Gda.DataHandler @new (); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerBooleanPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_numerical_get_type ()")] - public class HandlerNumerical : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerNumerical (); - public static Gda.DataHandler @new (); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerNumericalPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_string_get_type ()")] - public class HandlerString : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerString (); - public static Gda.DataHandler @new (); - public static Gda.DataHandler new_with_provider (Gda.ServerProvider prov, Gda.Connection? cnc); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerStringPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_time_get_type ()")] - public class HandlerTime : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerTime (); - public string get_format (GLib.Type type); - public string get_no_locale_str_from_value (GLib.Value value); - public static Gda.DataHandler @new (); - public static Gda.DataHandler new_no_locale (); - public void set_sql_spec (GLib.DateDMY first, GLib.DateDMY sec, GLib.DateDMY third, char separator, bool twodigits_years); - public void set_str_spec (GLib.DateDMY first, GLib.DateDMY sec, GLib.DateDMY third, char separator, bool twodigits_years); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerTimePriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_handler_type_get_type ()")] - public class HandlerType : GLib.Object, Gda.DataHandler { - [CCode (has_construct_function = false)] - protected HandlerType (); - public static Gda.DataHandler @new (); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class HandlerTypePriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_holder_get_type ()")] - public class Holder : GLib.Object, Gda.Lockable { - [CCode (has_construct_function = false)] - public Holder (GLib.Type type); - [NoWrapper] - public virtual void att_changed (string att_name, GLib.Value att_value); - public Gda.Holder copy (); - public static GLib.Quark error_quark (); - public void force_invalid (); - public void force_invalid_e (owned GLib.Error? error); - public string get_alphanum_id (); - public unowned GLib.Value? get_attribute (string attribute); - public unowned Gda.Holder get_bind (); - public unowned GLib.Value? get_default_value (); - public GLib.Type get_g_type (); - public unowned string get_id (); - public bool get_not_null (); - public unowned Gda.DataModel get_source_model (int col); - public unowned GLib.Value? get_value (); - public string get_value_str (Gda.DataHandler? dh); - public bool is_valid (); - public bool is_valid_e () throws GLib.Error; - public void set_attribute (string attribute, GLib.Value value, GLib.DestroyNotify? destroy); - public bool set_bind (Gda.Holder bind_to) throws GLib.Error; - public void set_default_value (GLib.Value value); - public void set_not_null (bool not_null); - public bool set_source_model (Gda.DataModel model, int col) throws GLib.Error; - public bool set_value (GLib.Value? value) throws GLib.Error; - public bool set_value_str (Gda.DataHandler dh, string value) throws GLib.Error; - public bool set_value_to_default (); - public GLib.Value? take_static_value (GLib.Value value, bool value_changed) throws GLib.Error; - public bool take_value (owned GLib.Value value) throws GLib.Error; - public bool value_is_default (); - [NoAccessorMethod] - public string description { owned get; set; } - [NoAccessorMethod] - public Gda.Holder full_bind { owned get; set; } - [NoAccessorMethod] - public GLib.Type g_type { get; set construct; } - [NoAccessorMethod] - public string id { owned get; set; } - [NoAccessorMethod] - public string name { owned get; set; } - public bool not_null { get; set; } - [NoAccessorMethod] - public Gda.Holder simple_bind { owned get; set; } - [NoAccessorMethod] - public int source_column { get; set; } - [NoAccessorMethod] - public Gda.DataModel source_model { owned get; set; } - [NoAccessorMethod] - public bool validate_changes { get; set; } - public signal void attribute_changed (string att_name, GLib.Value att_value); - public virtual signal void changed (); - public virtual signal void source_changed (); - public virtual signal GLib.Error validate_change (GLib.Value new_value); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_meta_context_get_type ()")] - [Compact] - public class MetaContext { - [CCode (array_length = false, array_null_terminated = true)] - public weak string[] column_names; - [CCode (array_length = false, array_null_terminated = true)] - public weak GLib.Value[] column_values; - public weak GLib.HashTable columns; - public int size; - public weak string table_name; - [CCode (has_construct_function = false)] - public MetaContext (); - public Gda.MetaContext copy (); - public void free (); - public unowned string get_table (); - public void set_column (string column, GLib.Value value, Gda.Connection? cnc); - public void set_columns (GLib.HashTable columns, Gda.Connection? cnc); - public void set_table (string table); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_meta_store_get_type ()")] - public class MetaStore : GLib.Object { - [CCode (has_construct_function = false)] - public MetaStore (string? cnc_string); - public Gda.DataModel create_modify_data_model (string table_name); - public bool declare_foreign_key (Gda.MetaStruct? mstruct, string fk_name, string? catalog, string? schema, string table, string? ref_catalog, string? ref_schema, string ref_table, [CCode (array_length_cname = "nb_cols", array_length_pos = 8.5, array_length_type = "guint")] string[] colnames, [CCode (array_length_cname = "nb_cols", array_length_pos = 8.5, array_length_type = "guint")] string[] ref_colnames) throws GLib.Error; - public static GLib.Quark error_quark (); - [CCode (cname = "gda_meta_store_extract_v")] - public Gda.DataModel extract (string select_sql, GLib.HashTable? vars) throws GLib.Error; - public bool get_attribute_value (string att_name, out string att_value) throws GLib.Error; - public unowned Gda.Connection get_internal_connection (); - public int get_version (); - public bool modify_v (string table_name, Gda.DataModel? new_data, string? condition, [CCode (array_length_cname = "nvalues", array_length_pos = 3.5)] string[] value_names, [CCode (array_length_cname = "nvalues", array_length_pos = 3.5)] GLib.Value[] values) throws GLib.Error; - public bool modify_with_context (Gda.MetaContext context, Gda.DataModel? new_data) throws GLib.Error; - public bool schema_add_custom_object (string xml_description) throws GLib.Error; - public GLib.SList schema_get_all_tables (); - public GLib.SList schema_get_depend_tables (string table_name); - public Gda.MetaStruct schema_get_structure () throws GLib.Error; - public bool schema_remove_custom_object (string obj_name) throws GLib.Error; - public bool set_attribute_value (string att_name, string? att_value) throws GLib.Error; - public void set_identifiers_style (Gda.SqlIdentifierStyle style); - public void set_reserved_keywords_func (Gda.SqlReservedKeywordsFunc? func); - public static string sql_identifier_quote (string id, Gda.Connection cnc); - public bool undeclare_foreign_key (Gda.MetaStruct? mstruct, string fk_name, string? catalog, string? schema, string table, string? ref_catalog, string? ref_schema, string ref_table) throws GLib.Error; - [CCode (has_construct_function = false)] - public MetaStore.with_file (string file_name); - public string catalog { construct; } - [NoAccessorMethod] - public Gda.Connection cnc { owned get; construct; } - public string cnc_string { construct; } - public string schema { construct; } - public signal void meta_changed (GLib.SList changes); - public virtual signal void meta_reset (); - public virtual signal GLib.Error suggest_update (Gda.MetaContext suggest); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_meta_struct_get_type ()")] - public class MetaStruct : GLib.Object { - [CCode (has_construct_function = false)] - public MetaStruct (Gda.MetaStore store, Gda.MetaStructFeature features); - public unowned Gda.MetaDbObject? complement (Gda.MetaDbObjectType type, GLib.Value? catalog, GLib.Value? schema, GLib.Value name) throws GLib.Error; - public bool complement_all () throws GLib.Error; - public bool complement_default () throws GLib.Error; - public bool complement_depend (Gda.MetaDbObject dbo) throws GLib.Error; - public bool complement_schema (GLib.Value? catalog, GLib.Value? schema) throws GLib.Error; - public string dump_as_graph (Gda.MetaGraphInfo info) throws GLib.Error; - public static GLib.Quark error_quark (); - public GLib.SList get_all_db_objects (); - public unowned Gda.MetaDbObject? get_db_object (GLib.Value? catalog, GLib.Value? schema, GLib.Value name); - public bool load_from_xml_file (string? catalog, string? schema, string xml_spec_file) throws GLib.Error; - public bool sort_db_objects (Gda.MetaSortType sort_type) throws GLib.Error; - [NoAccessorMethod] - public uint features { get; construct; } - [NoAccessorMethod] - public Gda.MetaStore meta_store { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_null_get_type ()")] - [Compact] - public class Null { - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_numeric_get_type ()")] - [Compact] - public class Numeric { - public weak string number; - public long precision; - public long width; - [CCode (has_construct_function = false)] - public Numeric (); - public Gda.Numeric copy (); - public void free (); - public double get_double (); - public long get_precision (); - public string get_string (); - public long get_width (); - public void set_double (double number); - public void set_from_string (string str); - public void set_precision (long precision); - public void set_width (long width); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_pstmt_get_type ()")] - public abstract class PStmt : GLib.Object { - public int ncols; - public weak GLib.SList param_ids; - public weak string sql; - public weak GLib.SList tmpl_columns; - public GLib.Type types; - [CCode (has_construct_function = false)] - protected PStmt (); - public void copy_contents (Gda.PStmt dest); - public unowned Gda.Statement get_gda_statement (); - public void set_gda_statement (Gda.Statement? stmt); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_quark_list_get_type ()")] - [Compact] - public class QuarkList { - [CCode (has_construct_function = false)] - public QuarkList (); - public void add_from_string (string string, bool cleanup); - public void clear (); - public Gda.QuarkList copy (); - public unowned string find (string name); - public void @foreach (GLib.HFunc func); - public void free (); - [CCode (has_construct_function = false)] - public QuarkList.from_string (string string); - public void protect_values (); - public void remove (string name); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_repetitive_statement_get_type ()")] - public class RepetitiveStatement : GLib.Object { - [CCode (has_construct_function = false)] - public RepetitiveStatement (Gda.Statement stmt); - public bool append_set (Gda.Set values, bool make_copy); - public GLib.SList get_all_sets (); - public bool get_template_set (Gda.Set @set) throws GLib.Error; - [NoAccessorMethod] - public Gda.Statement statement { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_row_get_type ()")] - public class Row : GLib.Object { - [CCode (has_construct_function = false)] - public Row (int count); - public int get_length (); - public unowned GLib.Value? get_value (int num); - public void invalidate_value (GLib.Value value); - public void invalidate_value_e (GLib.Value value, owned GLib.Error? error); - public bool value_is_valid (GLib.Value value); - public bool value_is_valid_e (GLib.Value value) throws GLib.Error; - [NoAccessorMethod] - public int nb_values { set; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_server_operation_get_type ()")] - public class ServerOperation : GLib.Object { - [CCode (has_construct_function = false)] - public ServerOperation (Gda.ServerOperationType op_type, string xml_file); - public uint add_item_to_sequence (string seq_path); - public bool del_item_from_sequence (string item_path); - public static GLib.Quark error_quark (); - public string get_node_parent (string path); - public string get_node_path_portion (string path); - public Gda.ServerOperationNodeType get_node_type (string path, Gda.ServerOperationNodeStatus? status); - public Gda.ServerOperationType get_op_type (); - [CCode (array_length = false, array_null_terminated = true)] - public string[] get_root_nodes (); - [CCode (array_length = false, array_null_terminated = true)] - public string[] get_sequence_item_names (string path); - public uint get_sequence_max_size (string path); - public uint get_sequence_min_size (string path); - public unowned string get_sequence_name (string path); - public uint get_sequence_size (string path); - public string get_sql_identifier_at_path (Gda.Connection? cnc, Gda.ServerProvider? prov, string path) throws GLib.Error; - [CCode (cname = "gda_server_operation_get_value_at_path")] - public unowned GLib.Value? get_value_at (string path); - public bool is_valid (string? xml_file) throws GLib.Error; - public bool is_valid_from_resource (string? resource) throws GLib.Error; - public bool load_data_from_xml ([CCode (type = "xmlNodePtr")] Xml.Node* node) throws GLib.Error; - public static unowned string op_type_to_string (Gda.ServerOperationType type); - public bool perform_create_database (string? provider) throws GLib.Error; - public bool perform_create_table () throws GLib.Error; - public bool perform_drop_database (string? provider) throws GLib.Error; - public bool perform_drop_table () throws GLib.Error; - public static Gda.ServerOperation prepare_create_database (string provider, string? db_name) throws GLib.Error; - public static Gda.ServerOperation prepare_drop_database (string provider, string? db_name) throws GLib.Error; - public static Gda.ServerOperation prepare_drop_table (Gda.Connection cnc, string table_name) throws GLib.Error; - [NoWrapper] - public virtual void seq_item_added (string seq_path, int item_index); - [NoWrapper] - public virtual void seq_item_remove (string seq_path, int item_index); - [CCode (cname = "gda_server_operation_set_value_at_path")] - public bool set_value_at (string? value, string path) throws GLib.Error; - public static Gda.ServerOperationType string_to_op_type (string str); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - public int op_type { get; construct; } - [NoAccessorMethod] - public Gda.ServerProvider provider { owned get; construct; } - public string spec_filename { construct; } - public string spec_resource { construct; } - public signal void sequence_item_added (string seq_path, int item_index); - public signal void sequence_item_remove (string seq_path, int item_index); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_server_provider_get_type ()")] - public abstract class ServerProvider : GLib.Object { - [CCode (has_construct_function = false)] - protected ServerProvider (); - public Gda.ServerOperation create_operation (Gda.Connection? cnc, Gda.ServerOperationType type, Gda.Set? options) throws GLib.Error; - public Gda.SqlParser create_parser (Gda.Connection? cnc); - public static GLib.Quark error_quark (); - public string escape_string (Gda.Connection? cnc, string str); - public string find_file (string inst_dir, string filename); - public unowned Gda.DataHandler get_data_handler_dbms (Gda.Connection? cnc, string for_type); - [Deprecated (since = "5.2")] - public unowned Gda.DataHandler get_data_handler_default (Gda.Connection? cnc, GLib.Type type, string dbms_type); - public unowned Gda.DataHandler get_data_handler_g_type (Gda.Connection? cnc, GLib.Type for_type); - public unowned string get_default_dbms_type (Gda.Connection? cnc, GLib.Type type); - public unowned string get_name (); - public unowned string get_server_version (Gda.Connection cnc); - public unowned string get_version (); - public void handler_declare (Gda.DataHandler dh, Gda.Connection cnc, GLib.Type g_type, string dbms_type); - public unowned Gda.DataHandler handler_find (Gda.Connection? cnc, GLib.Type g_type, string? dbms_type); - public unowned Gda.SqlParser internal_get_parser (); - public static string load_file_contents (string inst_dir, string data_dir, string filename); - public static string load_resource_contents (string prov_name, string resource); - public bool perform_operation (Gda.Connection? cnc, Gda.ServerOperation op) throws GLib.Error; - public bool perform_operation_default (Gda.Connection? cnc, Gda.ServerOperation op) throws GLib.Error; - public string render_operation (Gda.Connection? cnc, Gda.ServerOperation op) throws GLib.Error; - public GLib.Value? string_to_value (Gda.Connection? cnc, string string, GLib.Type preferred_type, string? dbms_type); - public bool supports_feature (Gda.Connection? cnc, Gda.ConnectionFeature feature); - public bool supports_operation (Gda.Connection? cnc, Gda.ServerOperationType type, Gda.Set? options); - public string unescape_string (Gda.Connection? cnc, string str); - public string value_to_sql_string (Gda.Connection? cnc, GLib.Value from); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class ServerProviderInfo { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_set_get_type ()")] - public class Set : GLib.Object { - public weak GLib.SList groups_list; - public weak GLib.SList nodes_list; - public weak GLib.SList sources_list; - [CCode (has_construct_function = false)] - public Set (GLib.SList? holders); - public bool add_holder (Gda.Holder holder); - public Gda.Set copy (); - public static GLib.Quark error_quark (); - [CCode (has_construct_function = false)] - public Set.from_spec_node ([CCode (type = "xmlNodePtr")] Xml.Node* xml_spec) throws GLib.Error; - [CCode (has_construct_function = false)] - public Set.from_spec_string (string xml_spec) throws GLib.Error; - public unowned Gda.SetGroup get_group (Gda.Holder holder); - public unowned Gda.Holder get_holder (string holder_id); - public unowned GLib.Value? get_holder_value (string holder_id); - public unowned Gda.SetNode get_node (Gda.Holder holder); - public unowned Gda.Holder get_nth_holder (int pos); - public unowned Gda.SetSource get_source (Gda.Holder holder); - public unowned Gda.SetSource get_source_for_model (Gda.DataModel model); - public bool is_valid () throws GLib.Error; - public void merge_with_set (Gda.Set set_to_merge); - [CCode (has_construct_function = false)] - public Set.read_only (GLib.SList holders); - public void remove_holder (Gda.Holder holder); - public void replace_source_model (Gda.SetSource source, Gda.DataModel model); - [NoAccessorMethod] - public string description { owned get; set; } - public void* holders { construct; } - [NoAccessorMethod] - public string id { owned get; set; } - [NoAccessorMethod] - public string name { owned get; set; } - [NoAccessorMethod] - public bool validate_changes { get; set; } - public virtual signal void holder_attr_changed (Gda.Holder holder, string attr_name, GLib.Value attr_value); - public virtual signal void holder_changed (Gda.Holder holder); - public virtual signal void holder_type_set (Gda.Holder holder); - public virtual signal void public_data_changed (); - public virtual signal void source_model_changed (void* source); - public virtual signal GLib.Error validate_holder_change (Gda.Holder holder, GLib.Value new_value); - public virtual signal GLib.Error validate_set (); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_set_group_get_type ()")] - [Compact] - public class SetGroup { - public weak GLib.SList nodes; - public weak Gda.SetSource nodes_source; - [CCode (has_construct_function = false)] - public SetGroup (Gda.SetNode node); - public void add_node (Gda.SetNode node); - public Gda.SetGroup copy (); - public void free (); - public int get_n_nodes (); - public Gda.SetNode get_node (); - public unowned GLib.SList get_nodes (); - public Gda.SetSource get_source (); - public void set_source (Gda.SetSource source); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_set_node_get_type ()")] - [Compact] - public class SetNode { - public weak Gda.Holder holder; - public int source_column; - public weak Gda.DataModel source_model; - [CCode (has_construct_function = false)] - public SetNode (Gda.Holder holder); - public Gda.SetNode copy (); - public void free (); - public unowned Gda.DataModel get_data_model (); - public unowned Gda.Holder get_holder (); - public int get_source_column (); - public void set_data_model (Gda.DataModel? model); - public void set_holder (Gda.Holder holder); - public void set_source_column (int column); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_set_source_get_type ()")] - [Compact] - public class SetSource { - public weak Gda.DataModel data_model; - public weak GLib.SList nodes; - [CCode (has_construct_function = false)] - public SetSource (Gda.DataModel model); - public void add_node (Gda.SetNode node); - public Gda.SetSource copy (); - public void free (); - public unowned Gda.DataModel get_data_model (); - public int get_n_nodes (); - public unowned GLib.SList get_nodes (); - public void set_data_model (Gda.DataModel model); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_short_get_type ()")] - public class Short { - [CCode (has_construct_function = false)] - protected Short (); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_sql_builder_get_type ()")] - public class SqlBuilder : GLib.Object { - [CCode (has_construct_function = false)] - public SqlBuilder (Gda.SqlStatementType stmt_type); - public Gda.SqlBuilderId add_case_v (Gda.SqlBuilderId test_expr, Gda.SqlBuilderId else_expr, [CCode (array_length_cname = "args_size", array_length_pos = 4.1)] Gda.SqlBuilderId[] when_array, [CCode (array_length_cname = "args_size", array_length_pos = 4.1)] Gda.SqlBuilderId[] then_array); - public Gda.SqlBuilderId add_cond (Gda.SqlOperatorType op, Gda.SqlBuilderId op1, Gda.SqlBuilderId op2, Gda.SqlBuilderId op3); - public Gda.SqlBuilderId add_expr_value (Gda.DataHandler? dh, GLib.Value? value); - public Gda.SqlBuilderId add_field_id (string field_name, string? table_name); - public void add_field_value_as_gvalue (string field_name, GLib.Value? value); - public void add_field_value_id (Gda.SqlBuilderId field_id, Gda.SqlBuilderId value_id); - public Gda.SqlBuilderId add_function_v (string func_name, [CCode (array_length_cname = "args_size", array_length_pos = 2.1)] Gda.SqlBuilderId[] args); - public Gda.SqlBuilderId add_id (string str); - public Gda.SqlBuilderId add_param (string param_name, GLib.Type type, bool nullok); - public void compound_add_sub_select_from_builder (Gda.SqlBuilder subselect); - public void compound_set_type (Gda.SqlStatementCompoundType compound_type); - public static GLib.Quark error_quark (); - public Gda.Statement get_statement () throws GLib.Error; - public Gda.SqlBuilderId import_expression_from_builder (Gda.SqlBuilder query, Gda.SqlBuilderId expr_id); - public void join_add_field (Gda.SqlBuilderId join_id, string field_name); - public Gda.SqlBuilderId select_add_field (string field_name, string? table_name, string? alias); - public Gda.SqlBuilderId select_add_target (string table_name, string? alias); - public Gda.SqlBuilderId select_add_target_id (Gda.SqlBuilderId table_id, string? alias); - public void select_group_by (Gda.SqlBuilderId expr_id); - public void select_order_by (Gda.SqlBuilderId expr_id, bool asc, string? collation_name); - public void select_set_distinct (bool distinct, Gda.SqlBuilderId expr_id); - public void select_set_having (Gda.SqlBuilderId cond_id); - public void select_set_limit (Gda.SqlBuilderId limit_count_expr_id, Gda.SqlBuilderId limit_offset_expr_id); - public void set_table (string table_name); - public void set_where (Gda.SqlBuilderId cond_id); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_sql_parser_get_type ()")] - public class SqlParser : GLib.Object, Gda.Lockable { - [CCode (has_construct_function = false)] - public SqlParser (); - public static GLib.Quark error_quark (); - public Gda.Batch parse_file_as_batch (string filename) throws GLib.Error; - public Gda.Statement parse_string (string sql, out string remain) throws GLib.Error; - public Gda.Batch parse_string_as_batch (string sql, out string remain) throws GLib.Error; - public void set_overflow_error (); - public void set_syntax_error (); - [NoAccessorMethod] - public int column_error { get; } - [NoAccessorMethod] - public int line_error { get; } - [NoAccessorMethod] - public int mode { get; set; } - [NoAccessorMethod] - public int tokenizer_flavour { get; set; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatement { - public void compound_set_type (Gda.SqlStatementCompoundType type); - public void compound_take_stmt (Gda.SqlStatement s); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementDelete { - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementInsert { - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementSelect { - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementTransaction { - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementUnknown { - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class SqlStatementUpdate { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_statement_get_type ()")] - public class Statement : GLib.Object { - [CCode (has_construct_function = false)] - public Statement (); - public bool check_structure () throws GLib.Error; - public bool check_validity (Gda.Connection? cnc) throws GLib.Error; - public Gda.Statement copy (); - public static GLib.Quark error_quark (); - public bool get_parameters (out Gda.Set out_params) throws GLib.Error; - public Gda.SqlStatementType get_statement_type (); - public bool is_useless (); - public bool normalize (Gda.Connection cnc) throws GLib.Error; - public string serialize (); - public string to_sql_extended (Gda.Connection? cnc, Gda.Set? @params, Gda.StatementSqlFlag flags, out GLib.SList params_used) throws GLib.Error; - public string to_sql_real (Gda.SqlRenderingContext context) throws GLib.Error; - [NoAccessorMethod] - public void* structure { get; set; } - public virtual signal void checked (Gda.Connection cnc, bool checked); - public virtual signal void reset (); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_time_get_type ()")] - [Compact] - public class Time { - public ulong fraction; - public ushort hour; - public ushort minute; - public ushort second; - public long timezone; - public void change_timezone (long ntz); - public static void* copy (void* boxed); - public static void free (void* boxed); - public bool valid (); - } - [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gda_timestamp_get_type ()")] - [Compact] - public class Timestamp { - public ushort day; - public ulong fraction; - public ushort hour; - public ushort minute; - public ushort month; - public ushort second; - public long timezone; - public short year; - public void change_timezone (long ntz); - public static void* copy (void* boxed); - public static void free (void* boxed); - public bool valid (); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_transaction_status_get_type ()")] - public class TransactionStatus : GLib.Object { - public weak GLib.List events; - public Gda.TransactionIsolation isolation_level; - public weak string name; - public Gda.TransactionStatusState state; - [CCode (has_construct_function = false)] - public TransactionStatus (string name); - public Gda.TransactionStatus find (string str, Gda.TransactionStatusEvent destev); - public Gda.TransactionStatus find_current (Gda.TransactionStatusEvent destev, bool unnamed_only); - public void free_events (Gda.TransactionStatusEvent event, bool free_after); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_get_type ()")] - public class Tree : GLib.Object { - [CCode (has_construct_function = false)] - public Tree (); - public void add_manager (Gda.TreeManager manager); - public void clean (); - public void dump (Gda.TreeNode? node, void* stream); - public static GLib.Quark error_quark (); - public unowned Gda.TreeNode get_node (string tree_path, bool use_names); - public unowned Gda.TreeManager get_node_manager (Gda.TreeNode node); - public string get_node_path (Gda.TreeNode node); - public GLib.SList get_nodes_in_path (string? tree_path, bool use_names); - public void set_attribute (string attribute, GLib.Value value, GLib.DestroyNotify destroy); - public bool update_all () throws GLib.Error; - public bool update_children (Gda.TreeNode? node) throws GLib.Error; - public bool update_part (Gda.TreeNode node) throws GLib.Error; - [NoAccessorMethod] - public bool is_list { get; } - public virtual signal void node_changed (Gda.TreeNode node); - public virtual signal void node_deleted (string node_path); - public virtual signal void node_has_child_toggled (Gda.TreeNode node); - public virtual signal void node_inserted (Gda.TreeNode node); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_manager_get_type ()")] - public class TreeManager : GLib.Object { - [CCode (has_construct_function = false)] - protected TreeManager (); - public void add_manager (Gda.TreeManager sub); - public void add_new_node_attribute (string attribute, GLib.Value? value); - public Gda.TreeNode create_node (Gda.TreeNode? parent, string? name); - public static GLib.Quark error_quark (); - public unowned GLib.SList get_managers (); - [NoAccessorMethod] - public void* func { get; set construct; } - [NoAccessorMethod] - public bool recursive { get; set construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_mgr_columns_get_type ()")] - public class TreeMgrColumns : Gda.TreeManager { - [CCode (has_construct_function = false, type = "GdaTreeManager*")] - public TreeMgrColumns (Gda.Connection cnc, string schema, string table_name); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - [NoAccessorMethod] - public Gda.MetaStore meta_store { owned get; construct; } - public string schema { construct; } - public string table_name { construct; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class TreeMgrColumnsPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_mgr_label_get_type ()")] - public class TreeMgrLabel : Gda.TreeManager { - [CCode (has_construct_function = false, type = "GdaTreeManager*")] - public TreeMgrLabel (string label); - public string label { construct; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class TreeMgrLabelPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_mgr_schemas_get_type ()")] - public class TreeMgrSchemas : Gda.TreeManager { - [CCode (has_construct_function = false, type = "GdaTreeManager*")] - public TreeMgrSchemas (Gda.Connection cnc); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - [NoAccessorMethod] - public Gda.MetaStore meta_store { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class TreeMgrSchemasPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_mgr_select_get_type ()")] - public class TreeMgrSelect : Gda.TreeManager { - [CCode (has_construct_function = false, type = "GdaTreeManager*")] - public TreeMgrSelect (Gda.Connection cnc, Gda.Statement stmt, Gda.Set @params); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - [NoAccessorMethod] - public Gda.Set @params { owned get; construct; } - [NoAccessorMethod] - public Gda.Statement statement { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class TreeMgrSelectPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_mgr_tables_get_type ()")] - public class TreeMgrTables : Gda.TreeManager { - [CCode (has_construct_function = false, type = "GdaTreeManager*")] - public TreeMgrTables (Gda.Connection cnc, string? schema); - [NoAccessorMethod] - public Gda.Connection connection { owned get; construct; } - [NoAccessorMethod] - public Gda.MetaStore meta_store { owned get; construct; } - public string schema { construct; } - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class TreeMgrTablesPriv { - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_tree_node_get_type ()")] - public class TreeNode : GLib.Object { - [CCode (has_construct_function = false)] - public TreeNode (string? name); - [NoWrapper] - public virtual void dump_children (string prefix, GLib.StringBuilder in_string); - [NoWrapper] - public virtual string dump_header (); - public static GLib.Quark error_quark (); - public unowned GLib.Value? fetch_attribute (string attribute); - public unowned Gda.TreeNode get_child_index (int index); - public unowned Gda.TreeNode get_child_name (string name); - public GLib.SList get_children (); - public unowned GLib.Value? get_node_attribute (string attribute); - public unowned Gda.TreeNode get_parent (); - public void set_node_attribute (string attribute, GLib.Value? value, GLib.DestroyNotify destroy); - [NoAccessorMethod] - public string name { owned get; set; } - public virtual signal void node_changed (Gda.TreeNode node); - public virtual signal void node_deleted (string relative_path); - public virtual signal void node_has_child_toggled (Gda.TreeNode node); - public virtual signal void node_inserted (Gda.TreeNode node); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_ushort_get_type ()")] - public class UShort { - [CCode (has_construct_function = false)] - protected UShort (); - } - [CCode (cheader_filename = "libgda/libgda.h")] - [Compact] - public class Worker { - public unowned GLib.Thread get_worker_thread (); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_xa_transaction_get_type ()")] - public class XaTransaction : GLib.Object { - [CCode (has_construct_function = false)] - public XaTransaction (uint32 format, string global_transaction_id); - public bool begin () throws GLib.Error; - public bool commit (out GLib.SList cnc_to_recover) throws GLib.Error; - public bool commit_recovered (out GLib.SList cnc_to_recover) throws GLib.Error; - public static GLib.Quark error_quark (); - public bool register_connection (Gda.Connection cnc, string branch) throws GLib.Error; - public bool rollback () throws GLib.Error; - public void unregister_connection (Gda.Connection cnc); - [NoAccessorMethod] - public uint format_id { get; construct; } - [NoAccessorMethod] - public string transaction_id { owned get; construct; } - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_handler_get_type ()")] - public interface DataHandler : GLib.Object { - public abstract bool accepts_g_type (GLib.Type type); - public static unowned Gda.DataHandler get_default (GLib.Type for_type); - public abstract unowned string get_descr (); - public abstract unowned GLib.Value? get_sane_init_value (GLib.Type type); - public abstract string get_sql_from_value (GLib.Value? value); - public abstract string get_str_from_value (GLib.Value? value); - public abstract GLib.Value? get_value_from_sql (string? sql, GLib.Type type); - public abstract GLib.Value? get_value_from_str (string? str, GLib.Type type); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_data_model_get_type ()")] - public interface DataModel : GLib.Object { - public bool add_data_from_xml_node ([CCode (type = "xmlNodePtr")] Xml.Node* node) throws GLib.Error; - [CCode (vfunc_name = "i_append_row")] - public abstract int append_row () throws GLib.Error; - [CCode (vfunc_name = "i_append_values")] - public abstract int append_values (GLib.List? values) throws GLib.Error; - public Gda.DataModelArray array_copy_model () throws GLib.Error; - public Gda.DataModelArray array_copy_model_ext ([CCode (array_length_cname = "ncols", array_length_pos = 0.5)] int[] cols) throws GLib.Error; - [CCode (vfunc_name = "i_create_iter")] - public abstract Gda.DataModelIter create_iter (); - [CCode (vfunc_name = "i_describe_column")] - public abstract unowned Gda.Column describe_column (int col); - public void dump (void* to_stream); - public string dump_as_string (); - public static GLib.Quark error_quark (); - public bool export_to_file (Gda.DataModelIOFormat format, string file, [CCode (array_length_cname = "nb_cols", array_length_pos = 3.5)] int[]? cols, [CCode (array_length_cname = "nb_rows", array_length_pos = 4.5)] int[]? rows, Gda.Set options) throws GLib.Error; - public string export_to_string (Gda.DataModelIOFormat format, [CCode (array_length_cname = "nb_cols", array_length_pos = 2.5)] int[]? cols, [CCode (array_length_cname = "nb_rows", array_length_pos = 3.5)] int[]? rows, Gda.Set options); - public void freeze (); - [CCode (vfunc_name = "i_get_access_flags")] - public abstract Gda.DataModelAccessFlags get_access_flags (); - [CCode (vfunc_name = "i_get_attributes_at")] - public abstract Gda.ValueAttribute get_attributes_at (int col, int row); - public int get_column_index (string name); - public unowned string get_column_name (int col); - public unowned string get_column_title (int col); - [CCode (array_length = false, array_null_terminated = true, vfunc_name = "i_get_exceptions")] - public abstract unowned GLib.Error[] get_exceptions (); - [CCode (vfunc_name = "i_get_n_columns")] - public abstract int get_n_columns (); - [CCode (vfunc_name = "i_get_n_rows")] - public abstract int get_n_rows (); - [CCode (vfunc_name = "i_get_notify")] - public abstract bool get_notify (); - [CCode (vfunc_name = "i_find_row")] - public abstract int get_row_from_values (GLib.SList values, [CCode (array_length = false)] int[] cols_index); - public unowned GLib.Value? get_typed_value_at (int col, int row, GLib.Type expected_type, bool nullok) throws GLib.Error; - [CCode (vfunc_name = "i_get_value_at")] - public abstract unowned GLib.Value? get_value_at (int col, int row) throws GLib.Error; - public bool import_from_file (string file, GLib.HashTable? cols_trans, Gda.Set options) throws GLib.Error; - public bool import_from_model (Gda.DataModel from, bool overwrite, GLib.HashTable? cols_trans) throws GLib.Error; - public bool import_from_string (string string, GLib.HashTable? cols_trans, Gda.Set options) throws GLib.Error; - [CCode (vfunc_name = "i_iter_at_row")] - [Deprecated (since = "5.2")] - public abstract bool iter_at_row (Gda.DataModelIter iter, int row); - [CCode (vfunc_name = "i_iter_next")] - [Deprecated (since = "5.2")] - public abstract bool iter_next (Gda.DataModelIter iter); - [CCode (vfunc_name = "i_iter_prev")] - [Deprecated (since = "5.2")] - public abstract bool iter_prev (Gda.DataModelIter iter); - [CCode (vfunc_name = "i_iter_set_value")] - [Deprecated (since = "5.2")] - public abstract bool iter_set_value (Gda.DataModelIter iter, int col, GLib.Value value) throws GLib.Error; - [CCode (vfunc_name = "i_remove_row")] - public abstract bool remove_row (int row) throws GLib.Error; - [CCode (vfunc_name = "i_send_hint")] - public abstract void send_hint (Gda.DataModelHint hint, GLib.Value? hint_value); - public void set_column_name (int col, string name); - public void set_column_title (int col, string title); - [CCode (vfunc_name = "i_set_notify")] - [Deprecated (since = "5.2")] - public abstract void set_notify (bool do_notify_changes); - [CCode (vfunc_name = "i_set_value_at")] - public abstract bool set_value_at (int col, int row, GLib.Value value) throws GLib.Error; - [CCode (vfunc_name = "i_set_values")] - public abstract bool set_values (int row, GLib.List? values) throws GLib.Error; - public void thaw (); - public virtual signal void access_changed (); - public virtual signal void changed (); - [HasEmitter] - public virtual signal void reset (); - [HasEmitter] - public virtual signal void row_inserted (int row); - [HasEmitter] - public virtual signal void row_removed (int row); - [HasEmitter] - public virtual signal void row_updated (int row); - } - [CCode (cheader_filename = "libgda/libgda.h", type_id = "gda_lockable_get_type ()")] - public interface Lockable : GLib.Object { - [NoWrapper] - public abstract void i_lock (); - [NoWrapper] - public abstract bool i_trylock (); - [NoWrapper] - public abstract void i_unlock (); - public void @lock (); - public bool trylock (); - public void unlock (); - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct Diff { - public Gda.DiffType type; - public int old_row; - public int new_row; - public weak GLib.HashTable values; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaDbObject { - public Gda.MetaDbObjectType obj_type; - public bool outdated; - public weak string obj_catalog; - public weak string obj_schema; - public weak string obj_name; - public weak string obj_short_name; - public weak string obj_full_name; - public weak string obj_owner; - public weak GLib.SList depend_list; - [CCode (cname = "extra.meta_table")] - public Gda.MetaTable extra_meta_table; - [CCode (cname = "extra.meta_view")] - public Gda.MetaView extra_meta_view; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaStoreChange { - public Gda.MetaStoreChangeType c_type; - public weak string table_name; - public weak GLib.HashTable keys; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaTable { - public weak GLib.SList columns; - public int pk_cols_array; - public int pk_cols_nb; - public weak GLib.SList reverse_fk_list; - public weak GLib.SList fk_list; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaTableColumn { - public weak string column_name; - public weak string column_type; - public GLib.Type gtype; - public bool pkey; - public bool nullok; - public weak string default_value; - public void foreach_attribute (Gda.AttributesManagerFunc func); - public unowned GLib.Value? get_attribute (string attribute); - public void set_attribute (string attribute, GLib.Value? value, GLib.DestroyNotify? destroy); - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaTableForeignKey { - public Gda.MetaDbObject meta_table; - public Gda.MetaDbObject depend_on; - public int cols_nb; - public int fk_cols_array; - public weak string fk_names_array; - public int ref_pk_cols_array; - public weak string ref_pk_names_array; - public weak string fk_name; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct MetaView { - public Gda.MetaTable table; - public weak string view_def; - public bool is_updatable; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct ProviderInfo { - public weak string id; - public weak string location; - public weak string description; - public weak Gda.Set dsn_params; - public weak Gda.Set auth_params; - public weak string icon_id; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct ServerOperationNode { - public Gda.ServerOperationNodeType type; - public Gda.ServerOperationNodeStatus status; - public weak Gda.Set plist; - public weak Gda.DataModel model; - public weak Gda.Column column; - public weak Gda.Holder param; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct ServerProviderConnectionData { - public weak Gda.Worker worker; - public weak GLib.DestroyNotify provider_data_destroy_func; - public void* pad1; - public void* pad2; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct ServerProviderHandlerInfo { - public weak Gda.Connection cnc; - public GLib.Type g_type; - public weak string dbms_type; - } - [CCode (cheader_filename = "libgda/libgda.h")] - [SimpleType] - public struct SqlBuilderId : uint { - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct SqlParserIface { - public weak Gda.SqlParser parser; - public weak Gda.SqlStatement parsed_statement; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct SqlRenderingContext { - public Gda.StatementSqlFlag flags; - public weak Gda.Set @params; - public weak GLib.SList params_used; - public weak Gda.ServerProvider provider; - public weak Gda.Connection cnc; - public weak Gda.SqlRenderingValue render_value; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct TransactionStatusEvent { - public weak Gda.TransactionStatus trans; - public Gda.TransactionStatusEventType type; - public weak Gda.ConnectionEvent conn_event; - [CCode (cname = "pl.svp_name")] - public weak string pl_svp_name; - [CCode (cname = "pl.sql")] - public weak string pl_sql; - [CCode (cname = "pl.sub_trans")] - public weak Gda.TransactionStatus pl_sub_trans; - } - [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)] - public struct XaTransactionId { - public uint32 format; - public ushort gtrid_length; - public ushort bqual_length; - [CCode (array_length = false, array_null_terminated = true)] - public weak char[] data; - public string to_string (); - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_BATCH_CONFLICTING_PARAMETER_", has_type_id = false)] - public enum BatchError { - [CCode (cname = "GDA_BATCH_CONFLICTING_PARAMETER_ERROR")] - BATCH_CONFLICTING_PARAMETER_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONFIG_", has_type_id = false)] - public enum ConfigError { - DSN_NOT_FOUND_ERROR, - PERMISSION_ERROR, - PROVIDER_NOT_FOUND_ERROR, - PROVIDER_CREATION_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_", has_type_id = false)] - public enum ConnectionError { - DSN_NOT_FOUND_ERROR, - PROVIDER_NOT_FOUND_ERROR, - PROVIDER_ERROR, - NO_CNC_SPEC_ERROR, - NO_PROVIDER_SPEC_ERROR, - OPEN_ERROR, - ALREADY_OPENED_ERROR, - STATEMENT_TYPE_ERROR, - CANT_LOCK_ERROR, - TASK_NOT_FOUND_ERROR, - CLOSED_ERROR, - META_DATA_CONTEXT_ERROR, - UNSUPPORTED_ASYNC_EXEC_ERROR, - NO_MAIN_CONTEXT_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_EVENT_CODE_", has_type_id = false)] - public enum ConnectionEventCode { - CONSTRAINT_VIOLATION, - RESTRICT_VIOLATION, - NOT_NULL_VIOLATION, - FOREIGN_KEY_VIOLATION, - UNIQUE_VIOLATION, - CHECK_VIOLATION, - INSUFFICIENT_PRIVILEGES, - UNDEFINED_COLUMN, - UNDEFINED_FUNCTION, - UNDEFINED_TABLE, - DUPLICATE_COLUMN, - DUPLICATE_DATABASE, - DUPLICATE_FUNCTION, - DUPLICATE_SCHEMA, - DUPLICATE_TABLE, - DUPLICATE_ALIAS, - DUPLICATE_OBJECT, - SYNTAX_ERROR, - UNKNOWN - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_EVENT_", has_type_id = false)] - public enum ConnectionEventType { - NOTICE, - WARNING, - ERROR, - COMMAND - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_FEATURE_", has_type_id = false)] - public enum ConnectionFeature { - AGGREGATES, - BLOBS, - INDEXES, - INHERITANCE, - NAMESPACES, - PROCEDURES, - SEQUENCES, - SQL, - TRANSACTIONS, - SAVEPOINTS, - SAVEPOINTS_REMOVE, - TRIGGERS, - UPDATABLE_CURSOR, - USERS, - VIEWS, - TRANSACTION_ISOLATION_READ_COMMITTED, - TRANSACTION_ISOLATION_READ_UNCOMMITTED, - TRANSACTION_ISOLATION_REPEATABLE_READ, - TRANSACTION_ISOLATION_SERIALIZABLE, - XA_TRANSACTIONS, - LAST - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_META_", has_type_id = false)] - public enum ConnectionMetaType { - NAMESPACES, - TYPES, - TABLES, - VIEWS, - FIELDS, - INDEXES - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_OPTIONS_", has_type_id = false)] - [Flags] - public enum ConnectionOptions { - NONE, - READ_ONLY, - SQL_IDENTIFIERS_CASE_SENSITIVE, - AUTO_META_DATA - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_CONNECTION_STATUS_", has_type_id = false)] - public enum ConnectionStatus { - CLOSED, - OPENING, - IDLE, - BUSY - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_COMPARATOR_", has_type_id = false)] - public enum DataComparatorError { - MISSING_DATA_MODEL_ERROR, - COLUMN_TYPES_MISMATCH_ERROR, - MODEL_ACCESS_ERROR, - USER_CANCELLED_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_MODEL_ACCESS_", has_type_id = false)] - [Flags] - public enum DataModelAccessFlags { - RANDOM, - CURSOR_FORWARD, - CURSOR_BACKWARD, - CURSOR, - INSERT, - UPDATE, - DELETE, - WRITE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_MODEL_HINT_", has_type_id = false)] - public enum DataModelHint { - START_BATCH_UPDATE, - END_BATCH_UPDATE, - REFRESH - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_MODEL_IO_", has_type_id = false)] - public enum DataModelIOFormat { - DATA_ARRAY_XML, - TEXT_SEPARATED, - TEXT_TABLE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_MODEL_ITER_COLUMN_OUT_OF_RANGE_", has_type_id = false)] - public enum DataModelIterError { - [CCode (cname = "GDA_DATA_MODEL_ITER_COLUMN_OUT_OF_RANGE_ERROR")] - DATA_MODEL_ITER_COLUMN_OUT_OF_RANGE_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_PIVOT_", has_type_id = false)] - public enum DataPivotAggregate { - AVG, - COUNT, - MAX, - MIN, - SUM - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_PIVOT_", has_type_id = false)] - public enum DataPivotError { - INTERNAL_ERROR, - SOURCE_MODEL_ERROR, - FIELD_FORMAT_ERROR, - USAGE_ERROR, - OVERFLOW_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_PIVOT_FIELD_", has_type_id = false)] - public enum DataPivotFieldType { - ROW, - COLUMN - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_PROXY_", has_type_id = false)] - public enum DataProxyError { - COMMIT_ERROR, - COMMIT_CANCELLED, - READ_ONLY_VALUE, - READ_ONLY_ROW, - FILTER_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_SELECT_COND_", has_type_id = false)] - public enum DataSelectConditionType { - PK, - ALL_COLUMNS - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_SELECT_", has_type_id = false)] - public enum DataSelectError { - MODIFICATION_STATEMENT_ERROR, - MISSING_MODIFICATION_STATEMENT_ERROR, - CONNECTION_ERROR, - ACCESS_ERROR, - SQL_ERROR, - SAFETY_LOCKED_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DIFF_", has_type_id = false)] - public enum DiffType { - ADD_ROW, - REMOVE_ROW, - MODIFY_ROW - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_HOLDER_", has_type_id = false)] - public enum HolderError { - STRING_CONVERSION_ERROR, - VALUE_TYPE_ERROR, - VALUE_NULL_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_DB_", has_type_id = false)] - public enum MetaDbObjectType { - UNKNOWN, - TABLE, - VIEW - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_FOREIGN_KEY_", has_type_id = false)] - public enum MetaForeignKeyPolicy { - UNKNOWN, - NONE, - NO_ACTION, - RESTRICT, - CASCADE, - SET_NULL, - SET_DEFAULT - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_GRAPH_", has_type_id = false)] - [Flags] - public enum MetaGraphInfo { - [CCode (cname = "GDA_META_GRAPH_COLUMNS")] - META_GRAPH_COLUMNS - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_SORT_", has_type_id = false)] - public enum MetaSortType { - ALHAPETICAL, - DEPENDENCIES - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_STORE_", has_type_id = false)] - public enum MetaStoreChangeType { - ADD, - REMOVE, - MODIFY - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_STORE_", has_type_id = false)] - public enum MetaStoreError { - INCORRECT_SCHEMA_ERROR, - UNSUPPORTED_PROVIDER_ERROR, - INTERNAL_ERROR, - META_CONTEXT_ERROR, - MODIFY_CONTENTS_ERROR, - EXTRACT_SQL_ERROR, - ATTRIBUTE_NOT_FOUND_ERROR, - ATTRIBUTE_ERROR, - SCHEMA_OBJECT_NOT_FOUND_ERROR, - SCHEMA_OBJECT_CONFLICT_ERROR, - SCHEMA_OBJECT_DESCR_ERROR, - TRANSACTION_ALREADY_STARTED_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_STRUCT_", has_type_id = false)] - public enum MetaStructError { - UNKNOWN_OBJECT_ERROR, - DUPLICATE_OBJECT_ERROR, - INCOHERENCE_ERROR, - XML_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_META_STRUCT_FEATURE_", has_type_id = false)] - [Flags] - public enum MetaStructFeature { - NONE, - FOREIGN_KEYS, - VIEW_DEPENDENCIES, - ALL - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_OPERATION_CREATE_TABLE_", has_type_id = false)] - [Flags] - public enum ServerOperationCreateTableFlag { - NOTHING_FLAG, - PKEY_FLAG, - NOT_NULL_FLAG, - UNIQUE_FLAG, - AUTOINC_FLAG, - FKEY_FLAG, - PKEY_AUTOINC_FLAG - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_OPERATION_", has_type_id = false)] - public enum ServerOperationError { - OBJECT_NAME_ERROR, - INCORRECT_VALUE_ERROR, - XML_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_OPERATION_STATUS_", has_type_id = false)] - public enum ServerOperationNodeStatus { - OPTIONAL, - REQUIRED, - UNKNOWN - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_OPERATION_NODE_", has_type_id = false)] - public enum ServerOperationNodeType { - PARAMLIST, - DATA_MODEL, - PARAM, - SEQUENCE, - SEQUENCE_ITEM, - DATA_MODEL_COLUMN, - UNKNOWN - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_OPERATION_", has_type_id = false)] - public enum ServerOperationType { - CREATE_DB, - DROP_DB, - CREATE_TABLE, - DROP_TABLE, - RENAME_TABLE, - ADD_COLUMN, - DROP_COLUMN, - CREATE_INDEX, - DROP_INDEX, - CREATE_VIEW, - DROP_VIEW, - COMMENT_TABLE, - COMMENT_COLUMN, - CREATE_USER, - ALTER_USER, - DROP_USER, - LAST - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_PROVIDER_", has_type_id = false)] - public enum ServerProviderError { - METHOD_NON_IMPLEMENTED_ERROR, - PREPARE_STMT_ERROR, - EMPTY_STMT_ERROR, - MISSING_PARAM_ERROR, - STATEMENT_EXEC_ERROR, - OPERATION_ERROR, - INTERNAL_ERROR, - BUSY_ERROR, - NON_SUPPORTED_ERROR, - SERVER_VERSION_ERROR, - DATA_ERROR, - DEFAULT_VALUE_HANDLING_ERROR, - MISUSE_ERROR, - FILE_NOT_FOUND_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SERVER_META_", has_type_id = false)] - public enum ServerProviderMetaType { - _INFO, - _BTYPES, - _UDT, - UDT, - _UDT_COLS, - UDT_COLS, - _ENUMS, - ENUMS, - _DOMAINS, - DOMAINS, - _CONSTRAINTS_DOM, - CONSTRAINTS_DOM, - _EL_TYPES, - EL_TYPES, - _COLLATIONS, - COLLATIONS, - _CHARACTER_SETS, - CHARACTER_SETS, - _SCHEMATA, - SCHEMATA, - _TABLES_VIEWS, - TABLES_VIEWS, - _COLUMNS, - COLUMNS, - _VIEW_COLS, - VIEW_COLS, - _CONSTRAINTS_TAB, - CONSTRAINTS_TAB, - _CONSTRAINTS_REF, - CONSTRAINTS_REF, - _KEY_COLUMNS, - KEY_COLUMNS, - _CHECK_COLUMNS, - CHECK_COLUMNS, - _TRIGGERS, - TRIGGERS, - _ROUTINES, - ROUTINES, - _ROUTINE_COL, - ROUTINE_COL, - _ROUTINE_PAR, - ROUTINE_PAR, - _INDEXES_TAB, - INDEXES_TAB, - _INDEX_COLS, - INDEX_COLS - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SET_", has_type_id = false)] - public enum SetError { - XML_SPEC_ERROR, - HOLDER_NOT_FOUND_ERROR, - INVALID_ERROR, - READ_ONLY_ERROR, - IMPLEMENTATION_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_BUILDER_", has_type_id = false)] - public enum SqlBuilderError { - WRONG_TYPE_ERROR, - MISUSE_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_IDENTIFIERS_", has_type_id = false)] - [Flags] - public enum SqlIdentifierStyle { - LOWER_CASE, - UPPER_CASE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_OPERATOR_TYPE_", has_type_id = false)] - public enum SqlOperatorType { - AND, - OR, - EQ, - IS, - LIKE, - BETWEEN, - GT, - LT, - GEQ, - LEQ, - DIFF, - REGEXP, - REGEXP_CI, - NOT_REGEXP, - NOT_REGEXP_CI, - SIMILAR, - ISNULL, - ISNOTNULL, - NOT, - IN, - NOTIN, - CONCAT, - PLUS, - MINUS, - STAR, - DIV, - REM, - BITAND, - BITOR, - BITNOT, - ILIKE, - NOTLIKE, - NOTILIKE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_PARSER_", has_type_id = false)] - public enum SqlParserError { - SYNTAX_ERROR, - OVERFLOW_ERROR, - EMPTY_SQL_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_PARSER_FLAVOUR_", has_type_id = false)] - public enum SqlParserFlavour { - STANDARD, - SQLITE, - MYSQL, - ORACLE, - POSTGRESQL - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_PARSER_MODE_", has_type_id = false)] - public enum SqlParserMode { - PARSE, - DELIMIT - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_SELECT_JOIN_", has_type_id = false)] - public enum SqlSelectJoinType { - CROSS, - NATURAL, - INNER, - LEFT, - RIGHT, - FULL; - public static unowned string to_string (Gda.SqlSelectJoinType type); - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_STATEMENT_COMPOUND_", has_type_id = false)] - public enum SqlStatementCompoundType { - UNION, - UNION_ALL, - INTERSECT, - INTERSECT_ALL, - EXCEPT, - EXCEPT_ALL - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_STATEMENT_", has_type_id = false)] - public enum SqlStatementType { - SELECT, - INSERT, - UPDATE, - DELETE, - COMPOUND, - BEGIN, - ROLLBACK, - COMMIT, - SAVEPOINT, - ROLLBACK_SAVEPOINT, - DELETE_SAVEPOINT, - UNKNOWN, - NONE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_STATEMENT_", has_type_id = false)] - public enum StatementError { - PARSE_ERROR, - SYNTAX_ERROR, - NO_CNC_ERROR, - CNC_CLOSED_ERROR, - EXEC_ERROR, - PARAM_TYPE_ERROR, - PARAM_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_STATEMENT_MODEL_", has_type_id = false)] - [Flags] - public enum StatementModelUsage { - RANDOM_ACCESS, - CURSOR_FORWARD, - CURSOR_BACKWARD, - CURSOR, - ALLOW_NOPARAM, - OFFLINE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_STATEMENT_SQL_", has_type_id = false)] - [Flags] - public enum StatementSqlFlag { - PARAMS_AS_VALUES, - PRETTY, - PARAMS_LONG, - PARAMS_SHORT, - PARAMS_AS_COLON, - PARAMS_AS_DOLLAR, - PARAMS_AS_QMARK, - PARAMS_AS_UQMARK, - TIMEZONE_TO_GMT - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TRANSACTION_ISOLATION_", has_type_id = false)] - public enum TransactionIsolation { - SERVER_DEFAULT, - READ_COMMITTED, - READ_UNCOMMITTED, - REPEATABLE_READ, - SERIALIZABLE - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TRANSACTION_STATUS_EVENT_", has_type_id = false)] - public enum TransactionStatusEventType { - SAVEPOINT, - SQL, - SUB_TRANSACTION - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TRANSACTION_STATUS_STATE_", has_type_id = false)] - public enum TransactionStatusState { - OK, - FAILED - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TREE_UNKNOWN_", has_type_id = false)] - public enum TreeError { - [CCode (cname = "GDA_TREE_UNKNOWN_ERROR")] - TREE_UNKNOWN_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TREE_MANAGER_UNKNOWN_", has_type_id = false)] - public enum TreeManagerError { - [CCode (cname = "GDA_TREE_MANAGER_UNKNOWN_ERROR")] - TREE_MANAGER_UNKNOWN_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_TREE_NODE_UNKNOWN_", has_type_id = false)] - public enum TreeNodeError { - [CCode (cname = "GDA_TREE_NODE_UNKNOWN_ERROR")] - TREE_NODE_UNKNOWN_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_VALUE_ATTR_", has_type_id = false)] - [Flags] - public enum ValueAttribute { - NONE, - IS_NULL, - CAN_BE_NULL, - IS_DEFAULT, - CAN_BE_DEFAULT, - IS_UNCHANGED, - ACTIONS_SHOWN, - DATA_NON_VALID, - HAS_VALUE_ORIG, - NO_MODIF, - UNUSED - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_XA_TRANSACTION_", has_type_id = false)] - public enum XaTransactionError { - ALREADY_REGISTERED_ERROR, - DTP_NOT_SUPPORTED_ERROR, - CONNECTION_BRANCH_LENGTH_ERROR - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_XA_", has_type_id = false)] - public enum XaType { - START, - END, - PREPARE, - COMMIT, - ROLLBACK, - RECOVER - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_DATA_MODEL_")] - public errordomain DataModelError { - ROW_OUT_OF_RANGE_ERROR, - COLUMN_OUT_OF_RANGE_ERROR, - VALUES_LIST_ERROR, - VALUE_TYPE_ERROR, - ROW_NOT_FOUND_ERROR, - ACCESS_ERROR, - FEATURE_NON_SUPPORTED_ERROR, - FILE_EXIST_ERROR, - XML_FORMAT_ERROR, - TRUNCATED_ERROR, - OTHER_ERROR; - public static GLib.Quark quark (); - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_SQL_")] - public errordomain SqlError { - STRUCTURE_CONTENTS_ERROR, - MALFORMED_IDENTIFIER_ERROR, - MISSING_IDENTIFIER_ERROR, - VALIDATION_ERROR; - public static GLib.Quark quark (); - } - [CCode (cheader_filename = "libgda/libgda.h", cprefix = "GDA_WORKER_")] - public errordomain WorkerError { - INTER_THREAD_ERROR, - JOB_NOT_FOUND_ERROR, - JOB_QUEUED_ERROR, - JOB_BEING_PROCESSED_ERROR, - JOB_PROCESSED_ERROR, - JOB_CANCELLED_ERROR, - THREAD_KILLED; - public static GLib.Quark quark (); - } - [CCode (cheader_filename = "libgda/libgda.h", has_target = false)] - public delegate void AttributesManagerFunc (string att_name, GLib.Value value, void* data); - [CCode (cheader_filename = "libgda/libgda.h", has_target = false)] - public delegate void AttributesManagerSignal (GLib.Object obj, string att_name, GLib.Value value, void* data); - [CCode (cheader_filename = "libgda/libgda.h", has_target = false)] - public delegate void ConnectionOpenFunc (Gda.Connection cnc, uint job_id, bool result, GLib.Error error, void* data); - [CCode (cheader_filename = "libgda/libgda.h", has_target = false)] - public delegate string SqlRenderingValue (GLib.Value value, Gda.SqlRenderingContext context) throws GLib.Error; - [CCode (cheader_filename = "libgda/libgda.h", has_target = false)] - public delegate bool SqlReservedKeywordsFunc (string word); - [CCode (cheader_filename = "libgda/libgda.h", instance_pos = 4.9)] - public delegate void WorkerCallback (Gda.Worker worker, uint job_id, void* result_data, GLib.Error error); - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_AUTO_INCREMENT")] - public const string ATTRIBUTE_AUTO_INCREMENT; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_DESCRIPTION")] - public const string ATTRIBUTE_DESCRIPTION; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_IS_DEFAULT")] - public const string ATTRIBUTE_IS_DEFAULT; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_NAME")] - public const string ATTRIBUTE_NAME; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_NUMERIC_PRECISION")] - public const string ATTRIBUTE_NUMERIC_PRECISION; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_NUMERIC_SCALE")] - public const string ATTRIBUTE_NUMERIC_SCALE; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_ATTRIBUTE_TREE_NODE_UNKNOWN_CHILDREN")] - public const string ATTRIBUTE_TREE_NODE_UNKNOWN_CHILDREN; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_EXTRA_AUTO_INCREMENT")] - public const string EXTRA_AUTO_INCREMENT; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_SQLSTATE_GENERAL_ERROR")] - public const string SQLSTATE_GENERAL_ERROR; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_SQLSTATE_NO_ERROR")] - public const string SQLSTATE_NO_ERROR; - [CCode (cheader_filename = "libgda/libgda.h", cname = "GDA_TIMEZONE_INVALID")] - public const int TIMEZONE_INVALID; - [CCode (cheader_filename = "libgda/libgda.h")] - public static string alphanum_to_text (string text); - [CCode (array_length = false, array_null_terminated = true, cheader_filename = "libgda/libgda.h")] - public static string[] completion_list_get (Gda.Connection cnc, string sql, int start, int end); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool compute_dml_statements (Gda.Connection cnc, Gda.Statement select_stmt, bool require_pk, owned Gda.Statement? insert_stmt, owned Gda.Statement? update_stmt, owned Gda.Statement? delete_stmt) throws GLib.Error; - [CCode (cheader_filename = "libgda/libgda.h")] - public static unowned Gda.DataHandler data_handler_get_default (GLib.Type for_type); - [CCode (cheader_filename = "libgda/libgda.h")] - public static void dsn_split (string string, string out_dsn, string out_username, string out_password); - [CCode (cheader_filename = "libgda/libgda.h")] - public static GLib.Type g_type_from_string (string str); - [CCode (cheader_filename = "libgda/libgda.h")] - public static unowned string g_type_to_string (GLib.Type type); - [CCode (cheader_filename = "libgda/libgda.h")] - public static string get_application_exec_path (string app_name); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool identifier_equal (string id1, string id2); - [CCode (cheader_filename = "libgda/libgda.h")] - public static uint identifier_hash (string id); - [CCode (cheader_filename = "libgda/libgda.h")] - public static void init (); - [CCode (cheader_filename = "libgda/libgda.h")] - public static void locale_changed (); - [CCode (cheader_filename = "libgda/libgda.h")] - public static void log_disable (); - [CCode (cheader_filename = "libgda/libgda.h")] - public static void log_enable (); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool log_is_enabled (); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_formatted_date (GLib.Date gdate, string value, GLib.DateDMY first, GLib.DateDMY second, GLib.DateDMY third, char sep); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_formatted_time (Gda.Time timegda, string value, char sep); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_formatted_timestamp (Gda.Timestamp timestamp, string value, GLib.DateDMY first, GLib.DateDMY second, GLib.DateDMY third, char sep); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_iso8601_date (GLib.Date gdate, string value); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_iso8601_time (Gda.Time timegda, string value); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool parse_iso8601_timestamp (Gda.Timestamp timestamp, string value); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool rewrite_statement_for_null_parameters (Gda.Statement stmt, Gda.Set @params, owned Gda.Statement? out_stmt) throws GLib.Error; - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool rfc1738_decode (string string); - [CCode (cheader_filename = "libgda/libgda.h")] - public static string rfc1738_encode (string string); - [CCode (cheader_filename = "libgda/libgda.h")] - public static Gda.Statement select_alter_select_for_empty (Gda.Statement stmt) throws GLib.Error; - [CCode (cheader_filename = "libgda/libgda.h")] - public static string sql_identifier_quote (string id, Gda.Connection? cnc, Gda.ServerProvider? prov, bool meta_store_convention, bool force_quotes); - [CCode (array_length = false, array_null_terminated = true, cheader_filename = "libgda/libgda.h")] - public static string[] sql_identifier_split (string id); - [CCode (cheader_filename = "libgda/libgda.h")] - public static Gda.SqlOperatorType sql_operation_operator_from_string (string op); - [CCode (cheader_filename = "libgda/libgda.h")] - public static unowned string sql_operation_operator_to_string (Gda.SqlOperatorType op); - [CCode (cheader_filename = "libgda/libgda.h")] - public static Gda.Binary string_to_binary (string? str); - [CCode (cheader_filename = "libgda/libgda.h")] - public static Gda.Blob string_to_blob (string str); - [CCode (cheader_filename = "libgda/libgda.h")] - public static string text_to_alphanum (string text); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool utility_check_data_model_v (Gda.DataModel model, [CCode (array_length_cname = "nbcols", array_length_pos = 1.5)] GLib.Type[] types); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool utility_data_model_dump_data_to_xml (Gda.DataModel model, [CCode (type = "xmlNodePtr")] Xml.Node* parent, [CCode (array_length_cname = "nb_cols", array_length_pos = 3.5)] int[]? cols, [CCode (array_length_cname = "nb_rows", array_length_pos = 4.5)] int[]? rows, bool use_col_ids); - [CCode (cheader_filename = "libgda/libgda.h")] - public static unowned string utility_data_model_find_column_description (Gda.DataSelect model, string field_name); - [CCode (cheader_filename = "libgda/libgda.h")] - public static bool utility_holder_load_attributes (Gda.Holder holder, [CCode (type = "xmlNodePtr")] Xml.Node* node, GLib.SList sources) throws GLib.Error; - [CCode (cheader_filename = "libgda/libgda.h")] - public static int value_compare (GLib.Value value1, GLib.Value value2); - [CCode (cheader_filename = "libgda/libgda.h")] - public static int value_differ (GLib.Value value1, GLib.Value value2); - [CCode (cheader_filename = "libgda/libgda.h")] - public static string value_stringify (GLib.Value value); -}