Ejemplo n.º 1
0
 public void disappear()
 {
     custom_image.Hide();
     custom_label.Hide();
     dec_width = width;
     GLib.Timeout.Add(2, decreassing_size);
 }
Ejemplo n.º 2
0
		public CreateNotebookDialog(Gtk.Window parent,
									Gtk.DialogFlags flags)
				: base (parent, flags, Gtk.MessageType.Info,
						Gtk.ButtonsType.None,
						Catalog.GetString ("Create a new notebook"),
						Catalog.GetString ("Type the name of the notebook you'd like to create."))
		{
			this.Pixbuf = newNotebookIconDialog;
			
			Gtk.Table table = new Gtk.Table (2, 2, false);
			
			Gtk.Label label = new Gtk.Label (Catalog.GetString ("N_otebook name:"));
			label.Xalign = 0;
			label.UseUnderline = true;
			label.Show ();
			
			nameEntry = new Gtk.Entry ();
			nameEntry.Changed += OnNameEntryChanged;
			nameEntry.ActivatesDefault = true;
			nameEntry.Show ();
			label.MnemonicWidget = nameEntry;
			
			errorLabel = new Gtk.Label ();
			errorLabel.Xalign = 0;
			errorLabel.Markup = string.Format("<span foreground='red' style='italic'>{0}</span>",
			                                  Catalog.GetString ("Name already taken"));
			
			table.Attach (label, 0, 1, 0, 1);
			table.Attach (nameEntry, 1, 2, 0, 1);
			table.Attach (errorLabel, 1, 2, 1, 2);
			table.Show ();
			
			ExtraWidget = table;
			
			AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
			AddButton (
				newNotebookIcon,
				// Translation note: This is the Create button in the Create
				// New Note Dialog.
				Catalog.GetString ("C_reate"),
				Gtk.ResponseType.Ok,
				true);
			
			// Only let the Ok response be sensitive when
			// there's something in nameEntry
			SetResponseSensitive (Gtk.ResponseType.Ok, false);
			errorLabel.Hide ();
		}
Ejemplo n.º 3
0
        public CreateNotebookDialog(Gtk.Window parent,
                                    Gtk.DialogFlags flags)
            : base(parent, flags, Gtk.MessageType.Info,
                   Gtk.ButtonsType.None,
                   Catalog.GetString("Create a new notebook"),
                   Catalog.GetString("Type the name of the notebook you'd like to create."))
        {
            this.Pixbuf = newNotebookIconDialog;

            Gtk.Table table = new Gtk.Table(2, 2, false);

            Gtk.Label label = new Gtk.Label(Catalog.GetString("N_otebook name:"));
            label.Xalign       = 0;
            label.UseUnderline = true;
            label.Show();

            nameEntry                  = new Gtk.Entry();
            nameEntry.Changed         += OnNameEntryChanged;
            nameEntry.ActivatesDefault = true;
            nameEntry.Show();
            label.MnemonicWidget = nameEntry;

            errorLabel        = new Gtk.Label();
            errorLabel.Xalign = 0;
            errorLabel.Markup = string.Format("<span foreground='red' style='italic'>{0}</span>",
                                              Catalog.GetString("Name already taken"));

            table.Attach(label, 0, 1, 0, 1);
            table.Attach(nameEntry, 1, 2, 0, 1);
            table.Attach(errorLabel, 1, 2, 1, 2);
            table.Show();

            ExtraWidget = table;

            AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
            AddButton(
                newNotebookIcon,
                // Translation note: This is the Create button in the Create
                // New Note Dialog.
                Catalog.GetString("C_reate"),
                Gtk.ResponseType.Ok,
                true);

            // Only let the Ok response be sensitive when
            // there's something in nameEntry
            SetResponseSensitive(Gtk.ResponseType.Ok, false);
            errorLabel.Hide();
        }
Ejemplo n.º 4
0
        void HandleSendButtonClicked(object sender, EventArgs e)
        {
            string email = mailEntry.Text;

            if (!ValidateEmail(email))
            {
                mailWarningLabel.Show();
                mailEntry.GrabFocus();
                return;
            }
            mailWarningLabel.Hide();

            if (textEntry.Buffer.Text.Length == 0)
            {
                bodyWarningLabel.Show();
                textEntry.GrabFocus();
                return;
            }

            FeedbackService.SendFeedback(email, textEntry.Buffer.Text);

            mainFrame.Remove(mainBox);
            mainBox.Destroy();

            Gtk.VBox box = new Gtk.VBox(false, 18);
            box.PackStart(new Gtk.Label(), true, true, 0); // Filler
            string txt = "<big>" + GettextCatalog.GetString("Thank you for your feedback!") + "</big>";

            Gtk.Label lab = new Gtk.Label();
            lab.Markup = txt;
            box.PackStart(lab, false, false, 0);

            lab = new Gtk.Label(GettextCatalog.GetString("Feedbacks sent: {0}", FeedbackService.FeedbacksSent));
            box.PackStart(lab, false, false, 0);

            box.PackStart(new Gtk.Label(), true, true, 0); // Filler
            box.ShowAll();

            mainFrame.Add(box);
            GLib.Timeout.Add(1000, delegate
            {
                Close();
                return(false);
            });
            sent = true;
        }
