Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
|
|
|
|
|
|
|
|
nautilus-monitor.c: file and directory change monitoring for nautilus
|
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
Copyright (C) 2000, 2001 Eazel, Inc.
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
|
|
|
This program 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 2 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public
|
|
|
|
License along with this program; if not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
Authors: Seth Nickell <seth@eazel.com>
|
2001-09-15 19:18:15 +00:00
|
|
|
Darin Adler <darin@bentspoon.com>
|
2002-05-22 21:34:19 +00:00
|
|
|
Alex Graveley <alex@ximian.com>
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
*/
|
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
#include <config.h>
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
#include "nautilus-monitor.h"
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
#include "nautilus-file-changes-queue.h"
|
2002-05-22 21:34:19 +00:00
|
|
|
#include "nautilus-file-utilities.h"
|
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
#include <libgnome/gnome-util.h>
|
|
|
|
#include <libgnomevfs/gnome-vfs-utils.h>
|
2002-05-22 21:34:19 +00:00
|
|
|
#include <libgnomevfs/gnome-vfs-ops.h>
|
2003-11-05 16:20:01 +00:00
|
|
|
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
struct NautilusMonitor {
|
2002-05-22 21:34:19 +00:00
|
|
|
GnomeVFSMonitorHandle *handle;
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
};
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
gboolean
|
|
|
|
nautilus_monitor_active (void)
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
{
|
2002-05-22 21:34:19 +00:00
|
|
|
static gboolean tried_monitor = FALSE;
|
|
|
|
static gboolean monitor_success;
|
|
|
|
char *desktop_directory, *uri;
|
|
|
|
NautilusMonitor *monitor;
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
if (tried_monitor == FALSE) {
|
|
|
|
desktop_directory = nautilus_get_desktop_directory ();
|
|
|
|
uri = gnome_vfs_get_uri_from_local_path (desktop_directory);
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
monitor = nautilus_monitor_directory (uri);
|
|
|
|
monitor_success = (monitor != NULL);
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
if (monitor != NULL) {
|
|
|
|
nautilus_monitor_cancel (monitor);
|
|
|
|
}
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
g_free (desktop_directory);
|
|
|
|
g_free (uri);
|
2002-01-21 14:09:10 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
tried_monitor = TRUE;
|
2002-01-21 14:09:10 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
return monitor_success;
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
}
|
|
|
|
|
2001-09-15 00:35:56 +00:00
|
|
|
static gboolean
|
|
|
|
path_is_on_readonly_volume (const char *path)
|
|
|
|
{
|
2003-11-05 16:20:01 +00:00
|
|
|
GnomeVFSVolumeMonitor *volume_monitor;
|
|
|
|
GnomeVFSVolume *volume;
|
|
|
|
gboolean res;
|
|
|
|
|
2006-10-19 14:31:33 +00:00
|
|
|
g_assert (path != NULL);
|
|
|
|
|
2003-11-05 16:20:01 +00:00
|
|
|
volume_monitor = gnome_vfs_get_volume_monitor ();
|
|
|
|
volume = gnome_vfs_volume_monitor_get_volume_for_path (volume_monitor,
|
|
|
|
path);
|
|
|
|
res = FALSE;
|
2002-05-22 21:34:19 +00:00
|
|
|
if (volume != NULL) {
|
2003-11-05 16:20:01 +00:00
|
|
|
res = gnome_vfs_volume_is_read_only (volume);
|
|
|
|
gnome_vfs_volume_unref (volume);
|
2002-05-22 21:34:19 +00:00
|
|
|
}
|
2003-11-05 16:20:01 +00:00
|
|
|
return res;
|
2001-09-15 00:35:56 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
static gboolean call_consume_changes_idle_id = 0;
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
static gboolean
|
|
|
|
call_consume_changes_idle_cb (gpointer not_used)
|
2001-04-19 23:15:19 +00:00
|
|
|
{
|
2002-05-22 21:34:19 +00:00
|
|
|
nautilus_file_changes_consume_changes (TRUE);
|
|
|
|
call_consume_changes_idle_id = 0;
|
2001-04-19 23:15:19 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
static void
|
|
|
|
monitor_notify_cb (GnomeVFSMonitorHandle *handle,
|
|
|
|
const gchar *monitor_uri,
|
|
|
|
const gchar *info_uri,
|
|
|
|
GnomeVFSMonitorEventType event_type,
|
|
|
|
gpointer user_data)
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
{
|
2002-05-22 21:34:19 +00:00
|
|
|
switch (event_type) {
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_CHANGED:
|
|
|
|
nautilus_file_changes_queue_file_changed (info_uri);
|
|
|
|
break;
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_DELETED:
|
2006-12-08 09:23:17 +00:00
|
|
|
nautilus_file_changes_queue_schedule_metadata_remove (info_uri);
|
2002-05-22 21:34:19 +00:00
|
|
|
nautilus_file_changes_queue_file_removed (info_uri);
|
|
|
|
break;
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_CREATED:
|
|
|
|
nautilus_file_changes_queue_file_added (info_uri);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* None of the following are supported yet */
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_STARTEXECUTING:
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_STOPEXECUTING:
|
|
|
|
case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED:
|
|
|
|
break;
|
|
|
|
}
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
if (call_consume_changes_idle_id == 0) {
|
|
|
|
call_consume_changes_idle_id =
|
|
|
|
g_idle_add (call_consume_changes_idle_cb, NULL);
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
}
|
2002-05-22 21:34:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static NautilusMonitor *
|
|
|
|
monitor_add_internal (const char *uri, gboolean is_directory)
|
|
|
|
{
|
|
|
|
gchar *path;
|
|
|
|
NautilusMonitor *ret;
|
|
|
|
GnomeVFSResult result;
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
|
|
|
|
path = gnome_vfs_get_local_path_from_uri (uri);
|
2002-05-24 05:14:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't monitor URIs on a read-only volume.
|
|
|
|
* This is a hack to avoid FAM keeping open fds to CD-ROMs,
|
|
|
|
* causing unmount/eject to fail.
|
|
|
|
*/
|
|
|
|
if (path != NULL && path_is_on_readonly_volume (path) == TRUE) {
|
2002-05-22 21:34:19 +00:00
|
|
|
g_free (path);
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2002-05-22 21:34:19 +00:00
|
|
|
g_free (path);
|
Merge some stuff from the redhat-outstanding-patches branch
2001-09-05 Alex Larsson <alexl@redhat.com>
Merge some stuff from the redhat-outstanding-patches branch
* eazel-logos/default.xml:
* icons/default.xml:
don't hardcode the title, title info, and
shadow colors; this prevented the auto-color-selection stuff
in nautilus-sidebar-title.c from working properly.
And the hardcoded values were the same thing the autoselector
would have chosen anyhow.
* libnautilus-private/nautilus-monitor.c:
Don't monitor files on read only volumes, they never change, and
will keep cdroms from being unmounted because fam has open file
descriptors on them.
* libnautilus-private/nautilus-thumbnails.c:
Always look for local thumbnails first.
* libnautilus-private/nautilus-volume-monitor.[ch]:
Add nautilus_volume_is_read_only() and
nautilus_volume_monitor_get_volume_for_path()
* src/nautilus-desktop-window.c:
(set_wmspec_desktop_hint): function to set _NET_WM_WINDOW_TYPE, to
avoid confusing kwin so badly, and also to go ahead and support
the Window Manager Hints Of The Future.
(set_gdk_window_background): only set root background to a pixel
if we retrieved a pixel property
(map): Set background of our child widgets in addition to our
own background. This gets rid of the last of the ugliness during
Nautilus startup, I believe.
* src/file-manager/fm-icon-view.c:
Don't read GMC position meta data -- it is never right for nautilus,
due to different size icons, additional icons, different placement
policies, so falling back to normal automatic placement works better.
2001-09-11 01:20:43 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
ret = g_new0 (NautilusMonitor, 1);
|
|
|
|
|
|
|
|
result = gnome_vfs_monitor_add (&ret->handle,
|
|
|
|
uri,
|
|
|
|
is_directory == TRUE ?
|
|
|
|
GNOME_VFS_MONITOR_DIRECTORY :
|
|
|
|
GNOME_VFS_MONITOR_FILE,
|
|
|
|
monitor_notify_cb,
|
|
|
|
NULL);
|
|
|
|
if (result != GNOME_VFS_OK) {
|
|
|
|
g_free (ret);
|
Merge some stuff from the redhat-outstanding-patches branch
2001-09-05 Alex Larsson <alexl@redhat.com>
Merge some stuff from the redhat-outstanding-patches branch
* eazel-logos/default.xml:
* icons/default.xml:
don't hardcode the title, title info, and
shadow colors; this prevented the auto-color-selection stuff
in nautilus-sidebar-title.c from working properly.
And the hardcoded values were the same thing the autoselector
would have chosen anyhow.
* libnautilus-private/nautilus-monitor.c:
Don't monitor files on read only volumes, they never change, and
will keep cdroms from being unmounted because fam has open file
descriptors on them.
* libnautilus-private/nautilus-thumbnails.c:
Always look for local thumbnails first.
* libnautilus-private/nautilus-volume-monitor.[ch]:
Add nautilus_volume_is_read_only() and
nautilus_volume_monitor_get_volume_for_path()
* src/nautilus-desktop-window.c:
(set_wmspec_desktop_hint): function to set _NET_WM_WINDOW_TYPE, to
avoid confusing kwin so badly, and also to go ahead and support
the Window Manager Hints Of The Future.
(set_gdk_window_background): only set root background to a pixel
if we retrieved a pixel property
(map): Set background of our child widgets in addition to our
own background. This gets rid of the last of the ugliness during
Nautilus startup, I believe.
* src/file-manager/fm-icon-view.c:
Don't read GMC position meta data -- it is never right for nautilus,
due to different size icons, additional icons, different placement
policies, so falling back to normal automatic placement works better.
2001-09-11 01:20:43 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
return ret;
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
}
|
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
NautilusMonitor *
|
|
|
|
nautilus_monitor_directory (const char *uri)
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
{
|
2002-05-22 21:34:19 +00:00
|
|
|
return monitor_add_internal (uri, TRUE);
|
|
|
|
}
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
NautilusMonitor *
|
|
|
|
nautilus_monitor_file (const char *uri)
|
|
|
|
{
|
|
|
|
return monitor_add_internal (uri, FALSE);
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 21:34:19 +00:00
|
|
|
void
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
nautilus_monitor_cancel (NautilusMonitor *monitor)
|
2002-05-22 21:34:19 +00:00
|
|
|
{
|
|
|
|
if (monitor->handle != NULL) {
|
|
|
|
gnome_vfs_monitor_cancel (monitor->handle);
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
}
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
|
Some work on FAM.
* libnautilus-extensions/nautilus-monitor.h:
* libnautilus-extensions/nautilus-monitor.c: (get_fam_connection),
(get_request_hash_table), (get_event_uri),
(process_fam_notifications), (nautilus_monitor_file),
(nautilus_monitor_directory), (nautilus_monitor_cancel): Improved
API, fixed some storage leaks, simplified some code, made it
handle URI escaping properly, use the file changes queue. Almost
ready for prime time!
* libnautilus-extensions/nautilus-file-changes-queue.h:
* libnautilus-extensions/nautilus-file-changes-queue.c:
(nautilus_file_changes_queue_file_changed),
(nautilus_file_changes_consume_changes):
* libnautilus-extensions/nautilus-directory-notify.h:
* libnautilus-extensions/nautilus-directory.c:
(call_files_changed_unref_free_list),
(nautilus_directory_notify_files_changed):
Added a new kind of notification for the file changed case.
2001-04-16 22:07:01 +00:00
|
|
|
g_free (monitor);
|
Add some initial code to deal with file notification and monitoring. This
2001-04-12 Seth Nickell <snickell@stanford.edu>
Add some initial code to deal with file notification and
monitoring. This isn't hooked in yet, but provides interfaces
for Nautilus code to use.
* configure.in:
Add configure checks for FAM.
* libnautilus-extensions/Makefile.am:
Include FAM libraries if they exist.
* libnautilus-extensions/nautilus-monitor.c:
(nautilus_monitor_establish_connection),
(nautilus_monitor_get_fam),
(nautilus_monitor_find_path_from_request),
(nautilus_monitor_find_request_from_path),
(nautilus_monitor_delete_first_request_found),
(nautilus_monitor_get_uri),
(nautilus_monitor_process_fam_notifications),
(nautilus_monitor_add_file), (nautilus_monitor_add_directory),
(nautilus_monitor_remove):
* libnautilus-extensions/nautilus-monitor.h:
The code that actually communicates w/ FAM.
2001-04-12 22:43:38 +00:00
|
|
|
}
|