mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
Get rid of g_return_* macros in file operation routines
...since they produce warnings about non-created UI and clutter screen up. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
907b7cce5d
commit
3ecfeb04da
@ -649,7 +649,8 @@ check_progress_buttons (FileOpContext * ctx)
|
|||||||
Gpm_Event event;
|
Gpm_Event event;
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_val_if_fail (ctx->ui != NULL, FILE_CONT);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
|
return FILE_CONT;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
@ -702,8 +703,8 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
|
|||||||
int dlg_width = 58, dlg_height = 17;
|
int dlg_width = 58, dlg_height = 17;
|
||||||
int y = 2, x = 3;
|
int y = 2, x = 3;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui != NULL)
|
||||||
g_return_if_fail (ctx->ui == NULL);
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
if (progress_buttons[0].len == -1)
|
if (progress_buttons[0].len == -1)
|
||||||
@ -715,7 +716,6 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ctx->dialog_type = dialog_type;
|
ctx->dialog_type = dialog_type;
|
||||||
ctx->recursive_result = RECURSIVE_YES;
|
ctx->recursive_result = RECURSIVE_YES;
|
||||||
ctx->ui = g_new0 (FileOpContextUI, 1);
|
ctx->ui = g_new0 (FileOpContextUI, 1);
|
||||||
@ -829,9 +829,7 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta,
|
|||||||
void
|
void
|
||||||
file_op_context_destroy_ui (FileOpContext * ctx)
|
file_op_context_destroy_ui (FileOpContext * ctx)
|
||||||
{
|
{
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx != NULL && ctx->ui != NULL)
|
||||||
|
|
||||||
if (ctx->ui != NULL)
|
|
||||||
{
|
{
|
||||||
FileOpContextUI *ui = (FileOpContextUI *) ctx->ui;
|
FileOpContextUI *ui = (FileOpContextUI *) ctx->ui;
|
||||||
|
|
||||||
@ -856,12 +854,9 @@ file_progress_show (FileOpContext * ctx, off_t done, off_t total,
|
|||||||
char buffer2[BUF_TINY];
|
char buffer2[BUF_TINY];
|
||||||
char buffer3[BUF_TINY];
|
char buffer3[BUF_TINY];
|
||||||
|
|
||||||
if (!verbose)
|
if (!verbose || ctx == NULL || ctx->ui == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
if (total == 0)
|
if (total == 0)
|
||||||
@ -903,8 +898,8 @@ file_progress_show_count (FileOpContext * ctx, size_t done, size_t total)
|
|||||||
char buffer[BUF_TINY];
|
char buffer[BUF_TINY];
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
return;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
if (ctx->progress_totals_computed)
|
if (ctx->progress_totals_computed)
|
||||||
@ -927,8 +922,8 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma
|
|||||||
struct timeval tv_current;
|
struct timeval tv_current;
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
return;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
@ -995,8 +990,8 @@ file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath)
|
|||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
return;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
@ -1023,8 +1018,8 @@ file_progress_show_target (FileOpContext * ctx, const vfs_path_t * s_vpath)
|
|||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
return;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
@ -1051,8 +1046,8 @@ file_progress_show_deleting (FileOpContext * ctx, const char *s)
|
|||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_if_fail (ctx->ui != NULL);
|
return;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
label_set_text (ui->file_label[0], _("Deleting"));
|
label_set_text (ui->file_label[0], _("Deleting"));
|
||||||
@ -1068,8 +1063,8 @@ file_progress_real_query_replace (FileOpContext * ctx,
|
|||||||
{
|
{
|
||||||
FileOpContextUI *ui;
|
FileOpContextUI *ui;
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, FILE_CONT);
|
if (ctx == NULL || ctx->ui == NULL)
|
||||||
g_return_val_if_fail (ctx->ui != NULL, FILE_CONT);
|
return FILE_CONT;
|
||||||
|
|
||||||
ui = ctx->ui;
|
ui = ctx->ui;
|
||||||
|
|
||||||
@ -1132,7 +1127,8 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation,
|
|||||||
char *dest_dir, *tmp;
|
char *dest_dir, *tmp;
|
||||||
char *def_text_secure;
|
char *def_text_secure;
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, NULL);
|
if (ctx == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* unselect checkbox if target filesystem don't support attributes */
|
/* unselect checkbox if target filesystem don't support attributes */
|
||||||
ctx->op_preserve = filegui__check_attrs_on_fs (def_text);
|
ctx->op_preserve = filegui__check_attrs_on_fs (def_text);
|
||||||
|
@ -98,12 +98,12 @@ file_op_context_new (FileOperation op)
|
|||||||
void
|
void
|
||||||
file_op_context_destroy (FileOpContext * ctx)
|
file_op_context_destroy (FileOpContext * ctx)
|
||||||
{
|
{
|
||||||
g_return_if_fail (ctx != NULL);
|
if (ctx != NULL)
|
||||||
|
{
|
||||||
file_op_context_destroy_ui (ctx);
|
file_op_context_destroy_ui (ctx);
|
||||||
mc_search_free (ctx->search_handle);
|
mc_search_free (ctx->search_handle);
|
||||||
/** \todo FIXME: do we need to free ctx->dest_mask? */
|
g_free (ctx);
|
||||||
g_free (ctx);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user