44 GFileMonitorEvent event_type,
47 #define EV_FILE_MONITOR_GET_PRIVATE(object) \
48 (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_FILE_MONITOR, EvFileMonitorPrivate))
67 if (ev_monitor->priv->monitor) {
68 g_signal_handlers_disconnect_by_func (ev_monitor->priv->monitor,
71 g_object_unref (ev_monitor->priv->monitor);
72 ev_monitor->priv->monitor = NULL;
75 G_OBJECT_CLASS (ev_file_monitor_parent_class)->finalize (
object);
81 GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
89 g_signal_new (
"changed",
94 g_cclosure_marshal_VOID__VOID,
103 ev_monitor->priv->timeout_id = 0;
112 ev_monitor->priv->timeout_id =
113 g_timeout_add_seconds (5, (GSourceFunc)
timeout_cb, ev_monitor);
119 if (ev_monitor->priv->timeout_id > 0) {
120 g_source_remove (ev_monitor->priv->timeout_id);
121 ev_monitor->priv->timeout_id = 0;
129 GFileMonitorEvent event_type,
132 switch (event_type) {
133 case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
138 case G_FILE_MONITOR_EVENT_CHANGED:
151 GError *error = NULL;
155 file = g_file_new_for_uri (uri);
156 ev_monitor->priv->monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error);
157 if (ev_monitor->priv->monitor) {
158 g_signal_connect (ev_monitor->priv->monitor,
"changed",
161 g_warning (
"%s", error->message);
162 g_error_free (error);
165 g_object_unref (file);