Ejemplo n.º 1
0
 public WindowConfiguration(SchemaEntry<int> widthSchema,
                             SchemaEntry<int> heightSchema,
                             SchemaEntry<int> xPosSchema,
                             SchemaEntry<int> yPosSchema,
                             SchemaEntry<bool> maximizedSchema)
 {
     WidthSchema = widthSchema;
     HeightSchema = heightSchema;
     XPosSchema = xPosSchema;
     YPosSchema = yPosSchema;
     MaximizedSchema = maximizedSchema;
 }
 public static T Get <T>(SchemaEntry <T> entry, T fallback)
 {
     return(Get <T>(entry.Namespace, entry.Key, fallback));
 }
 public static T Get <T>(SchemaEntry <T> entry)
 {
     return(Get <T>(entry.Namespace, entry.Key, entry.DefaultValue));
 }
 public static void Set <T> (SchemaEntry <T> entry, T value)
 {
     Set(entry.Namespace, entry.Key, value);
 }
Ejemplo n.º 5
0
        private void PrimarySourceInitialize ()
        {
            // Scope the tracks to this primary source
            DatabaseTrackModel.AddCondition (String.Format ("CoreTracks.PrimarySourceID = {0}", DbId));

            primary_sources[DbId] = this;

            // Load our playlists and smart playlists
            foreach (PlaylistSource pl in PlaylistSource.LoadAll (this)) {
                AddChildSource (pl);
            }

            int sp_count = 0;
            foreach (SmartPlaylistSource pl in SmartPlaylistSource.LoadAll (this)) {
                AddChildSource (pl);
                sp_count++;
            }

            // Create default smart playlists if we haven't done it ever before, and if the
            // user has zero smart playlists.
            if (!HaveCreatedSmartPlaylists) {
                if (sp_count == 0) {
                    foreach (SmartPlaylistDefinition def in DefaultSmartPlaylists) {
                        SmartPlaylistSource pl = def.ToSmartPlaylistSource (this);
                        pl.Save ();
                        AddChildSource (pl);
                        pl.RefreshAndReload ();
                        sp_count++;
                    }
                }

                // Only save it if we already had some smart playlists, or we actually created some (eg not
                // if we didn't have any and the list of default ones is empty atm).
                if (sp_count > 0)
                    HaveCreatedSmartPlaylists = true;

            }

            expanded_schema = new SchemaEntry<bool> (
                String.Format ("sources.{0}", ParentConfigurationId), "expanded", true, "Is source expanded", "Is source expanded"
            );
        }
Ejemplo n.º 6
0
        private void BuildPreferences()
        {
            conf_ns = "sync";
            LegacyManuallyManage = dap.CreateSchema<bool> (conf_ns, "enabled", false, "", "");

            auto_sync = dap.CreateSchema<bool> (conf_ns, "auto_sync", false,
                Catalog.GetString ("Sync when first plugged in and when the libraries change"),
                Catalog.GetString ("Begin synchronizing the device as soon as the device is plugged in or the libraries change.")
            );

            sync_prefs = new Section ("sync", Catalog.GetString ("Sync Preferences"), 0);
            pref_sections.Add (sync_prefs);

            sync_prefs.Add (new VoidPreference ("library-options"));

            auto_sync_pref = sync_prefs.Add (auto_sync);
            auto_sync_pref.ValueChanged += OnAutoSyncChanged;
        }
 public static void Control(Paned pane, SchemaEntry<int> entry)
 {
     Control (pane, entry.Namespace, entry.Key, entry.DefaultValue);
 }
Ejemplo n.º 8
0
 public bool Equals(SchemaEntry <T> entry)
 {
     return(Namespace == entry.Namespace && Key == entry.Key);
 }
Ejemplo n.º 9
0
 public static T Get <T> (SchemaEntry <T> entry, T fallback)
 {
     return(Client.Get <T> (entry, fallback));
 }
Ejemplo n.º 10
0
 public static T Get <T> (SchemaEntry <T> entry)
 {
     return(Client.Get <T> (entry));
 }
Ejemplo n.º 11
0
 public static void Set <T> (SchemaEntry <T> entry, T value)
 {
     Client.Set <T> (entry, value);
 }
        private void BuildPreferences ()
        {
            conf_ns = String.Format ("{0}.{1}", sync.ConfigurationNamespace, library.ParentConfigurationId);

            enabled = sync.Dap.CreateSchema<bool> (conf_ns, "enabled", sync.LegacyManuallyManage.Get (),
                String.Format (Catalog.GetString ("Sync {0}"), library.Name), "");

            sync_entire_library = sync.Dap.CreateSchema<bool> (conf_ns, "sync_entire_library", true,
                "Whether to sync the entire library and all playlists.", "");

            sync_source = sync.Dap.CreateSchema<string> (conf_ns, "sync_source", null,
                "If sync_entire_library is false, this contains the source to sync from", "");
        }
        private TreeViewColumn NewColumn(string title, 
                                          int sortColumn, 
                                          SchemaEntry<int> schema)
        {
            TreeViewColumn tmp_column = new TreeViewColumn ();

            tmp_column.Resizable = true;
            tmp_column.Clickable = true;
            tmp_column.Reorderable = false;
            tmp_column.Visible = true;
            tmp_column.Sizing = TreeViewColumnSizing.Fixed;
            tmp_column.Title = title;
            tmp_column.SortColumnId = sortColumn;

            tmp_column.FixedWidth = schema.Get ();

            schemas.Add (schema);
            columns.Add (tmp_column);

            return tmp_column;
        }
Ejemplo n.º 14
0
        private void DatabaseSourceInitialize()
        {
            InitializeTrackModel ();

            current_filters_schema = CreateSchema<string[]> ("current_filters");

            DatabaseSource filter_src = Parent as DatabaseSource ?? this;
            foreach (IFilterListModel filter in filter_src.CreateFiltersFor (this)) {
                AvailableFilters.Add (filter);
                DefaultFilters.Add (filter);
            }

            reload_limiter = new RateLimiter (RateLimitedReload);
        }