gio: Fix regression encoding an array of doubles
[platform/upstream/glib.git] / gio / inotify / inotify-helper.c
index 6ee0b4b..abf66c8 100644 (file)
@@ -16,8 +16,7 @@
 
    You should have received a copy of the GNU Library General Public
    License along with the Gnome Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
+   see <http://www.gnu.org/licenses/>.
 
    Authors: 
                 John McCutchan <john@johnmccutchan.com>
 #include "inotify-helper.h"
 #include "inotify-missing.h"
 #include "inotify-path.h"
-#include "inotify-diag.h"
 
 static gboolean ih_debug_enabled = FALSE;
 #define IH_W if (ih_debug_enabled) g_warning 
 
-static void ih_event_callback (ik_event_t *event, inotify_sub *sub);
+static void ih_event_callback (ik_event_t  *event,
+                              inotify_sub *sub,
+                              gboolean     file_event);
 static void ih_not_missing_callback (inotify_sub *sub);
 
 /* We share this lock with inotify-kernel.c and inotify-missing.c
@@ -54,7 +54,7 @@ static void ih_not_missing_callback (inotify_sub *sub);
  *
  * We take the lock in all public functions
  */
-G_GNUC_INTERNAL G_LOCK_DEFINE (inotify_lock);
+G_LOCK_DEFINE (inotify_lock);
 
 static GFileMonitorEvent ih_mask_to_EventFlags (guint32 mask);
 
@@ -64,7 +64,7 @@ static GFileMonitorEvent ih_mask_to_EventFlags (guint32 mask);
  * Initializes the inotify backend.  This must be called before
  * any other functions in this module.
  *
- * Return value: #TRUE if initialization succeeded, #FALSE otherwise
+ * Returns: #TRUE if initialization succeeded, #FALSE otherwise
  */
 gboolean
 _ih_startup (void)
@@ -87,7 +87,6 @@ _ih_startup (void)
       return FALSE;
     }
   _im_startup (ih_not_missing_callback);
-  _id_startup ();
 
   IH_W ("started gvfs inotify backend\n");
   
@@ -135,11 +134,15 @@ _ih_sub_cancel (inotify_sub *sub)
 }
 
 static char *
-_ih_fullpath_from_event (ik_event_t *event, const char *dirname)
+_ih_fullpath_from_event (ik_event_t *event,
+                        const char *dirname,
+                        const char *filename)
 {
   char *fullpath;
 
-  if (event->name)
+  if (filename)
+    fullpath = g_strdup_printf ("%s/%s", dirname, filename);
+  else if (event->name)
     fullpath = g_strdup_printf ("%s/%s", dirname, event->name);
   else
     fullpath = g_strdup_printf ("%s/", dirname);
@@ -163,7 +166,8 @@ ih_event_is_paired_move (ik_event_t *event)
 
 static void
 ih_event_callback (ik_event_t  *event, 
-                   inotify_sub *sub)
+                   inotify_sub *sub,
+                  gboolean     file_event)
 {
   gchar *fullpath;
   GFileMonitorEvent eflags;
@@ -171,14 +175,15 @@ ih_event_callback (ik_event_t  *event,
   GFile* other;
 
   eflags = ih_mask_to_EventFlags (event->mask);
-  fullpath = _ih_fullpath_from_event (event, sub->dirname);
+  fullpath = _ih_fullpath_from_event (event, sub->dirname,
+                                     file_event ? sub->filename : NULL);
   child = g_file_new_for_path (fullpath);
   g_free (fullpath);
 
   if (ih_event_is_paired_move (event) && sub->pair_moves)
     {
       const char *parent_dir = (char *) _ip_get_path_for_wd (event->pair->wd);
-      fullpath = _ih_fullpath_from_event (event->pair, parent_dir);
+      fullpath = _ih_fullpath_from_event (event->pair, parent_dir, NULL);
       other = g_file_new_for_path (fullpath);
       g_free (fullpath);
       eflags = G_FILE_MONITOR_EVENT_MOVED;