~ubuntu-branches/ubuntu/natty/shotwell/natty

« back to all changes in this revision

Viewing changes to src/main.vala

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-06-29 12:47:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100629124716-1hb2tj31ho45ttu9
Tags: 0.6.0-0ubuntu1
* New upstream release
* debian/watch:
  - Now tracking stable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    if (already_running())
42
42
        return;
43
43
#else
44
 
    // update Debug prefix
45
 
    Debug.set_app_version_prefix(Debug.LIBRARY_PREFIX);
46
44
    // the library is single-instance; editing windows are one-process-per
47
45
    Unique.App shotwell = new Unique.App("org.yorba.shotwell", null);
48
46
    shotwell.add_command("MOUNTED_CAMERA", (int) ShotwellCommand.MOUNTED_CAMERA);
184
182
}
185
183
 
186
184
void editing_exec(string filename) {
187
 
    // update Debug prefix
188
 
    Debug.set_app_version_prefix(Debug.VIEWER_PREFIX);
189
185
    // init modules direct-editing relies on
190
186
    DatabaseTable.init(null);
191
187
    DirectPhoto.init();
233
229
        return;
234
230
    }
235
231
    
 
232
    // init debug prior to anything else (except Gtk, which it relies on, and AppDirs, which needs
 
233
    // to be set ASAP) ... since we need to know what mode we're in, examine the command-line
 
234
    // first
 
235
    
 
236
    // walk command-line arguments for camera mounts or filename for direct editing ... only one
 
237
    // filename supported for now, so take the first one and drop the rest ... note that URIs for
 
238
    // filenames are currently not permitted, to differentiate between mount points
 
239
    string[] mounts = new string[0];
 
240
    string filename = null;
 
241
 
 
242
    for (int ctr = 1; ctr < args.length; ctr++) {
 
243
        string arg = args[ctr];
 
244
        
 
245
        if (LibraryWindow.is_mount_uri_supported(arg)) {
 
246
            mounts += arg;
 
247
        } else if (is_string_empty(filename) && !arg.contains("://")) {
 
248
            filename = arg;
 
249
        }
 
250
    }
 
251
    
 
252
    Debug.init(is_string_empty(filename) ? Debug.LIBRARY_PREFIX : Debug.VIEWER_PREFIX);
 
253
    
236
254
    // set custom data directory if it's been supplied
237
255
    if (data_dir != null)
238
256
        AppDirs.set_data_dir(File.parse_name(data_dir));
246
264
    startup_timer = new Timer();
247
265
    startup_timer.start();
248
266
    
249
 
    // init debug prior to anything else (except Gtk, which it relies on)
250
 
    Debug.init();
251
 
    
252
267
    // set up GLib environment
253
268
    GLib.Environment.set_application_name(Resources.APP_TITLE);
254
269
    
255
 
    // walk command-line arguments for camera mounts or filename for direct editing ... only one
256
 
    // filename supported for now, so take the first one and drop the rest ... note that URIs for
257
 
    // filenames are currently not permitted, to differentiate between mount points
258
 
    string[] mounts = new string[0];
259
 
    string filename = null;
260
 
 
261
 
    for (int ctr = 1; ctr < args.length; ctr++) {
262
 
        string arg = args[ctr];
263
 
        
264
 
        if (LibraryWindow.is_mount_uri_supported(arg)) {
265
 
            mounts += arg;
266
 
        } else if (filename == null && !arg.contains("://")) {
267
 
            filename = arg;
268
 
        }
269
 
    }
270
 
    
271
270
    // in both the case of running as the library or an editor, Resources is always
272
271
    // initialized
273
272
    Resources.init();
275
274
    // since it's possible for a mount name to be passed that's not supported (and hence an empty
276
275
    // mount list), or for nothing to be on the command-line at all, only go to direct editing if a
277
276
    // filename is spec'd
278
 
    if (filename == null)
 
277
    if (is_string_empty(filename))
279
278
        library_exec(mounts);
280
279
    else
281
280
        editing_exec(filename);