Skip to content

Commit

Permalink
Small refactoring of Expander and AboutSystem GCI patches.
Browse files Browse the repository at this point in the history
* Fix excessive snprintf in SystemAbout kernel build date/time;
* Create destination folder message adjusted with HIG requirements;

Thanks for pointing out, Landon Fuller and Pulkomandy.
  • Loading branch information
siarzhuk committed Dec 2, 2012
1 parent 1789de4 commit 2ede175
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
4 changes: 1 addition & 3 deletions src/apps/aboutsystem/AboutSystem.cpp
Expand Up @@ -677,9 +677,7 @@ AboutView::AboutView()
} else
buildTimeDate.SetTo(kernelTimeDate);

snprintf(string, sizeof(string), buildTimeDate);

BStringView* kernelView = new BStringView("kerneltext", string);
BStringView* kernelView = new BStringView("kerneltext", buildTimeDate);
kernelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));

Expand Down
46 changes: 23 additions & 23 deletions src/apps/expander/ExpanderWindow.cpp
Expand Up @@ -150,53 +150,53 @@ ExpanderWindow::ValidateDest()
BVolume volume;
if (!entry.Exists()) {
BAlert* alert = new BAlert("destAlert",
B_TRANSLATE("Destination folder doesn't exist, create?"),
B_TRANSLATE("Yes"), B_TRANSLATE("No"), NULL,
B_TRANSLATE("Destination folder doesn't exist. "
"Would you like to create it?"),
B_TRANSLATE("Create"), B_TRANSLATE("Cancel"), NULL,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 0) {
if (create_directory(fDestText->Text(), 0755) == B_OK) {
BEntry newEntry(fDestText->Text(), true);
newEntry.GetRef(&fDestRef);
return true;
} else {
BAlert* alert = new BAlert("stopAlert",
B_TRANSLATE("Failed to create the destination folder."),
B_TRANSLATE("Cancel"), NULL, NULL,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
}
} else {

if (alert->Go() != 0)
return false;

if (create_directory(fDestText->Text(), 0755) != B_OK) {
BAlert* alert = new BAlert("stopAlert",
B_TRANSLATE("The extraction operation aborted."),
B_TRANSLATE("Failed to create the destination folder."),
B_TRANSLATE("Cancel"), NULL, NULL,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
}
} else if (!entry.IsDirectory()) {

BEntry newEntry(fDestText->Text(), true);
newEntry.GetRef(&fDestRef);
return true;

}

if (!entry.IsDirectory()) {
BAlert* alert = new BAlert("destAlert",
B_TRANSLATE("The destination is not a folder."),
B_TRANSLATE("Cancel"), NULL, NULL,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
} else if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) {
}

if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) {
BAlert* alert = new BAlert("destAlert",
B_TRANSLATE("The destination is read only."),
B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL,
B_EVEN_SPACING, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
} else {
entry.GetRef(&fDestRef);
return true;
}

entry.GetRef(&fDestRef);
return true;
}


Expand Down

0 comments on commit 2ede175

Please sign in to comment.