Ticket #2185: src_bin_desklink_desklink.cpp.diff

File src_bin_desklink_desklink.cpp.diff, 3.8 KB (added by kaoutsis, 16 years ago)
  • src/bin/desklink/desklink.cpp

     
    159159    case B_ABOUT_REQUESTED:
    160160        (new BAlert("About Volume Control", "Volume Control (Replicant)\n"
    161161                "  Brought to you by Jérôme DUVAL.\n\n"
    162                 "Copyright " B_UTF8_COPYRIGHT "2003-2007, Haiku","OK"))->Go();
     162                "Copyright " B_UTF8_COPYRIGHT "2003-2008, Haiku","OK"))->Go(NULL);
    163163        break;
     164
    164165    case OPEN_MEDIA_PLAYER:
     166    {
     167        BPath mediaPlayerPath;
     168        status_t status = find_directory(B_BEOS_APPS_DIRECTORY, &mediaPlayerPath);
     169        if (status < B_OK) {
     170            BString errorMessage;
     171            errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
     172            errorMessage << "find_directory() failed. \nReason: ";
     173            errorMessage << strerror(status);
     174            (new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
     175                B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
     176            break;
     177        }
     178        mediaPlayerPath.Append("MediaPlayer");
     179
    165180        // launch the media player app
    166181        if (LaunchBySig("application/x-vnd.Haiku-MediaPlayer") == B_OK
    167182            || LaunchBySig("application/x-vnd.Be.MediaPlayer") == B_OK
    168             || LaunchByPath("/boot/beos/apps/MediaPlayer") == B_OK)
     183            || LaunchByPath(mediaPlayerPath.Path()) == B_OK)
    169184            break;
    170185
    171186        (new BAlert("desklink", "Couldn't launch MediaPlayer", "OK"))->Go();
    172187        break;
     188    }
     189
    173190    case MEDIA_SETTINGS:
     191    {
     192        BPath mediaPrefsPath;
     193        status_t status = find_directory(B_BEOS_PREFERENCES_DIRECTORY,
     194            &mediaPrefsPath);
     195        if (status < B_OK) {
     196            BString errorMessage;
     197            errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
     198            errorMessage << "find_directory() failed. \nReason: ";
     199            errorMessage << strerror(status);
     200            (new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
     201                B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
     202            break;
     203        }
     204        mediaPrefsPath.Append("Media");
     205
    174206        // launch the media prefs app
    175207        if (LaunchBySig("application/x-vnd.Haiku-Media") == B_OK
    176208            || LaunchBySig("application/x-vnd.Be.MediaPrefs") == B_OK
    177             || LaunchByPath("/boot/home/config/be/Preferences/Media") == B_OK)
     209            || LaunchByPath(mediaPrefsPath.Path()) == B_OK)
    178210            break;
    179211
    180212        (new BAlert("desklink", "Couldn't launch Media Preferences", "OK"))->Go();
    181213        break;
     214    }
     215
    182216    case SOUND_SETTINGS:
     217    {
     218        BPath soundsPrefsPath;
     219        status_t status = find_directory(B_BEOS_PREFERENCES_DIRECTORY,
     220            &soundsPrefsPath);
     221        if (status < B_OK) {
     222            BString errorMessage;
     223            errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
     224            errorMessage << "find_directory() failed. \nReason: ";
     225            errorMessage << strerror(status);
     226            (new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
     227                B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
     228            break;
     229        }
     230        soundsPrefsPath.Append("Sounds");
     231       
    183232        // launch the sounds prefs app
    184233        if (LaunchBySig("application/x-vnd.Haiku-Sounds") == B_OK
    185234            || LaunchBySig("application/x-vnd.Be.SoundsPrefs") == B_OK
    186             || LaunchByPath("/boot/home/config/be/Preferences/Sounds") == B_OK)
     235            || LaunchByPath(soundsPrefsPath.Path()) == B_OK)
    187236            break;
    188237
    189238        (new BAlert("desklink", "Couldn't launch Sounds Preferences", "OK"))->Go();
    190239        break;
     240    }
     241
    191242    case TOGGLE_DONT_BEEP:
    192243        fDontBeep = !fDontBeep;
    193244        break;
     245
    194246    case SET_VOLUME_WHICH:
    195247        message->FindInt32("volwhich", &fVolumeWhich);
    196248        break;
     249
    197250    default:
    198251        BView::MessageReceived(message);
    199252        break;     
     
    296349        volMenu->AddItem(tmpItem);
    297350        tmpItem->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
    298351        menu->AddItem(volMenu);
    299        
     352
     353        menu->AddSeparatorItem();
     354        menu->SetFont(be_plain_font);
     355        menu->AddItem(new BMenuItem("About desklink " B_UTF8_ELLIPSIS,
     356            new BMessage(B_ABOUT_REQUESTED)));
     357
    300358        menu->SetTargetForItems(this);
    301359        volMenu->SetTargetForItems(this);
    302360        menu->Go(where, true, true, BRect(where - BPoint(4, 4),