Example #1
0
		void AddLinkButton (string uri = "", string label = "")
		{
			linkButton = new LinkButton (uri, label);
			linkButton.Relief = ReliefStyle.None;
			linkButton.CanFocus = false;
			linkButton.SetAlignment (0, 0);
			linkButton.Clicked += LinkButtonClicked;
			this.Add (linkButton);
		}
		public AbstractLoginWidget (string serviceName, string serviceUri)
		{
			Build();

			// setup the link button
			new_account_button = new LinkButton (serviceUri, string.Format (NewAccountButtonFormat, serviceName));
			new_account_button_box.Add (new_account_button);

			// masks chars for passwords
			password_entry.InnerEntry.Visibility = false;

			password_entry.InnerEntry.Activated += OnPasswordEntryActivated;
			new_account_button.Clicked += OnNewAccountBtnClicked;

			ChangeService (serviceName, serviceUri);
			
			username_entry.Show ();
			password_entry.Show ();

			ShowAll ();

		}
    private void populate()
    {
        using(StreamReader sr = new StreamReader(".history"))
        {
            while(!sr.EndOfStream)
            {
                //Column 0: lr node published to
                //Column 1: docId
                //Column 2: publish date
                string[] items = sr.ReadLine().Split(' ');
                string url = String.Format("{0}/obtain?by_doc_ID=true&request_id={1}", items[0], items[1]);
                string dateString = DateTime.Parse(items[2]).ToShortDateString();

                Gtk.LinkButton lb = new Gtk.LinkButton(url, "View record in browser");
                lb.Clicked += (sender, e) => System.Diagnostics.Process.Start(url);
                Gtk.HBox row = new Gtk.HBox();
                row.Add(new Gtk.Label(dateString));
                row.Add(new Gtk.Label(items[1]));
                row.Add(lb);

                HistoryTable.Add(row);
            }
        }
    }
        public HmPreferencesWidget()
            : base()
        {
            HmBackend.LoadCredentials (out this.username, out this.password);

            //Fixme Please ! I look UGLY!
            VBox mainVBox = new VBox(false, 12);
            mainVBox.BorderWidth = 10;
            mainVBox.Show();
            Add(mainVBox);

            HBox usernameBox = new HBox(false, 12);
            Gtk.Label emailLabel = new Label ("Email Address");
            usernameBox.Add (emailLabel);
            emailEntry = new Entry(username);
            usernameBox.Add (emailEntry);
            usernameBox.ShowAll();
            mainVBox.PackStart (usernameBox, false, false, 0);

            HBox passwordBox = new HBox(false, 12);
            Gtk.Label passwordLabel = new Label ("Password");
            passwordBox.Add (passwordLabel);
            passwordEntry = new Entry(password);
            passwordBox.Add (passwordEntry);
            passwordBox.ShowAll();
            mainVBox.PackStart (passwordBox, false, false, 0);

            // Status message label
            statusLabel = new Label();
            statusLabel.Justify = Gtk.Justification.Center;
            statusLabel.Wrap = true;
            statusLabel.LineWrap = true;
            statusLabel.Show();
            statusLabel.UseMarkup = true;
            statusLabel.UseUnderline = false;

            mainVBox.PackStart(statusLabel, false, false, 0);

            authButton = new LinkButton("Click Here to Connect");
            authButton.Show();
            mainVBox.PackStart(authButton, false, false, 0);
            mainVBox.ShowAll();

            authButton.Clicked += OnAuthButtonClicked;
        }
