protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Choose your users"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "Users are the people logging into this system. By adding separate logins you can track the activity of the individuals and restrict their access. To create your users quickly use the form bellow. To edit your users later go to:{0}{1}{0}{0}To edit the user permissions that each user has go to:{0}{2}"),
                                       Environment.NewLine,
                                       new PangoStyle {
                    Italic = true, Bold = true, Text = Translator.GetString("Edit->Users...")
                },
                                       new PangoStyle {
                    Italic = true, Bold = true, Text = Translator.GetString("Edit->Administration->Permissions...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, false, true, 0);

            tbl = new Table(1, 1, false)
            {
                RowSpacing = 4, ColumnSpacing = 4
            };
            Alignment alignment = new Alignment(.5f, .5f, 1f, 1f)
            {
                TopPadding = 20
            };

            alignment.Add(tbl);
            alignment.ShowAll();
            vboBody.PackStart(alignment, true, true, 0);

            RefreshUsersTable();
        }
Exemple #2
0
        public AddinDetailsDialog(Addin addin, Window parent) : base(String.Empty, parent)
        {
            SetDefaultSize(400, -1);

            AddinHeader info = SetupService.GetAddinHeader(addin);

            HBox box = new HBox();

            box.BorderWidth = 10;
            box.Spacing     = 10;
            VBox.PackStart(box, false, false, 0);

            Image image = new Image();

            image.IconName = "package-x-generic";
            image.IconSize = (int)IconSize.Dialog;
            image.Yalign   = 0.0f;

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

            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("<b><big>{0}</big></b>\n\n", GLib.Markup.EscapeText(addin.Name));
            builder.AppendFormat(GLib.Markup.EscapeText(addin.Description.Description)).Append("\n\n");

            builder.Append("<small>");

            builder.AppendFormat("<b>{0}</b> {1}\n\n", Catalog.GetString("Version:"),
                                 GLib.Markup.EscapeText(addin.Description.Version));

            builder.AppendFormat("<b>{0}</b> {1}\n\n", Catalog.GetString("Authors:"),
                                 GLib.Markup.EscapeText(addin.Description.Author));

            builder.AppendFormat("<b>{0}</b> {1}\n\n", Catalog.GetString("Copyright/License:"),
                                 GLib.Markup.EscapeText(addin.Description.Copyright));

            if (info.Dependencies.Count > 0)
            {
                builder.AppendFormat("<b>{0}</b>\n", Catalog.GetString("Extension Dependencies:"));
                foreach (AddinDependency dep in info.Dependencies)
                {
                    builder.Append(GLib.Markup.EscapeText(dep.Name)).Append('\n');
                }
            }

            builder.Append("</small>");

            WrapLabel label = new WrapLabel();

            label.Markup = builder.ToString();
            box.PackStart(label, true, true, 0);

            VBox.ShowAll();

            AddDefaultCloseButton();
        }
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Add your peripheral devices"));

            XML form = FormHelper.LoadGladeXML("SetupAssistant.StepAddDevices.glade", "tblRoot");

            form.Autoconnect(this);

            chkReceiptPrinter.Label = Translator.GetString("I have a cash receipt printer");
            chkKitchenPrinter.Label = Translator.GetString("I have a kitchen printer");
            chkExtDisplay.Label     = Translator.GetString("I have an external display connected to this computer");
            chkScale.Label          = Translator.GetString("I have an electronic scale connected to this computer");
            chkCardReader.Label     = Translator.GetString("I have a card reader connected to the serial port");

            vboBody.PackStart(tblRoot, true, true, 6);

            chkReceiptPrinter.Toggled += chkReceiptPrinter_Toggled;
            chkKitchenPrinter.Toggled += chkKitchenPrinter_Toggled;
            chkExtDisplay.Toggled     += chkExtDisplay_Toggled;
            chkScale.Toggled          += chkScale_Toggled;
            chkCardReader.Toggled     += chkCardReader_Toggled;

            try {
                initializing = true;
                RefreshDevcesTable(algReceiptPrinter, DeviceType.CashReceiptPrinter, chkReceiptPrinter);
                RefreshDevcesTable(algKitchenPrinter, DeviceType.KitchenPrinter, chkKitchenPrinter);
                RefreshDevcesTable(algExtDisplay, DeviceType.ExternalDisplay, chkExtDisplay);
                RefreshDevcesTable(algScale, DeviceType.ElectronicScale, chkScale);
                RefreshDevcesTable(algCardReader, DeviceType.CardReader, chkCardReader);
            } finally {
                initializing = false;
            }

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString("To change the device settings later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Devices...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, true, true, 4);
        }
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Welcome to the database assistant"));

            wlbBody = new WrapLabel
            {
                Markup = new PangoStyle
                {
                    Size = PangoStyle.TextSize.Large,
                    Text = Translator.GetString("This assistant will help you setup your new database so you can start working right away. If you don't need help from the assistant, you can press \"Finish\" at any time and complete the setup of your entities yourself.")
                }
            };
            wlbBody.Show();

            vboBody.PackStart(wlbBody, true, true, 0);
        }
