Mercurial > geeqie
comparison src/utilops.c @ 135:15c1925b3bfb
improved external delete command
| author | nadvornik |
|---|---|
| date | Thu, 16 Aug 2007 20:57:09 +0000 |
| parents | 9009856628f7 |
| children | 18c2a29e681c |
comparison
equal
deleted
inserted
replaced
| 134:9009856628f7 | 135:15c1925b3bfb |
|---|---|
| 1231 gchar *result = NULL; | 1231 gchar *result = NULL; |
| 1232 gint success = TRUE; | 1232 gint success = TRUE; |
| 1233 | 1233 |
| 1234 if (!isfile(path)) return FALSE; | 1234 if (!isfile(path)) return FALSE; |
| 1235 | 1235 |
| 1236 if (editor_command[CMD_DELETE]) | |
| 1237 { | |
| 1238 return start_editor_from_file(CMD_DELETE, path); | |
| 1239 } | |
| 1240 | 1236 |
| 1241 if (!safe_delete_enable) | 1237 if (!safe_delete_enable) |
| 1242 { | 1238 { |
| 1243 return unlink_file(path); | 1239 return unlink_file(path); |
| 1244 } | 1240 } |
| 1324 static void file_util_delete_multiple_cancel_cb(GenericDialog *gd, gpointer data); | 1320 static void file_util_delete_multiple_cancel_cb(GenericDialog *gd, gpointer data); |
| 1325 | 1321 |
| 1326 static void file_util_delete_multiple_ok_cb(GenericDialog *gd, gpointer data) | 1322 static void file_util_delete_multiple_ok_cb(GenericDialog *gd, gpointer data) |
| 1327 { | 1323 { |
| 1328 GList *source_list = data; | 1324 GList *source_list = data; |
| 1325 | |
| 1326 if (editor_command[CMD_DELETE]) | |
| 1327 { | |
| 1328 if (!start_editor_from_path_list(CMD_DELETE, source_list)) | |
| 1329 { | |
| 1330 file_util_warning_dialog(_("File deletion failed"), _("Unable to delete files by external command\n"), GTK_STOCK_DIALOG_ERROR, NULL); | |
| 1331 } | |
| 1332 else | |
| 1333 { | |
| 1334 while (source_list) | |
| 1335 { | |
| 1336 gchar *path = source_list->data; | |
| 1337 source_list = g_list_remove(source_list, path); | |
| 1338 file_maint_removed(path, source_list); | |
| 1339 g_free(path); | |
| 1340 } | |
| 1341 } | |
| 1342 return; | |
| 1343 } | |
| 1344 | |
| 1329 | 1345 |
| 1330 while (source_list) | 1346 while (source_list) |
| 1331 { | 1347 { |
| 1332 gchar *path = source_list->data; | 1348 gchar *path = source_list->data; |
| 1333 | 1349 |
| 1525 | 1541 |
| 1526 static void file_util_delete_ok_cb(GenericDialog *gd, gpointer data) | 1542 static void file_util_delete_ok_cb(GenericDialog *gd, gpointer data) |
| 1527 { | 1543 { |
| 1528 gchar *path = data; | 1544 gchar *path = data; |
| 1529 | 1545 |
| 1530 if (!file_util_unlink(path)) | 1546 if (editor_command[CMD_DELETE]) |
| 1547 { | |
| 1548 if (!start_editor_from_file(CMD_DELETE, path)) | |
| 1549 { | |
| 1550 gchar *text = g_strdup_printf(_("Unable to delete file by external command:\n%s"), path); | |
| 1551 file_util_warning_dialog(_("File deletion failed"), text, GTK_STOCK_DIALOG_ERROR, NULL); | |
| 1552 g_free(text); | |
| 1553 } | |
| 1554 else | |
| 1555 { | |
| 1556 file_maint_removed(path, NULL); | |
| 1557 } | |
| 1558 } | |
| 1559 else if (!file_util_unlink(path)) | |
| 1531 { | 1560 { |
| 1532 gchar *text = g_strdup_printf(_("Unable to delete file:\n%s"), path); | 1561 gchar *text = g_strdup_printf(_("Unable to delete file:\n%s"), path); |
| 1533 file_util_warning_dialog(_("File deletion failed"), text, GTK_STOCK_DIALOG_ERROR, NULL); | 1562 file_util_warning_dialog(_("File deletion failed"), text, GTK_STOCK_DIALOG_ERROR, NULL); |
| 1534 g_free(text); | 1563 g_free(text); |
| 1535 } | 1564 } |