Example #5
0
        private void CreateAbout ()
        {
            Gdk.Color fgcolor = new Gdk.Color();
            Gdk.Color.Parse("red", ref fgcolor);
            Label version = new Label () {
                Markup = string.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                        String.Format(Properties_Resources.Version, Controller.RunningVersion)),
                       Xalign = 0
            };

            this.updates = new Label () {
                Markup = "<span font_size='small' fgcolor='#729fcf'><b>Please check for updates at CmisSync.com</b></span>",
                       Xalign = 0
            };

            Label credits = new Label () {
                LineWrap     = true,
                             LineWrapMode = Pango.WrapMode.Word,
                             Markup = "<span font_size='small' fgcolor='#729fcf'>" +
                                 "Copyright © 2014–" + DateTime.Now.Year.ToString() + " GRAU DATA AG, Aegif and others.\n" +
                                 "\n" +
                                 "CmisSync is Open Source software. You are free to use, modify, " +
                                 "and redistribute it under the GNU General Public License version 3 or later." +
                                 "</span>",
                             WidthRequest = 330,
                             Wrap         = true,
                             Xalign = 0
            };

            LinkButton website_link = new LinkButton (Controller.WebsiteLinkAddress, Properties_Resources.Website);
            website_link.ModifyFg(StateType.Active, fgcolor);
            LinkButton credits_link = new LinkButton (Controller.CreditsLinkAddress, Properties_Resources.Credits);
            LinkButton report_problem_link = new LinkButton (Controller.ReportProblemLinkAddress, Properties_Resources.ReportProblem);

            HBox layout_links = new HBox (false, 0);
            layout_links.PackStart (website_link, false, false, 0);
            layout_links.PackStart (credits_link, false, false, 0);
            layout_links.PackStart (report_problem_link, false, false, 0);

            VBox layout_vertical = new VBox (false, 0);
            layout_vertical.PackStart (new Label (""), false, false, 42);
            layout_vertical.PackStart (version, false, false, 0);
            //layout_vertical.PackStart (this.updates, false, false, 0);
            layout_vertical.PackStart (credits, false, false, 9);
            layout_vertical.PackStart (new Label (""), false, false, 0);
            layout_vertical.PackStart (layout_links, false, false, 0);

            HBox layout_horizontal = new HBox (false, 0) {
                BorderWidth   = 0,
                              HeightRequest = 260,
                              WidthRequest  = 640
            };
            layout_horizontal.PackStart (new Label (""), false, false, 150);
            layout_horizontal.PackStart (layout_vertical, false, false, 0);

            Add (layout_horizontal);
        }
Example #6
0
        private Widget BuildCenter ()
        {
            var vbox = new VBox () { Spacing = 2 };

            // Search entry/button
            var search_box = new HBox () { Spacing = 6, BorderWidth = 4 };
            var entry = new SearchEntry () {
                Visible = true,
                EmptyMessage = String.Format (Catalog.GetString ("Search..."))
            };

            source.Properties.Set<SearchEntry> ("Nereid.SearchEntry", entry);

            // Make the search entry text nice and big
            var font = entry.InnerEntry.Style.FontDescription.Copy ();
            font.Size = (int) (font.Size * Pango.Scale.XLarge);
            entry.InnerEntry.ModifyFont (font);
            font.Dispose ();

            var button = new Hyena.Widgets.ImageButton (Catalog.GetString ("_Go"), Stock.Find);
            entry.Activated += (o, a) => { button.Activate (); };
            button.Clicked += (o, a) => source.SetSearch (new SearchDescription (null, entry.Query, IA.Sort.DownloadsDesc, null));

            search_box.PackStart (entry, true, true, 0);
            search_box.PackStart (button, false, false, 0);

            var example_searches = new SearchDescription [] {
                new SearchDescription (Catalog.GetString ("Staff Picks"), "pick:1", IA.Sort.WeekDesc, null),
                new SearchDescription (Catalog.GetString ("Creative Commons"), "license:creativecommons", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("History"), "subject:history", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("Classic Cartoons"), "", IA.Sort.DateCreatedAsc, IA.MediaType.Get ("animationandcartoons")),
                new SearchDescription (Catalog.GetString ("Speeches"), "subject:speeches OR title:speech", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("For Children"), "subject:children", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("Poetry"), "subject:poetry", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("Creator is United States"), "creator:\"United States\"", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("Old Movies"), "", IA.Sort.DateCreatedAsc, IA.MediaType.Get ("moviesandfilms")),
                new SearchDescription (Catalog.GetString ("New From LibriVox"), "publisher:LibriVox", IA.Sort.DateAddedDesc, IA.MediaType.Get ("audio")),
                new SearchDescription (Catalog.GetString ("Old Texts"), "", IA.Sort.DateCreatedAsc, IA.MediaType.Get ("texts")),
                new SearchDescription (Catalog.GetString ("Charlie Chaplin"), "\"Charlie Chaplin\"", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("NASA"), "NASA", IA.Sort.DownloadsDesc, null),
                new SearchDescription (Catalog.GetString ("Library of Congress"), "creator:\"Library of Congress\"", IA.Sort.DownloadsDesc, null)
            };

            var examples = new FlowBox () { Spacing = 0 };
            examples.Add (PaddingBox (new Label () { Markup = "Examples:" }));

            foreach (var search in example_searches) {
                var this_search = search;
                var link = CreateLink (search.Name, search.Query);
                link.TooltipText = search.Query;
                link.Clicked += (o, a) => source.SetSearch (this_search);
                examples.Add (link);
            }

            // Intro text and visit button
            var intro_label = new Hyena.Widgets.WrapLabel () {
                Markup = Catalog.GetString ("The Internet Archive, a 501(c)(3) non-profit, is building a digital library of Internet sites and other cultural artifacts in digital form. Like a paper library, we provide free access to researchers, historians, scholars, and the general public.")
            };

            var visit_button = new LinkButton ("http://archive.org/", Catalog.GetString ("Visit the Internet Archive online at archive.org"));
            visit_button.Clicked += (o, a) => Banshee.Web.Browser.Open ("http://archive.org/");
            visit_button.Xalign = 0f;
            var visit_box = new HBox ();
            visit_box.PackStart (visit_button, false, false, 0);
            visit_box.PackStart (new Label () { Visible = true }, true, true, 0);

            // Packing
            vbox.PackStart (search_box, false, false, 0);
            vbox.PackStart (examples, false, false, 0);
            vbox.PackStart (PaddingBox (new HSeparator ()), false, false, 6);
            vbox.PackStart (PaddingBox (intro_label), false, false, 0);
            vbox.PackStart (visit_box, false, false, 0);

            return vbox;
        }
