void on_okButton_clicked(object o, EventArgs args) { if (Core.Settings.KeyEncrypted && !Core.Settings.CheckKeyPassword(oldPasswordEntry.Text)) { Gui.ShowErrorDialog("Old password incorrect"); oldPasswordEntry.GrabFocus(); return; } if (newPasswordEntry.Text != confirmPasswordEntry.Text) { Gui.ShowErrorDialog("New passwords do not match"); newPasswordEntry.GrabFocus(); return; } if (newPasswordEntry.Text == String.Empty) { var dialog = new Gtk.MessageDialog(base.Window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, "Are you sure you don't want to set a password?"); dialog.Show(); int r = dialog.Run(); dialog.Destroy(); if (r != (int)Gtk.ResponseType.Yes) { return; } } Core.Settings.ChangeKeyPassword(newPasswordEntry.Text); if (!Core.Settings.FirstRun) { Gui.ShowMessageDialog("Your password has been changed."); } Dialog.Respond(Gtk.ResponseType.Ok); }
void AddClicked(object sender, EventArgs args) { Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog( Catalog.GetString("Select an icon..."), null, Gtk.FileChooserAction.Open, new object[] {}); dialog.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dialog.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); dialog.DefaultResponse = Gtk.ResponseType.Ok; dialog.LocalOnly = true; dialog.SetCurrentFolder(last_opened_dir); Gtk.FileFilter filter = new Gtk.FileFilter(); filter.AddPixbufFormats(); dialog.Filter = filter; // Extra Widget Gtk.Label l = new Gtk.Label(Catalog.GetString("_Host name:")); Gtk.Entry host_entry = new Gtk.Entry(); l.MnemonicWidget = host_entry; Gtk.HBox hbox = new Gtk.HBox(false, 6); hbox.PackStart(l, false, false, 0); hbox.PackStart(host_entry, true, true, 0); hbox.ShowAll(); dialog.ExtraWidget = hbox; int response; string icon_file; string host; run_add_dialog: response = dialog.Run(); icon_file = dialog.Filename; host = host_entry.Text.Trim(); if (response == (int)Gtk.ResponseType.Ok && host == String.Empty) { // Let the user know that they // have to specify a host name. HIGMessageDialog warn = new HIGMessageDialog( null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, Catalog.GetString("No host name specified"), Catalog.GetString("You must specify the Bugzilla " + "host name to use with this icon.")); warn.Run(); warn.Destroy(); host_entry.GrabFocus(); goto run_add_dialog; } else if (response != (int)Gtk.ResponseType.Ok) { dialog.Destroy(); return; } // Keep track of the last directory the user had open last_opened_dir = dialog.CurrentFolder; dialog.Destroy(); // Copy the file to the BugzillaIcons directory string err_msg; if (!CopyToBugizllaIconsDir(icon_file, host, out err_msg)) { HIGMessageDialog err = new HIGMessageDialog( null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error saving icon"), Catalog.GetString("Could not save the icon file.") + " " + err_msg); err.Run(); err.Destroy(); } UpdateIconStore(); }
public override void SetFocus() { base.SetFocus(); TextEntry.GrabFocus(); }
void AddClicked (object sender, EventArgs args) { Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ( Catalog.GetString ("Select an icon..."), null, Gtk.FileChooserAction.Open, new object[] {}); dialog.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dialog.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok); dialog.DefaultResponse = Gtk.ResponseType.Ok; dialog.LocalOnly = true; dialog.SetCurrentFolder (last_opened_dir); Gtk.FileFilter filter = new Gtk.FileFilter (); filter.AddPixbufFormats (); dialog.Filter = filter; // Extra Widget Gtk.Label l = new Gtk.Label (Catalog.GetString ("_Host name:")); Gtk.Entry host_entry = new Gtk.Entry (); l.MnemonicWidget = host_entry; Gtk.HBox hbox = new Gtk.HBox (false, 6); hbox.PackStart (l, false, false, 0); hbox.PackStart (host_entry, true, true, 0); hbox.ShowAll (); dialog.ExtraWidget = hbox; int response; string icon_file; string host; run_add_dialog: response = dialog.Run (); icon_file = dialog.Filename; host = host_entry.Text.Trim (); if (response == (int) Gtk.ResponseType.Ok && host == String.Empty) { // Let the user know that they // have to specify a host name. HIGMessageDialog warn = new HIGMessageDialog ( null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, Catalog.GetString ("No host name specified"), Catalog.GetString ("You must specify the Bugzilla " + "host name to use with this icon.")); warn.Run (); warn.Destroy (); host_entry.GrabFocus (); goto run_add_dialog; } else if (response != (int) Gtk.ResponseType.Ok) { dialog.Destroy (); return; } // Keep track of the last directory the user had open last_opened_dir = dialog.CurrentFolder; dialog.Destroy (); // Copy the file to the BugzillaIcons directory string err_msg; if (!CopyToBugizllaIconsDir (icon_file, host, out err_msg)) { HIGMessageDialog err = new HIGMessageDialog ( null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Error saving icon"), Catalog.GetString ("Could not save the icon file.") + " " + err_msg); err.Run (); err.Destroy (); } UpdateIconStore (); }