Lines 1458-1475
Link Here
|
1458 |
public void HandleDeleteSelectedTagCommand (object sender, EventArgs args) |
1458 |
public void HandleDeleteSelectedTagCommand (object sender, EventArgs args) |
1459 |
{ |
1459 |
{ |
1460 |
Tag [] tags = this.tag_selection_widget.TagHighlight (); |
1460 |
Tag [] tags = this.tag_selection_widget.TagHighlight (); |
1461 |
string header = Mono.Posix.Catalog.GetPluralString ("Delete the selected tag?", |
1461 |
bool okToDelete = true; |
1462 |
"Delete the {0} selected tags?", |
1462 |
string ProblemCategoryName = ""; |
1463 |
tags.Length); |
1463 |
|
1464 |
|
1464 |
// Check if we are supposed to delete a Category with sub tags. If so, we can not. |
1465 |
header = String.Format (header, tags.Length); |
1465 |
foreach (Tag slaskTag in tags) { |
1466 |
string msg = Mono.Posix.Catalog.GetString("If you delete a tag, all associations with photos are lost."); |
1466 |
if (slaskTag != null) { |
1467 |
string ok_caption = Mono.Posix.Catalog.GetPluralString ("_Delete tag", "_Delete tags", tags.Length); |
1467 |
if (slaskTag is Category) { |
1468 |
|
1468 |
Category slaskCategory = (Category)slaskTag; |
1469 |
if (ResponseType.Ok == HigMessageDialog.RunHigConfirmation(main_window, DialogFlags.DestroyWithParent, MessageType.Warning, header, msg, ok_caption)) { |
1469 |
if (slaskCategory.Children.Length > 1) { |
1470 |
db.Photos.Remove (tags); |
1470 |
okToDelete = false; |
1471 |
icon_view.QueueDraw (); |
1471 |
ProblemCategoryName = slaskCategory.Name; |
1472 |
} |
1472 |
} |
|
|
1473 |
// System.Console.WriteLine ("{0} --> {1}", slaskCategory.Name, okToDelete); |
1474 |
} |
1475 |
} |
1476 |
} // foreach |
1477 |
|
1478 |
if (okToDelete) { |
1479 |
|
1480 |
string header = Mono.Posix.Catalog.GetPluralString ("Delete the selected tag?", |
1481 |
"Delete the {0} selected tags?", |
1482 |
tags.Length); |
1483 |
|
1484 |
header = String.Format (header, tags.Length); |
1485 |
string msg = Mono.Posix.Catalog.GetString("If you delete a tag, all associations with photos are lost."); |
1486 |
string ok_caption = Mono.Posix.Catalog.GetPluralString ("_Delete tag", "_Delete tags", tags.Length); |
1487 |
|
1488 |
if (ResponseType.Ok == HigMessageDialog.RunHigConfirmation(main_window, DialogFlags.DestroyWithParent, MessageType.Warning, header, msg, ok_caption)) { |
1489 |
db.Photos.Remove (tags); |
1490 |
icon_view.QueueDraw (); |
1491 |
} |
1492 |
} else { // A Category is not empty. Can not delete it. |
1493 |
string msg = Mono.Posix.Catalog.GetString ("Category is not empty"); |
1494 |
string desc = String.Format (Mono.Posix.Catalog.GetString ("Can not delete categorys which has tags. Please delete tags under \"{0}\" first"), |
1495 |
ProblemCategoryName); |
1496 |
|
1497 |
HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent, |
1498 |
Gtk.MessageType.Error, ButtonsType.Ok, |
1499 |
msg, |
1500 |
desc); |
1501 |
md.Run (); |
1502 |
md.Destroy (); |
1503 |
} |
1473 |
} |
1504 |
} |
1474 |
|
1505 |
|
1475 |
void HandleUpdateThumbnailCommand (object sende, EventArgs args) |
1506 |
void HandleUpdateThumbnailCommand (object sende, EventArgs args) |