예제 #1
0
        /// <summary>
        /// Emitted on the drag source when the drag finishes
        /// </summary>
        void HandleDragEnd(object o, DragEndArgs args)
        {
            if (RepositionMode)
            {
                Owner.CursorTracker.CursorPositionChanged -= HandleCursorPositionChanged;
            }

            if (!drag_canceled && drag_item != null)
            {
                if (!Owner.DockHovered)
                {
                    // Remove from dock
                    AbstractDockItemProvider provider = ProviderForItem(drag_item);
                    bool poof = false;

                    if (provider != null && provider.ItemCanBeRemoved(drag_item))
                    {
                        // provider can manually remove
                        provider.RemoveItem(drag_item);
                        if (FileApplicationProvider.WindowManager != null)
                        {
                            FileApplicationProvider.WindowManager.UpdateTransientItems();
                        }
                        poof = true;
                    }

                    if (poof)
                    {
                        PoofWindow window = new PoofWindow(128);
                        window.SetCenterPosition(Owner.CursorTracker.Cursor);
                        window.Run();
                    }
                }
                else
                {
                    // Dropped somewhere on dock
                    AbstractDockItem item = Owner.HoveredItem;
                    if (item != null && item.CanAcceptDrop(drag_item))
                    {
                        item.AcceptDrop(drag_item);
                    }
                }
            }

            InternalDragActive = false;
            drag_item          = null;
            Keyboard.Ungrab(Gtk.Global.CurrentEventTime);

            Owner.AnimatedDraw();
            Owner.CursorTracker.CancelHighResolution(this);
        }
예제 #2
0
		/// <summary>
		/// Emitted on the drag source when the drag finishes
		/// </summary>
		void HandleDragEnd (object o, DragEndArgs args)
		{
			if (RepositionMode)
				Owner.CursorTracker.CursorPositionChanged -= HandleCursorPositionChanged;
			
			if (!drag_canceled && drag_item != null) {
				if (!Owner.DockHovered) {
					// Remove from dock
					AbstractDockItemProvider provider = ProviderForItem (drag_item);
					bool poof = false;
					
					if (provider != null && provider.ItemCanBeRemoved (drag_item)) {
						// provider can manually remove
						provider.RemoveItem (drag_item);
						if (FileApplicationProvider.WindowManager != null)
							FileApplicationProvider.WindowManager.UpdateTransientItems ();
						poof = true;
					}
					
					if (poof) {
						PoofWindow window = new PoofWindow (128);
						window.SetCenterPosition (Owner.CursorTracker.Cursor);
						window.Run ();
					}
				} else {
					// Dropped somewhere on dock
					AbstractDockItem item = Owner.HoveredItem;
					if (item != null && item.CanAcceptDrop (drag_item))
						item.AcceptDrop (drag_item);
				}
			}
			
			InternalDragActive = false;
			drag_item = null;
			Keyboard.Ungrab (Gtk.Global.CurrentEventTime);
			
			Owner.AnimatedDraw ();
			Owner.CursorTracker.CancelHighResolution (this);
		}