Exemple #5
0
        protected override void CreateBody()
        {
            CreateBody(string.Format(Translator.GetString("Welcome to the {0} setup assistant"), DataHelper.ProductName));

            WrapLabel message = new WrapLabel
            {
                Markup = new PangoStyle
                {
                    Size = PangoStyle.TextSize.Large,
                    Text = string.Format(Translator.GetString("This assistant will help you setup {0} so you can start working right away. If you don't need help from this assistant, you can press \"Finish\" at any time and complete the setup of {0} yourself."), DataHelper.ProductName)
                }
            };

            message.Show();

            vboBody.PackStart(message, true, true, 10);
        }
 public QuestionDisplay() : base(0.5f, 0.5f, 1, 1)
 {
     bus   = MessageBus.Instance;
     label = new WrapLabel();
     this.SetPadding(10, 10, 50, 50);
     this.Add(label);
     if (bus.CurrentState == QuizState.Question)
     {
         ShowQuestion();
         HowOftenAskFill();
     }
     else if (bus.CurrentState == QuizState.Answer)
     {
         ShowQuestion();
         ShowAnswer();
     }
 }
        private void InitializeEntries()
        {
            KeyValuePair <CreateDatabaseType, string> [] samples = new []
            {
                new KeyValuePair <CreateDatabaseType, string> (CreateDatabaseType.SampleRestaurant, Translator.GetString("Restaurant")),
                new KeyValuePair <CreateDatabaseType, string> (CreateDatabaseType.SampleStore, Translator.GetString("Store"))
            };

            lblDescription = new WrapLabel();
            lblDescription.Show();
            algSampleDescription.Add(lblDescription);

            cboSampleType.Load(samples, "Key", "Value");
            cboSampleType.Changed += cboSampleType_Changed;
            cboSampleType_Changed(null, EventArgs.Empty);

            rbtSampleDb.Toggled += rbtSampleDb_Toggled;
            rbtSampleDb_Toggled(null, EventArgs.Empty);

            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/DatabaseCreator"))
            {
                IDatabaseCreator creator = (IDatabaseCreator)node.CreateInstance();
                RadioButton      rbtn    = new RadioButton(rbtBlankDb)
                {
                    Label = creator.Type
                };
                rbtn.Toggled += (sender, args) =>
                {
                    if (rbtn.Active)
                    {
                        lblDescription.Text = creator.Description;
                    }
                };

                rbtn.Show();
                vbxAdditionalTypes.PackStart(rbtn, false, true, 0);
                customCreators.Add(new KeyValuePair <RadioButton, IDatabaseCreator> (rbtn, creator));
            }
        }
        private void RefreshUsersTable()
        {
            for (int i = tbl.Children.Length - 1; i >= 0; i--)
            {
                Widget child = tbl.Children [i];
                tbl.Remove(child);
                child.Destroy();
            }


            tbl.Attach(GetAddWidget(), 0, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            uint index = 0;

            foreach (User user in User.GetAll())
            {
                if (user.Id == User.DefaultId)
                {
                    continue;
                }

                tbl.Attach(GetUserWidget(user), index % 2, (index % 2) + 1, (index / 2) + 1, (index / 2) + 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
                index++;
            }

            if (index == 0)
            {
                WrapLabel wlbNoUsers = new WrapLabel
                {
                    Markup = Translator.GetString("Currently no users are added, which means that no user or password will be required at startup!")
                };
                tbl.Attach(wlbNoUsers, 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 4);
            }

            tbl.ShowAll();
        }
Exemple #9
0
        protected override void CreateBody()
        {
            vboBody = new VBox();

            lblTitle = new Label();
            vboBody.PackStart(lblTitle, false, true, 10);

            wlbBody = new WrapLabel();
            vboBody.PackStart(wlbBody, true, true, 0);
            vboBody.ShowAll();

            tblUnfinished = new Table(1, 1, false);
            vboBody.PackStart(tblUnfinished, true, true, 10);

            Assistant.StatusChanged += Assistant_StatusChanged;
            if (AllStepsFinished())
            {
                SetMessageCompleted();
            }
            else
            {
                SetMessageIncomplete();
            }
        }
Exemple #10
0
        protected override void InitializeForm()
        {
            XML form = FormHelper.LoadGladeXML("Dialogs.Message.glade", "dlgMessage");

            form.Autoconnect(this);

            dlgMessage.Icon = string.IsNullOrEmpty(dialogIcon) ?
                              FormHelper.LoadImage("Icons.AppMain16.png").Pixbuf :
                              FormHelper.LoadImage(dialogIcon).Pixbuf;

            dlgMessage.Title = title;

            if (!string.IsNullOrEmpty(messageIcon))
            {
                Image image = FormHelper.LoadImage(messageIcon);
                algDialogIcon.Add(image);
                image.Show();
            }
            lblDialogMessage      = new WrapLabel();
            lblDialogMessage.Text = message;
            lblDialogMessage.Show();
            algDialogMessage.Add(lblDialogMessage);

            btnOK.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png"));
            btnRetry.SetChildImage(FormHelper.LoadImage("Icons.Retry24.png"));
            btnCancel.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png"));
            btnYes.SetChildImage(FormHelper.LoadImage("Icons.Ok24.png"));
            btnNo.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png"));
            btnRestart.SetChildImage(FormHelper.LoadImage("Icons.Retry24.png"));

            Buttons = MessageButtons.OK;

            base.InitializeForm();

            InitializeFormStrings();
        }
Exemple #11
0
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Enter your company information"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "This information will be printed on the documents you issue. If you want to change that information later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Administration->Company information...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, false, true, 0);

            panel = new EditNewCompanyRecordPanel(CompanyRecord.GetDefault());
            panel.Show();
            vboBody.PackStart(panel, true, true, 10);
        }
