Ticket #2185: src_bin_desklink_desklink.cpp.diff
File src_bin_desklink_desklink.cpp.diff, 3.8 KB (added by , 16 years ago) |
---|
-
src/bin/desklink/desklink.cpp
159 159 case B_ABOUT_REQUESTED: 160 160 (new BAlert("About Volume Control", "Volume Control (Replicant)\n" 161 161 " Brought to you by Jérôme DUVAL.\n\n" 162 "Copyright " B_UTF8_COPYRIGHT "2003-200 7, Haiku","OK"))->Go();162 "Copyright " B_UTF8_COPYRIGHT "2003-2008, Haiku","OK"))->Go(NULL); 163 163 break; 164 164 165 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 165 180 // launch the media player app 166 181 if (LaunchBySig("application/x-vnd.Haiku-MediaPlayer") == B_OK 167 182 || LaunchBySig("application/x-vnd.Be.MediaPlayer") == B_OK 168 || LaunchByPath( "/boot/beos/apps/MediaPlayer") == B_OK)183 || LaunchByPath(mediaPlayerPath.Path()) == B_OK) 169 184 break; 170 185 171 186 (new BAlert("desklink", "Couldn't launch MediaPlayer", "OK"))->Go(); 172 187 break; 188 } 189 173 190 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 174 206 // launch the media prefs app 175 207 if (LaunchBySig("application/x-vnd.Haiku-Media") == B_OK 176 208 || LaunchBySig("application/x-vnd.Be.MediaPrefs") == B_OK 177 || LaunchByPath( "/boot/home/config/be/Preferences/Media") == B_OK)209 || LaunchByPath(mediaPrefsPath.Path()) == B_OK) 178 210 break; 179 211 180 212 (new BAlert("desklink", "Couldn't launch Media Preferences", "OK"))->Go(); 181 213 break; 214 } 215 182 216 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 183 232 // launch the sounds prefs app 184 233 if (LaunchBySig("application/x-vnd.Haiku-Sounds") == B_OK 185 234 || LaunchBySig("application/x-vnd.Be.SoundsPrefs") == B_OK 186 || LaunchByPath( "/boot/home/config/be/Preferences/Sounds") == B_OK)235 || LaunchByPath(soundsPrefsPath.Path()) == B_OK) 187 236 break; 188 237 189 238 (new BAlert("desklink", "Couldn't launch Sounds Preferences", "OK"))->Go(); 190 239 break; 240 } 241 191 242 case TOGGLE_DONT_BEEP: 192 243 fDontBeep = !fDontBeep; 193 244 break; 245 194 246 case SET_VOLUME_WHICH: 195 247 message->FindInt32("volwhich", &fVolumeWhich); 196 248 break; 249 197 250 default: 198 251 BView::MessageReceived(message); 199 252 break; … … 296 349 volMenu->AddItem(tmpItem); 297 350 tmpItem->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT); 298 351 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 300 358 menu->SetTargetForItems(this); 301 359 volMenu->SetTargetForItems(this); 302 360 menu->Go(where, true, true, BRect(where - BPoint(4, 4),