Merged [13632]: Patch from Gayle Laakmann to not append @gmail.com if @googlemail...
[adiumx.git] / Source / ESContactSortConfigurationWindowController.m
blob825751ca6d2b9be014cef92a673cb56eee21ca15
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import "ESContactSortConfigurationWindowController.h"
18 #import <Adium/AISortController.h>
20 /*!
21  * @class ESContactSortConfigurationWindowController
22  * @brief Window controller for configuring sorting options for an <tt>AISortController</tt>
23  */
24 @implementation ESContactSortConfigurationWindowController
26 /*!
27  * @brief Show the sort configuration window for a controller
28  *
29  * @param controller The controller to configure
30  */
31 + (id)showSortConfigurationWindowForController:(AISortController *)controller
33         static ESContactSortConfigurationWindowController   *sharedSortConfigInstance = nil;
34         
35     if(!sharedSortConfigInstance){
36         sharedSortConfigInstance = [[self alloc] initWithWindowNibName:@"SortConfiguration"];
37                 
38                 //Remove those buttons we don't want.  removeFromSuperview will confuse the window, so just make them invisible.
39                 NSButton *standardWindowButton = [[sharedSortConfigInstance window] standardWindowButton:NSWindowMiniaturizeButton];
40                 [standardWindowButton setFrame:NSMakeRect(0,0,0,0)];
41                 standardWindowButton = [[sharedSortConfigInstance window] standardWindowButton:NSWindowZoomButton];
42                 [standardWindowButton setFrame:NSMakeRect(0,0,0,0)];
43     }
44         
45         [sharedSortConfigInstance configureForController:controller];
46         
47         [sharedSortConfigInstance showWindow:nil];
48         
49         return sharedSortConfigInstance;
52 /*!
53  * @brief Configure our window and view for a passed controller
54  */
55 - (void)configureForController:(AISortController *)controller
57         //Configure the title
58         [[self window] setTitle:[controller configureSortWindowTitle]];
59         
60         //Configure the view
61         NSView  *configureView = [controller configureView];
63         NSSize newSize = [configureView frame].size;
64         
65         //This will resize the view to the current window size...
66         [[self window] setContentView:configureView];
67         
68         //...so restore the window to the size this view really wants to be
69         [[self window] setContentSize:newSize];
72 /*!
73  * @brief Window did load
74  */
75 - (void)windowDidLoad
77         [super windowDidLoad];
78         
79         [[self window] setTitle:AILocalizedString(@"Configure Sorting","Configure Sort window title")];
82 @end