Exemple #12
0
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("How do you want to handle the taxes?"));

            #region VAT or Sales tax

            WrapLabel lblVATorTax = new WrapLabel
            {
                Markup = new PangoStyle
                {
                    Size = PangoStyle.TextSize.Large,
                    Text = Translator.GetString("Are you using VAT or Sales tax?")
                }
            };
            lblVATorTax.Show();
            vboBody.PackStart(lblVATorTax, true, true, 5);

            rbnVAT          = new RadioButton(Translator.GetString("VAT"));
            rbnSalesTax     = new RadioButton(rbnVAT, Translator.GetString("Sales tax"));
            rbnVAT.Toggled += rbnVAT_Toggled;

            HBox hbo = new HBox {
                Spacing = 10
            };
            hbo.PackStart(rbnVAT, false, true, 0);
            hbo.PackStart(rbnSalesTax, false, true, 0);
            hbo.ShowAll();
            vboBody.PackStart(hbo, false, true, 5);

            #endregion

            HSeparator hs = new HSeparator();
            hs.Show();
            vboBody.PackStart(hs, true, true, 2);

            #region Default tax

            WrapLabel lblTaxRateTitle = new WrapLabel
            {
                Markup = new PangoStyle
                {
                    Size = PangoStyle.TextSize.Large,
                    Text = Translator.GetString("What is the dafault tax rate you want to use?")
                }
            };
            lblTaxRateTitle.Show();
            vboBody.PackStart(lblTaxRateTitle, true, true, 5);

            Label lblTaxRate = new Label
            {
                Markup = new PangoStyle
                {
                    Text = Translator.GetString("Rate:")
                }
            };

            defaultVatGroup = VATGroup.GetById(VATGroup.DefaultVATGroupId);

            txtTaxRate = new Entry {
                Text = Percent.ToEditString(defaultVatGroup.VatValue)
            };
            txtTaxRate.WidthChars = 10;
            txtTaxRate.Alignment  = 1;

            hbo = new HBox {
                Spacing = 10
            };
            hbo.PackStart(lblTaxRate, false, true, 0);
            hbo.PackStart(txtTaxRate, false, true, 0);
            hbo.ShowAll();
            vboBody.PackStart(hbo, false, true, 5);

            #endregion

            hs = new HSeparator();
            hs.Show();
            vboBody.PackStart(hs, true, true, 2);

            #region With or without VAT

            WrapLabel lblPrices = new WrapLabel
            {
                Markup = new PangoStyle
                {
                    Size = PangoStyle.TextSize.Large,
                    Text = Translator.GetString("How do you want to use the prices in the application? Choose which value you want to round your prices to.")
                }
            };
            lblPrices.Show();
            vboBody.PackStart(lblPrices, true, true, 5);

            rbnWithVAT    = new RadioButton(Translator.GetString("With VAT"));
            rbnWithoutVAT = new RadioButton(rbnWithVAT, Translator.GetString("Without VAT"));

            hbo = new HBox {
                Spacing = 10
            };
            hbo.PackStart(rbnWithVAT, false, true, 0);
            hbo.PackStart(rbnWithoutVAT, false, true, 0);
            hbo.ShowAll();
            vboBody.PackStart(hbo, false, true, 5);

            lblNote = new WrapLabel
            {
                Text = Translator.GetString("Note: You can easely add or subtract VAT after you enter the prices in the operation, using the buttons on the right.")
            };
            lblNote.Show();
            vboBody.PackStart(lblNote, true, true, 5);

            #endregion
        }
        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);

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

            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);
                    }
                }
            }

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

            var url_box = new HBox()
            {
                Spacing = 12
            };

            url_box.PackStart(new Label(Catalog.GetString("URL:")), false, false, 0);
            url_box.PackStart(url_entry, true, true, 0);
            contentBox.PackStart(url_box, false, false, 0);

            var options_label = new Label()
            {
                Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString("Subscription Options"))),
                Xalign = 0f
            };

            download_check = new CheckButton(Catalog.GetString("Download new episodes"));
            archive_check  = new CheckButton(Catalog.GetString("Archive all episodes except the newest one"));
            var options_box = new VBox()
            {
                Spacing = 3
            };

            options_box.PackStart(options_label, false, false, 0);
            options_box.PackStart(new Gtk.Alignment(0f, 0f, 0f, 0f)
            {
                LeftPadding = 12, Child = download_check
            }, false, false, 0);
            options_box.PackStart(new Gtk.Alignment(0f, 0f, 0f, 0f)
            {
                LeftPadding = 12, Child = archive_check
            }, false, false, 0);
            contentBox.PackStart(options_box, false, false, 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);
        }
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Choose your items"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "Items are used to describe the goods and services that you purchase and sell. To modify your items later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Items...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, false, true, 0);

            if (setups.Count == 0)
            {
                foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/ItemsSetup"))
                {
                    object     instance = node.CreateInstance();
                    ItemsSetup setup    = instance as ItemsSetup;
                    if (setup != null)
                    {
                        setups.Add(setup);
                    }
                }
                setups.Sort((p1, p2) => Math.Max(-1, Math.Min(1, p1.Ordinal - p2.Ordinal)));
            }

            nbkMain = new Notebook();
            if (setups.Count > 0)
            {
                foreach (ItemsSetup setup in setups)
                {
                    Label lblTab = new Label(setup.Label)
                    {
                        Xpad = 4
                    };
                    Widget page = setup.GetPageWidget();
                    page.Show();

                    Alignment alg = new Alignment(.5f, .5f, 1f, 1f)
                    {
                        LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
                    };
                    alg.Add(page);
                    alg.Show();

                    EventBox evb = new EventBox {
                        alg
                    };
                    evb.Show();

                    nbkMain.AppendPage(evb, lblTab);
                }
                nbkMain.Show();
            }
            vboBody.PackStart(nbkMain, true, true, 10);

            wlbError = new WrapLabel();
            vboBody.PackStart(wlbError, false, true, 0);

            pgbProgress = new ProgressBar {
                Fraction = 0.00
            };
            vboBody.PackEnd(pgbProgress, false, true, 2);

            lblProgress = new Label();
            vboBody.PackEnd(lblProgress, false, true, 4);
        }
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("What is the main purpose of this workstation?"));

            List <PurposeBase> allPurposes = new List <PurposeBase> ();

            foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/Purpose"))
            {
                object      instance = node.CreateInstance();
                PurposeBase purpose  = instance as PurposeBase;
                if (purpose != null)
                {
                    allPurposes.Add(purpose);
                }
            }
            allPurposes.Sort((p1, p2) => Math.Max(-1, Math.Min(1, p1.Ordinal - p2.Ordinal)));

            HBox hbo = new HBox();

            hbo.Show();
            vboBody.PackStart(hbo, true, true, 6);

            VBox vbo = new VBox();

            vbo.Show();
            hbo.PackStart(vbo, true, true, 4);

            algImage = new Alignment(.5f, .5f, 1f, 1f)
            {
                WidthRequest = 220
            };
            algImage.Show();
            hbo.PackStart(algImage, false, true, 4);

            RadioButton group     = null;
            bool        activeSet = false;

            foreach (PurposeBase purpose in allPurposes)
            {
                Widget rbtn = purpose.GetSelectionWidget(ref group);
                rbtn.Show();
                purpose.Toggled += rbtn_Toggled;

                vbo.PackStart(rbtn, false, true, 4);
                choices.Add(purpose);

                if (activeSet)
                {
                    continue;
                }

                activeSet      = true;
                purpose.Active = true;
                rbtn_Toggled(rbtn, EventArgs.Empty);
            }

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "The selection here will determine the content displayed when {1} is started. To change this later please go to:{0}{2}"),
                                       Environment.NewLine,
                                       DataHelper.ProductName,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Other->Settings->Special->Startup->Startup page")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, true, true, 4);
        }
