Add g_file_monitor
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 2 Jul 2008 17:19:16 +0000 (17:19 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 2 Jul 2008 17:19:16 +0000 (17:19 +0000)
svn path=/trunk/; revision=7145

docs/reference/ChangeLog
docs/reference/gio/gio-sections.txt
gio/ChangeLog
gio/gfile.c
gio/gfile.h
gio/gio.symbols

index ab426e21fb5415d58cc4ea113241d07deb18958d..4100a0323071891557e0d59f5efcb44564e95b96 100644 (file)
@@ -1,6 +1,7 @@
 2008-07-02  Matthias Clasen  <mclasen@redhat.com>
 
        * gio/gio-sections.txt: Add g_desktop_app_info_new_from_keyfile
+       and g_file_monitor
 
 2008-07-01  Matthias Clasen  <mclasen@redhat.com>
 
index 3e07ce9ab70930d671701fb70212cda10224b0e5..52a1482040fb55825249e6c583ab1f73cc7ca7ee 100644 (file)
@@ -115,6 +115,7 @@ g_file_mount_enclosing_volume
 g_file_mount_enclosing_volume_finish
 g_file_monitor_directory
 g_file_monitor_file
+g_file_monitor
 g_file_load_contents
 g_file_load_contents_async
 g_file_load_contents_finish
index 723a216a9bc2e8b29219bd24fb6d659dc8104d93..13ea0e3ddbcc1ffc57537168e19d9ee295b2f430 100644 (file)
@@ -1,3 +1,11 @@
+2008-07-02  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 536160 – Add g_file_monitor()
+
+       * gio.symbols:
+       * gfile.[hc]: Add g_file_monitor which can return either
+       a file or a directory monitor.  Proposed by Behdad Esfahbod
+
 2008-07-02  Matthias Clasen  <mclasen@redhat.com>
 
        536733 – gio build failure on Irix
index da793d0bb2f507a4af701cb462fffd7ba9efa0e6..7ba61089432d6b15623cee95928134798245b25e 100644 (file)
@@ -3896,6 +3896,36 @@ g_file_monitor_file (GFile             *file,
   return monitor;
 }
 
+/**
+ * g_file_monitor:
+ * @file: input #GFile
+ * @flags: a set of #GFileMonitorFlags
+ * @cancellable: optional #GCancellable object, %NULL to ignore
+ * @error: a #GError, or %NULL
+ * 
+ * Obtains a file or directory monitor for the given file, depending
+ * on the type of the file.
+ *
+ * If @cancellable is not %NULL, then the operation can be cancelled by
+ * triggering the cancellable object from another thread. If the operation
+ * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. 
+ * 
+ * Returns: a #GFileMonitor for the given @file.
+ *
+ * Since: 2.18
+ */
+GFileMonitor*
+g_file_monitor (GFile             *file,
+               GFileMonitorFlags  flags,
+               GCancellable      *cancellable,
+               GError           **error)
+{
+  if (g_file_query_file_type (file, 0, cancellable) == G_FILE_TYPE_DIRECTORY)
+    return g_file_monitor_directory (file, flags, cancellable, error);
+  else
+    return g_file_monitor_file (file, flags, cancellable, error);
+}
+
 /********************************************
  *   Default implementation of async ops    *
  ********************************************/
index 9bb5b446529948b2b5de78866f6c08c528e65619..58b29923e17b832645f5389624a664e062653282 100644 (file)
@@ -749,6 +749,10 @@ GFileMonitor*           g_file_monitor_file               (GFile
                                                           GFileMonitorFlags       flags,
                                                           GCancellable           *cancellable,
                                                           GError                **error);
+GFileMonitor*           g_file_monitor                    (GFile                  *file,
+                                                          GFileMonitorFlags       flags,
+                                                          GCancellable           *cancellable,
+                                                          GError                **error);
 
 
 /* Utilities */
index 6c5738ad0a48e8844787ab634308461e665154f4..9a890f4606179a9f68f54595ed051782c034e500 100644 (file)
@@ -300,6 +300,7 @@ g_file_eject_mountable_finish
 g_file_copy_attributes
 g_file_monitor_directory
 g_file_monitor_file
+g_file_monitor
 g_file_query_default_handler
 g_file_load_contents
 g_file_load_contents_async