static void gedit_main (gboolean service) { GeditPluginsEngine *engine; GeditApp *app; const gchar *dir; gchar *icon_dir; gedit_debug_message (DEBUG_APP, "Set icon"); dir = gedit_dirs_get_gedit_data_dir (); icon_dir = g_build_filename (dir, "icons", NULL); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), icon_dir); g_free (icon_dir); /* Init plugins engine */ gedit_debug_message (DEBUG_APP, "Init plugins"); engine = gedit_plugins_engine_get_default (); app = gedit_app_get_default (); /* Initialize session management */ gedit_debug_message (DEBUG_APP, "Init session manager"); gedit_session_init (); if (!service) { gboolean restored = FALSE; if (gedit_session_is_restored ()) { restored = gedit_session_load (); } if (!restored) { gedit_main_window (); } } _gedit_app_ready (app); gedit_debug_message (DEBUG_APP, "Start gtk-main"); gtk_main (); /* Make sure settings are saved */ g_settings_sync (); /* Cleanup */ g_object_unref (engine); g_object_unref (app); gedit_dirs_shutdown (); #ifndef ENABLE_GVFS_METADATA gedit_metadata_manager_shutdown (); #endif }
static void gedit_app_shutdown (GApplication *app) { gedit_debug_message (DEBUG_APP, "Quitting\n"); /* Last window is gone... save some settings and exit */ ensure_user_config_dir (); save_accels (); save_page_setup (GEDIT_APP (app)); save_print_settings (GEDIT_APP (app)); /* GTK+ can still hold references to some gedit objects, for example * GeditDocument for the clipboard. So the metadata-manager should be * shutdown after. */ G_APPLICATION_CLASS (gedit_app_parent_class)->shutdown (app); #ifndef ENABLE_GVFS_METADATA gedit_metadata_manager_shutdown (); #endif gedit_dirs_shutdown (); }