Update glib to 2.44.1

Highlights from the release notes:

* Don't redefine typedefs to avoid build problems on OpenBSD
* Improve the default application algorithm
* Bump the number of children a GType can have
* GUnixMountMonitor now properly supports multiple main contexts
* many documentation improvements and cleanups.  We are now
  approaching a point where the documentation is 100% complete and the
  xml will build without warnings.  This will probably be enabled by
  default in the next cycle.
* new support for HTTP proxies in GIO
* new GTask:completed property
* use "private" futexes in order to further improve the performance of
  the contended case of GMutex and g_bit_lock()
* GApplication now has an "is-busy" property, allowing one to query the
  effective busy state.
* new GSimpleIOStream class to construct a GIOStream from an arbitrary
  GInputStream and GOutputStream
* GApplication: new API for marking 'busy' state according to the value
  of a boolean property on another object
* GOptionGroup: add binding support (boxed type, annotation fixes, etc.)
* GType now has type declaration macros G_DECLARE_DERIVABLE_TYPE,
  G_DECLARE_FINAL_TYPE and G_DECLARE_INTERFACE, which significantly reduce
  the boilerplate needed for GObject types and interfaces.
* g_autoptr and g_auto are macros for declaring variables with automatic
  cleanup. They only work with gcc and clang.
* GListModel is a new interface that represents a dynamic list of GObjects.
* GListStore is a GSequence-based implementation of GListModel.
* Support thread names on OS X
* g_simple_action_set_state_hint: New function to set the state hint
  of GSimpleActions
* g_win32_check_windows_version: New function to check Windows version
* g_settings_schema_list_children and g_settings_schema_key_get_name
* add g_set_object() convenience function
* GNetworkMonitor: check if NM is not running and don't crash
* fix some races with g_mkdir_with_parents
* fix some warnings in MSVC
* avoid use of G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC in order to save
  on static strings
* fix some content type vs. mime issues
* documentation improvements
* GSocket: avoid unnecessary g_socket_wait_condition() for blocking sockets
* Implement GContentType on OSX
* New function: g_strv_contains
* New function: g_network_address_new_loopback
* New function: g_socket_send_messages
* A new GNetworkMonitor implementation using NetworkManager provides
  more detailed connectivity information
* GQueue now accepts NULL as a sibling in g_queue_insert_before() and
  g_queue_insert_after()
* Need to disable SSLv3 in glib-networking
* GObject gained a debug option to provide instance counts. To use it,
  set GOBJECT_DEBUG=instance-count and call g_type_get_instance_count().
* GOption now has a strict POSIX mode in which it stops parsing arguments
  as soon as a non-option argument is encountered.
* ... and many other bug fixes.
* Many translations updated.

For full details see:

