Changeset 847


Ignore:
Timestamp:
11/09/08 02:30:39 (3 years ago)
Author:
szabgab
Message:

rebless document when saved with a different extension

Location:
trunk/lib/Padre
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Padre/Document.pm

    r781 r847  
    181181        $self->set_mimetype( $self->guess_mimetype ); 
    182182    } 
    183     $self->rebless($class); 
     183    $self->rebless; 
    184184 
    185185    return $self; 
     
    187187 
    188188sub rebless { 
    189     my ($self, $class) = @_; 
    190  
    191     # If we blessed as the base class, and the mime type has a 
    192     # specific subclass, rebless it. 
     189    my ($self) = @_; 
     190 
     191    # Rebless as either to a subclass if there is a mime-type or 
     192    # to the the base class,  
    193193    # This isn't exactly the most elegant way to do this, but will 
    194194    # do for a first implementation. 
    195     if ( $class eq __PACKAGE__ ) { 
    196         my $subclass = $MIME_CLASS{$self->mimetype}; 
    197         if ( $subclass ) { 
    198             Class::Autouse->autouse($subclass); 
    199             bless $self, $subclass; 
    200         } 
     195    my $subclass = $MIME_CLASS{$self->mimetype} || __PACKAGE__; 
     196    if ( $subclass ) { 
     197        Class::Autouse->autouse($subclass); 
     198        bless $self, $subclass; 
    201199    } 
    202200     
  • trunk/lib/Padre/Wx/MainWindow.pm

    r846 r847  
    10521052    $doc->set_mimetype( $doc->guess_mimetype ); 
    10531053    $doc->editor->padre_setup; 
     1054    $doc->rebless; 
    10541055 
    10551056    $self->refresh_all; 
Note: See TracChangeset for help on using the changeset viewer.