Icon-Theme-Helper

 view release on metacpan or  search on metacpan

lib/Icon/Theme/Helper.pm  view on Meta::CPAN

	}

	#tries a generic one if it is a tar ball
	if ($mimetype =~ /tar/) {
		$icon=$self->getIcon('MimeTypes', 'tar');
		if (defined($icon)) {
			return $icon;
		}
	}

	#tries a generic one if it is video
	if ($mimetype =~ /video/) {
		$icon=$self->getIcon('MimeTypes', 'video');
		if (defined($icon)) {
			return $icon;
		}
	}

	#tries a generic one if it is a html file
	if ($mimetype =~ /html/) {
		$icon=$self->getIcon('MimeTypes', 'text-html');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /html/) {
		$icon=$self->getIcon('MimeTypes', 'html');
		if (defined($icon)) {
			return $icon;
		}
	}

	#tries a generic one for a template
	if ($mimetype =~ /template/) {
		$icon=$self->getIcon('MimeTypes', 'text-x-generic-template');
		if (defined($icon)) {
			return $icon;
		}
	}

	#tries a generic one for a addressbook
	if ($mimetype =~ /addressbook/) {
		$icon=$self->getIcon('MimeTypes', 'stock_addressbook');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /addressbook/) {
		$icon=$self->getIcon('MimeTypes', 'addressbook');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /addressbook/) {
		$icon=$self->getIcon('MimeTypes', 'x-office-address-book');
		if (defined($icon)) {
			return $icon;
		}
	}

	#checks it for a calendar
	if ($mimetype =~ /calendar/) {
		$icon=$self->getIcon('MimeTypes', 'calendar');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /calendar/) {
		$icon=$self->getIcon('MimeTypes', 'stock_calendar');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /calendar/) {
		$icon=$self->getIcon('MimeTypes', 'x-office-calendar');
		if (defined($icon)) {
			return $icon;
		}
	}

	#try it for images
	if ($mimetype =~ /image/) {
		$icon=$self->getIcon('MimeTypes', 'image');
		if (defined($icon)) {
			return $icon;
		}
	}
	if ($mimetype =~ /image/) {
		$icon=$self->getIcon('MimeTypes', 'image-x-generic');
		if (defined($icon)) {
			return $icon;
		}
	}

	#gets it for a RPM
	if ($mimetype =~ /rpm$/) {
		$icon=$self->getIcon('MimeTypes', 'rpm');
		if (defined($icon)) {
			return $icon;
		}
	}

	#tries a generic one for a text file
	if ($mimetype =~ /text/) {
		$icon=$self->getIcon('MimeTypes', 'txt');
		if (defined($icon)) {
			return $icon;
		}
	}

   	#try unknown before finally returning undef
	$icon=$self->getIcon('MimeTypes', 'unknown');
	if (defined($icon)) {
		return $icon;
	}

	#if we get here we did not find one
	return undef;
}

=head1 ERROR METHODS

=head2 error

This fetches any current errors.

A return of undef, false, indicates no error is present.

    if($iconhelper->error){
        warn("Error!");
    }

=cut

sub error{



( run in 1.972 second using v1.01-cache-2.11-cpan-39bf76dae61 )