monitor: don't check for FAM

There is code that is used in case FAM is not available. But
we use inotify since 2006, so I'm confident we are fine without
checking for it.

This remove some not needed code.
parent 41da60c3
......@@ -3,6 +3,7 @@
nautilus-monitor.c: file and directory change monitoring for nautilus
Copyright (C) 2000, 2001 Eazel, Inc.
Copyright (C) 2016 Red Hat
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -20,6 +21,7 @@
Authors: Seth Nickell <seth@eazel.com>
Darin Adler <darin@bentspoon.com>
Alex Graveley <alex@ximian.com>
Carlos Soriano <csoriano@gnome.org>
*/
#include <config.h>
......@@ -35,30 +37,6 @@ struct NautilusMonitor {
GFile *location;
};
gboolean
nautilus_monitor_active (void)
{
static gboolean tried_monitor = FALSE;
static gboolean monitor_success;
GFileMonitor *dir_monitor;
GFile *file;
if (tried_monitor == FALSE) {
file = g_file_new_for_path (g_get_home_dir ());
dir_monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_object_unref (file);
monitor_success = (dir_monitor != NULL);
if (dir_monitor) {
g_object_unref (dir_monitor);
}
tried_monitor = TRUE;
}
return monitor_success;
}
static gboolean call_consume_changes_idle_id = 0;
static gboolean
......
......@@ -3,6 +3,7 @@
nautilus-monitor.h: file and directory change monitoring for nautilus
Copyright (C) 2000, 2001 Eazel, Inc.
Copyright (C) 2016 Red Hat, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
......@@ -19,6 +20,7 @@
Authors: Seth Nickell <seth@eazel.com>
Darin Adler <darin@bentspoon.com>
Carlos Soriano <csoriano@gnome.org>
*/
#ifndef NAUTILUS_MONITOR_H
......@@ -29,7 +31,6 @@
typedef struct NautilusMonitor NautilusMonitor;
gboolean nautilus_monitor_active (void);
NautilusMonitor *nautilus_monitor_directory (GFile *location);
void nautilus_monitor_cancel (NautilusMonitor *monitor);
......
......@@ -59,18 +59,9 @@
#include <sys/types.h>
#include <unistd.h>
/* Timeout to check the desktop directory for updates */
#define RESCAN_TIMEOUT 4
struct NautilusDesktopCanvasViewDetails
{
GdkWindow *root_window;
/* For the desktop rescanning
*/
gulong delayed_init_signal;
guint reload_desktop_timeout;
gboolean pending_rescan;
};
static void default_zoom_level_changed (gpointer user_data);
......@@ -81,7 +72,6 @@ static void font_changed_callback (gpointer
G_DEFINE_TYPE (NautilusDesktopCanvasView, nautilus_desktop_canvas_view, NAUTILUS_TYPE_CANVAS_VIEW)
static char *desktop_directory;
static time_t desktop_dir_modify_time;
#define get_canvas_container(w) nautilus_canvas_view_get_canvas_container(NAUTILUS_CANVAS_VIEW (w))
......@@ -239,12 +229,6 @@ nautilus_desktop_canvas_view_dispose (GObject *object)
canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (object);
/* Remove desktop rescan timeout. */
if (canvas_view->details->reload_desktop_timeout != 0) {
g_source_remove (canvas_view->details->reload_desktop_timeout);
canvas_view->details->reload_desktop_timeout = 0;
}
g_signal_handlers_disconnect_by_func (nautilus_icon_view_preferences,
default_zoom_level_changed,
canvas_view);
......@@ -399,69 +383,6 @@ default_zoom_level_changed (gpointer user_data)
g_free (new_icon_size_string);
}
static gboolean
do_desktop_rescan (gpointer data)
{
NautilusDesktopCanvasView *desktop_canvas_view;
struct stat buf;
desktop_canvas_view = NAUTILUS_DESKTOP_CANVAS_VIEW (data);
if (desktop_canvas_view->details->pending_rescan) {
return TRUE;
}
if (stat (desktop_directory, &buf) == -1) {
return TRUE;
}
if (buf.st_ctime == desktop_dir_modify_time) {
return TRUE;
}
desktop_canvas_view->details->pending_rescan = TRUE;
nautilus_directory_force_reload
(nautilus_files_view_get_model (NAUTILUS_FILES_VIEW (desktop_canvas_view)));
return TRUE;
}
static void
done_loading (NautilusDirectory *model,
NautilusDesktopCanvasView *desktop_canvas_view)
{
struct stat buf;
desktop_canvas_view->details->pending_rescan = FALSE;
if (stat (desktop_directory, &buf) == -1) {
return;
}
desktop_dir_modify_time = buf.st_ctime;
}
/* This function is used because the NautilusDirectory model does not
* exist always in the desktop_canvas_view, so we wait until it has been
* instantiated.
*/
static void
delayed_init (NautilusDesktopCanvasView *desktop_canvas_view)
{
/* Keep track of the load time. */
g_signal_connect_object (nautilus_files_view_get_model (NAUTILUS_FILES_VIEW (desktop_canvas_view)),
"done-loading",
G_CALLBACK (done_loading), desktop_canvas_view, 0);
/* Monitor desktop directory. */
desktop_canvas_view->details->reload_desktop_timeout =
g_timeout_add_seconds (RESCAN_TIMEOUT, do_desktop_rescan, desktop_canvas_view);
g_signal_handler_disconnect (desktop_canvas_view,
desktop_canvas_view->details->delayed_init_signal);
desktop_canvas_view->details->delayed_init_signal = 0;
}
static void
font_changed_callback (gpointer callback_data)
{
......@@ -701,15 +622,6 @@ nautilus_desktop_canvas_view_init (NautilusDesktopCanvasView *desktop_canvas_vie
canvas_container = get_canvas_container (desktop_canvas_view);
nautilus_canvas_view_container_set_sort_desktop (NAUTILUS_CANVAS_VIEW_CONTAINER (canvas_container), TRUE);
/* Do a reload on the desktop if we don't have FAM, a smarter
* way to keep track of the items on the desktop.
*/
if (!nautilus_monitor_active ()) {
desktop_canvas_view->details->delayed_init_signal = g_signal_connect_object
(desktop_canvas_view, "begin-loading",
G_CALLBACK (delayed_init), desktop_canvas_view, 0);
}
nautilus_canvas_container_set_is_fixed_size (canvas_container, TRUE);
nautilus_canvas_container_set_is_desktop (canvas_container, TRUE);
nautilus_canvas_container_set_store_layout_timestamps (canvas_container, TRUE);
......
......@@ -849,8 +849,6 @@ check_force_reload (GFile *location,
if (type == NAUTILUS_LOCATION_CHANGE_RELOAD) {
force_reload = TRUE;
} else if (!nautilus_monitor_active ()) {
force_reload = TRUE;
} else {
force_reload = !nautilus_directory_is_local (directory);
}
......
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