nautilus-application.c 1.08 KB
Newer Older
1 2 3 4
#include "nautilus.h"

static int window_count = 0;

5 6 7 8 9 10 11 12 13 14 15
/**
 * nautilus_app_exiting:
 * 
 * Called after the main event loop has finished, just before the
 * program ends. Don't call from anywhere else.
 **/
void
nautilus_app_exiting()
{
  /* Do those things that gotta be done just once before quitting */
  nautilus_prefs_save();
16
  nautilus_bookmarks_menu_exiting();
17 18
}

19
void
20
nautilus_app_init(const char *initial_url)
21 22 23
{
  NautilusWindow *mainwin;

24
  nautilus_navinfo_init();
25
  nautilus_prefs_load();
26

27 28 29
  /* Set default configuration */
  mainwin = nautilus_app_create_window();
  bonobo_activate();
30
  nautilus_window_set_initial_state(mainwin, initial_url);
31 32 33 34 35 36 37 38
}

static void
nautilus_app_destroy_window(GtkObject *obj)
{
  window_count--;

  if(window_count <= 0)
39 40 41
    {
      gtk_main_quit();
    }
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
}

NautilusWindow *
nautilus_app_create_window(void)
{
  GtkWidget *win = gtk_widget_new(nautilus_window_get_type(), "app_id", "nautilus", NULL);

  window_count++;

  gtk_signal_connect(GTK_OBJECT(win), "destroy", nautilus_app_destroy_window, NULL);

  gtk_widget_show(win);

  return NAUTILUS_WINDOW(win);
}