[Xfce4-commits] <midori:master> Implement low_memory_profile for Win32

Christian Dywan noreply at xfce.org
Tue Mar 13 20:06:02 CET 2012


Updating branch refs/heads/master
         to 1edfd88d2fcbc38f3720ce21cd656d1e6cda39bb (commit)
       from ecbc8d077295a77c37004cc487f85f472627abdc (commit)

commit 1edfd88d2fcbc38f3720ce21cd656d1e6cda39bb
Author: Paweł Forysiuk <tuxator at o2.pl>
Date:   Tue Mar 13 19:49:47 2012 +0100

    Implement low_memory_profile for Win32

 midori/midori-websettings.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c
index d4444cc..6257650 100644
--- a/midori/midori-websettings.c
+++ b/midori/midori-websettings.c
@@ -347,6 +347,13 @@ midori_get_download_dir (void)
 static gboolean
 midori_web_settings_low_memory_profile ()
 {
+#ifdef _WIN32
+    /* See http://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx */
+    MEMORYSTATUSEX mem;
+    mem.dwLength = sizeof (mem);
+    if (GlobalMemoryStatusEx (&mem))
+        return mem.ullTotalPhys / 1024 / 1024 < 352;
+#else
     gchar* contents;
     const gchar* total;
     if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL))
@@ -357,6 +364,7 @@ midori_web_settings_low_memory_profile ()
         gdouble mem_total = g_ascii_strtoll (value, NULL, 0);
         return mem_total / 1024.0 < 352 + 1;
     }
+#endif
     return FALSE;
 }
 


More information about the Xfce4-commits mailing list