]> granicus.if.org Git - transmission/commitdiff
make the buttons in the URL window localizable
authorMitchell Livingston <livings124@transmissionbt.com>
Fri, 11 Feb 2011 03:05:57 +0000 (03:05 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Fri, 11 Feb 2011 03:05:57 +0000 (03:05 +0000)
macosx/URLSheetWindow.xib
macosx/URLSheetWindowController.h
macosx/URLSheetWindowController.m

index 5b4b3a88edeb7847f8536405f27358d43e927d93..4577860e543aa0cec9b10e4438845825969ba98e 100644 (file)
                                        </object>
                                        <int key="connectionID">21</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">fCancelButton</string>
+                                               <reference key="source" ref="1001"/>
+                                               <reference key="destination" ref="9691643"/>
+                                       </object>
+                                       <int key="connectionID">22</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <reference ref="459786882"/>
                                                        <reference ref="9691643"/>
-                                                       <reference ref="794131740"/>
                                                        <reference ref="1066788818"/>
+                                                       <reference ref="794131740"/>
                                                </object>
                                                <reference key="parent" ref="461713252"/>
                                        </object>
                                        <string>6.IBPluginDependency</string>
                                        <string>6.ImportedFromIB2</string>
                                        <string>7.IBPluginDependency</string>
+                                       <string>7.IBViewBoundsToFrameTransform</string>
                                        <string>7.ImportedFromIB2</string>
                                        <string>8.IBPluginDependency</string>
                                        <string>8.ImportedFromIB2</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>{{535, 596}, {400, 177}}</string>
+                                       <string>{{594, 582}, {400, 177}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>{{535, 596}, {400, 177}}</string>
+                                       <string>{{594, 582}, {400, 177}}</string>
                                        <integer value="1"/>
                                        <integer value="0"/>
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <object class="NSAffineTransform">
+                                               <bytes key="NSTransformStruct">P4AAAL+AAABDmAAAwigAAA</bytes>
+                                       </object>
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">21</int>
+                       <int key="maxID">22</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                <object class="NSArray" key="dict.sortedKeys">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>fCancelButton</string>
                                                        <string>fLabelField</string>
                                                        <string>fOpenButton</string>
                                                        <string>fTextField</string>
                                                </object>
                                                <object class="NSMutableArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>NSButton</string>
                                                        <string>NSTextField</string>
                                                        <string>NSButton</string>
                                                        <string>NSTextField</string>
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                <object class="NSArray" key="dict.sortedKeys">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>fCancelButton</string>
                                                        <string>fLabelField</string>
                                                        <string>fOpenButton</string>
                                                        <string>fTextField</string>
                                                </object>
                                                <object class="NSMutableArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">fCancelButton</string>
+                                                               <string key="candidateClassName">NSButton</string>
+                                                       </object>
                                                        <object class="IBToOneOutletInfo">
                                                                <string key="name">fLabelField</string>
                                                                <string key="candidateClassName">NSTextField</string>
index 8974035e69b18040dd023e4907400cc4f803a49e..abc9819bc05332624e18200b9c9e1a59b014abe0 100644 (file)
@@ -30,7 +30,7 @@
 {
        IBOutlet NSTextField * fLabelField;
     IBOutlet NSTextField * fTextField;
-    IBOutlet NSButton * fOpenButton;
+    IBOutlet NSButton * fOpenButton, * fCancelButton;
     
     Controller * fController;
 }
index 501f498fd26e8c5aefb39bee48ec64a285497d81..7714f674e878ec71c973d30dc59139ed9bdb5e1b 100644 (file)
@@ -45,7 +45,31 @@ NSString * urlString = @"";
     [fTextField setStringValue: urlString];
     [fTextField selectText: self];
     
-    [fOpenButton setEnabled: ![urlString isEqualToString: @""]];
+    [fOpenButton setTitle: NSLocalizedString(@"Open", "URL sheet button")];
+    [fCancelButton setTitle: NSLocalizedString(@"Cancel", "URL sheet button")];
+    
+    [fOpenButton sizeToFit];
+    [fCancelButton sizeToFit];
+    
+    //size the two buttons the same
+    NSRect openFrame = [fOpenButton frame];
+    openFrame.size.width += 10.0;
+    NSRect cancelFrame = [fCancelButton frame];
+    cancelFrame.size.width += 10.0;
+    
+    
+    
+    if (NSWidth(openFrame) > NSWidth(cancelFrame))
+        cancelFrame.size.width = NSWidth(openFrame);
+    else
+        openFrame.size.width = NSWidth(cancelFrame);
+    
+    openFrame.origin.x = NSWidth([[self window] frame]) - NSWidth(openFrame) - 20.0 + 6.0; //I don't know why the extra 6.0 is needed
+    
+    [fOpenButton setFrame: openFrame];
+    
+    cancelFrame.origin.x = NSMinX(openFrame) - NSWidth(cancelFrame);
+    [fCancelButton setFrame: cancelFrame];
 }
 
 - (IBAction) beginSheetForWindow: (NSWindow *) window