[glib/wip/hadess/add-memory-monitor: 2/2] fixup! gio: Add GMemoryMonitor to monitor for low-memory
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/hadess/add-memory-monitor: 2/2] fixup! gio: Add GMemoryMonitor to monitor for low-memory
- Date: Mon, 29 Jul 2019 15:36:16 +0000 (UTC)
commit 28aa18a8ac9cb723aec4c5212fb627592629b41e
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jul 29 17:23:34 2019 +0200
fixup! gio: Add GMemoryMonitor to monitor for low-memory
gio/gio.h | 1 +
gio/giomodule.c | 8 ++++----
gio/gmemorymonitor.h | 2 +-
gio/gmemorymonitordbus.c | 7 +++----
gio/gmemorymonitordbus.h | 4 ++--
gio/gmemorymonitorportal.c | 13 ++++++-------
gio/gmemorymonitorportal.h | 2 +-
gio/meson.build | 5 +++--
8 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/gio/gio.h b/gio/gio.h
index f4d934dac..6abaf2884 100644
--- a/gio/gio.h
+++ b/gio/gio.h
@@ -91,6 +91,7 @@
#include <gio/gloadableicon.h>
#include <gio/gmemoryinputstream.h>
#include <gio/gmemoryoutputstream.h>
+#include <gio/gmemorymonitor.h>
#include <gio/gmount.h>
#include <gio/gmountoperation.h>
#include <gio/gnativevolumemonitor.h>
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 18da183a9..f2bffcb7b 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -1028,8 +1028,8 @@ extern GType _g_network_monitor_netlink_get_type (void);
extern GType _g_network_monitor_nm_get_type (void);
#endif
-extern GType _g_memory_monitor_dbus_get_type (void);
-extern GType _g_memory_monitor_portal_get_type (void);
+extern GType g_memory_monitor_dbus_get_type (void);
+extern GType g_memory_monitor_portal_get_type (void);
#ifdef G_OS_UNIX
extern GType g_fdo_notification_backend_get_type (void);
@@ -1241,7 +1241,7 @@ _g_io_modules_ensure_loaded (void)
g_type_ensure (g_fdo_notification_backend_get_type ());
g_type_ensure (g_gtk_notification_backend_get_type ());
g_type_ensure (g_portal_notification_backend_get_type ());
- g_type_ensure (_g_memory_monitor_portal_get_type ());
+ g_type_ensure (g_memory_monitor_portal_get_type ());
g_type_ensure (g_network_monitor_portal_get_type ());
g_type_ensure (g_proxy_resolver_portal_get_type ());
#endif
@@ -1260,7 +1260,7 @@ _g_io_modules_ensure_loaded (void)
g_type_ensure (_g_socks4_proxy_get_type ());
g_type_ensure (_g_socks5_proxy_get_type ());
g_type_ensure (_g_dummy_tls_backend_get_type ());
- g_type_ensure (_g_memory_monitor_dbus_get_type ());
+ g_type_ensure (g_memory_monitor_dbus_get_type ());
g_type_ensure (g_network_monitor_base_get_type ());
#ifdef HAVE_NETLINK
g_type_ensure (_g_network_monitor_netlink_get_type ());
diff --git a/gio/gmemorymonitor.h b/gio/gmemorymonitor.h
index 25a2dd8a0..f62e73102 100644
--- a/gio/gmemorymonitor.h
+++ b/gio/gmemorymonitor.h
@@ -51,7 +51,7 @@ struct _GMemoryMonitorInterface {
};
GLIB_AVAILABLE_IN_2_32
-GType g_memory_monitor_get_type (void) G_GNUC_CONST;
+GType g_memory_monitor_get_type (void) G_GNUC_CONST;
GLIB_AVAILABLE_IN_2_32
GMemoryMonitor *g_memory_monitor_get_default (void);
diff --git a/gio/gmemorymonitordbus.c b/gio/gmemorymonitordbus.c
index 3e053d789..35e27c5a6 100644
--- a/gio/gmemorymonitordbus.c
+++ b/gio/gmemorymonitordbus.c
@@ -24,9 +24,9 @@
#include "giomodule-priv.h"
#include "glibintl.h"
#include "glib/gstdio.h"
-#include "gmemorymonitor.h"
#include "gdbusproxy.h"
+static GInitableIface *parent_iface;
static void g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *iface);
static void g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface);
@@ -36,7 +36,6 @@ struct _GMemoryMonitorDbus
guint signal_id;
};
-#define g_memory_monitor_dbus_get_type _g_memory_monitor_dbus_get_type
G_DEFINE_TYPE_WITH_CODE (GMemoryMonitorDbus, g_memory_monitor_dbus, G_TYPE_MEMORY_MONITOR,
G_IMPLEMENT_INTERFACE (G_TYPE_MEMORY_MONITOR,
g_memory_monitor_dbus_iface_init)
@@ -73,10 +72,8 @@ g_memory_monitor_dbus_initable_init (GInitable *initable,
{
GMemoryMonitorDbus *dbus = G_MEMORY_MONITOR_DBUS (initable);
GDBusProxy *proxy;
- GInitableIface *parent_iface;
gchar *name_owner = NULL;
- parent_iface = g_type_interface_peek_parent (G_MEMORY_MONITOR_DBUS_GET_INITABLE_IFACE (initable));
if (!parent_iface->init (initable, cancellable, error))
return FALSE;
@@ -143,5 +140,7 @@ g_memory_monitor_dbus_iface_init (GMemoryMonitorInterface *monitor_iface)
static void
g_memory_monitor_dbus_initable_iface_init (GInitableIface *iface)
{
+ parent_iface = g_type_interface_peek_parent (iface);
+
iface->init = g_memory_monitor_dbus_initable_init;
}
diff --git a/gio/gmemorymonitordbus.h b/gio/gmemorymonitordbus.h
index d7503b8e4..6dce743df 100644
--- a/gio/gmemorymonitordbus.h
+++ b/gio/gmemorymonitordbus.h
@@ -24,10 +24,10 @@
G_BEGIN_DECLS
-#define G_TYPE_MEMORY_MONITOR_DBUS (_g_memory_monitor_dbus_get_type ())
+#define G_TYPE_MEMORY_MONITOR_DBUS (g_memory_monitor_dbus_get_type ())
G_DECLARE_FINAL_TYPE (GMemoryMonitorDbus, g_memory_monitor_dbus, G, MEMORY_MONITOR_DBUS, GObject)
-GType _g_memory_monitor_dbus_get_type (void);
+GType g_memory_monitor_dbus_get_type (void);
G_END_DECLS
diff --git a/gio/gmemorymonitorportal.c b/gio/gmemorymonitorportal.c
index b6720d6d1..283149ae8 100644
--- a/gio/gmemorymonitorportal.c
+++ b/gio/gmemorymonitorportal.c
@@ -24,7 +24,7 @@
#include "xdp-dbus.h"
#include "gportalsupport.h"
-static GInitableIface *initable_parent_iface;
+static GInitableIface *parent_iface;
static void g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *iface);
static void g_memory_monitor_portal_initable_iface_init (GInitableIface *iface);
@@ -34,7 +34,6 @@ struct _GMemoryMonitorPortal
guint signal_id;
};
-#define g_memory_monitor_portal_get_type _g_memory_monitor_portal_get_type
G_DEFINE_TYPE_WITH_CODE (GMemoryMonitorPortal, g_memory_monitor_portal, G_TYPE_MEMORY_MONITOR,
G_IMPLEMENT_INTERFACE (G_TYPE_MEMORY_MONITOR,
g_memory_monitor_portal_iface_init)
@@ -73,6 +72,9 @@ g_memory_monitor_portal_initable_init (GInitable *initable,
GDBusProxy *proxy;
gchar *name_owner = NULL;
+ if (!parent_iface->init (initable, cancellable, error))
+ return FALSE;
+
if (!glib_should_use_portal ())
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Not using portals");
@@ -109,9 +111,6 @@ g_memory_monitor_portal_initable_init (GInitable *initable,
portal->proxy = proxy;
- if (!initable_parent_iface->init (initable, cancellable, error))
- return FALSE;
-
return TRUE;
}
@@ -125,7 +124,7 @@ g_memory_monitor_portal_finalize (GObject *object)
{
g_signal_handler_disconnect (portal->proxy,
portal->signal_id);
- portal->ignal_id = 0;
+ portal->signal_id = 0;
}
g_clear_object (&portal->proxy);
@@ -148,7 +147,7 @@ g_memory_monitor_portal_iface_init (GMemoryMonitorInterface *monitor_iface)
static void
g_memory_monitor_portal_initable_iface_init (GInitableIface *iface)
{
- initable_parent_iface = g_type_interface_peek_parent (iface);
+ parent_iface = g_type_interface_peek_parent (iface);
iface->init = g_memory_monitor_portal_initable_init;
}
diff --git a/gio/gmemorymonitorportal.h b/gio/gmemorymonitorportal.h
index a107af508..b56002cca 100644
--- a/gio/gmemorymonitorportal.h
+++ b/gio/gmemorymonitorportal.h
@@ -23,7 +23,7 @@
G_BEGIN_DECLS
-#define G_TYPE_MEMORY_MONITOR_PORTAL (_g_memory_monitor_portal_get_type ())
+#define G_TYPE_MEMORY_MONITOR_PORTAL (g_memory_monitor_portal_get_type ())
G_DECLARE_FINAL_TYPE (GMemoryMonitorPortal, g_memory_monitor_portal, G, MEMORY_MONITOR_PORTAL, GObject)
GType _g_memory_monitor_portal_get_type (void);
diff --git a/gio/meson.build b/gio/meson.build
index a07f16781..bb23d93ee 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -393,8 +393,9 @@ if host_system != 'windows'
portal_sources = [files(
'gdocumentportal.c',
'gopenuriportal.c',
- 'gnetworkmonitorportal.c',
+ 'gmemorymonitordbus.c',
'gmemorymonitorportal.c',
+ 'gnetworkmonitorportal.c',
'gproxyresolverportal.c',
'gtrashportal.c',
'gportalsupport.c',
@@ -530,7 +531,6 @@ gio_sources = files(
'gmarshal-internal.c',
'gmount.c',
'gmemorymonitor.c',
- 'gmemorymonitordbus.c',
'gmemoryinputstream.c',
'gmemoryoutputstream.c',
'gmountoperation.c',
@@ -674,6 +674,7 @@ gio_headers = files(
'gmount.h',
'gmemoryinputstream.h',
'gmemoryoutputstream.h',
+ 'gmemorymonitor.h',
'gmountoperation.h',
'gnativevolumemonitor.h',
'gnetworkaddress.h',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]