예제 #1
0
        private void Initialize()
        {
            Dialog.Title = Catalog.GetString("New Smart Playlist");

            builder = new BansheeQueryBox();

            builder.Show();
            builder.Spacing = 4;

            builder_box.PackStart(builder, true, true, 0);

            name_entry.Changed += HandleNameChanged;

            // Model is Name, SmartPlaylistDefinition
            ListStore list_model = new ListStore(typeof(string), typeof(SmartPlaylistDefinition));

            bool have_any_predefined = false;

            foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists)
            {
                list_model.AppendValues(
                    String.Format("<b>{0}</b>\n<small>{1}</small>", def.Name, def.Description), def
                    );
                have_any_predefined = true;
            }

            adv_tree_view.Selection.Mode = SelectionMode.Multiple;
            adv_tree_view.Model          = list_model;
            CellRendererText renderer = new CellRendererText();

            renderer.Ellipsize = Pango.EllipsizeMode.End;
            adv_tree_view.AppendColumn("title", renderer, "markup", 0);
            adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;

            UpdateAdvButtons(0);

            adv_add_button.Clicked += HandleAdvAdd;
            adv_use_button.Clicked += HandleAdvUse;

            if (!have_any_predefined)
            {
                advanced_expander.NoShowAll = true;
                advanced_expander.Hide();
            }

            Update();

            name_entry.GrabFocus();
        }
예제 #2
0
        private void Initialize()
        {
            Title        = Catalog.GetString("New Smart Playlist");
            VBox.Spacing = 8;

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            ok_button = AddStockButton(Stock.Save, ResponseType.Ok, true);

            var builder_box = new VBox()
            {
                BorderWidth = 5,
                Spacing     = 10
            };

            var name_box = new HBox()
            {
                Spacing = 2
            };

            name_box.PackStart(new Label()
            {
                Text         = Catalog.GetString("Playlist _Name:"),
                UseUnderline = true
            }, false, false, 0);

            name_box.PackStart(name_entry = new Entry(), true, true, 0);
            name_entry.Changed           += HandleNameChanged;
            builder_box.PackStart(name_box, false, false, 0);

            builder_box.PackStart(builder = new BansheeQueryBox(), true, true, 0);
            builder.Show();
            builder.Spacing = 4;

            var expander = new Expander(Catalog.GetString("Predefined Smart Playlists"));
            var hbox     = new HBox()
            {
                Spacing = 8
            };
            var scrolled_window = new ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never,
                VscrollbarPolicy = PolicyType.Automatic,
                ShadowType       = ShadowType.In
            };
            var button_box = new VButtonBox()
            {
                Spacing     = 2,
                LayoutStyle = ButtonBoxStyle.Start
            };

            button_box.PackStart(adv_use_button = new Button(Catalog.GetString("Open in editor")), false, false, 0);
            button_box.PackStart(adv_add_button = new Button(Catalog.GetString("Create and save")), false, false, 0);

            scrolled_window.Add(adv_tree_view = new TreeView()
            {
                HeightRequest  = 150,
                HeadersVisible = false
            });
            hbox.PackStart(scrolled_window, true, true, 0);
            hbox.PackStart(button_box, false, false, 0);

            expander.Add(hbox);

            VBox.PackStart(builder_box, true, true, 0);
            VBox.PackStart(expander, false, false, 0);

            // Model is Name, SmartPlaylistDefinition
            ListStore list_model = new ListStore(typeof(string), typeof(SmartPlaylistDefinition));

            bool have_any_predefined = false;

            foreach (SmartPlaylistDefinition def in primary_source.PredefinedSmartPlaylists)
            {
                list_model.AppendValues(
                    String.Format("<b>{0}</b>\n<small>{1}</small>", def.Name, def.Description), def
                    );
                have_any_predefined = true;
            }

            adv_tree_view.Selection.Mode = SelectionMode.Multiple;
            adv_tree_view.Model          = list_model;
            CellRendererText renderer = new CellRendererText();

            renderer.Ellipsize = Pango.EllipsizeMode.End;
            adv_tree_view.AppendColumn("title", renderer, "markup", 0);
            adv_tree_view.Selection.Changed += HandleAdvSelectionChanged;

            UpdateAdvButtons(0);

            adv_add_button.Clicked += HandleAdvAdd;
            adv_use_button.Clicked += HandleAdvUse;

            if (!have_any_predefined)
            {
                expander.NoShowAll = true;
                expander.Hide();
            }

            Update();

            name_entry.GrabFocus();

            ShowAll();
        }