Ejemplo n.º 5
0
        // Enable the Ok response only if there's text in the nameEntry
        // and the Notebook's name hasn't already been taken
        private void OnNameEntryChanged(object sender, EventArgs args)
        {
            bool nameTaken = false;

            if (Notebooks.NotebookManager.NotebookExists(NotebookName))
            {
                errorLabel.Show();
                nameTaken = true;
            }
            else
            {
                errorLabel.Hide();
            }

            SetResponseSensitive(
                Gtk.ResponseType.Ok,
                NotebookName == string.Empty || nameTaken ? false : true);
        }
Ejemplo n.º 6
0
        public AnimatedButton(string label, bool from_zero)
        {
            custom_hbox  = new Gtk.HBox();
            custom_label = new Gtk.Label(label);

            custom_label.LineWrap      = true;
            custom_label.LineWrapMode  = Pango.WrapMode.Word;
            custom_label.MaxWidthChars = 30;

            custom_image        = new Gtk.Image();
            custom_image.Pixbuf = Gdk.Pixbuf.LoadFromResource("llum.arrow.svg");

            custom_hbox.PackStart(custom_image, false, false, 5);
            custom_hbox.PackStart(custom_label, false, false, 5);



            custom_hbox.ShowAll();
            custom_image.Hide();
            custom_label.Hide();

            this.Add(custom_hbox);



            height    = 50;
            width     = 150;
            dec_width = width;

            this.Show();

            if (!from_zero)
            {
                this.SetSizeRequest(width, height);
            }
            else
            {
                appear();
            }
        }
Ejemplo n.º 7
0
        public FeedbackDialog(int x, int y) : base(Gtk.WindowType.Toplevel)
        {
            SetDefaultSize(350, 200);
            if (x == -1 && y == -1)
            {
                int ww, wh;
                IdeApp.Workbench.RootWindow.GdkWindow.GetSize(out ww, out wh);
                IdeApp.Workbench.RootWindow.GdkWindow.GetOrigin(out x, out y);
                x = ww / 2 - 350 / 2;
                y = wh / 2 - 200 / 2;
                Move(x, y);
            }
            else
            {
                Move(x - 350, y - 200);
            }

            mainFrame = new Gtk.Frame();

            mainBox                = new Gtk.VBox();
            mainBox.BorderWidth    = 12;
            mainBox.Spacing        = 6;
            headerBox              = new Gtk.HBox();
            mailEntry              = new EntryWithEmptyMessage();
            mailEntry.EmptyMessage = GettextCatalog.GetString("email address");
            Decorated              = false;
            mainFrame.ShadowType   = Gtk.ShadowType.Out;

            // Header

            headerBox.Spacing = 6;
            mailLabel         = new Gtk.Label();
            headerBox.PackStart(mailLabel, false, false, 0);
            Gtk.Button changeButton = new Gtk.Button("(Change)");
            changeButton.Relief = Gtk.ReliefStyle.None;
            headerBox.PackStart(changeButton, false, false, 0);
            changeButton.Clicked += HandleChangeButtonClicked;
            mainBox.PackStart(headerBox, false, false, 0);
            mainBox.PackStart(mailEntry, false, false, 0);
            mailWarningLabel        = new Gtk.Label(GettextCatalog.GetString("Please enter a valid e-mail address"));
            mailWarningLabel.Xalign = 0;
            mainBox.PackStart(mailWarningLabel, false, false, 0);

            // Body

            textEntry = new TextViewWithEmptyMessage();
            textEntry.EmptyMessage = GettextCatalog.GetString(
                "Tell us how we can make {0} better.",
                BrandingService.SuiteName
                );
            textEntry.AcceptsTab   = false;
            textEntry.WrapMode     = Gtk.WrapMode.Word;
            textEntry.WidthRequest = 300;
            var sw = new Gtk.ScrolledWindow();

            sw.ShadowType       = Gtk.ShadowType.In;
            sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.Add(textEntry);
            mainBox.PackStart(sw, true, true, 0);
            bodyWarningLabel        = new Gtk.Label(GettextCatalog.GetString("Please enter some feedback"));
            bodyWarningLabel.Xalign = 0;
            mainBox.PackStart(bodyWarningLabel, false, false, 0);

            // Bottom

            Gtk.HBox  bottomBox  = new Gtk.HBox(false, 6);
            Gtk.Label countLabel = new Gtk.Label();
            countLabel.Xalign = 0;
            bottomBox.PackStart(countLabel, false, false, 0);

            Gtk.Button sendButton = new Gtk.Button(GettextCatalog.GetString("Send Feedback"));
            sendButton.Clicked += HandleSendButtonClicked;
            bottomBox.PackEnd(sendButton, false, false, 0);
            mainBox.PackStart(bottomBox, false, false, 0);

            // Init

            mainBox.ShowAll();

            mailWarningLabel.Hide();
            bodyWarningLabel.Hide();

            string mail = FeedbackService.ReporterEMail;

            if (string.IsNullOrEmpty(mail))
            {
                mail = AuthorInformation.Default.Email;
            }

            if (string.IsNullOrEmpty(mail))
            {
                headerBox.Hide();
                mailEntry.GrabFocus();
            }
            else
            {
                mailEntry.Text = mail;
                mailEntry.Hide();
                mailLabel.Text = GettextCatalog.GetString("From: {0}", mail);
                textEntry.GrabFocus();
            }
            if (FeedbackService.FeedbacksSent > 0)
            {
                countLabel.Text = GettextCatalog.GetString("Your feedbacks: {0}", FeedbackService.FeedbacksSent);
            }
            else
            {
                countLabel.Hide();
            }

            mainFrame.Show();
            mainFrame.Add(mainBox);
            Add(mainFrame);
        }