Example #7
0
        private Button CreateLink (string title, string url)
        {
            var button = new LinkButton (url, "") {
                Relief = ReliefStyle.None,
            };

            var label = button.Child as Label;
            if (label != null) {
                label.Markup = title;//"<small>" + title + "</small>";
            }
            return button;
        }
Example #8
0
		// called when no search results are found in the selected notebook
		void NoMatchesFoundAction ()
		{
			hpaned.Remove (matches_window);
			String message = Catalog.GetString ("No results found " +
				"in the selected notebook.\nClick here to " +
				"search across all notes.");
			Gtk.LinkButton link_button = new Gtk.LinkButton ("", message);
			Gtk.LinkButton.SetUriHook(ShowAllSearchResults);
			link_button.TooltipText = Catalog.GetString 
				("Click here to search across all notebooks");
			link_button.Show();
			Gtk.Table no_matches_found_table = new Gtk.Table (1, 3, false);
			no_matches_found_table.Attach (link_button, 1, 2, 0, 1,
			                               Gtk.AttachOptions.Fill | Gtk.AttachOptions.Shrink,
			                 Gtk.AttachOptions.Shrink,
			                0, 0
			              );
			
			no_matches_found_table.ColumnSpacing = 4;
			no_matches_found_table.ShowAll ();
			no_matches_box = new HBox (false, 0);
			no_matches_box.PackStart (no_matches_found_table, true, true, 0);
			no_matches_box.Show ();
			hpaned.Add2 (no_matches_box);
		}
        public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences)
            : base()
        {
            if (backend == null)
                throw new ArgumentNullException ("backend");
            if (preferences == null)
                throw new ArgumentNullException ("preferences");
            this.backend = backend;
            this.preferences = preferences;

            LoadPreferences ();

            BorderWidth = 0;

            // We're using an event box so we can paint the background white
            EventBox imageEb = new EventBox ();
            imageEb.BorderWidth = 0;
            imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
            imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));
            imageEb.Show ();

            VBox mainVBox = new VBox(false, 0);
            mainVBox.BorderWidth = 10;
            mainVBox.Show();
            Add(mainVBox);

            // Add the rtm logo
            image = new Gtk.Image (normalPixbuf);
            image.Show();
            //make the dialog box look pretty without hard coding total size and
            //therefore clipping displays with large fonts.
            Alignment spacer = new Alignment((float)0.5, 0, 0, 0);
            spacer.SetPadding(0, 0, 125, 125);
            spacer.Add(image);
            spacer.Show();
            imageEb.Add (spacer);
            mainVBox.PackStart(imageEb, true, true, 0);

            // Status message label
            statusLabel = new Label();
            statusLabel.Justify = Gtk.Justification.Center;
            statusLabel.Wrap = true;
            statusLabel.LineWrap = true;
            statusLabel.Show();
            statusLabel.UseMarkup = true;
            statusLabel.UseUnderline = false;

            authButton = new LinkButton (
            #if GETTEXT
            Catalog.GetString ("Click Here to Connect"));
            #elif ANDROID

            #endif
            authButton.Clicked += OnAuthButtonClicked;

            if ( isAuthorized ) {
                statusLabel.Text = "\n\n" +
            #if GETTEXT
                    Catalog.GetString ("You are currently connected");
            #elif ANDROID

            #endif
                string userName = preferences.Get (PreferencesKeys.UserNameKey);
                if (userName != null && userName.Trim () != string.Empty)
                    statusLabel.Text = "\n\n" +
            #if GETTEXT
                        Catalog.GetString ("You are currently connected as") +
            #elif ANDROID

            #endif
                        "\n" + userName.Trim();
            } else {
                statusLabel.Text = "\n\n" +
            #if GETTEXT
                    Catalog.GetString ("You are not connected");
            #elif ANDROID

            #endif
                authButton.Show();
            }
            mainVBox.PackStart(statusLabel, false, false, 0);
            mainVBox.PackStart(authButton, false, false, 0);

            Label blankLabel = new Label("\n");
            blankLabel.Show();
            mainVBox.PackStart(blankLabel, false, false, 0);
        }