https://git.gnome.org/browse/glib/tree/NEWS?h=glib-2-44
This commit is contained in:
prlw1 2015-06-10 23:00:05 +00:00
parent 766d5555f7
commit 98f0b6033c
5 changed files with 432 additions and 40 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile.common,v 1.44 2015/03/14 01:24:54 prlw1 Exp $
# $NetBSD: Makefile.common,v 1.45 2015/06/10 23:00:05 prlw1 Exp $
#
# used by devel/glib2/Makefile
# used by devel/gdbus-codegen/Makefile
@ -6,7 +6,7 @@
# When updating this package, please apply patch-ak to configure.in and
# then run a matching version of autoconf to regen patch-aa.
DISTNAME= glib-2.42.2
DISTNAME= glib-2.44.1
PKGNAME= ${DISTNAME:S/glib/glib2/}
CATEGORIES= # empty; redefined in Makefile
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/glib/${PKGVERSION_NOREV:R}/}

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.83 2015/03/14 01:24:54 prlw1 Exp $
@comment $NetBSD: PLIST,v 1.84 2015/06/10 23:00:05 prlw1 Exp $
bin/gapplication
bin/gdbus
bin/gio-querymodules
@ -86,6 +86,7 @@ include/glib/glib-2.0/gio/ginetaddressmask.h
include/glib/glib-2.0/gio/ginetsocketaddress.h
include/glib/glib-2.0/gio/ginitable.h
include/glib/glib-2.0/gio/ginputstream.h
include/glib/glib-2.0/gio/gio-autocleanups.h
include/glib/glib-2.0/gio/gio.h
include/glib/glib-2.0/gio/gioenums.h
include/glib/glib-2.0/gio/gioenumtypes.h
@ -94,6 +95,8 @@ include/glib/glib-2.0/gio/giomodule.h
include/glib/glib-2.0/gio/gioscheduler.h
include/glib/glib-2.0/gio/giostream.h
include/glib/glib-2.0/gio/giotypes.h
include/glib/glib-2.0/gio/glistmodel.h
include/glib/glib-2.0/gio/gliststore.h
include/glib/glib-2.0/gio/gloadableicon.h
include/glib/glib-2.0/gio/gmemoryinputstream.h
include/glib/glib-2.0/gio/gmemoryoutputstream.h
@ -128,6 +131,7 @@ include/glib/glib-2.0/gio/gsettingsschema.h
include/glib/glib-2.0/gio/gsimpleaction.h
include/glib/glib-2.0/gio/gsimpleactiongroup.h
include/glib/glib-2.0/gio/gsimpleasyncresult.h
include/glib/glib-2.0/gio/gsimpleiostream.h
include/glib/glib-2.0/gio/gsimplepermission.h
include/glib/glib-2.0/gio/gsimpleproxyresolver.h
include/glib/glib-2.0/gio/gsocket.h
@ -199,6 +203,7 @@ include/glib/glib-2.0/glib/gi18n-lib.h
include/glib/glib-2.0/glib/gi18n.h
include/glib/glib-2.0/glib/giochannel.h
include/glib/glib-2.0/glib/gkeyfile.h
include/glib/glib-2.0/glib/glib-autocleanups.h
include/glib/glib-2.0/glib/glist.h
include/glib/glib-2.0/glib/gmacros.h
include/glib/glib-2.0/glib/gmain.h
@ -250,6 +255,7 @@ include/glib/glib-2.0/gobject/gclosure.h
include/glib/glib-2.0/gobject/genums.h
include/glib/glib-2.0/gobject/glib-types.h
include/glib/glib-2.0/gobject/gmarshal.h
include/glib/glib-2.0/gobject/gobject-autocleanups.h
include/glib/glib-2.0/gobject/gobject.h
include/glib/glib-2.0/gobject/gobjectnotifyqueue.c
include/glib/glib-2.0/gobject/gparam.h
@ -280,8 +286,8 @@ lib/pkgconfig/gthread-2.0.pc
share/aclocal/glib-2.0.m4
share/aclocal/glib-gettext.m4
share/aclocal/gsettings.m4
share/gdb/auto-load/libglib-2.0.so.0.4200.2-gdb.py
share/gdb/auto-load/libgobject-2.0.so.0.4200.2-gdb.py
share/gdb/auto-load/libglib-2.0.so.0.4400.1-gdb.py
share/gdb/auto-load/libgobject-2.0.so.0.4400.1-gdb.py
share/glib-2.0/gdb/glib.py
share/glib-2.0/gdb/gobject.py
share/glib-2.0/gettext/po/Makefile.in.in
@ -301,6 +307,7 @@ share/gtk-doc/html/gio/GAsyncInitable.html
share/gtk-doc/html/gio/GAsyncResult.html
share/gtk-doc/html/gio/GBufferedInputStream.html
share/gtk-doc/html/gio/GBufferedOutputStream.html
share/gtk-doc/html/gio/GBytesIcon.html
share/gtk-doc/html/gio/GCancellable.html
share/gtk-doc/html/gio/GCharsetConverter.html
share/gtk-doc/html/gio/GConverter.html
@ -342,9 +349,12 @@ share/gtk-doc/html/gio/GIOModule.html
share/gtk-doc/html/gio/GIOStream.html
share/gtk-doc/html/gio/GIcon.html
share/gtk-doc/html/gio/GInetAddress.html
share/gtk-doc/html/gio/GInetAddressMask.html
share/gtk-doc/html/gio/GInetSocketAddress.html
share/gtk-doc/html/gio/GInitable.html
share/gtk-doc/html/gio/GInputStream.html
share/gtk-doc/html/gio/GListModel.html
share/gtk-doc/html/gio/GListStore.html
share/gtk-doc/html/gio/GLoadableIcon.html
share/gtk-doc/html/gio/GMemoryInputStream.html
share/gtk-doc/html/gio/GMemoryOutputStream.html
@ -355,21 +365,25 @@ share/gtk-doc/html/gio/GMountOperation.html
share/gtk-doc/html/gio/GNetworkAddress.html
share/gtk-doc/html/gio/GNetworkMonitor.html
share/gtk-doc/html/gio/GNetworkService.html
share/gtk-doc/html/gio/GNotification.html
share/gtk-doc/html/gio/GOutputStream.html
share/gtk-doc/html/gio/GPermission.html
share/gtk-doc/html/gio/GPollableInputStream.html
share/gtk-doc/html/gio/GPollableOutputStream.html
share/gtk-doc/html/gio/GPropertyAction.html
share/gtk-doc/html/gio/GProxy.html
share/gtk-doc/html/gio/GProxyAddress.html
share/gtk-doc/html/gio/GProxyResolver.html
share/gtk-doc/html/gio/GRemoteActionGroup.html
share/gtk-doc/html/gio/GResolver.html
share/gtk-doc/html/gio/GResource.html
share/gtk-doc/html/gio/GSeekable.html
share/gtk-doc/html/gio/GSettings.html
share/gtk-doc/html/gio/GSettingsBackend.html
share/gtk-doc/html/gio/GSimpleAction.html
share/gtk-doc/html/gio/GSimpleActionGroup.html
share/gtk-doc/html/gio/GSimpleAsyncResult.html
share/gtk-doc/html/gio/GSimpleIOStream.html
share/gtk-doc/html/gio/GSimplePermission.html
share/gtk-doc/html/gio/GSimpleProxyResolver.html
share/gtk-doc/html/gio/GSocket.html
@ -382,6 +396,7 @@ share/gtk-doc/html/gio/GSocketListener.html
share/gtk-doc/html/gio/GSocketService.html
share/gtk-doc/html/gio/GSrvTarget.html
share/gtk-doc/html/gio/GSubprocess.html
share/gtk-doc/html/gio/GSubprocessLauncher.html
share/gtk-doc/html/gio/GTask.html
share/gtk-doc/html/gio/GTcpConnection.html
share/gtk-doc/html/gio/GTcpWrapperConnection.html
@ -423,6 +438,7 @@ share/gtk-doc/html/gio/api-index-2-36.html
share/gtk-doc/html/gio/api-index-2-38.html
share/gtk-doc/html/gio/api-index-2-40.html
share/gtk-doc/html/gio/api-index-2-42.html
share/gtk-doc/html/gio/api-index-2-44.html
share/gtk-doc/html/gio/api-index-deprecated.html
share/gtk-doc/html/gio/api-index-full.html
share/gtk-doc/html/gio/application.html
@ -430,23 +446,24 @@ share/gtk-doc/html/gio/async.html
share/gtk-doc/html/gio/ch01.html
share/gtk-doc/html/gio/ch02.html
share/gtk-doc/html/gio/ch03.html
share/gtk-doc/html/gio/ch30.html
share/gtk-doc/html/gio/ch31.html
share/gtk-doc/html/gio/ch31s02.html
share/gtk-doc/html/gio/ch31s03.html
share/gtk-doc/html/gio/ch32.html
share/gtk-doc/html/gio/ch32s02.html
share/gtk-doc/html/gio/ch32s03.html
share/gtk-doc/html/gio/ch32s04.html
share/gtk-doc/html/gio/ch32s05.html
share/gtk-doc/html/gio/ch32s06.html
share/gtk-doc/html/gio/ch32s07.html
share/gtk-doc/html/gio/ch33.html
share/gtk-doc/html/gio/ch33s02.html
share/gtk-doc/html/gio/ch33s03.html
share/gtk-doc/html/gio/ch33s04.html
share/gtk-doc/html/gio/ch33s05.html
share/gtk-doc/html/gio/ch33s06.html
share/gtk-doc/html/gio/ch33s07.html
share/gtk-doc/html/gio/ch34.html
share/gtk-doc/html/gio/ch34s02.html
share/gtk-doc/html/gio/ch34s03.html
share/gtk-doc/html/gio/ch34s04.html
share/gtk-doc/html/gio/ch34s05.html
share/gtk-doc/html/gio/conversion.html
share/gtk-doc/html/gio/data-models.html
share/gtk-doc/html/gio/extending-gio.html
share/gtk-doc/html/gio/extending.html
share/gtk-doc/html/gio/failable_initialization.html
@ -465,7 +482,6 @@ share/gtk-doc/html/gio/gio-D-Bus-Utilities.html
share/gtk-doc/html/gio/gio-Desktop-file-based-GAppInfo.html
share/gtk-doc/html/gio/gio-Extension-Points.html
share/gtk-doc/html/gio/gio-GActionGroup-exporter.html
share/gtk-doc/html/gio/gio-GBytesIcon.html
share/gtk-doc/html/gio/gio-GContentType.html
share/gtk-doc/html/gio/gio-GConverterInputstream.html
share/gtk-doc/html/gio/gio-GConverterOutputstream.html
@ -473,13 +489,8 @@ share/gtk-doc/html/gio/gio-GDBusError.html
share/gtk-doc/html/gio/gio-GFileAttribute.html
share/gtk-doc/html/gio/gio-GIOError.html
share/gtk-doc/html/gio/gio-GIOScheduler.html
share/gtk-doc/html/gio/gio-GInetAddressMask.html
share/gtk-doc/html/gio/gio-GMenuModel-exporter.html
share/gtk-doc/html/gio/gio-GNotification.html
share/gtk-doc/html/gio/gio-GPropertyAction.html
share/gtk-doc/html/gio/gio-GResource.html
share/gtk-doc/html/gio/gio-GSettingsSchema-GSettingsSchemaSource.html
share/gtk-doc/html/gio/gio-GSubprocessLauncher.html
share/gtk-doc/html/gio/gio-GWin32InputStream.html
share/gtk-doc/html/gio/gio-GWin32OutputStream.html
share/gtk-doc/html/gio/gio-Owning-Bus-Names.html
@ -551,6 +562,7 @@ share/gtk-doc/html/glib/api-index-2-38.html
share/gtk-doc/html/glib/api-index-2-4.html
share/gtk-doc/html/glib/api-index-2-40.html
share/gtk-doc/html/glib/api-index-2-42.html
share/gtk-doc/html/glib/api-index-2-44.html
share/gtk-doc/html/glib/api-index-2-6.html
share/gtk-doc/html/glib/api-index-2-8.html
share/gtk-doc/html/glib/api-index-deprecated.html
@ -679,6 +691,7 @@ share/gtk-doc/html/gobject/api-index-2-38.html
share/gtk-doc/html/gobject/api-index-2-4.html
share/gtk-doc/html/gobject/api-index-2-40.html
share/gtk-doc/html/gobject/api-index-2-42.html
share/gtk-doc/html/gobject/api-index-2-44.html
share/gtk-doc/html/gobject/api-index-2-6.html
share/gtk-doc/html/gobject/api-index-2-8.html
share/gtk-doc/html/gobject/api-index-deprecated.html

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.208 2015/03/14 01:24:54 prlw1 Exp $
$NetBSD: distinfo,v 1.209 2015/06/10 23:00:05 prlw1 Exp $
SHA1 (glib-2.42.2.tar.xz) = 87113de4096377fab1129da44f38a0da0f7f0fb4
RMD160 (glib-2.42.2.tar.xz) = ef5e441ecb6f9e1554ab6dbd4c41b51d033a4628
Size (glib-2.42.2.tar.xz) = 7002480 bytes
SHA1 (glib-2.44.1.tar.xz) = 88176375f97ecd9ff45e7b5fd5ab80d4b7db6b34
RMD160 (glib-2.44.1.tar.xz) = 40db36e25c4baf5bdcdde34379d4968e9b35557c
Size (glib-2.44.1.tar.xz) = 7132940 bytes
SHA1 (patch-aa) = 03313c0ee430a127c07510b096c5d1556c8db74e
SHA1 (patch-ab) = 04bde955a2a588011a8c77ada4923d5464a0d544
SHA1 (patch-ac) = 96e153339675457356f71e35d20375bed669d337
@ -20,9 +20,9 @@ SHA1 (patch-cd) = 0d574419257a604ca19e18a43aa42ec6e9a36c78
SHA1 (patch-ck) = 324116cc6fb8dbce8ce8d20f5b237fc469a55cd2
SHA1 (patch-cl) = 871e1ca59f697eddd6692702fc7d63a2df826afc
SHA1 (patch-cm) = 534af37ae8f2bd667f630142058d4de5ea91be93
SHA1 (patch-cn) = 0cb2fa14b2d3f0ff66f5d5f32e79a36c71a99b78
SHA1 (patch-gio_gdbusauthmechanismsha1.c) = dfbd4a85ea842f11e4bb76d39c5509fb8b0d5baa
SHA1 (patch-gio_gresource-tool.c) = 4eb7c9df25e9ac3e977edf3be8fb977a6fb39182
SHA1 (patch-gio_gunixmounts.c) = 40edf6a79d37bf8eca38d0f84521a7538443c00c
SHA1 (patch-glib_gmain.c) = d09ff66e475ee52d37ac0dcb463110f690ce6511
SHA1 (patch-glib_gthread-posix.c) = ca93c8dc358453eb79b518c884464c90d7628888
SHA1 (patch-glib_gtimezone.c) = d9686da52f171a073d80cfd9f80aa490088a00a3

