Beispiel #1
0
        private void OnGroupRowChanged(object sender, RowChangedArgs args)
        {
            PersonGroup group =
                groupTreeModel.GetValue(args.Iter, 0) as PersonGroup;

            if (group == null)
            {
                return;
            }

            if (groupButtonMap.ContainsKey(args.Path.Indices [0]) == false)
            {
                Logger.Debug("GroupWindow.OnGroupRowChanged () called on a path we don't know about, adding it now.");
                AddGroupButton(new GroupButton(group), args.Path);
                return;
            }

            GroupButton groupButton = groupButtonMap [args.Path.Indices [0]];

            Logger.Debug("GroupWindow.OnGroupRowChanged updating group: {0} -> {1}",
                         groupButton.PersonGroup.DisplayName,
                         group.DisplayName);

            // Update the button's PersonGroup.  It'll do the work of updating the label.
            groupButton.PersonGroup = group;
        }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        private void BuildGroupButtonsView()
        {
            TreeIter iter;

            Logger.Debug("GroupWindow.BuildGroupButtonsView adding {0} groups",
                         groupTreeModel.IterNChildren());

            // Loop through the model, create buttons, and add them into the
            // groupButtonsVBox.
            if (groupTreeModel.GetIterFirst(out iter))
            {
                do
                {
                    PersonGroup group =
                        groupTreeModel.GetValue(iter, 0) as PersonGroup;
                    if (group == null)
                    {
                        continue;
                    }

                    AddGroupButton(new GroupButton(group),
                                   groupTreeModel.GetPath(iter));
                } while (groupTreeModel.IterNext(ref iter));
            }
        }
Beispiel #4
0
        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();
        }
Beispiel #5
0
        private void SelectEveryoneGroup()
        {
            Title         = Catalog.GetString("Everyone - Banter");
            selectedGroup = null;

            personView.Model = PersonManager.People;

            QueueSaveState();
        }
Beispiel #6
0
        /// <summary>
        /// Add a PersonGroup to the Store
        /// </summary>
        public static bool AddGroup(PersonGroup group)
        {
//			if(PersonManager.Instance.systemBook.AddContact(group.EDSContact)) {
            // if they added, then add the person to our tables to find them
            Gtk.TreeIter iter = PersonManager.Instance.groupTreeStore.AppendValues(group);
            PersonManager.Instance.groupIters[group.Id] = iter;
            return(true);
//			}
//			return false;
        }
Beispiel #7
0
        /// <summary>
        /// Store the changes to a Person to the Store
        /// </summary>

/*		public static bool CommitPerson(Person person)
 *              {
 *                      return PersonManager.Instance.systemBook.CommitContact(person.EDSContact);
 *              }
 */

        /// <summary>
        /// Remove the Person from the store by Id
        /// </summary>

/*		public static bool RemovePerson(string Id)
 *              {
 *                      return PersonManager.Instance.systemBook.RemoveContact(Id);
 *              }
 */

        /// <summary>
        /// Gets the PersonGroup object for a given Id
        /// </summary>
        public static PersonGroup GetGroup(string groupId)
        {
            PersonGroup group = null;

            if (PersonManager.Instance.groupIters.ContainsKey(groupId))
            {
                Gtk.TreeIter iter = PersonManager.Instance.groupIters[groupId];
                group = (PersonGroup)PersonManager.Instance.groupTreeStore.GetValue(iter, 0);
            }
            return(group);
        }
Beispiel #8
0
        private void OnGroupRowInserted(object sender, RowInsertedArgs args)
        {
            PersonGroup group =
                groupTreeModel.GetValue(args.Iter, 0) as PersonGroup;

            if (group == null)
            {
                return;
            }

            AddGroupButton(new GroupButton(group),
                           groupTreeModel.GetPath(args.Iter));
        }
Beispiel #9
0
        private void OnGroupButtonClicked(GroupButton sender, PersonGroup group)
        {
            // Update the window title
            Title = string.Format(
                Catalog.GetString("{0} - Banter"),
                group.DisplayName);

            // Update the PersonView
            personView.Model = group.People;

            selectedGroup = group;

            QueueSaveState();
        }
