public void ShareWithContact(Contact c) { if( (!collection.Domain.Equals(Domain.WorkGroupDomainID)) && ( (c.UserID == null) || (c.UserID.Length == 0) ) ) { MessageDialog md = new MessageDialog( (Gtk.Window) SharingVBox.Toplevel, DialogFlags.DestroyWithParent | DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Unable to share with the following incomplete user:\n\n" + c.FN); md.Run(); md.Hide(); return; } try { Subscription sub = pobox.CreateSubscription(collection, collection.GetCurrentMember(), "iFolder"); sub.SubscriptionRights = Access.Rights.ReadWrite; sub.ToName = c.FN; if(collection.Domain.Equals(Domain.WorkGroupDomainID)) { sub.FromAddress = String.Format("{0}@{1}", System.Environment.UserName, Simias.MyDns.GetHostName()); sub.ToAddress = c.EMail; sub.ToIdentity = c.UserID; } else { sub.ToIdentity = c.UserID; } pobox.AddMessage(sub); SharingListHolder slh = new SharingListHolder(null, sub); ContactTreeStore.AppendValues(slh); } catch(Exception e) { Console.WriteLine(e); } }
private void Init_Page() { ContactTreeStore = new ListStore(typeof(SharingListHolder)); ContactTreeView.Model = ContactTreeStore; CellRendererPixbuf ccrp = new CellRendererPixbuf(); TreeViewColumn ctvc = new TreeViewColumn(); ctvc.PackStart(ccrp, false); ctvc.SetCellDataFunc(ccrp, new TreeCellDataFunc(ContactCellPixbufDataFunc)); CellRendererText ccrt = new CellRendererText(); ctvc.PackStart(ccrt, false); ctvc.SetCellDataFunc(ccrt, new TreeCellDataFunc(ContactCellTextDataFunc)); ctvc.Title = "Contacts"; ContactTreeView.AppendColumn(ctvc); ContactTreeView.AppendColumn("State", new CellRendererText(), new TreeCellDataFunc(StateCellTextDataFunc)); ContactTreeView.AppendColumn("Access", new CellRendererText(), new TreeCellDataFunc(AccessCellTextDataFunc)); ContactTreeView.Selection.Changed += new EventHandler(on_selection_changed); ContactPixBuf = new Pixbuf(Util.ImagesPath("contact.png")); CurContactPixBuf = new Pixbuf(Util.ImagesPath("contact_me.png")); InvContactPixBuf = new Pixbuf(Util.ImagesPath("invited-contact.png")); guidList = new ArrayList(); abMan = Novell.AddressBook.Manager.Connect( ); if(abMan == null) Console.WriteLine("Warning: Unable to connect to AddressBook"); ICSList memList = collection.GetMemberList(); foreach(ShallowNode sNode in memList) { Member m = new Member(collection, sNode); SharingListHolder slh = new SharingListHolder( m, null); ContactTreeStore.AppendValues(slh); guidList.Add(m.UserID); } ICSList poList = pobox.Search( Subscription.SubscriptionCollectionIDProperty, collection.ID, SearchOp.Equal); foreach(ShallowNode sNode in poList) { Subscription sub = new Subscription(pobox, sNode); if (sub.SubscriptionState == SubscriptionStates.Ready) { if (pobox.StoreReference.GetCollectionByID(sub.SubscriptionCollectionID) != null) { continue; } } SharingListHolder slh = new SharingListHolder( null, sub); ContactTreeStore.AppendValues(slh); } if(collection.IsShareable(collection.GetCurrentMember())) addSharingButton.Sensitive = true; else { addSharingButton.Sensitive = false; FullControlRB.Sensitive = false; ReadWriteRB.Sensitive = false; ReadOnlyRB.Sensitive = false; } removeSharingButton.Sensitive = false; AcceptButton.Sensitive = false; DeclineButton.Sensitive = false; }