~ubuntu-branches/ubuntu/vivid/projectcenter.app/vivid

« back to all changes in this revision

Viewing changes to PCAppController.m

  • Committer: Bazaar Package Importer
  • Author(s): Yavor Doganov
  • Date: 2010-06-03 16:04:52 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100603160452-dcsmkjwdtwxuitdo
Tags: 0.5.3~20100601-1
* New upstream release.
* debian/compat: Set to 7.
* debian/control (Section): Change to `gnustep'.
  (Build-Depends): Require debhelper >= 7, remove version constraints
  for libgnustep-gui-dev (obsolete).
  (Depends): Add ${gnustep:Depends}.
  (Standards-Version): Compliant with 3.8.4 as of this release.
  (Vcs-Arch): New field.
  (Description): Do not praise NextStep.
* debian/rules: Export GNUSTEP_MAKEFILES and get rid of gs_make.
  (OPTFLAG): No longer define; rework noopt handling to be compatible
  with gnustep-make/2.4.x (Closes: #581976).
  (build-stamp): Pass GDB=/usr/bin/gdb for the PCDefaultDebugger
  define.
  (install): Replace dh_clean -k with dh_prep.
  (binary-arch): Adjust dh_installchangelogs' argument.  Rework the
  FHS_ME_HARDER snippet; PC's supporting executables are no longer
  installed as Bundles.
* debian/patches/05_link-libs.dpatch: Update; the fix was merged
  upstream, but now -lm is required as well.
* debian/patches/10_bundles-install-dir.dpatch: Remove; obsolete with
  the new way of FHS-compliance handling.
* debian/links: Delete; no longer needed.
* debian/menu: Adjust command.
* debian/source/format:
* debian/README.source:
* debian/preinst: New file.
* debian/copyright: Bump copyright years, add more upstream authors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
   License along with this library; if not, write to the Free
20
20
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21
21
*/
22
 
#include <ProjectCenter/PCPrefController.h>
23
 
#include <ProjectCenter/PCLogController.h>
24
 
#include <ProjectCenter/PCFileManager.h>
25
 
 
26
 
#include "PCAppController.h"
27
 
#include "PCMenuController.h"
28
 
#include "PCInfoController.h"
29
 
 
30
 
#include <ProjectCenter/ProjectCenter.h>
 
22
#import <ProjectCenter/PCLogController.h>
 
23
#import <ProjectCenter/PCFileManager.h>
 
24
 
 
25
#import "PCAppController.h"
 
26
#import "PCMenuController.h"
 
27
#import "PCInfoController.h"
 
28
#import "PCPrefController.h"
 
29
 
 
30
#import "Modules/Preferences/Build/PCBuildPrefs.h"
 
31
#import "Modules/Preferences/Saving/PCSavingPrefs.h"
 
32
#import "Modules/Preferences/Misc/PCMiscPrefs.h"
 
33
 
 
34
#import <ProjectCenter/ProjectCenter.h>
31
35
 
32
36
@implementation PCAppController
33
37
 
47
51
      // Termporary workaround to initialize defaults values
48
52
      prefController = [PCPrefController sharedPCPreferences];
49
53
      logController  = [PCLogController sharedLogController];
50
 
      
 
54
 
 
55
      // It's our entry point to Framework
51
56
      projectManager = [[PCProjectManager alloc] init];
52
57
      [projectManager setDelegate:self];
53
58
      [projectManager setPrefController:prefController];
107
112
  if ([[fileName pathExtension] isEqualToString:@"pcproj"] == YES
108
113
      || [[fileName pathExtension] isEqualToString:@"project"] == YES) 
109
114
    {
110
 
      [projectManager openProjectAt:fileName];
 
115
      [projectManager openProjectAt: fileName makeActive: YES];
111
116
      [[[projectManager activeProject] projectWindow] 
112
117
        makeKeyAndOrderFront:self];
113
118
    }
115
120
    {
116
121
      [projectManager openFileAtPath:fileName];
117
122
    }
118
 
 
 
123
  
119
124
  return YES;
120
125
}
121
126
 
127
132
{
128
133
//  NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter"];
129
134
 
130
 
  if ([[prefController objectForKey:DisplayLog] isEqualToString:@"YES"])
 
135
  if ([prefController boolForKey:DisplayLog])
131
136
    {
132
137
      [logController showPanel];
133
138
    }
142
147
 
143
148
- (BOOL)applicationShouldTerminate:(id)sender
144
149
{
145
 
  NSString *poq;
146
 
  NSString *soq;
147
 
  BOOL     quit;
 
150
  BOOL quit = YES;
148
151
 
149
 
  poq = [[NSUserDefaults standardUserDefaults] objectForKey:PromptOnQuit];
150
 
  soq = [[NSUserDefaults standardUserDefaults] objectForKey:SaveOnQuit];
151
 
  if ([poq isEqualToString:@"YES"])
 
152
  if ([prefController boolForKey:PromptOnQuit])
152
153
    {
153
 
      if (NSRunAlertPanel(@"Quit!",
 
154
      if (NSRunAlertPanel(@"Quit",
154
155
                          @"Do you really want to quit ProjectCenter?",
155
 
                          @"No", @"Yes", nil))
 
156
                          @"Cancel", @"Quit", nil))
156
157
        {
157
158
          return NO;
158
159
        }
159
160
 
160
161
    }
161
162
 
162
 
  // Save projects if preferences tells that
163
 
  if ([soq isEqualToString:@"YES"])
 
163
  // Save projects unconditionally if preferences tells that
 
164
  if ([prefController boolForKey:SaveOnQuit])
164
165
    {
165
166
      quit = [projectManager saveAllProjects];
166
167
    }
167
168
 
168
 
  // Close all loaded projects
169
 
  quit = [projectManager closeAllProjects];
170
 
 
171
 
  if (quit == NO)
 
169
  // Close ProjectManager (projects, editors, etc.)
 
170
  if ((quit == NO) || ([projectManager close] == NO))
172
171
    {
173
172
      return NO;
174
173
    }
182
181
 
183
182
- (void)applicationWillTerminate:(NSNotification *)notification
184
183
{
185
 
  NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
186
184
  NSFileManager *fm;
187
185
  PCFileManager *pcfm;
188
186
  NSString      *rootBuildDir;
189
187
  NSArray       *rootBuildDirList;
 
188
  NSEnumerator  *enumerator;
 
189
  NSString      *buildItem;
190
190
 
191
 
#ifdef DEVELOPMENT
192
 
  NSLog (@"--- Application WILL terminate");
 
191
#ifdef DEBUG
 
192
  NSLog(@"--- Application WILL terminate");
193
193
#endif
194
194
 
195
 
 
196
 
  if ([[ud stringForKey:DeleteCacheWhenQuitting] isEqualToString:@"YES"]) 
 
195
  if ([prefController boolForKey:DeleteCacheWhenQuitting]) 
197
196
    {
198
197
      fm = [NSFileManager defaultManager];
199
198
      pcfm = [PCFileManager defaultManager];
200
199
 
201
 
      rootBuildDir = [prefController objectForKey:RootBuildDirectory];
 
200
      rootBuildDir = [prefController stringForKey:RootBuildDirectory];
202
201
      rootBuildDirList = [fm directoryContentsAtPath:rootBuildDir];
203
 
      NSLog(@"The following files will be removed from directory \"%@\": %@",
204
 
            rootBuildDir, rootBuildDirList);
205
 
      [pcfm removeFiles:rootBuildDirList 
206
 
          fromDirectory:rootBuildDir
207
 
      removeDirsIfEmpty:NO];
 
202
 
 
203
      enumerator = [rootBuildDirList objectEnumerator];
 
204
      while ((buildItem = [enumerator nextObject]))
 
205
        {
 
206
          if([[buildItem pathExtension] isEqualToString:@"build"])
 
207
            {
 
208
              NSLog(@"Remove build directory %@/%@",
 
209
                    rootBuildDir, buildItem);
 
210
              [pcfm removeFile:buildItem
 
211
                 fromDirectory:rootBuildDir removeDirsIfEmpty:YES];
 
212
            }
 
213
        }
 
214
 
208
215
    }
209
216
 
210
 
  [ud synchronize];
211
 
 
212
217
  //--- Cleanup
213
218
  if (doConnection)
214
219
    {
222
227
  RELEASE(menuController);
223
228
  RELEASE(projectManager);
224
229
 
225
 
#ifdef DEVELOPMENT
 
230
#ifdef DEBUG
226
231
  NSLog (@"--- Application WILL terminate.END");
227
232
#endif
228
233
}