Пример #1
0
        void HandleMountAdded(object o, MountAddedArgs args)
        {
            // FIXME: due to a bug in GIO#, this will crash when trying to get args.Mount
            Mount m = MountAdapter.GetObject(args.Args[0] as GLib.Object);

            if (IsTrash(m))
            {
                return;
            }

            Mounts.Add(new MountItem(m));
            Log <MountProvider> .Info("{0} mounted.", m.Name);

            Items = Mounts.Cast <AbstractDockItem> ();
        }
Пример #2
0
        void HandleMountRemoved(object o, MountRemovedArgs args)
        {
            // FIXME: due to a bug in GIO#, this will crash when trying to get args.Mount
            Mount m = MountAdapter.GetObject(args.Args[0] as GLib.Object);

            if (Mounts.Any(d => d.Mnt.Handle == m.Handle))
            {
                MountItem mntToRemove = Mounts.First(d => d.Mnt.Handle == m.Handle);

                Mounts.Remove(mntToRemove);
                Items = Mounts.Cast <AbstractDockItem> ();
                mntToRemove.Dispose();

                Log <MountProvider> .Info("{0} unmounted.", m.Name);
            }
        }