private void BuildWindow ()
        {
            DefaultWidth = 475;

            BorderWidth = 6;
            VBox.Spacing = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            HBox box = new HBox();
            box.BorderWidth = 6;
            box.Spacing = 12;

            Image image = new Image (IconThemeUtils.LoadIcon (48, "podcast"));

            image.Yalign = 0.0f;

            box.PackStart(image, false, true, 0);

            VBox contentBox = new VBox();
            contentBox.Spacing = 12;

            Label header = new Label();
            header.Markup = String.Format (
                "<big><b>{0}</b></big>",
                GLib.Markup.EscapeText (Catalog.GetString ("Subscribe to New Podcast"))
            );

            header.Justify = Justification.Left;
            header.SetAlignment (0.0f, 0.0f);

            WrapLabel message = new WrapLabel ();
            message.Markup = Catalog.GetString (
                "Please enter the URL of the podcast to which you would like to subscribe."
            );

            message.Wrap = true;

            VBox sync_vbox = new VBox ();

            VBox expander_children = new VBox();
            //expander_children.BorderWidth = 6;
            expander_children.Spacing = 6;

            Label sync_text = new Label (
                Catalog.GetString ("When new episodes are available:  ")
            );

            sync_text.SetAlignment (0.0f, 0.0f);
            sync_text.Justify = Justification.Left;

            syncCombo = new SyncPreferenceComboBox ();

            expander_children.PackStart (sync_text, true, true, 0);
            expander_children.PackStart (syncCombo, true, true, 0);

            sync_vbox.Add (expander_children);

            url_entry = new Entry ();
            url_entry.ActivatesDefault = true;

            // If the user has copied some text to the clipboard that starts with http, set
            // our url entry to it and select it
            Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
            if (clipboard != null) {
                string pasted = clipboard.WaitForText ();
                if (!String.IsNullOrEmpty (pasted)) {
                    if (pasted.StartsWith ("http")) {
                        url_entry.Text = pasted.Trim ();
                        url_entry.SelectRegion (0, url_entry.Text.Length);
                    }
                }
            }

            Table table = new Table (1, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 12;

            table.Attach (
                new Label (Catalog.GetString ("URL:")), 0, 1, 0, 1,
                AttachOptions.Shrink, AttachOptions.Shrink, 0, 0
            );

            table.Attach (
                url_entry, 1, 2, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0
            );

            table.Attach (
                sync_vbox, 0, 2, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0
            );

            contentBox.PackStart (header, true, true, 0);
            contentBox.PackStart (message, true, true, 0);

            contentBox.PackStart (table, true, true, 0);

            box.PackStart (contentBox, true, true, 0);

            AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
            AddButton (Catalog.GetString ("Subscribe"), ResponseType.Ok, true);

            box.ShowAll ();
            VBox.Add (box);
        }
Beispiel #2
0
        private void BuildWindow()
        {
            DefaultWidth = 475;

            BorderWidth       = 6;
            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            HBox box = new HBox();

            box.BorderWidth = 6;
            box.Spacing     = 12;

            Image image = new Image(IconThemeUtils.LoadIcon(48, "podcast"));

            image.Yalign = 0.0f;

            box.PackStart(image, false, true, 0);

            VBox contentBox = new VBox();

            contentBox.Spacing = 12;

            Label header = new Label();

            header.Markup = String.Format(
                "<big><b>{0}</b></big>",
                GLib.Markup.EscapeText(Catalog.GetString("Subscribe to New Podcast"))
                );

            header.Justify = Justification.Left;
            header.SetAlignment(0.0f, 0.0f);

            WrapLabel message = new WrapLabel();

            message.Markup = Catalog.GetString(
                "Please enter the URL of the podcast to which you would like to subscribe."
                );

            message.Wrap = true;

            VBox sync_vbox = new VBox();

            VBox expander_children = new VBox();

            //expander_children.BorderWidth = 6;
            expander_children.Spacing = 6;

            Label sync_text = new Label(
                Catalog.GetString("When new episodes are available:  ")
                );

            sync_text.SetAlignment(0.0f, 0.0f);
            sync_text.Justify = Justification.Left;

            syncCombo = new SyncPreferenceComboBox();

            expander_children.PackStart(sync_text, true, true, 0);
            expander_children.PackStart(syncCombo, true, true, 0);

            sync_vbox.Add(expander_children);

            url_entry = new Entry();
            url_entry.ActivatesDefault = true;

            // If the user has copied some text to the clipboard that starts with http, set
            // our url entry to it and select it
            Clipboard clipboard = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

            if (clipboard != null)
            {
                string pasted = clipboard.WaitForText();
                if (!String.IsNullOrEmpty(pasted))
                {
                    if (pasted.StartsWith("http"))
                    {
                        url_entry.Text = pasted.Trim();
                        url_entry.SelectRegion(0, url_entry.Text.Length);
                    }
                }
            }

            Table table = new Table(1, 2, false);

            table.RowSpacing    = 6;
            table.ColumnSpacing = 12;

            table.Attach(
                new Label(Catalog.GetString("URL:")), 0, 1, 0, 1,
                AttachOptions.Shrink, AttachOptions.Shrink, 0, 0
                );

            table.Attach(
                url_entry, 1, 2, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0
                );

            table.Attach(
                sync_vbox, 0, 2, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0
                );

            contentBox.PackStart(header, true, true, 0);
            contentBox.PackStart(message, true, true, 0);

            contentBox.PackStart(table, true, true, 0);

            box.PackStart(contentBox, true, true, 0);

            AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
            AddButton(Catalog.GetString("Subscribe"), ResponseType.Ok, true);

            box.ShowAll();
            VBox.Add(box);
        }
        private void BuildWindow()
        {
            BorderWidth = 6;
            VBox.Spacing = 12;
            HasSeparator = false;

            HBox box = new HBox();
            box.BorderWidth = 6;
            box.Spacing = 12;

            Button save_button = new Button("gtk-save");
            save_button.CanDefault = true;
            save_button.Show();

            // For later additions to the dialog.  (I.E. Feed art)
            HBox content_box = new HBox();
            content_box.Spacing = 12;

            Table table = new Table (2, 4, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 12;

            Label description_label = new Label (Catalog.GetString ("Description:"));
            description_label.SetAlignment (0f, 0f);
            description_label.Justify = Justification.Left;

            Label last_updated_label = new Label (Catalog.GetString ("Last updated:"));
            last_updated_label.SetAlignment (0f, 0f);
            last_updated_label.Justify = Justification.Left;

            Label name_label = new Label (Catalog.GetString ("Podcast Name:"));
            name_label.SetAlignment (0f, 0f);
            name_label.Justify = Justification.Left;

            name_entry = new Entry ();
            name_entry.Text = feed.Title;
            name_entry.Changed += delegate {
                save_button.Sensitive = !String.IsNullOrEmpty (name_entry.Text);
            };

            Label feed_url_label = new Label (Catalog.GetString ("URL:"));
            feed_url_label.SetAlignment (0f, 0f);
            feed_url_label.Justify = Justification.Left;

            Label new_episode_option_label = new Label (Catalog.GetString ("When feed is updated:"));
            new_episode_option_label.SetAlignment (0f, 0.5f);
            new_episode_option_label.Justify = Justification.Left;

            Label last_updated_text = new Label (feed.LastDownloadTime.ToString ("f"));
            last_updated_text.Justify = Justification.Left;
            last_updated_text.SetAlignment (0f, 0f);

            Label feed_url_text = new Label (feed.Url.ToString ());
            feed_url_text.Wrap = false;
            feed_url_text.Selectable = true;
            feed_url_text.SetAlignment (0f, 0f);
            feed_url_text.Justify = Justification.Left;
            feed_url_text.Ellipsize = Pango.EllipsizeMode.End;

            string description_string = String.IsNullOrEmpty (feed.Description) ?
                                        Catalog.GetString ("No description available") :
                                        feed.Description;

            Label descrition_text = new Label (description_string);
            descrition_text.Justify = Justification.Left;
            descrition_text.SetAlignment (0f, 0f);
            descrition_text.Wrap = true;
            descrition_text.Selectable = true;

            Viewport description_viewport = new Viewport();
            description_viewport.SetSizeRequest(-1, 150);
            description_viewport.ShadowType = ShadowType.None;

            ScrolledWindow description_scroller = new ScrolledWindow ();
            description_scroller.HscrollbarPolicy = PolicyType.Never;
            description_scroller.VscrollbarPolicy = PolicyType.Automatic;

            description_viewport.Add (descrition_text);
            description_scroller.Add (description_viewport);

            new_episode_option_combo = new SyncPreferenceComboBox (feed.AutoDownload);

            // First column
            uint i = 0;
            table.Attach (
                name_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                feed_url_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                description_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            // Second column
            i = 0;
            table.Attach (
                name_entry, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                feed_url_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_combo, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (description_scroller, 1, 2, i, ++i,
                          AttachOptions.Expand | AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill, 0, 0
                         );

            content_box.PackStart (table, true, true, 0);
            box.PackStart (content_box, true, true, 0);

            Button cancel_button = new Button("gtk-cancel");
            cancel_button.CanDefault = true;
            cancel_button.Show();

            AddActionWidget (cancel_button, ResponseType.Cancel);
            AddActionWidget (save_button, ResponseType.Ok);

            DefaultResponse = Gtk.ResponseType.Cancel;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            box.ShowAll ();
            VBox.Add (box);

            Response += OnResponse;
        }
        private void BuildWindow()
        {
            BorderWidth  = 6;
            VBox.Spacing = 12;
            HasSeparator = false;

            HBox box = new HBox();

            box.BorderWidth = 6;
            box.Spacing     = 12;

            Button save_button = new Button("gtk-save");

            save_button.CanDefault = true;
            save_button.Show();

            // For later additions to the dialog.  (I.E. Feed art)
            HBox content_box = new HBox();

            content_box.Spacing = 12;

            Table table = new Table(2, 4, false);

            table.RowSpacing    = 6;
            table.ColumnSpacing = 12;

            Label description_label = new Label(Catalog.GetString("Description:"));

            description_label.SetAlignment(0f, 0f);
            description_label.Justify = Justification.Left;

            Label last_updated_label = new Label(Catalog.GetString("Last updated:"));

            last_updated_label.SetAlignment(0f, 0f);
            last_updated_label.Justify = Justification.Left;

            Label name_label = new Label(Catalog.GetString("Podcast Name:"));

            name_label.SetAlignment(0f, 0f);
            name_label.Justify = Justification.Left;

            name_entry          = new Entry();
            name_entry.Text     = feed.Title;
            name_entry.Changed += delegate {
                save_button.Sensitive = !String.IsNullOrEmpty(name_entry.Text);
            };

            Label feed_url_label = new Label(Catalog.GetString("URL:"));

            feed_url_label.SetAlignment(0f, 0f);
            feed_url_label.Justify = Justification.Left;

            Label new_episode_option_label = new Label(Catalog.GetString("When feed is updated:"));

            new_episode_option_label.SetAlignment(0f, 0.5f);
            new_episode_option_label.Justify = Justification.Left;

            Label last_updated_text = new Label(feed.LastDownloadTime.ToString("f"));

            last_updated_text.Justify = Justification.Left;
            last_updated_text.SetAlignment(0f, 0f);

            Label feed_url_text = new Label(feed.Url.ToString());

            feed_url_text.Wrap       = false;
            feed_url_text.Selectable = true;
            feed_url_text.SetAlignment(0f, 0f);
            feed_url_text.Justify   = Justification.Left;
            feed_url_text.Ellipsize = Pango.EllipsizeMode.End;

            string description_string = String.IsNullOrEmpty(feed.Description) ?
                                        Catalog.GetString("No description available") :
                                        feed.Description;

            Label descrition_text = new Label(description_string);

            descrition_text.Justify = Justification.Left;
            descrition_text.SetAlignment(0f, 0f);
            descrition_text.Wrap       = true;
            descrition_text.Selectable = true;

            Viewport description_viewport = new Viewport();

            description_viewport.SetSizeRequest(-1, 150);
            description_viewport.ShadowType = ShadowType.None;

            ScrolledWindow description_scroller = new ScrolledWindow();

            description_scroller.HscrollbarPolicy = PolicyType.Never;
            description_scroller.VscrollbarPolicy = PolicyType.Automatic;

            description_viewport.Add(descrition_text);
            description_scroller.Add(description_viewport);

            new_episode_option_combo = new SyncPreferenceComboBox(feed.AutoDownload);

            // First column
            uint i = 0;

            table.Attach(
                name_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                feed_url_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                last_updated_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                new_episode_option_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                description_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            // Second column
            i = 0;
            table.Attach(
                name_entry, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                feed_url_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                last_updated_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(
                new_episode_option_combo, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
                );

            table.Attach(description_scroller, 1, 2, i, ++i,
                         AttachOptions.Expand | AttachOptions.Fill,
                         AttachOptions.Expand | AttachOptions.Fill, 0, 0
                         );

            content_box.PackStart(table, true, true, 0);
            box.PackStart(content_box, true, true, 0);

            Button cancel_button = new Button("gtk-cancel");

            cancel_button.CanDefault = true;
            cancel_button.Show();

            AddActionWidget(cancel_button, ResponseType.Cancel);
            AddActionWidget(save_button, ResponseType.Ok);

            DefaultResponse   = Gtk.ResponseType.Cancel;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            box.ShowAll();
            VBox.Add(box);

            Response += OnResponse;
        }