Example #1
0
 void HandleChangeButtonClicked(object sender, EventArgs e)
 {
     headerBox.Hide();
     mailEntry.Show();
     mailEntry.GrabFocus();
 }
Example #2
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);
        }
Example #3
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);
		}