Example #10
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;
		}
Example #11
0
        void Upload()
        {
            Album album = null;

            IBrowsableItem [] items = dialog.Items;
            string [] captions = dialog.Captions;
            dialog.StoreCaption ();

            if (dialog.CreateAlbum) {
                string name = dialog.AlbumName;
                if (String.IsNullOrEmpty (name)) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Album must have a name"),
                            Catalog.GetString ("Please name your album or choose an existing album."));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum (name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Creating a new album failed"),
                            String.Format (Catalog.GetString ("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }
            } else {
                album = dialog.ActiveAlbum;
            }

            long sent_bytes = 0;

            FilterSet filters = new FilterSet ();
            filters.Add (new JpegFilter ());
            filters.Add (new ResizeFilter ((uint) size));

            for (int i = 0; i < items.Length; i++) {
                try {
                    IBrowsableItem item = items [i];

                    FileInfo file_info;
                    Console.WriteLine ("uploading {0}", i);

                    progress_dialog.Message = String.Format (Catalog.GetString ("Uploading picture \"{0}\" ({1} of {2})"), item.Name, i + 1, items.Length);
                    progress_dialog.ProgressText = string.Empty;
                    progress_dialog.Fraction = i / (double) items.Length;

                    FilterRequest request = new FilterRequest (item.DefaultVersionUri);
                    filters.Convert (request);

                    file_info = new FileInfo (request.Current.LocalPath);

                    album.Upload (captions [i] ?? "", request.Current.LocalPath);

                    sent_bytes += file_info.Length;
                }
                catch (Exception e) {
                    progress_dialog.Message = String.Format (Catalog.GetString ("Error Uploading To Facebook: {0}"), e.Message);
                    progress_dialog.ProgressText = Catalog.GetString ("Error");
                    Console.WriteLine (e);

                    if (progress_dialog.PerformRetrySkip ())
                        i--;
                }
            }

            progress_dialog.Message = Catalog.GetString ("Done Sending Photos");
            progress_dialog.Fraction = 1.0;
            progress_dialog.ProgressText = Catalog.GetString ("Upload Complete");
            progress_dialog.ButtonLabel = Gtk.Stock.Ok;

            var li = new LinkButton ("http://www.facebook.com/group.php?gid=158960179844&ref=mf", Catalog.GetString ("Visit F-Spot group on Facebook"));
            progress_dialog.VBoxPackEnd (li);
            li.ShowAll ();
        }
Example #12
0
        public void AddSignUpButton()
        {
            if (signup_button != null) {
                return;
            }

            Resize (2, 2);
            signup_button = new LinkButton (account.SignUpUrl, Catalog.GetString ("Sign up for Last.fm"));
            signup_button.Show ();
            Attach (signup_button, 1, 2, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
        }
        protected void SetupGui()
        {
            // This is all just stuff to make the UI work sanely.
            sbInitialDeposit.Adjustment.PageIncrement = 100;

            sbInitialDeposit.Xalign = 1.0f;
            sbReserveRequirement.Xalign = 1.0f;
            sbIterations.Xalign = 1.0f;
            sbBankCanLoan.Xalign = 1.0f;
            sbBankHasLoanedOut.Xalign = 1.0f;
            sbBanksNextLoan.Xalign = 1.0f;
            sbBanksReserves.Xalign = 1.0f;
            sbWhatCustomersThink.Xalign = 1.0f;
            sbTotalInterestAndPrincipal.Xalign = 1.0f;
            sbTotalInterestOnly.Xalign = 1.0f;
            sbInterestPeriods.Xalign = 1.0f;
            sbInterestRate.Xalign = 1.0f;

            lblInitDeposit.Xalign = 1.0f;
            lblReserveRequirement.Xalign = 1.0f;
            lblIterations.Xalign = 1.0f;

            // Make the headings a larger, bold font.
            Pango.FontDescription fd = new Pango.FontDescription ();
            fd.Family = "Sans";

            // The following bit is unreliable. See below.
            OperatingSystem os = Environment.OSVersion;
            PlatformID pid = os.Platform;
            switch (pid) {
            case PlatformID.MacOSX:  // Does not work.
                fd.Size = Convert.ToInt32 (16 * Pango.Scale.PangoScale);
                break;
            case PlatformID.Unix:  // Macs lie and say they are Unix.
                fd.Size = Convert.ToInt32 (12 * Pango.Scale.PangoScale);
                break;
            default: // Windows.
                fd.Size = Convert.ToInt32 (12 * Pango.Scale.PangoScale);
                break;
            }
            // Since macs lie, we need to properly determine if we're on a mac.
            // The following method was taken from a question on StackOverflow.
            if (IsRunningOnMac ()) {
                fd.Size = Convert.ToInt32 (16 * Pango.Scale.PangoScale);
            }

            fd.Weight = Pango.Weight.Bold;

            // Set the font on the headings.
            lblFractionalResults.ModifyFont(fd);
            lblInterestOwedParameters.ModifyFont(fd);
            lblInitParams.ModifyFont(fd);
            lblInterestResults.ModifyFont (fd);

            // Set the default values.
            sbInitialDeposit.Value = 1000;
            sbIterations.Value = 10;
            sbReserveRequirement.Value = 0.1f;
            sbWhatCustomersThink.Value = 0;

            cbxCompounded.Active = 1; // Set it to monthly
            sbInterestPeriods.Value = 10; // Set 10 years
            sbInterestRate.Value = 0.05; // Set 5%

            // Info
            LinkButton lb = new LinkButton("Click here for more information and tutorials.");
            lb.Uri = "http://cynic.me/";
            lb.Xalign = 0.5f;
            fixed1.Add (lb);
            lb.Clicked += CynicLinkClicked;
            lb.Show ();

            // Do the initial population of the calculated spin button values.
            DoFractionalMath();
        }
Example #14
0
        //step 4
        private void Photo()
        {
            //ok, let's check if the user can reach this step, or
            //return to the previous

            Validation.Validator v = new Validation.Validator();
            Contact ct = this.TargetMember.InnerContact;
            v.SetRule(ct.Name, "nombre de contacto", 2, 50);
            v.SetRule(ct.PhoneNumber, "teléfono de contacto", 7, 13, Validation.ValidationRule.Number);
            Validation.ValidationResponse r = v.Run();
            if(!r.Status)
            {
                string s = "";
                for(int i = 0; i < r.Messages.Length; s += r.Messages[i++] + "\n");
                GuiHelper.ShowError(s);
                this.Step -= 1;
                return;
            }

            else if(!(string.IsNullOrEmpty(ct.Name) == string.IsNullOrEmpty(ct.PhoneNumber)))
            {
                GuiHelper.ShowError(this, "Si va a proporcionar los datos de contacto, debe proporcionar ambos");
                this.Step -= 1;
                return;
            }

            //ok, if everything is ok, lets ask for the photo :)
            this.Header = "";
            this.ClearContentBox();
            this.Description = "Introduzca opcionalmente una fotografía para identificar al cliente";

            Button img_button = new Button();
            this.ImageButton = img_button;
            img_button.SetSizeRequest(300, 250);
            img_button.Clicked += this.ChoosePicture;

            if(this.TargetMember.BinImage == null)
                this.CleanImage(null, null);
            else
                this.LoadImage();

            Button clean_button = new Button("Quitar");
            clean_button.Relief = ReliefStyle.None;
            clean_button.Clicked += this.CleanImage;

            LinkButton link = new LinkButton("", "O bien, toma una fotografía");
            link.HasTooltip = false;
            link.FocusOnClick = false;
            link.Clicked += this.TakePicture;

            this.PackWidgetSingle(img_button);
            this.PackWidgetPair(clean_button, link);
            this.ContentVBox.ShowAll();
        }
        private bool need_authorization_checked = true; // state for at which button the auth arrows should point

        private void OnPreferencesServiceInstallWidgetAdapters (object sender, EventArgs args)
        {
            if (reporting_preference != null && scrobbler != null) {
                reporting_preference.Value = scrobbler.Enabled;
            }

            if (account_section == null) {
                return;
            }

            var align = new Alignment (0.0f, 0.0f, 1.0f, 1.0f) {
                LeftPadding = 20,
                RightPadding = 20
            };

            sign_in_box = new Table (0, 0, false) {
                ColumnSpacing = 6,
                RowSpacing = 2
            };

            align.Add (sign_in_box);
            align.Show ();

            username_preference.DisplayWidget = align;

            align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f) {
                LeftPadding = 20,
                RightPadding = 20,
                TopPadding = 5
            };

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

            button_box.PackStart (new Badge (source.Account), false, false, 0);

            signup_button = new Gtk.LinkButton (source.Account.SignUpUrl, Catalog.GetString ("Sign up for Last.fm"));
            signup_button.Xalign = 0f;
            button_box.PackStart (signup_button, false, false, 0);

            profile_page_button = new Gtk.LinkButton (String.Empty, Catalog.GetString ("Visit Your Last.fm Profile Page"));
            profile_page_button.Clicked += (o, e) => source.Account.VisitUserProfile (source.Account.UserName);
            profile_page_button.Xalign = 0f;
            button_box.PackStart (profile_page_button, false, false, 0);

            align.Add (button_box);
            align.ShowAll ();

            account_section["lastfm-signup"].DisplayWidget = align;

            GetSignInState ();
            BuildSignIn ();
        }
        void Upload()
        {
            IPhoto [] items = dialog.Items;
            string [] captions = dialog.Captions;
            dialog.StoreCaption ();

            long sent_bytes = 0;

            FilterSet filters = new FilterSet ();
            filters.Add (new JpegFilter ());
            filters.Add (new ResizeFilter ((uint) size));

            for (int i = 0; i < items.Length; i++) {
                try {
                    IPhoto item = items [i];

                    FileInfo file_info;
                    Log.DebugFormat ("uploading {0}", i);

                    progress_dialog.Message = String.Format (Catalog.GetString ("Uploading picture \"{0}\" ({1} of {2})"), item.Name, i + 1, items.Length);
                    progress_dialog.ProgressText = string.Empty;
                    progress_dialog.Fraction = i / (double) items.Length;

                    FilterRequest request = new FilterRequest (item.DefaultVersion.Uri);
                    filters.Convert (request);

                    file_info = new FileInfo (request.Current.LocalPath);

                    album.Upload (captions [i] ?? "", request.Current.LocalPath);

                    sent_bytes += file_info.Length;
                }
                catch (Exception e) {
                    progress_dialog.Message = String.Format (Catalog.GetString ("Error Uploading To Facebook: {0}"), e.Message);
                    progress_dialog.ProgressText = Catalog.GetString ("Error");
                    Log.DebugException (e);

                    if (progress_dialog.PerformRetrySkip ())
                        i--;
                }
            }

            progress_dialog.Message = Catalog.GetString ("Done Sending Photos");
            progress_dialog.Fraction = 1.0;
            progress_dialog.ProgressText = Catalog.GetString ("Upload Complete");
            progress_dialog.ButtonLabel = Gtk.Stock.Ok;

            var li = new LinkButton ("http://www.facebook.com/group.php?gid=158960179844&ref=mf", Catalog.GetString ("Visit F-Spot group on Facebook"));
            progress_dialog.VBoxPackEnd (li);
            li.ShowAll ();
        }
Example #17
0
        // The page shown when the setup has been completed
        private void ShowCompletedPage()
        {
            Reset ();

                VBox layout_vertical = new VBox (false, 0);

                Label header = new Label ("<span size='x-large'><b>" +
                                                _("SparkleShare is ready to go!") +
                                                "</b></span>") {
                    UseMarkup = true,
                    Xalign = 0
                };

                Label information = new Label (_("Now you can start accepting invitations from others. " + "\n" +
                                                 "Just click on invitations you get by email and " +
                                                 "we will take care of the rest.")) {
                    UseMarkup = true,
                    Wrap      = true,
                    Xalign    = 0
                };

                HBox link_wrapper = new HBox (false, 0);
                LinkButton link = new LinkButton ("http://www.sparkleshare.org/",
                    _("Learn how to host your own SparkleServer"));

                link_wrapper.PackStart (link, false, false, 0);

                layout_vertical.PackStart (header, false, false, 0);
                layout_vertical.PackStart (information, false, false, 21);
                layout_vertical.PackStart (link_wrapper, false, false, 0);

                    Button finish_button = new Button (_("Finish"));

                    finish_button.Clicked += delegate (object o, EventArgs args) {

                        Destroy ();

                    };

                AddButton (finish_button);

            Add (layout_vertical);

            ShowAll ();
        }
Example #18
0
        // loads the feed into the popup
        private void loadFeed(Feed feed)
        {
            page_number = 0;
            unread_items.Clear ();

            //find all the unread items
            foreach (Item item in feed.Items)
                if (item.IsNew)
                    unread_items.Add (item);

            //create the links to be used in the popup
            links = new LinkButton[unread_items.Count];

            for (int i=0; i<unread_items.Count; i++)
            {
                Item item = unread_items[i];

                links[i] = new LinkButton (item.Url, item.Title);
                links[i].Xalign = 0;
                links[i].EnterNotifyEvent += button_enter;
                links[i].LeaveNotifyEvent += button_leave;

                //the link has been clicked
                links[i].Clicked += delegate (object o, EventArgs args) {
                    parent.News.NewsViewer.LoadItem (item, feed);
                    feed.UpdateStatus ();
                    unread.Markup = feed.UnreadStatus;
                    parent.News.NewsTree.QueueDraw ();
                };
            }

            //get the amount of pages
            if (unread_items.Count > 0)
            {
                double item_count = (double) unread_items.Count;
                double show_count = (double) show_total+1;
                page_count = (int) Math.Ceiling (item_count / show_count);
            }
            else
                page_count = 0;

            //update the feed details
            title.Markup = Utils.ParseMarkup (feed.Name);
            unread.Markup = feed.UnreadStatus;
            refreshFeed ();

            //create the items
            generateItems ();
        }