Exemplo n.º 1
0
        private void OnPreferencesServiceInstallWidgetAdapters(object sender, EventArgs args)
        {
            if (pref_section == null)
            {
                return;
            }

            var user_entry = new Gtk.Entry(user_pref.Value ?? "");

            user_entry.Changed += (o, a) => { user_pref.Value = user_entry.Text; };

            var auth_button = new Gtk.Button(Authorized ? Catalog.GetString("Authorized!") : Catalog.GetString("Authorize..."));

            user_pref.ValueChanged += (s) => { auth_button.Sensitive = NeedAuth; };
            auth_button.Sensitive   = NeedAuth;
            auth_button.TooltipText = Catalog.GetString("Open Last.fm in a browser, giving you the option to authorize Banshee to work with your account");
            auth_button.Clicked    += delegate {
                account.SessionKey = null;
                account.RequestAuthorization();
            };

            var signup_button = new Gtk.LinkButton(account.SignUpUrl, Catalog.GetString("Sign up for Last.fm"));

            signup_button.Xalign = 0f;

            var refresh_button = new Gtk.Button(new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Button));

            user_pref.ValueChanged    += (s) => { refresh_button.Sensitive = NeedAuth; };
            refresh_button.Sensitive   = NeedAuth;
            refresh_button.TooltipText = Catalog.GetString("Check if Banshee has been authorized");
            refresh_button.Clicked    += delegate {
                if (String.IsNullOrEmpty(account.UserName) || account.SessionKey == null)
                {
                    account.UserName = LastUserSchema.Get();
                    account.FetchSessionKey();
                    account.Save();
                    LastSessionKeySchema.Set(account.SessionKey);
                }

                auth_button.Sensitive = refresh_button.Sensitive = NeedAuth;
                auth_button.Label     = Authorized
                    ? Catalog.GetString("Authorized!")
                    : Catalog.GetString("Authorize...");
            };

            var auth_box = new Gtk.HBox()
            {
                Spacing = 6
            };

            auth_box.PackStart(user_entry, true, true, 0);
            auth_box.PackStart(auth_button, false, false, 0);
            auth_box.PackStart(refresh_button, false, false, 0);
            auth_box.ShowAll();

            signup_button.Visible = String.IsNullOrEmpty(user_pref.Value);

            var button_box = new Gtk.HBox()
            {
                Spacing = 6
            };

            button_box.PackStart(new Badge(account)
            {
                Visible = true
            }, false, false, 0);
            button_box.PackStart(signup_button, true, true, 0);

            user_pref.DisplayWidget = auth_box;
            pref_section["lastfm-signup"].DisplayWidget = button_box;
        }
Exemplo n.º 2
0
		// Page 3
		// Extension Preferences
		public Gtk.Widget MakeAddinsPane ()
		{
			Gtk.VBox vbox = new Gtk.VBox (false, 6);
			vbox.BorderWidth = 6;
			Gtk.Label l = new Gtk.Label (Catalog.GetString (
			                                     "The following add-ins are installed"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			Gtk.HBox hbox = new Gtk.HBox (false, 6);

			// TreeView of Add-ins
			Gtk.TreeView tree = new Gtk.TreeView ();
			addin_tree = new Mono.Addins.Gui.AddinTreeWidget (tree);

			tree.Show ();

			Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
			sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.ShadowType = Gtk.ShadowType.In;
			sw.Add (tree);
			sw.Show ();
			Gtk.LinkButton get_more_link =
				new Gtk.LinkButton ("http://live.gnome.org/Tomboy/PluginList",
				                    Catalog.GetString ("Get More Add-Ins..."));
			get_more_link.Show ();
			Gtk.VBox tree_box = new Gtk.VBox (false, 0);
			tree_box.Add (sw);
			tree_box.PackEnd (get_more_link, false, false, 5);
			tree_box.Show ();
			hbox.PackStart (tree_box, true, true, 0);

			// Action Buttons (right of TreeView)
			Gtk.VButtonBox button_box = new Gtk.VButtonBox ();
			button_box.Spacing = 4;
			button_box.Layout = Gtk.ButtonBoxStyle.Start;

			// TODO: In a future version, add in an "Install Add-ins..." button

			// TODO: In a future version, add in a "Repositories..." button

			enable_addin_button =
			        new Gtk.Button (Catalog.GetString ("_Enable"));
			enable_addin_button.Sensitive = false;
			enable_addin_button.Clicked += OnEnableAddinButton;
			enable_addin_button.Show ();

			disable_addin_button =
			        new Gtk.Button (Catalog.GetString ("_Disable"));
			disable_addin_button.Sensitive = false;
			disable_addin_button.Clicked += OnDisableAddinButton;
			disable_addin_button.Show ();

			addin_prefs_button =
			        new Gtk.Button (Gtk.Stock.Preferences);
			addin_prefs_button.Sensitive = false;
			addin_prefs_button.Clicked += OnAddinPrefsButton;
			addin_prefs_button.Show ();

			addin_info_button =
			        new Gtk.Button (Gtk.Stock.Info);
			addin_info_button.Sensitive = false;
			addin_info_button.Clicked += OnAddinInfoButton;
			addin_info_button.Show ();

			button_box.PackStart (enable_addin_button);
			button_box.PackStart (disable_addin_button);
			button_box.PackStart (addin_prefs_button);
			button_box.PackStart (addin_info_button);

			button_box.Show ();
			hbox.PackStart (button_box, false, false, 0);

			hbox.Show ();
			vbox.PackStart (hbox, true, true, 0);
			vbox.Show ();

			tree.Selection.Changed += OnAddinTreeSelectionChanged;
			LoadAddins ();

			return vbox;
		}