[nautilus] application: move other init/cleanup functions in the app class
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] application: move other init/cleanup functions in the app class
- Date: Sat, 30 Oct 2010 15:22:25 +0000 (UTC)
commit 56dd8bb3d5594d9caffda23400f7bd64c94e5a4c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Oct 27 14:45:29 2010 +0200
application: move other init/cleanup functions in the app class
Instead of mixing them between nautilus-main and nautilus-application
src/nautilus-application.c | 21 ++++++++++++++++++---
src/nautilus-application.h | 3 ---
src/nautilus-main.c | 18 ++----------------
3 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 0bf7fdb..fc1e5fc 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -646,7 +646,7 @@ open_windows (NautilusApplication *application,
}
}
-gboolean
+static gboolean
nautilus_application_save_accel_map (gpointer data)
{
if (save_of_accel_map_requested) {
@@ -780,7 +780,7 @@ nautilus_application_create_desktop_windows (NautilusApplication *application)
}
}
-void
+static void
nautilus_application_open_desktop (NautilusApplication *application)
{
if (nautilus_application_desktop_windows == NULL) {
@@ -788,7 +788,7 @@ nautilus_application_open_desktop (NautilusApplication *application)
}
}
-void
+static void
nautilus_application_close_desktop (void)
{
if (nautilus_application_desktop_windows != NULL) {
@@ -1628,6 +1628,11 @@ nautilus_application_startup (GApplication *app)
/* initialize the session manager client */
nautilus_application_smclient_init (self);
+ /* Initialize preferences. This is needed to create the
+ * global GSettings objects.
+ */
+ nautilus_global_preferences_init ();
+
/* register views */
fm_icon_view_register ();
fm_desktop_icon_view_register ();
@@ -1652,6 +1657,15 @@ nautilus_application_startup (GApplication *app)
}
static void
+nautilus_application_quit_mainloop (GApplication *app)
+{
+ nautilus_icon_info_clear_caches ();
+ nautilus_application_save_accel_map (NULL);
+
+ G_APPLICATION_CLASS (nautilus_application_parent_class)->quit_mainloop (app);
+}
+
+static void
nautilus_application_class_init (NautilusApplicationClass *class)
{
GObjectClass *object_class;
@@ -1664,6 +1678,7 @@ nautilus_application_class_init (NautilusApplicationClass *class)
application_class = G_APPLICATION_CLASS (class);
application_class->startup = nautilus_application_startup;
application_class->command_line = nautilus_application_command_line;
+ application_class->quit_mainloop = nautilus_application_quit_mainloop;
}
NautilusApplication *
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index 2926734..3e8e88d 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -89,8 +89,5 @@ NautilusWindow * nautilus_application_create_navigation_window (Nautilus
void nautilus_application_close_all_navigation_windows (NautilusApplication *self);
void nautilus_application_close_parent_windows (NautilusSpatialWindow *window);
void nautilus_application_close_all_spatial_windows (void);
-void nautilus_application_open_desktop (NautilusApplication *application);
-void nautilus_application_close_desktop (void);
-gboolean nautilus_application_save_accel_map (gpointer data);
#endif /* __NAUTILUS_APPLICATION_H__ */
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index 1f8c58a..6d4e883 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -293,18 +293,6 @@ main (int argc, char *argv[])
/* Initialize the services that we use. */
LIBXML_TEST_VERSION
- /* Initialize preferences. This is needed to create the
- * global GSettings objects.
- */
- nautilus_global_preferences_init ();
-
-#if 0
- /* exit_with_last_window being FALSE, nautilus can run without window. */
- exit_with_last_window =
- g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_EXIT_WITH_LAST_WINDOW);
-#endif
- application = NULL;
-
/* Do either the self-check or the real work. */
if (perform_self_check) {
#ifndef NAUTILUS_OMIT_SELF_CHECK
@@ -326,13 +314,11 @@ main (int argc, char *argv[])
retval = g_application_run (G_APPLICATION (application),
argc, argv);
+
+ g_object_unref (application);
}
- nautilus_icon_info_clear_caches ();
- g_object_unref (application);
eel_debug_shut_down ();
- nautilus_application_save_accel_map (NULL);
-
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]