Commit b96e70d8 authored by William Jon McCann's avatar William Jon McCann

Don't initialize the desktop link monitor when it isn't needed

parent c3c9fa60
......@@ -58,12 +58,10 @@ G_DEFINE_TYPE (NautilusDesktopLinkMonitor, nautilus_desktop_link_monitor, G_TYPE
static NautilusDesktopLinkMonitor *the_link_monitor = NULL;
static void
destroy_desktop_link_monitor (void)
void
nautilus_desktop_link_monitor_shutdown (void)
{
if (the_link_monitor != NULL) {
g_object_unref (the_link_monitor);
}
g_clear_object (&the_link_monitor);
}
NautilusDesktopLinkMonitor *
......@@ -71,7 +69,7 @@ nautilus_desktop_link_monitor_get (void)
{
if (the_link_monitor == NULL) {
g_object_new (NAUTILUS_TYPE_DESKTOP_LINK_MONITOR, NULL);
eel_debug_call_at_shutdown (destroy_desktop_link_monitor);
eel_debug_call_at_shutdown (nautilus_desktop_link_monitor_shutdown);
}
return the_link_monitor;
}
......
......@@ -54,6 +54,8 @@ typedef struct {
GType nautilus_desktop_link_monitor_get_type (void);
NautilusDesktopLinkMonitor * nautilus_desktop_link_monitor_get (void);
void nautilus_desktop_link_monitor_shutdown (void);
void nautilus_desktop_link_monitor_delete_link (NautilusDesktopLinkMonitor *monitor,
NautilusDesktopLink *link,
GtkWidget *parent_view);
......
......@@ -494,25 +494,6 @@ nautilus_application_create_desktop_windows (NautilusApplication *application)
}
}
static void
nautilus_application_open_desktop (NautilusApplication *application)
{
if (nautilus_application_desktop_windows == NULL) {
nautilus_application_create_desktop_windows (application);
}
}
static void
nautilus_application_close_desktop (void)
{
if (nautilus_application_desktop_windows != NULL) {
g_list_foreach (nautilus_application_desktop_windows,
(GFunc) gtk_widget_destroy, NULL);
g_list_free (nautilus_application_desktop_windows);
nautilus_application_desktop_windows = NULL;
}
}
static gboolean
another_navigation_window_already_showing (NautilusApplication *application,
NautilusWindow *the_window)
......@@ -573,20 +554,6 @@ nautilus_application_create_window (NautilusApplication *application,
return window;
}
/* callback for showing or hiding the desktop based on the user's preference */
static void
desktop_changed_callback (gpointer user_data)
{
NautilusApplication *application;
application = NAUTILUS_APPLICATION (user_data);
if (g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP)) {
nautilus_application_open_desktop (application);
} else {
nautilus_application_close_desktop ();
}
}
static void
mount_added_callback (GVolumeMonitor *monitor,
GMount *mount,
......@@ -1206,11 +1173,45 @@ init_icons_and_styles (void)
}
static void
init_desktop (NautilusApplication *self)
nautilus_application_open_desktop (NautilusApplication *application)
{
/* Initialize the desktop link monitor singleton */
nautilus_desktop_link_monitor_get ();
if (nautilus_application_desktop_windows == NULL) {
nautilus_application_create_desktop_windows (application);
}
}
static void
nautilus_application_close_desktop (void)
{
if (nautilus_application_desktop_windows != NULL) {
g_list_foreach (nautilus_application_desktop_windows,
(GFunc) gtk_widget_destroy, NULL);
g_list_free (nautilus_application_desktop_windows);
nautilus_application_desktop_windows = NULL;
}
nautilus_desktop_link_monitor_shutdown ();
}
/* callback for showing or hiding the desktop based on the user's preference */
static void
desktop_changed_callback (gpointer user_data)
{
NautilusApplication *application;
application = NAUTILUS_APPLICATION (user_data);
if (g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP)) {
nautilus_application_open_desktop (application);
} else {
nautilus_application_close_desktop ();
}
}
static void
init_desktop (NautilusApplication *self)
{
if (!self->priv->no_desktop &&
!g_settings_get_boolean (gnome_background_preferences,
NAUTILUS_PREFERENCES_SHOW_DESKTOP)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment