~mitya57/ubuntu/precise/nautilus/desktop-window-fixes

« back to all changes in this revision

Viewing changes to src/nautilus-main.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2009-09-23 20:11:11 UTC
  • mto: (1.2.5 upstream) (2.4.1 sid)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: james.westby@ubuntu.com-20090923201111-r4e2b6x5biik0ldh
Tags: upstream-2.28.0
ImportĀ upstreamĀ versionĀ 2.28.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include <glib/gi18n.h>
47
47
#include <gio/gdesktopappinfo.h>
48
48
#include <libnautilus-private/nautilus-debug-log.h>
49
 
#include <libnautilus-private/nautilus-directory-metafile.h>
50
49
#include <libnautilus-private/nautilus-global-preferences.h>
51
50
#include <libnautilus-private/nautilus-lib-self-check-functions.h>
52
51
#include <libnautilus-private/nautilus-icon-names.h>
68
67
/* Keeps track of everyone who wants the main event loop kept active */
69
68
static GSList *event_loop_registrants;
70
69
 
 
70
static gboolean exit_with_last_window = TRUE;
 
71
 
71
72
static gboolean
72
73
is_event_loop_needed (void)
73
74
{
74
 
        return event_loop_registrants != NULL;
 
75
        return event_loop_registrants != NULL || !exit_with_last_window;
75
76
}
76
77
 
77
78
static int
132
133
{
133
134
        if (explicit) {
134
135
                /* Explicit --quit, make sure we don't restart */
 
136
 
 
137
                /* To quit all instances, reset exit_with_last_window */
 
138
                exit_with_last_window = TRUE;
 
139
 
 
140
                if (event_loop_registrants == NULL) {
 
141
                        /* If this is reached, nautilus must run in "daemon" mode
 
142
                         * (i.e. !exit_with_last_window) with no windows open.
 
143
                         * We need to quit_all here because the below loop won't
 
144
                         * trigger a quit.
 
145
                         */
 
146
                        eel_gtk_main_quit_all();
 
147
                }
 
148
 
135
149
                /* TODO: With the old session we needed to set restart
136
150
                   style to GNOME_RESTART_IF_RUNNING here, but i don't think we need
137
151
                   that now since gnome-session doesn't restart apps except on startup. */
312
326
        gboolean autostart_mode;
313
327
        const char *autostart_id;
314
328
        gchar *geometry;
315
 
        const gchar **remaining;
 
329
        gchar **remaining;
316
330
        gboolean perform_self_check;
317
331
        NautilusApplication *application;
318
332
        GOptionContext *context;
391
405
        browser_window = FALSE;
392
406
 
393
407
        g_set_prgname ("nautilus");
 
408
 
394
409
        if (g_file_test (DATADIR "/applications/nautilus.desktop", G_FILE_TEST_EXISTS)) {
395
410
                egg_set_desktop_file (DATADIR "/applications/nautilus.desktop");
396
411
        }
457
472
         * happens.
458
473
         */
459
474
        nautilus_global_preferences_init ();
 
475
 
 
476
        /* exit_with_last_window being FALSE, nautilus can run without window. */
 
477
        exit_with_last_window =
 
478
                eel_preferences_get_boolean (NAUTILUS_PREFERENCES_EXIT_WITH_LAST_WINDOW);
 
479
 
460
480
        if (no_desktop) {
461
481
                eel_preferences_set_is_invisible
462
482
                        (NAUTILUS_PREFERENCES_SHOW_DESKTOP, TRUE);
496
516
                        }
497
517
                        g_ptr_array_add (uris_array, NULL);
498
518
                        uris = (char **)g_ptr_array_free (uris_array, FALSE);
 
519
                        g_strfreev (remaining);
499
520
                }
500
521
 
501
522
                
514
535
                         uris);
515
536
                g_strfreev (uris);
516
537
 
 
538
                if (unique_app_is_running (application->unique_app) ||
 
539
                    kill_shell) {
 
540
                        exit_with_last_window = TRUE;
 
541
                }
 
542
 
517
543
                if (is_event_loop_needed ()) {
518
544
                        gtk_main ();
519
545
                }