private void OnNewGroupClicked(object sender, EventArgs args) { HIGMessageDialog dialog = new HIGMessageDialog(this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.OkCancel, Catalog.GetString("Banter - New group window"), Catalog.GetString("Add new group"), Catalog.GetString("Enter the name of the new group you'd like to create.")); Gtk.Entry groupNameEntry = new Entry(); groupNameEntry.ActivatesDefault = true; dialog.ExtraWidget = groupNameEntry; int returnCode = dialog.Run(); if (returnCode == (int)Gtk.ResponseType.Ok) { string groupName = groupNameEntry.Text.Trim(); if (groupName.Length > 0) { try { PersonGroup group = new PersonGroup(groupName); PersonManager.AddGroup(group); } catch (Exception e) { Logger.Debug("Couldn't create a group: {0}\n{1}\n{2}", groupName, e.Message, e.StackTrace); } } } dialog.Destroy(); }
private void OnGroupButtonRightClicked(GroupButton sender, PersonGroup group) { HIGMessageDialog dialog = new HIGMessageDialog( this, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.YesNo, Catalog.GetString("Banter - Delete Group"), string.Format( Catalog.GetString("Delete \"{0}\"?"), group.DisplayName), Catalog.GetString("This will delete the group and not the contacts inside of the group.")); int responseType = dialog.Run(); dialog.Destroy(); if (responseType == (int)ResponseType.Yes) { try { PersonManager.RemoveGroup(group.Id); } catch (Exception e) { Logger.Warn("Error removing the group: {0}\n{1}\n{2}", group.DisplayName, e.Message, e.StackTrace); } } }
private void OnAddPersonClicked(object sender, EventArgs args) { HIGMessageDialog dialog = new HIGMessageDialog(this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.OkCancel, Catalog.GetString("Banter - Add person"), Catalog.GetString("Invite a new person"), Catalog.GetString("Enter the email address of the person you'd like to add.")); Gtk.Entry emailEntry = new Entry(); emailEntry.ActivatesDefault = true; dialog.ExtraWidget = emailEntry; int returnCode = dialog.Run(); if (returnCode == (int)Gtk.ResponseType.Ok) { string emailAddress = emailEntry.Text.Trim(); // do stuff to add the new person Account account = null; foreach (Account acc in AccountManagement.GetAccounts()) { account = acc; break; } if (account != null) { account.InviteUser(emailAddress); } //Logger.Debug("FIXME: Add code to invite the person {0}", emailAddress); } dialog.Destroy(); }
private void OnNewGroupClicked(object sender, EventArgs args) { HIGMessageDialog dialog = new HIGMessageDialog (this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.OkCancel, Catalog.GetString ("Banter - New group window"), Catalog.GetString ("Add new group"), Catalog.GetString ("Enter the name of the new group you'd like to create.")); Gtk.Entry groupNameEntry = new Entry (); groupNameEntry.ActivatesDefault = true; dialog.ExtraWidget = groupNameEntry; int returnCode = dialog.Run (); if (returnCode == (int) Gtk.ResponseType.Ok) { string groupName = groupNameEntry.Text.Trim (); if (groupName.Length > 0) { try { PersonGroup group = new PersonGroup (groupName); PersonManager.AddGroup (group); } catch (Exception e) { Logger.Debug ("Couldn't create a group: {0}\n{1}\n{2}", groupName, e.Message, e.StackTrace); } } } dialog.Destroy (); }
private void OnGroupButtonRightClicked(GroupButton sender, PersonGroup group) { HIGMessageDialog dialog = new HIGMessageDialog ( this, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.YesNo, Catalog.GetString("Banter - Delete Group"), string.Format ( Catalog.GetString ("Delete \"{0}\"?"), group.DisplayName), Catalog.GetString ("This will delete the group and not the contacts inside of the group.")); int responseType = dialog.Run (); dialog.Destroy (); if (responseType == (int) ResponseType.Yes) { try { PersonManager.RemoveGroup (group.Id); } catch (Exception e) { Logger.Warn ("Error removing the group: {0}\n{1}\n{2}", group.DisplayName, e.Message, e.StackTrace); } } }
private void OnAddPersonClicked(object sender, EventArgs args) { HIGMessageDialog dialog = new HIGMessageDialog (this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.OkCancel, Catalog.GetString ("Banter - Add person"), Catalog.GetString ("Invite a new person"), Catalog.GetString ("Enter the email address of the person you'd like to add.")); Gtk.Entry emailEntry = new Entry (); emailEntry.ActivatesDefault = true; dialog.ExtraWidget = emailEntry; int returnCode = dialog.Run (); if (returnCode == (int) Gtk.ResponseType.Ok) { string emailAddress = emailEntry.Text.Trim (); // do stuff to add the new person Account account = null; foreach (Account acc in AccountManagement.GetAccounts()) { account = acc; break; } if (account != null) account.InviteUser (emailAddress); //Logger.Debug("FIXME: Add code to invite the person {0}", emailAddress); } dialog.Destroy (); }