Skip to content

Commit

Permalink
Fix #3952.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Nov 25, 2010
1 parent 20e74fa commit f458ba0
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions source/ch/cyberduck/ui/cocoa/ProgressController.java
Expand Up @@ -26,9 +26,7 @@
import ch.cyberduck.ui.cocoa.application.*;
import ch.cyberduck.ui.cocoa.delegate.AbstractMenuDelegate;
import ch.cyberduck.ui.cocoa.delegate.TransferMenuDelegate;
import ch.cyberduck.ui.cocoa.foundation.NSArray;
import ch.cyberduck.ui.cocoa.foundation.NSAttributedString;
import ch.cyberduck.ui.cocoa.foundation.NSDictionary;
import ch.cyberduck.ui.cocoa.foundation.*;

import org.rococoa.Foundation;
import org.rococoa.cocoa.foundation.NSInteger;
Expand Down Expand Up @@ -258,18 +256,14 @@ public void setHighlighted(final boolean highlighted) {
statusField.setTextColor(highlighted ? NSColor.whiteColor() : NSColor.textColor());
progressField.setTextColor(highlighted ? NSColor.whiteColor() : NSColor.darkGrayColor());
messageField.setTextColor(highlighted ? NSColor.whiteColor() : NSColor.darkGrayColor());
if(transfer.getRoot().getLocal().exists()) {
filesPopup.itemAtIndex(new NSInteger(0)).setAttributedTitle(
NSAttributedString.attributedStringWithAttributes(filesPopup.itemAtIndex(new NSInteger(0)).title(),
highlighted ? HIGHLIGHTED_FONT_ATTRIBUTES : NORMAL_FONT_ATTRIBUTES)
);
}
else {
filesPopup.itemAtIndex(new NSInteger(0)).setAttributedTitle(
NSAttributedString.attributedStringWithAttributes(filesPopup.itemAtIndex(new NSInteger(0)).title(),
highlighted ? HIGHLIGHTED_FONT_ATTRIBUTES : DARK_FONT_ATTRIBUTES)
);
}
this.setMenuHighlighted(highlighted);
}

private void setMenuHighlighted(boolean highlighted) {
filesPopup.itemAtIndex(new NSInteger(0)).setAttributedTitle(
NSAttributedString.attributedStringWithAttributes(filesPopup.itemAtIndex(new NSInteger(0)).title(),
highlighted ? HIGHLIGHTED_FONT_ATTRIBUTES : transfer.getRoot().getLocal().exists() ? NORMAL_FONT_ATTRIBUTES : DARK_FONT_ATTRIBUTES)
);
}

// ----------------------------------------------------------
Expand All @@ -294,6 +288,24 @@ public void setFilesPopup(NSPopUpButton filesPopup) {
}
this.filesPopupMenuDelegate = new TransferMenuDelegate(transfer.getRoots());
this.filesPopup.menu().setDelegate(this.filesPopupMenuDelegate.id());
NSNotificationCenter.defaultCenter().addObserver(this.id(),
Foundation.selector("filesPopupWillShow:"),
NSPopUpButton.PopUpButtonWillPopUpNotification,
this.filesPopup);
NSNotificationCenter.defaultCenter().addObserver(this.id(),
Foundation.selector("filesPopupWillHide:"),
"NSMenuDidEndTrackingNotification",
this.filesPopup.menu());
}

@Action
public void filesPopupWillShow(final NSNotification sender) {
this.setMenuHighlighted(false);
}

@Action
public void filesPopupWillHide(final NSNotification sender) {
this.setMenuHighlighted(true);
}

@Outlet
Expand Down

0 comments on commit f458ba0

Please sign in to comment.