Ticket #7406: commit-3102885-1305349515.diff

File commit-3102885-1305349515.diff, 1.7 KB (added by przemub, 8 years ago)
  • src/preferences/backgrounds/BackgroundsView.cpp

    commit 3102885b661ca3f0dd2b507301bb12c7c4f5aa68
    Author: Przemysław Buczkowski <przemub@yahoo.pl>
    Date:   Sat Jan 12 10:41:40 2013 +0100
    
        Backgrounds: truncate file names
        
        Fixes #7406.
        
        Signed-off-by: Przemysław Buczkowski <przemub@yahoo.pl>
    
    diff --git a/src/preferences/backgrounds/BackgroundsView.cpp b/src/preferences/backgrounds/BackgroundsView.cpp
    index bcbe548..057775e 100644
    a b  
    11/*
    2  * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
     2 * Copyright 2002-2013, Haiku, Inc. All Rights Reserved.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    BackgroundsView::_UpdateWithCurrent(void)  
    504504
    505505    for (int32 i = fImageList.CountItems() - 1; i >= 0; i--) {
    506506        BMessage* message = new BMessage(kMsgImageSelected);
    507         _AddItem(new BGImageMenuItem(GetImage(i)->GetName(), i, message));
     507        BString* name = new BString(GetImage(i)->GetName());
     508        if (name->Length() > 40)
     509            name->Truncate(40) << B_UTF8_ELLIPSIS;
     510        _AddItem(new BGImageMenuItem(name->String(), i, message));
    508511    }
    509512
    510513    fImageMenu->SetTargetForItems(this);
    BackgroundsView::RefsReceived(BMessage* msg)  
    992995                item = _FindImageItem(index);
    993996                fLastImageIndex = index;
    994997            } else {
    995                 const char* name = GetImage(-index - 1)->GetName();
    996                 item = new BGImageMenuItem(name, -index - 1,
     998                BString* name = new BString(GetImage(-index - 1)->GetName());
     999                if (name->Length() > 40)
     1000                    name->Truncate(40) << B_UTF8_ELLIPSIS;
     1001
     1002                item = new BGImageMenuItem(name->String(), -index - 1,
    9971003                    new BMessage(kMsgImageSelected));
    9981004                _AddItem(item);
    9991005                item->SetTarget(this);