Exemplo n.º 1
0
        private void OnPreferencesServiceInstallWidgetAdapters(object sender, EventArgs args)
        {
            /*if (source != null && source.Shell != null && source.Shell.StoreView != null) {
             *  logout_pref.DisplayWidget = new SignOutButton (source.Shell.StoreView);
             * }*/

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

            combo.Add(Catalog.GetString("Automatic (Geo IP detection)"), "geo");
            combo.Add(null, null);
            // TODO uncomment this after string-freeze
            //combo.Add (Catalog.GetString ("Canada (amazon.ca)"), "CA");
            combo.Add(Catalog.GetString("France (amazon.fr)"), "FR");
            combo.Add(Catalog.GetString("Germany, Switzerland, Austria (amazon.de)"), "DE");
            combo.Add(Catalog.GetString("Japan (amazon.co.jp)"), "JP");
            combo.Add(Catalog.GetString("United Kingdom (amazon.co.uk)"), "UK");
            combo.Add(Catalog.GetString("United States (amazon.com)"), "US");
            combo.RowSeparatorFunc = (model, iter) => model.GetValue(iter, 0) == null;
            combo.ActiveValue      = StoreCountry.Get();
            combo.Changed         += (o, e) => {
                StoreCountry.Set(combo.ActiveValue);
                if (source != null && source.Shell != null && source.Shell.StoreView != null)
                {
                    source.Shell.StoreView.Country = combo.ActiveValue;
                    source.Shell.StoreView.GoHome();
                }
            };
            country_pref.DisplayWidget = combo;
        }
Exemplo n.º 2
0
        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) {
                if (solver.PreferencesSection != null) {
                    sections.Add (solver.PreferencesSection);
                }
                combo.Add (solver.Name, solver);
            }

            if (sections.Count > 0) {
                page = new SourcePage (this);
                foreach (var section in sections) {
                    page.Add (section);
                }
            }

            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 ();
        }
        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();
        }
        private void OnPreferencesServiceInstallWidgetAdapters (object sender, EventArgs args)
        {
            /*if (source != null && source.Shell != null && source.Shell.StoreView != null) {
                logout_pref.DisplayWidget = new SignOutButton (source.Shell.StoreView);
            }*/

            var combo = new Banshee.Widgets.DictionaryComboBox<string> ();
            combo.Add (Catalog.GetString ("Automatic (Geo IP detection)"), "geo");
            combo.Add (null, null);
            combo.Add (Catalog.GetString ("France (amazon.fr)"), "FR");
            combo.Add (Catalog.GetString ("Germany, Switzerland, Austria (amazon.de)"), "DE");
            combo.Add (Catalog.GetString ("Japan (amazon.co.jp)"), "JP");
            combo.Add (Catalog.GetString ("United Kingdom (amazon.co.uk)"), "UK");
            combo.Add (Catalog.GetString ("United States (amazon.com)"), "US");
            combo.RowSeparatorFunc = (model, iter) => model.GetValue (iter, 0) == null;
            combo.ActiveValue = StoreCountry.Get ();
            combo.Changed += (o, e) => {
                StoreCountry.Set (combo.ActiveValue);
                if (source != null && source.Shell != null && source.Shell.StoreView != null) {
                    source.Shell.StoreView.Country = combo.ActiveValue;
                    source.Shell.StoreView.GoHome ();
                }
            };
            country_pref.DisplayWidget = combo;
        }