[Xfce4-commits] <midori:master> Disable page cache with < 352 MB RAM

Christian Dywan noreply at xfce.org
Thu Mar 8 23:34:01 CET 2012


Updating branch refs/heads/master
         to 8c8f985a5c1593eb70100c2c79137d59caf532fa (commit)
       from 472cbfa5b1d0212dbf6357b9fb7a8c4069e547a2 (commit)

commit 8c8f985a5c1593eb70100c2c79137d59caf532fa
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Mar 8 23:30:07 2012 +0100

    Disable page cache with < 352 MB RAM

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

diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c
index 5d3a2f0..d4444cc 100644
--- a/midori/midori-websettings.c
+++ b/midori/midori-websettings.c
@@ -344,6 +344,21 @@ midori_get_download_dir (void)
     }
     return g_get_home_dir ();
 }
+static gboolean
+midori_web_settings_low_memory_profile ()
+{
+    gchar* contents;
+    const gchar* total;
+    if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL))
+        return FALSE;
+    if (contents && (total = strstr (contents, "MemTotal:")) && *total)
+    {
+        const gchar* value = katze_skip_whitespace (total + 9);
+        gdouble mem_total = g_ascii_strtoll (value, NULL, 0);
+        return mem_total / 1024.0 < 352 + 1;
+    }
+    return FALSE;
+}
 
 static void
 midori_web_settings_class_init (MidoriWebSettingsClass* class)
@@ -777,7 +792,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
                                      g_param_spec_boolean ("enable-page-cache",
                                                            "Enable page cache",
                                                            "Whether the page cache should be used",
-                                                           TRUE,
+        !midori_web_settings_low_memory_profile (),
                                                            flags));
     #endif
     g_object_class_install_property (gobject_class,


More information about the Xfce4-commits mailing list