Ejemplo n.º 8
0
		public FeedbackDialog (int x, int y): base (Gtk.WindowType.Toplevel)
		{
			SetDefaultSize (350, 200);
			if (x == -1 && y == -1) {
				int ww, wh;
				IdeApp.Workbench.RootWindow.GdkWindow.GetSize (out ww, out wh);
				IdeApp.Workbench.RootWindow.GdkWindow.GetOrigin (out x, out y);
				x = ww / 2 - 350 / 2;
				y = wh / 2 - 200 / 2;
				Move (x, y);
			} else
				Move (x - 350, y - 200);

			mainFrame = new Gtk.Frame ();
			
			mainBox = new Gtk.VBox ();
			mainBox.BorderWidth = 12;
			mainBox.Spacing = 6;
			headerBox = new Gtk.HBox ();
			mailEntry = new EntryWithEmptyMessage ();
			mailEntry.EmptyMessage = GettextCatalog.GetString ("email address");
			Decorated = false;
			mainFrame.ShadowType = Gtk.ShadowType.Out;
			
			// Header
			
			headerBox.Spacing = 6;
			mailLabel = new Gtk.Label ();
			headerBox.PackStart (mailLabel, false, false, 0);
			Gtk.Button changeButton = new Gtk.Button ("(Change)");
			changeButton.Relief = Gtk.ReliefStyle.None;
			headerBox.PackStart (changeButton, false, false, 0);
			changeButton.Clicked += HandleChangeButtonClicked;
			mainBox.PackStart (headerBox, false, false, 0);
			mainBox.PackStart (mailEntry, false, false, 0);
			mailWarningLabel = new Gtk.Label (GettextCatalog.GetString ("Please enter a valid e-mail address"));
			mailWarningLabel.Xalign = 0;
			mainBox.PackStart (mailWarningLabel, false, false, 0);
			
			// Body
			
			textEntry = new TextViewWithEmptyMessage ();
			textEntry.EmptyMessage = GettextCatalog.GetString (
				"Tell us how we can make {0} better.",
				BrandingService.SuiteName
			);
			textEntry.AcceptsTab = false;
			textEntry.WrapMode = Gtk.WrapMode.Word;
			textEntry.WidthRequest = 300;
			var sw = new Gtk.ScrolledWindow ();
			sw.ShadowType = Gtk.ShadowType.In;
			sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.HscrollbarPolicy = Gtk.PolicyType.Never;
			sw.Add (textEntry);
			mainBox.PackStart (sw, true, true, 0);
			bodyWarningLabel = new Gtk.Label (GettextCatalog.GetString ("Please enter some feedback"));
			bodyWarningLabel.Xalign = 0;
			mainBox.PackStart (bodyWarningLabel, false, false, 0);
			
			// Bottom
			
			Gtk.HBox bottomBox = new Gtk.HBox (false, 6);
			Gtk.Label countLabel = new Gtk.Label ();
			countLabel.Xalign = 0;
			bottomBox.PackStart (countLabel, false, false, 0);
			
			Gtk.Button sendButton = new Gtk.Button (GettextCatalog.GetString ("Send Feedback"));
			sendButton.Clicked += HandleSendButtonClicked;
			bottomBox.PackEnd (sendButton, false, false, 0);
			mainBox.PackStart (bottomBox, false, false, 0);
			
			// Init
			
			mainBox.ShowAll ();
			
			mailWarningLabel.Hide ();
			bodyWarningLabel.Hide ();
			
			string mail = FeedbackService.ReporterEMail;
			if (string.IsNullOrEmpty (mail))
				mail = AuthorInformation.Default.Email;
			
			if (string.IsNullOrEmpty (mail)) {
				headerBox.Hide ();
				mailEntry.GrabFocus ();
			}
			else {
				mailEntry.Text = mail;
				mailEntry.Hide ();
				mailLabel.Text = GettextCatalog.GetString ("From: {0}", mail);
				textEntry.GrabFocus ();
			}
			if (FeedbackService.FeedbacksSent > 0)
				countLabel.Text = GettextCatalog.GetString ("Your feedbacks: {0}", FeedbackService.FeedbacksSent);
			else
				countLabel.Hide ();
			
			mainFrame.Show ();
			mainFrame.Add (mainBox);
			Add (mainFrame);
		}