Disable page cache with < 352 MB RAM
This commit is contained in:
parent
472cbfa5b1
commit
8c8f985a5c
1 changed files with 16 additions and 1 deletions
|
@ -344,6 +344,21 @@ midori_get_download_dir (void)
|
||||||
}
|
}
|
||||||
return g_get_home_dir ();
|
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
|
static void
|
||||||
midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
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",
|
g_param_spec_boolean ("enable-page-cache",
|
||||||
"Enable page cache",
|
"Enable page cache",
|
||||||
"Whether the page cache should be used",
|
"Whether the page cache should be used",
|
||||||
TRUE,
|
!midori_web_settings_low_memory_profile (),
|
||||||
flags));
|
flags));
|
||||||
#endif
|
#endif
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
|
|
Loading…
Reference in a new issue