Exemple #16
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);
        }
Exemple #17
0
        private void BuildTile()
        {
            BorderWidth   = 5;
            RowSpacing    = 1;
            ColumnSpacing = 5;

            Image image = new Image();

            image.IconName = "package-x-generic";
            image.IconSize = (int)IconSize.Dnd;
            image.Yalign   = 0.0f;
            image.Show();
            Attach(image, 0, 1, 0, 3, AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            title = new Label();
            SetLabelStyle(title);
            title.Show();
            title.Xalign = 0.0f;
            title.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(addin.Name));

            Attach(title, 1, 3, 0, 1,
                   AttachOptions.Expand | AttachOptions.Fill,
                   AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            description = new WrapLabel();
            SetLabelStyle(description);
            description.Show();
            description.Text = addin.Description.Description;
            description.Wrap = false;

            Attach(description, 1, 3, 1, 2,
                   AttachOptions.Expand | AttachOptions.Fill,
                   AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            authors = new WrapLabel();
            SetLabelStyle(authors);
            authors.Markup = String.Format(
                "<small><b>{0}</b> <i>{1}</i></small>",
                Catalog.GetString("Authors:"),
                GLib.Markup.EscapeText(addin.Description.Author)
                );

            Attach(authors, 1, 2, 2, 3,
                   AttachOptions.Expand | AttachOptions.Fill,
                   AttachOptions.Expand | AttachOptions.Fill, 0, 4);

            button_box = new VBox();
            HBox box = new HBox();

            box.Spacing = 3;

            button_box.PackEnd(box, false, false, 0);

            Pango.FontDescription font = PangoContext.FontDescription.Copy();
            font.Size = (int)(font.Size * Pango.Scale.Small);

            Label label = new Label("Details");

            label.ModifyFont(font);
            details_button = new Button();
            details_button.Add(label);
            details_button.Clicked += OnDetailsClicked;
            box.PackStart(details_button, false, false, 0);

            label = new Label();
            label.ModifyFont(font);
            activate_button = new Button();
            activate_button.Add(label);
            activate_button.Clicked += OnActivateClicked;
            box.PackStart(activate_button, false, false, 0);

            Attach(button_box, 2, 3, 2, 3, AttachOptions.Shrink, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            Show();

            UpdateState();
        }
        private void BuildWidgets()
        {
            var hbox = new HBox()
            {
                Spacing = 12
            };

            // Left box - cover art, title, etc
            var left_box = new VBox()
            {
                BorderWidth = 12, Spacing = 12
            };

            // Cover art
            cover = new BookCover(this)
            {
                WidthRequest  = 256,
                HeightRequest = 256
            };

            var editable_cover = CoverArtEditor.For(
                cover, (x, y) => true,
                () => library.TrackModel[0],
                UpdateCover
                );

            // Title
            title_label = new WrapLabel();

            resume_button = new ImageButton("", null, IconSize.LargeToolbar);
            resume_button.ImageWidget.Stock  = Stock.MediaPlay;
            resume_button.LabelWidget.Xalign = 0;
            resume_button.Spacing            = 6;

            // FIXME the left padding on this is not right
            rating_entry = new RatingEntry()
            {
                AlwaysShowEmptyStars = true,
                HasFrame             = false
            };
            var rating = new HBox();

            rating.PackStart(rating_entry, false, false, 0);

            // Packing
            left_box.PackStart(editable_cover, false, false, 0);
            left_box.PackStart(title_label, false, false, 0);
            left_box.PackStart(resume_button, false, false, 0);
            //left_box.PackStart (rating, false, false,  0);

            hbox.PackStart(left_box, false, false, 0);

            // Right box - track list
            track_list = new BaseTrackListView()
            {
                HeaderVisible     = true,
                IsEverReorderable = false
            };

            var columns      = new DefaultColumnController();
            var file_columns = new ColumnController();
            var disc_column  = DefaultColumnController.Create(
                BansheeQuery.DiscNumberField, 0.02, false, new ColumnCellPositiveInt(null, false, 2, 2));

            file_columns.AddRange(
                columns.IndicatorColumn,
                disc_column,
                columns.TitleColumn,
                columns.DurationColumn
                );
            file_columns.SortColumn = columns.DiscNumberAndCountColumn;

            foreach (var col in file_columns)
            {
                col.Visible = true;
            }

            var track_sw = new Gtk.ScrolledWindow()
            {
                Child      = track_list,
                ShadowType = ShadowType.None
            };

            track_list.ColumnController = file_columns;

            hbox.PackEnd(track_sw, true, true, 0);

            Child = hbox;
        }
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Choose your locations"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "Locations are used for your physical locations where you store items, place orders, or make purchases from. To create the locations quickly use the form bellow. To edit your locations later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Locations...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, false, true, 0);

            if (schemas.Count == 0)
            {
                foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/LocationsSetup"))
                {
                    object         instance = node.CreateInstance();
                    LocationsSetup schema   = instance as LocationsSetup;
                    if (schema != null)
                    {
                        schemas.Add(schema);
                    }
                }
                schemas.Sort((p1, p2) => Math.Max(-1, Math.Min(1, p1.Ordinal - p2.Ordinal)));
            }

            if (schemas.Count > 1)
            {
                nbkMain = new Notebook();
                foreach (LocationsSetup schema in schemas)
                {
                    Label lblTab = new Label(schema.Label)
                    {
                        Xpad = 4
                    };
                    Widget page = schema.GetPageWidget();
                    page.Show();

                    Alignment alg = new Alignment(.5f, .5f, 1f, 1f)
                    {
                        LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
                    };
                    alg.Add(page);
                    alg.Show();

                    EventBox evb = new EventBox {
                        alg
                    };
                    evb.Show();

                    nbkMain.AppendPage(evb, lblTab);
                }
                nbkMain.Show();
                vboBody.PackStart(nbkMain, true, true, 10);
            }
            else if (schemas.Count == 1)
            {
                Widget page = schemas [0].GetPageWidget();
                page.Show();

                Alignment alg = new Alignment(.5f, .5f, 1f, 1f)
                {
                    LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
                };
                alg.Add(page);
                alg.Show();

                vboBody.PackStart(alg, true, true, 10);
            }
        }