Skip to content

Commit

Permalink
Fixes: #2926 Disabled the closest size fallback as it was messing up …
Browse files Browse the repository at this point in the history
…with the fallback system
  • Loading branch information
Côme Bernigaud authored and Benoit Mortier committed Jan 30, 2014
1 parent fe7c557 commit b496b8a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions include/class_IconTheme.inc
Expand Up @@ -124,27 +124,30 @@ class IconTheme
}
}
unset($subdir);
$minimal_size = PHP_INT_MAX;
foreach ($this->subdirs[$context] as $path => &$subdir) {
if (($sizedistance = $subdir->SizeDistance($size)) < $minimal_size) {
foreach (self::$extensions as $extension) {
$filename = $this->path.'/'.$path.'/'.$iconname.'.'.$extension;
if (file_exists($filename)) {
$closest_filename = $filename;
$minimal_size = $sizedistance;
if (self::$find_closest) {
$minimal_size = PHP_INT_MAX;
foreach ($this->subdirs[$context] as $path => &$subdir) {
if (($sizedistance = $subdir->SizeDistance($size)) < $minimal_size) {
foreach (self::$extensions as $extension) {
$filename = $this->path.'/'.$path.'/'.$iconname.'.'.$extension;
if (file_exists($filename)) {
$closest_filename = $filename;
$minimal_size = $sizedistance;
}
}
}
}
}
unset($subdir);
if (isset($closest_filename)) {
return $closest_filename;
unset($subdir);
if (isset($closest_filename)) {
return $closest_filename;
}
}
return NULL;
}

static public $default_theme = 'default';
static public $extensions = array('png', 'xpm', 'svg');
static public $find_closest = FALSE;

/* We store themes in the session. To do otherwise, override these methods. */
static public $session_var = 'IconThemes';
Expand Down

0 comments on commit b496b8a

Please sign in to comment.