Beispiel #10
0
        public GroupButton(PersonGroup personGroup)
        {
            group = personGroup;

            HBox hbox;

            hbox = new HBox (false, 0);
            label = new Label (group.DisplayName);
            label.Xalign = 0;
            label.UseUnderline = false;
            label.UseMarkup = true;
            label.Show ();
            hbox.PackStart (label, false, false, 4);
            this.Relief = ReliefStyle.None;
            Add (hbox);
        }
Beispiel #11
0
        public GroupButton(PersonGroup personGroup)
        {
            group = personGroup;

            HBox hbox;

            hbox               = new HBox(false, 0);
            label              = new Label(group.DisplayName);
            label.Xalign       = 0;
            label.UseUnderline = false;
            label.UseMarkup    = true;
            label.Show();
            hbox.PackStart(label, false, false, 4);
            this.Relief = ReliefStyle.None;
            Add(hbox);
        }
Beispiel #12
0
 /// <summary>
 /// Add a PersonGroup to the Store
 /// </summary>	
 public static bool AddGroup(PersonGroup group)
 {
     //			if(PersonManager.Instance.systemBook.AddContact(group.EDSContact)) {
         // if they added, then add the person to our tables to find them
         Gtk.TreeIter iter = PersonManager.Instance.groupTreeStore.AppendValues(group);
         PersonManager.Instance.groupIters[group.Id] = iter;
         return true;
     //			}
     //			return false;
 }
Beispiel #13
0
        private void OnRealizeWidget(object sender, EventArgs args)
        {
            // Set "my" display name
            Person me = PersonManager.Me;

            if (me != null)
            {
                myDisplayName.Markup =
                    string.Format(
                        "<span weight=\"bold\" size=\"small\">{0}</span>",
                        me.DisplayName);

                // Set "my" status
                statusEntry.Presence = me.Presence;

                Logger.Debug("FIXME: Populate the StatusEntry widget with saved status messages.");

                if (me.Photo != null)
                {
                    avatarSelector.Pixbuf = me.Photo;
                }

                me.PresenceUpdated += OnMyPresenceUpdated;
            }
            else
            {
                PersonManager.Instance.PersonMeArrived += PersonMeArrivedHandler;
            }

            // Fill out the existing groups
            BuildGroupButtonsView();

            groupTreeModel.RowInserted += OnGroupRowInserted;
            groupTreeModel.RowDeleted  += OnGroupRowDeleted;
            groupTreeModel.RowChanged  += OnGroupRowChanged;

            personHScale.Value = (double)initialPersonCardSize;

            if (!initiallyShowSidebar)
            {
                sidebar.Hide();
                toggleSidebarButton.Label = Catalog.GetString("Show Sidebar");
            }

            // Set the view to the proper group

            if (string.Compare(initialGroupId, "0") == 0)
            {
                SelectEveryoneGroup();
            }
            else
            {
                foreach (GroupButton groupButton in groupButtonMap.Values)
                {
                    PersonGroup group = groupButton.PersonGroup;
                    if (string.Compare(group.Id, initialGroupId) == 0)
                    {
                        OnGroupButtonClicked(groupButton, group);
                        break;
                    }
                }
            }

            ConfigureEvent += OnConfigureEvent;

            // Cause brand new windows to be saved.  Previously existing windows
            // will be ignored unless the user moves them.
            SaveState();

            //Gnome.Sound.Play(System.IO.Path.Combine(Banter.Defines.SoundDir, "banter.wav"));
        }
Beispiel #14
0
        private void OnGroupButtonClicked(GroupButton sender, PersonGroup group)
        {
            // Update the window title
            Title = string.Format (
                    Catalog.GetString ("{0} - Banter"),
                    group.DisplayName);

            // Update the PersonView
            personView.Model = group.People;

            selectedGroup = group;

            QueueSaveState ();
        }
Beispiel #15
0
        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);
                }
            }
        }
Beispiel #16
0
        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 ();
        }
Beispiel #17
0
        private void SelectEveryoneGroup()
        {
            Title = Catalog.GetString ("Everyone - Banter");
            selectedGroup = null;

            personView.Model = PersonManager.People;

            QueueSaveState ();
        }