mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
2008-05-12 Dan Williams <dcbw@redhat.com>
* gfilemonitor/glocaldirectorymonitor.c gfilemonitor/glocaldirectorymonitor.h - (g_local_directory_monitor_constructor): actually subscribe to the watch - (_g_local_directory_monitor_new): ensure that inotify is started up * gfilemonitor/glocalfilemonitor.c gfilemonitor/glocalfilemonitor.h - (g_local_file_monitor_constructor): actually subscribe to the watch - (_g_local_file_monitor_new): ensure that inotify is started up git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3661 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
09d50dbe9d
commit
20dddc2c2b
5 changed files with 50 additions and 0 deletions
13
ChangeLog
13
ChangeLog
|
|
@ -1,3 +1,16 @@
|
||||||
|
2008-05-12 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* gfilemonitor/glocaldirectorymonitor.c
|
||||||
|
gfilemonitor/glocaldirectorymonitor.h
|
||||||
|
- (g_local_directory_monitor_constructor): actually subscribe to the
|
||||||
|
watch
|
||||||
|
- (_g_local_directory_monitor_new): ensure that inotify is started up
|
||||||
|
|
||||||
|
* gfilemonitor/glocalfilemonitor.c
|
||||||
|
gfilemonitor/glocalfilemonitor.h
|
||||||
|
- (g_local_file_monitor_constructor): actually subscribe to the watch
|
||||||
|
- (_g_local_file_monitor_new): ensure that inotify is started up
|
||||||
|
|
||||||
2008-05-11 Dan Williams <dcbw@redhat.com>
|
2008-05-11 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* configure.in
|
* configure.in
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "inotify-helper.h"
|
||||||
#include "glocaldirectorymonitor.h"
|
#include "glocaldirectorymonitor.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
@ -47,6 +49,8 @@ g_local_directory_monitor_finalize (GObject *object)
|
||||||
|
|
||||||
g_free (local_monitor->dirname);
|
g_free (local_monitor->dirname);
|
||||||
|
|
||||||
|
_ih_sub_free (local_monitor->sub);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (local_monitor->mount_monitor)
|
if (local_monitor->mount_monitor)
|
||||||
{
|
{
|
||||||
|
|
@ -108,8 +112,13 @@ g_local_directory_monitor_constructor (GType type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert (dirname);
|
||||||
local_monitor->dirname = g_strdup (dirname);
|
local_monitor->dirname = g_strdup (dirname);
|
||||||
|
|
||||||
|
local_monitor->sub = _ih_sub_new (local_monitor->dirname, NULL, local_monitor);
|
||||||
|
g_assert (local_monitor->sub);
|
||||||
|
g_assert (_ih_sub_add (local_monitor->sub));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!klass->mount_notify)
|
if (!klass->mount_notify)
|
||||||
{
|
{
|
||||||
|
|
@ -223,6 +232,10 @@ _g_local_directory_monitor_new (const char *dirname,
|
||||||
GFileMonitorFlags flags,
|
GFileMonitorFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
if (!_ih_startup ()) {
|
||||||
|
g_set_error (error, 0, 0, "inotify is unsupported!!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return G_FILE_MONITOR (g_object_new (G_TYPE_LOCAL_DIRECTORY_MONITOR, "dirname", dirname, NULL));
|
return G_FILE_MONITOR (g_object_new (G_TYPE_LOCAL_DIRECTORY_MONITOR, "dirname", dirname, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include "gfilemonitor.h"
|
#include "gfilemonitor.h"
|
||||||
|
#include "inotify-sub.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
@ -43,6 +44,7 @@ struct _GLocalDirectoryMonitor
|
||||||
{
|
{
|
||||||
GFileMonitor parent_instance;
|
GFileMonitor parent_instance;
|
||||||
gchar *dirname;
|
gchar *dirname;
|
||||||
|
inotify_sub *sub;
|
||||||
#if 0
|
#if 0
|
||||||
/* For mount emulation */
|
/* For mount emulation */
|
||||||
GUnixMountMonitor *mount_monitor;
|
GUnixMountMonitor *mount_monitor;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "inotify-helper.h"
|
||||||
#include "glocalfilemonitor.h"
|
#include "glocalfilemonitor.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
@ -65,6 +67,7 @@ g_local_file_monitor_constructor (GType type,
|
||||||
GObjectClass *parent_class;
|
GObjectClass *parent_class;
|
||||||
GLocalFileMonitor *local_monitor;
|
GLocalFileMonitor *local_monitor;
|
||||||
const gchar *filename = NULL;
|
const gchar *filename = NULL;
|
||||||
|
gchar *dname, *fname;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
klass = G_LOCAL_FILE_MONITOR_CLASS (g_type_class_peek (G_TYPE_LOCAL_FILE_MONITOR));
|
klass = G_LOCAL_FILE_MONITOR_CLASS (g_type_class_peek (G_TYPE_LOCAL_FILE_MONITOR));
|
||||||
|
|
@ -90,6 +93,17 @@ g_local_file_monitor_constructor (GType type,
|
||||||
g_warning ("%s: warning: filename was NULL", __func__);
|
g_warning ("%s: warning: filename was NULL", __func__);
|
||||||
|
|
||||||
local_monitor->filename = g_strdup (filename);
|
local_monitor->filename = g_strdup (filename);
|
||||||
|
|
||||||
|
fname = g_path_get_basename (filename);
|
||||||
|
dname = g_path_get_dirname (filename);
|
||||||
|
|
||||||
|
local_monitor->sub = _ih_sub_new (dname, fname, local_monitor);
|
||||||
|
g_free (fname);
|
||||||
|
g_free (dname);
|
||||||
|
|
||||||
|
g_assert (local_monitor->sub);
|
||||||
|
g_assert (_ih_sub_add (local_monitor->sub));
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,6 +117,8 @@ g_local_file_monitor_finalize (GObject *object)
|
||||||
local_monitor->filename = NULL;
|
local_monitor->filename = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ih_sub_free (local_monitor->sub);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (g_local_file_monitor_parent_class)->finalize)
|
if (G_OBJECT_CLASS (g_local_file_monitor_parent_class)->finalize)
|
||||||
(*G_OBJECT_CLASS (g_local_file_monitor_parent_class)->finalize) (object);
|
(*G_OBJECT_CLASS (g_local_file_monitor_parent_class)->finalize) (object);
|
||||||
}
|
}
|
||||||
|
|
@ -138,6 +154,10 @@ _g_local_file_monitor_new (const char *pathname,
|
||||||
GFileMonitorFlags flags,
|
GFileMonitorFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
if (!_ih_startup ()) {
|
||||||
|
g_set_error (error, 0, 0, "inotify is unsupported!!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return G_FILE_MONITOR (g_object_new (G_TYPE_LOCAL_FILE_MONITOR, "filename", pathname, NULL));
|
return G_FILE_MONITOR (g_object_new (G_TYPE_LOCAL_FILE_MONITOR, "filename", pathname, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include "gfilemonitor.h"
|
#include "gfilemonitor.h"
|
||||||
|
#include "inotify-sub.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
@ -43,6 +44,7 @@ struct _GLocalFileMonitor
|
||||||
{
|
{
|
||||||
GFileMonitor parent_instance;
|
GFileMonitor parent_instance;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
inotify_sub *sub;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GLocalFileMonitorClass {
|
struct _GLocalFileMonitorClass {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue