X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/cad8aef3241efa0873fb0c003b563cf31a4c0f2e..3698c4e475fb59730626af5d001599785ef5ef9e:/src/gfilenotify.c diff --git a/src/gfilenotify.c b/src/gfilenotify.c index b5baa30d7a..3b1f2fc516 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c @@ -1,12 +1,12 @@ /* Filesystem notifications support with glib API. - Copyright (C) 2013-2015 Free Software Foundation, Inc. + Copyright (C) 2013-2016 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,10 +23,8 @@ along with GNU Emacs. If not, see . */ #include #include "lisp.h" #include "coding.h" -#include "frame.h" #include "termhooks.h" #include "keyboard.h" -#include "process.h" /* This is a list, elements are triples (DESCRIPTOR FILE FLAGS CALLBACK) */ @@ -112,6 +110,7 @@ dir_monitor_callback (GFileMonitor *monitor, /* Cancel monitor if file or directory is deleted. */ if (!NILP (Fmember (symbol, list2 (Qdeleted, Qmoved))) && + (strcmp (name, SSDATA (XCAR (XCDR (watch_object)))) == 0) && !g_file_monitor_is_cancelled (monitor)) g_file_monitor_cancel (monitor); } @@ -195,6 +194,7 @@ will be reported only in case of the `moved' event. */) /* Enable watch. */ monitor = g_file_monitor (gfile, gflags, NULL, &gerror); + g_object_unref (gfile); if (gerror) { char msg[1024]; @@ -215,6 +215,10 @@ will be reported only in case of the `moved' event. */) file); } + /* The default rate limit is 800 msec. We adapt this. */ + g_file_monitor_set_rate_limit (monitor, 100); + + /* Subscribe to the "changed" signal. */ g_signal_connect (monitor, "changed", (GCallback) dir_monitor_callback, NULL);