Ejemplo n.º 1
0
            public ProblemListView(ProblemModel model)
            {
                this.model = model;
                SetModel(model);
                ColumnController = new ColumnController();

                var selected = new ColumnCellCheckBox("SavedSelected", true);

                selected.Toggled += (o, a) => model.Reload();
                ColumnController.Add(new Column(Catalog.GetString("Fix?"), selected, 0));

                var summary     = new ColumnCellSolutionOptions();
                var summary_col = new Column("", summary, 1.0);

                ColumnController.Add(summary_col);

                var track_details_col = new Column(Catalog.GetString("Track details"),
                                                   new ColumnCellText("TrackDetails", true), 0);

                ColumnController.Add(track_details_col);

                model.Reloaded += (o, a) => {
                    track_details_col.Visible = model.Solver.HasTrackDetails;
                    summary_col.Title         = model.Solver.Name;
                };

                RowOpaquePropertyName = "Selected";
                RulesHint             = true;
                RowActivated         += (o, e) => model.ToggleSelection();
            }
        public FixSource() : base(Catalog.GetString("Metadata Fixer"), Catalog.GetString("Metadata Fixer"), -1)
        {
            TypeUniqueId = "fixes";

            var header_widget = new HBox()
            {
                Spacing = 6
            };

            header_widget.PackStart(new Label(Catalog.GetString("Problem Type:")), false, false, 0);

            var combo = new Banshee.Widgets.DictionaryComboBox <Solver> ();

            foreach (var solver in problem_model.Solvers)
            {
                combo.Add(solver.Name, solver);
            }
            combo.Changed += (o, a) => {
                problem_model.Solver = combo.ActiveValue;
                SetStatus(problem_model.Solver.Description, false, false, "gtk-info");
            };
            combo.Active = 0;

            var apply_button = new Hyena.Widgets.ImageButton(Catalog.GetString("Apply Selected Fixes"), "gtk-apply");

            apply_button.Clicked   += (o, a) => problem_model.Fix();
            problem_model.Reloaded += (o, a) => apply_button.Sensitive = problem_model.SelectedCount > 0;

            header_widget.PackStart(combo, false, false, 0);
            header_widget.PackStart(apply_button, false, false, 0);
            header_widget.ShowAll();

            Properties.SetStringList("Icon.Name", "search", "gtk-search");
            Properties.SetString("ActiveSourceUIResource", "ActiveUI.xml");
            Properties.SetString("GtkActionPath", "/FixSourcePopup");
            Properties.Set <Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget);
            Properties.Set <Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new View(problem_model));
            Properties.SetString("UnmapSourceActionLabel", Catalog.GetString("Close"));
            Properties.SetString("UnmapSourceActionIconName", "gtk-close");

            var actions = new BansheeActionGroup("fix-source");

            actions.AddImportant(
                new ActionEntry("RefreshProblems", Stock.Refresh, Catalog.GetString("Refresh"), null, null, (o, a) => {
                problem_model.Refresh();
            })
                );
            actions.Register();

            problem_model.Reload();
        }