Exemplo n.º 1
0
        private void AddPaneItems()
        {
            if(info_link_clicked) {
                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                    "Back")));

                link.Clicked += delegate(object o, EventArgs args) {
                    info_link_clicked = false;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true,
                    IconThemeUtils.LoadIcon(24, "go-previous", Stock.GoBack));

                pane.Append(Catalog.GetString(
                    "iTunes\u00ae 7 introduced new compatibility issues and currently only " +
                    "works with other iTunes\u00ae 7 clients.\n\n" +
                    "No third-party clients can connect to iTunes\u00ae music shares anymore. " +
                    "This is an intentional limitation by Apple in iTunes\u00ae 7 and newer, we apologize for " +
                    "the unfortunate inconvenience."
                ));
            } else {
                if(failure != DaapErrorType.UserDisconnect) {
                    Label header_label = new Label();
                    header_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString(
                        "Common reasons for connection failures:")));
                    header_label.Xalign = 0.0f;
                    header_label.Show();

                    pane.Append(header_label, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, false);

                    pane.Append(Catalog.GetString("The provided login credentials are invalid"));
                    pane.Append(Catalog.GetString("The login process was canceled"));
                    pane.Append(Catalog.GetString("Too many users are connected to this share"));
                } else {
                    pane.Append(Catalog.GetString("You are no longer connected to this music share"));
                }

                if(failure == DaapErrorType.UserDisconnect || failure == DaapErrorType.InvalidAuthentication) {
                    Button button = new Button(Catalog.GetString("Try connecting again"));
                    button.Clicked += delegate { source.Activate(); };

                    HBox bbox = new HBox();
                    bbox.PackStart(button, false, false, 0);
                    bbox.ShowAll();

                    pane.Append(bbox, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, false);
                    return;
                }

                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                    "The music share is hosted by iTunes\u00ae 7 or newer")));

                link.Clicked += delegate(object o, EventArgs args) {
                    info_link_clicked = true;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
            }
        }
        private void AddPaneItems()
        {
            if(info_link_clicked) {
                bool file_exists = System.IO.File.Exists (Paths.Combine (
                    source.IpodDevice.ControlPath, "iTunes", "iTunesDB"));

                if(file_exists) {
                    pane.Append(Catalog.GetString(
                        "You have used this iPod with a version of iTunes that saves a " +
                        "version of the song database for your iPod that is too new " +
                        "for Banshee to recognize.\n\n" +

                        "Banshee can rebuild your database, but you might lose your settings and all the content in the device (be sure to backup your data first). " +
                        "Using Banshee and iTunes with the same iPod is not recommended."
                    ));

                    LinkLabel link = new LinkLabel();
                    link.Xalign = 0.0f;
                    link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                        "Learn more about Banshee's iPod support")));

                    link.Clicked += delegate { Banshee.Web.Browser.Open ("http://banshee-project.org/IpodAndItunes"); };

                    link.Show();
                    pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
                } else {
                    pane.Append(Catalog.GetString(
                        "An iPod database could not be found on this device.\n\n" +
                        "Banshee can build a new database for you."
                    ));
                }
            } else {
                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                    "What is the reason for this?")));

                link.Clicked += delegate {
                    info_link_clicked = true;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
            }

            if(source.IpodDevice.VolumeInfo.IsMountedReadOnly) {
                pane.Append(Catalog.GetString("Your iPod is mounted read only. Banshee can not restore your iPod."),
                    true, IconThemeUtils.LoadIcon(48, "dialog-error"));
                return;
            }

            LinkLabel rebuild_link = new LinkLabel();
            rebuild_link.Xalign = 0.0f;
            rebuild_link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                "Rebuild iPod Database...")));
            rebuild_link.Clicked += OnRebuildDatabase;
            rebuild_link.Show();
            pane.Append(rebuild_link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
        }