[glib/wip/desrt/mountmonitor: 59/65] Rename g_unix_mount_monitor_new() to _get()



commit 9c1e1fabc87b195edad4e01ddaf8df19a5a970a0
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jan 8 02:03:18 2015 -0500

    Rename g_unix_mount_monitor_new() to _get()
    
    This is a singleton, but we have a function called _new() to get it.
    What's worse is that the documentation makes no mention of this, and
    actually specifically says that a new monitor will be created each time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742599

 docs/reference/gio/gio-sections.txt |    1 +
 gio/glocaldirectorymonitor.c        |    2 +-
 gio/gunixmounts.c                   |   41 ++++++++++++++++++++++++++--------
 gio/gunixmounts.h                   |    4 ++-
 gio/gunixvolumemonitor.c            |    2 +-
 5 files changed, 37 insertions(+), 13 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index 4e5e907..ae5e0ab 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -1541,6 +1541,7 @@ g_unix_mounts_get
 g_unix_mount_at
 g_unix_mounts_changed_since
 g_unix_mount_points_changed_since
+g_unix_mount_monitor_get
 g_unix_mount_monitor_new
 g_unix_mount_monitor_set_rate_limit
 g_unix_is_mount_path_system_internal
diff --git a/gio/glocaldirectorymonitor.c b/gio/glocaldirectorymonitor.c
index d85d752..9bc9fa6 100644
--- a/gio/glocaldirectorymonitor.c
+++ b/gio/glocaldirectorymonitor.c
@@ -109,7 +109,7 @@ g_local_directory_monitor_start (GLocalDirectoryMonitor *local_monitor)
       if (mount)
         g_unix_mount_free (mount);
 
-      local_monitor->mount_monitor = g_unix_mount_monitor_new ();
+      local_monitor->mount_monitor = g_unix_mount_monitor_get ();
       g_signal_connect_object (local_monitor->mount_monitor, "mounts-changed",
                                G_CALLBACK (mounts_changed), local_monitor, 0);
 #endif
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index d8d2161..99266c9 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -1514,17 +1514,20 @@ g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,
 }
 
 /**
- * g_unix_mount_monitor_new:
- * 
- * Gets a new #GUnixMountMonitor. The default rate limit for which the
- * monitor will report consecutive changes for the mount and mount
- * point entry files is the default for a #GFileMonitor. Use
- * g_unix_mount_monitor_set_rate_limit() to change this.
- * 
- * Returns: a #GUnixMountMonitor. 
- */
+ * g_unix_mount_monitor_get:
+ *
+ * Gets the #GUnixMountMonitor.
+ *
+ * The mount monitor can be used to monitor for changes to the list of
+ * mounted filesystems as well as the list of mount points (ie: fstab
+ * entries).
+ *
+ * Returns: (transfer full): the #GUnixMountMonitor.
+ *
+ * Since: 2.44
+ **/
 GUnixMountMonitor *
-g_unix_mount_monitor_new (void)
+g_unix_mount_monitor_get (void)
 {
   if (the_mount_monitor == NULL)
     {
@@ -1536,6 +1539,24 @@ g_unix_mount_monitor_new (void)
 }
 
 /**
+ * g_unix_mount_monitor_new:
+ *
+ * Deprecated alias for g_unix_mount_monitor_get().
+ *
+ * This function was never a true constructor, which is why it was
+ * renamed.
+ *
+ * Returns: a #GUnixMountMonitor.
+ *
+ * Deprecated:2.44:Use g_unix_mount_monitor_get() instead.
+ */
+GUnixMountMonitor *
+g_unix_mount_monitor_new (void)
+{
+  return g_unix_mount_monitor_get ();
+}
+
+/**
  * g_unix_mount_free:
  * @mount_entry: a #GUnixMountEntry.
  * 
diff --git a/gio/gunixmounts.h b/gio/gunixmounts.h
index 1406d67..5f78ae5 100644
--- a/gio/gunixmounts.h
+++ b/gio/gunixmounts.h
@@ -126,7 +126,9 @@ gboolean       g_unix_mount_points_changed_since    (guint64             time);
 
 GLIB_AVAILABLE_IN_ALL
 GType              g_unix_mount_monitor_get_type       (void) G_GNUC_CONST;
-GLIB_AVAILABLE_IN_ALL
+GLIB_AVAILABLE_IN_2_44
+GUnixMountMonitor *g_unix_mount_monitor_get            (void);
+GLIB_DEPRECATED_IN_2_44_FOR(g_unix_mount_monitor_get)
 GUnixMountMonitor *g_unix_mount_monitor_new            (void);
 GLIB_AVAILABLE_IN_ALL
 void               g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,
diff --git a/gio/gunixvolumemonitor.c b/gio/gunixvolumemonitor.c
index 130ca62..b0508c9 100644
--- a/gio/gunixvolumemonitor.c
+++ b/gio/gunixvolumemonitor.c
@@ -209,7 +209,7 @@ static void
 g_unix_volume_monitor_init (GUnixVolumeMonitor *unix_monitor)
 {
 
-  unix_monitor->mount_monitor = g_unix_mount_monitor_new ();
+  unix_monitor->mount_monitor = g_unix_mount_monitor_get ();
 
   g_signal_connect (unix_monitor->mount_monitor,
                    "mounts-changed", G_CALLBACK (mounts_changed),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]