Exemple #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;
        }
Exemple #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);
                }
            }
        }
Exemple #3
0
        private void OnGroupRowDeleted(object sender, RowDeletedArgs args)
        {
            if (groupButtonMap.ContainsKey(args.Path.Indices [0]) == false)
            {
                Logger.Debug("GroupWindow.OnGroupRowDeleted () called on a path we don't know about.");
                return;
            }

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

            Logger.Debug("GroupWindow.OnGroupRowDeleted removing group: {0}", groupButton.PersonGroup.DisplayName);

            groupButtonMap.Remove(args.Path.Indices [0]);

            groupButtonsVBox.Remove(groupButton);

            // If this is the currently selected group, switch the view
            // back to the Everyone group so that there aren't weirdnesses.
            if (selectedGroup == groupButton.PersonGroup)
            {
                OnEveryoneClicked(this, EventArgs.Empty);
            }

            // FIXME: Determine whether we should be calling groupButton.Destroy () here.
            groupButton.Destroy();
        }
Exemple #4
0
 private void AddGroupButton(GroupButton button, TreePath path)
 {
     Logger.Debug("Adding group button: {0}", button.PersonGroup.DisplayName);
     button.Show();
     button.Clicked      += OnGroupButtonClicked;
     button.RightClicked += OnGroupButtonRightClicked;
     groupButtonsVBox.PackStart(button, false, false, 0);
     groupButtonMap [path.Indices [0]] = button;
 }
Exemple #5
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();
        }
Exemple #6
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);
                }
            }
        }
Exemple #7
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 ();
        }
Exemple #8
0
 private void AddGroupButton(GroupButton button, TreePath path)
 {
     Logger.Debug ("Adding group button: {0}", button.PersonGroup.DisplayName);
     button.Show ();
     button.Clicked += OnGroupButtonClicked;
     button.RightClicked += OnGroupButtonRightClicked;
     groupButtonsVBox.PackStart (button, false, false, 0);
     groupButtonMap [path.Indices [0]] = button;
 }