Exemple #1
0
        private void HandleAdvAdd(object sender, EventArgs args)
        {
            TreePath [] paths = adv_tree_view.Selection.GetSelectedRows();

            foreach (TreePath path in paths)
            {
                TreeIter iter;
                if (adv_tree_view.Model.GetIter(out iter, path))
                {
                    SmartPlaylistDefinition def = ((SmartPlaylistDefinition)adv_tree_view.Model.GetValue(iter, 1));
                    SmartPlaylistSource     pl  = def.ToSmartPlaylistSource(primary_source);
                    pl.Save();
                    pl.PrimarySource.AddChildSource(pl);
                    //SmartPlaylistCore.Instance.StartTimer (pl);
                }
            }

            currently_editing = null;
            Destroy();
        }
Exemple #2
0
        protected override void OnResponse(ResponseType response)
        {
            //int w = -1, h = -1;
            //dialog.GetSize (out w, out h);
            //Console.WriteLine ("w = {0}, h = {1}", w, h);

            QueryNode node = builder.QueryNode;

            if (node == null)
            {
                //Console.WriteLine ("Editor query is null");
            }
            else
            {
                //Console.WriteLine ("Editor query is: {0}", node.ToXml (BansheeQuery.FieldSet, true));
            }

            if (response == ResponseType.Ok)
            {
                string            name           = PlaylistName;
                QueryNode         condition_tree = Condition;
                QueryLimit        limit          = Limit;
                QueryOrder        order          = Order;
                IntegerQueryValue limit_value    = LimitValue;

                ThreadAssist.Spawn(delegate {
                    //Console.WriteLine ("Name = {0}, Cond = {1}, OrderAndLimit = {2}", name, condition, order_by, limit_number);
                    if (playlist == null)
                    {
                        playlist = new SmartPlaylistSource(name, primary_source);

                        playlist.ConditionTree = condition_tree;
                        playlist.QueryOrder    = order;
                        playlist.Limit         = limit;
                        playlist.LimitValue    = limit_value;

                        playlist.Save();
                        primary_source.AddChildSource(playlist);
                        playlist.RefreshAndReload();
                        //SmartPlaylistCore.Instance.StartTimer (playlist);
                    }
                    else
                    {
                        playlist.ConditionTree = condition_tree;
                        playlist.QueryOrder    = order;
                        playlist.LimitValue    = limit_value;
                        playlist.Limit         = limit;

                        playlist.Name = name;
                        playlist.Save();
                        playlist.RefreshAndReload();

                        /*if (playlist.TimeDependent)
                         *  SmartPlaylistCore.Instance.StartTimer (playlist);
                         * else
                         *  SmartPlaylistCore.Instance.StopTimer ();*/

                        //playlist.ListenToPlaylists ();
                        //SmartPlaylistCore.Instance.SortPlaylists ();
                    }
                });
            }

            currently_editing = null;
        }