View file

@ -1,17 +0,0 @@
$NetBSD: patch-cn,v 1.5 2013/12/08 13:08:59 prlw1 Exp $
The mem-overflow test contains a declaration of an empty struct, which breaks
on at least SunPro cc, and presumably some other non-gcc compilers. Skip this
test for now, pending a better fix.
https://bugzilla.gnome.org/show_bug.cgi?id=641350
(patch-cj)
--- glib/tests/Makefile.am.orig 2013-03-25 17:02:43.000000000 +0000
+++ glib/tests/Makefile.am
@@ -46,7 +46,6 @@ TEST_PROGS += \
markup-collect \
markup-escape \
markup-subparser \
- mem-overflow \
mutex \
node \
once \

View file

@ -0,0 +1,396 @@
$NetBSD: patch-gio_gunixmounts.c,v 1.1 2015/06/10 23:00:05 prlw1 Exp $
Revert commit 548c165a Make GUnixMountMonitor per-context
https://bugzilla.gnome.org/show_bug.cgi?id=750708
--- gio/gunixmounts.c.orig 2015-03-13 20:48:21.000000000 +0000
+++ gio/gunixmounts.c
@@ -68,7 +68,6 @@
#include "gfilemonitor.h"
#include "glibintl.h"
#include "gthemedicon.h"
-#include "gcontextspecificgroup.h"
#ifdef HAVE_MNTENT_H
@@ -1275,50 +1274,124 @@ static guint signals[LAST_SIGNAL];
struct _GUnixMountMonitor {
GObject parent;
- GMainContext *context;
+ GFileMonitor *fstab_monitor;
+ GFileMonitor *mtab_monitor;
+
+ GList *mount_poller_mounts;
+
+ GSource *proc_mounts_watch_source;
};
struct _GUnixMountMonitorClass {
GObjectClass parent_class;
};
+static GUnixMountMonitor *the_mount_monitor = NULL;
G_DEFINE_TYPE (GUnixMountMonitor, g_unix_mount_monitor, G_TYPE_OBJECT);
-static GContextSpecificGroup mount_monitor_group;
-static GFileMonitor *fstab_monitor;
-static GFileMonitor *mtab_monitor;
-static GSource *proc_mounts_watch_source;
-static GList *mount_poller_mounts;
+static void
+g_unix_mount_monitor_finalize (GObject *object)
+{
+ GUnixMountMonitor *monitor;
+
+ monitor = G_UNIX_MOUNT_MONITOR (object);
+
+ if (monitor->fstab_monitor)
+ {
+ g_file_monitor_cancel (monitor->fstab_monitor);
+ g_object_unref (monitor->fstab_monitor);
+ }
+
+ if (monitor->proc_mounts_watch_source != NULL)
+ g_source_destroy (monitor->proc_mounts_watch_source);
+
+ if (monitor->mtab_monitor)
+ {
+ g_file_monitor_cancel (monitor->mtab_monitor);
+ g_object_unref (monitor->mtab_monitor);
+ }
+
+ g_list_free_full (monitor->mount_poller_mounts, (GDestroyNotify)g_unix_mount_free);
+
+ the_mount_monitor = NULL;
+
+ G_OBJECT_CLASS (g_unix_mount_monitor_parent_class)->finalize (object);
+}
+
+
+static void
+g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = g_unix_mount_monitor_finalize;
+
+ /**
+ * GUnixMountMonitor::mounts-changed:
+ * @monitor: the object on which the signal is emitted
+ *
+ * Emitted when the unix mounts have changed.
+ */
+ signals[MOUNTS_CHANGED] =
+ g_signal_new ("mounts-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
+ * GUnixMountMonitor::mountpoints-changed:
+ * @monitor: the object on which the signal is emitted
+ *
+ * Emitted when the unix mount points have changed.
+ */
+ signals[MOUNTPOINTS_CHANGED] =
+ g_signal_new ("mountpoints-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
static void
fstab_file_changed (GFileMonitor *monitor,
- GFile *file,
- GFile *other_file,
- GFileMonitorEvent event_type,
- gpointer user_data)
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
{
+ GUnixMountMonitor *mount_monitor;
+
if (event_type != G_FILE_MONITOR_EVENT_CHANGED &&
event_type != G_FILE_MONITOR_EVENT_CREATED &&
event_type != G_FILE_MONITOR_EVENT_DELETED)
return;
- g_context_specific_group_emit (&mount_monitor_group, signals[MOUNTPOINTS_CHANGED]);
+ mount_monitor = user_data;
+ g_signal_emit (mount_monitor, signals[MOUNTPOINTS_CHANGED], 0);
}
static void
mtab_file_changed (GFileMonitor *monitor,
- GFile *file,
- GFile *other_file,
- GFileMonitorEvent event_type,
- gpointer user_data)
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
{
+ GUnixMountMonitor *mount_monitor;
+
if (event_type != G_FILE_MONITOR_EVENT_CHANGED &&
event_type != G_FILE_MONITOR_EVENT_CREATED &&
event_type != G_FILE_MONITOR_EVENT_DELETED)
return;
-
- g_context_specific_group_emit (&mount_monitor_group, signals[MOUNTS_CHANGED]);
+
+ mount_monitor = user_data;
+ g_signal_emit (mount_monitor, signals[MOUNTS_CHANGED], 0);
}
static gboolean
@@ -1326,21 +1399,23 @@ proc_mounts_changed (GIOChannel *chann
GIOCondition cond,
gpointer user_data)
{
+ GUnixMountMonitor *mount_monitor = G_UNIX_MOUNT_MONITOR (user_data);
if (cond & G_IO_ERR)
- g_context_specific_group_emit (&mount_monitor_group, signals[MOUNTS_CHANGED]);
-
+ g_signal_emit (mount_monitor, signals[MOUNTS_CHANGED], 0);
return TRUE;
}
static gboolean
mount_change_poller (gpointer user_data)
{
+ GUnixMountMonitor *mount_monitor;
GList *current_mounts, *new_it, *old_it;
gboolean has_changed = FALSE;
+ mount_monitor = user_data;
current_mounts = _g_get_unix_mounts ();
- for ( new_it = current_mounts, old_it = mount_poller_mounts;
+ for ( new_it = current_mounts, old_it = mount_monitor->mount_poller_mounts;
new_it != NULL && old_it != NULL;
new_it = g_list_next (new_it), old_it = g_list_next (old_it) )
{
@@ -1353,55 +1428,34 @@ mount_change_poller (gpointer user_data)
if (!(new_it == NULL && old_it == NULL))
has_changed = TRUE;
- g_list_free_full (mount_poller_mounts, (GDestroyNotify) g_unix_mount_free);
+ g_list_free_full (mount_monitor->mount_poller_mounts,
+ (GDestroyNotify)g_unix_mount_free);
- mount_poller_mounts = current_mounts;
+ mount_monitor->mount_poller_mounts = current_mounts;
if (has_changed)
{
- mount_poller_time = (guint64) g_get_monotonic_time ();
- g_context_specific_group_emit (&mount_monitor_group, signals[MOUNTPOINTS_CHANGED]);
+ mount_poller_time = (guint64)g_get_monotonic_time ();
+ g_signal_emit (mount_monitor, signals[MOUNTS_CHANGED], 0);
}
return TRUE;
}
-
-static void
-mount_monitor_stop (void)
-{
- if (fstab_monitor)
- {
- g_file_monitor_cancel (fstab_monitor);
- g_object_unref (fstab_monitor);
- }
-
- if (proc_mounts_watch_source != NULL)
- g_source_destroy (proc_mounts_watch_source);
-
- if (mtab_monitor)
- {
- g_file_monitor_cancel (mtab_monitor);
- g_object_unref (mtab_monitor);
- }
-
- g_list_free_full (mount_poller_mounts, (GDestroyNotify) g_unix_mount_free);
-}
-
static void
-mount_monitor_start (void)
+g_unix_mount_monitor_init (GUnixMountMonitor *monitor)
{
GFile *file;
-
+
if (get_fstab_file () != NULL)
{
file = g_file_new_for_path (get_fstab_file ());
- fstab_monitor = g_file_monitor_file (file, 0, NULL, NULL);
+ monitor->fstab_monitor = g_file_monitor_file (file, 0, NULL, NULL);
g_object_unref (file);
-
- g_signal_connect (fstab_monitor, "changed", (GCallback)fstab_file_changed, NULL);
+
+ g_signal_connect (monitor->fstab_monitor, "changed", (GCallback)fstab_file_changed, monitor);
}
-
+
if (get_mtab_monitor_file () != NULL)
{
const gchar *mtab_path;
@@ -1423,93 +1477,39 @@ mount_monitor_start (void)
}
else
{
- proc_mounts_watch_source = g_io_create_watch (proc_mounts_channel, G_IO_ERR);
- g_source_set_callback (proc_mounts_watch_source,
+ monitor->proc_mounts_watch_source = g_io_create_watch (proc_mounts_channel, G_IO_ERR);
+ g_source_set_callback (monitor->proc_mounts_watch_source,
(GSourceFunc) proc_mounts_changed,
- NULL, NULL);
- g_source_attach (proc_mounts_watch_source,
+ monitor,
+ NULL);
+ g_source_attach (monitor->proc_mounts_watch_source,
g_main_context_get_thread_default ());
- g_source_unref (proc_mounts_watch_source);
+ g_source_unref (monitor->proc_mounts_watch_source);
g_io_channel_unref (proc_mounts_channel);
}
}
else
{
file = g_file_new_for_path (mtab_path);
- mtab_monitor = g_file_monitor_file (file, 0, NULL, NULL);
+ monitor->mtab_monitor = g_file_monitor_file (file, 0, NULL, NULL);
g_object_unref (file);
- g_signal_connect (mtab_monitor, "changed", (GCallback)mtab_file_changed, NULL);
+ g_signal_connect (monitor->mtab_monitor, "changed", (GCallback)mtab_file_changed, monitor);
}
}
else
{
- proc_mounts_watch_source = g_timeout_source_new_seconds (3);
- mount_poller_mounts = _g_get_unix_mounts ();
+ monitor->proc_mounts_watch_source = g_timeout_source_new_seconds (3);
+ monitor->mount_poller_mounts = _g_get_unix_mounts ();
mount_poller_time = (guint64)g_get_monotonic_time ();
- g_source_set_callback (proc_mounts_watch_source,
- mount_change_poller,
- NULL, NULL);
- g_source_attach (proc_mounts_watch_source,
+ g_source_set_callback (monitor->proc_mounts_watch_source,
+ (GSourceFunc)mount_change_poller,
+ monitor, NULL);
+ g_source_attach (monitor->proc_mounts_watch_source,
g_main_context_get_thread_default ());
- g_source_unref (proc_mounts_watch_source);
+ g_source_unref (monitor->proc_mounts_watch_source);
}
}
-static void
-g_unix_mount_monitor_finalize (GObject *object)
-{
- GUnixMountMonitor *monitor;
-
- monitor = G_UNIX_MOUNT_MONITOR (object);
-
- g_context_specific_group_remove (&mount_monitor_group, monitor->context, monitor, mount_monitor_stop);
-
- G_OBJECT_CLASS (g_unix_mount_monitor_parent_class)->finalize (object);
-}
-
-static void
-g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->finalize = g_unix_mount_monitor_finalize;
-
- /**
- * GUnixMountMonitor::mounts-changed:
- * @monitor: the object on which the signal is emitted
- *
- * Emitted when the unix mounts have changed.
- */
- signals[MOUNTS_CHANGED] =
- g_signal_new ("mounts-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /**
- * GUnixMountMonitor::mountpoints-changed:
- * @monitor: the object on which the signal is emitted
- *
- * Emitted when the unix mount points have changed.
- */
- signals[MOUNTPOINTS_CHANGED] =
- g_signal_new ("mountpoints-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-g_unix_mount_monitor_init (GUnixMountMonitor *monitor)
-{
-}
-
/**
* g_unix_mount_monitor_set_rate_limit:
* @mount_monitor: a #GUnixMountMonitor
@@ -1537,16 +1537,12 @@ g_unix_mount_monitor_set_rate_limit (GUn
/**
* g_unix_mount_monitor_get:
*
- * Gets the #GUnixMountMonitor for the current thread-default main
- * context.
+ * 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).
*
- * You must only call g_object_unref() on the return value from under
- * the same main context as you called this function.
- *
* Returns: (transfer full): the #GUnixMountMonitor.
*
* Since: 2.44
@@ -1554,10 +1550,13 @@ g_unix_mount_monitor_set_rate_limit (GUn
GUnixMountMonitor *
g_unix_mount_monitor_get (void)
{
- return g_context_specific_group_get (&mount_monitor_group,
- G_TYPE_UNIX_MOUNT_MONITOR,
- G_STRUCT_OFFSET(GUnixMountMonitor, context),
- mount_monitor_start);
+ if (the_mount_monitor == NULL)
+ {
+ the_mount_monitor = g_object_new (G_TYPE_UNIX_MOUNT_MONITOR, NULL);
+ return the_mount_monitor;
+ }
+
+ return g_object_ref (the_mount_monitor);
}
/**