chore: better use of configure features
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
typedef struct
|
||||
{ Image *image;
|
||||
Method *self;
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
RS02Widgets *wl;
|
||||
#endif
|
||||
RS02Layout *lay;
|
||||
@@ -56,7 +56,7 @@ static void ecc_cleanup(gpointer data)
|
||||
|
||||
UnregisterCleanup();
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
{ if(ec->earlyTermination && ec->wl)
|
||||
SetLabelText(GTK_LABEL(ec->wl->encFootline),
|
||||
@@ -92,7 +92,7 @@ static void ecc_cleanup(gpointer data)
|
||||
|
||||
g_free(ec);
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
g_thread_exit(0);
|
||||
#endif
|
||||
@@ -108,7 +108,7 @@ static void ecc_cleanup(gpointer data)
|
||||
|
||||
static void abort_encoding(ecc_closure *ec, int truncate)
|
||||
{
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
RS02Widgets *wl = ec->wl;
|
||||
#endif
|
||||
|
||||
@@ -116,14 +116,14 @@ static void abort_encoding(ecc_closure *ec, int truncate)
|
||||
{ if(!LargeTruncate(ec->image->file, (gint64)(2048*ec->lay->dataSectors)))
|
||||
Stop(_("Could not truncate %s: %s\n"),Closure->imageName,strerror(errno));
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->stopActions == STOP_CURRENT_ACTION)
|
||||
SetLabelText(GTK_LABEL(wl->encFootline),
|
||||
_("<span %s>Aborted by user request!</span> (partial ecc data removed from image)"),
|
||||
Closure->redMarkup);
|
||||
#endif
|
||||
}
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
else
|
||||
{ if(Closure->stopActions == STOP_CURRENT_ACTION)
|
||||
SetLabelText(GTK_LABEL(wl->encFootline),
|
||||
@@ -149,14 +149,14 @@ static void remove_old_ecc(ecc_closure *ec)
|
||||
guint64 data_bytes;
|
||||
int answer;
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->confirmDeletion || !Closure->guiMode)
|
||||
#endif
|
||||
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
|
||||
_("Image \"%s\" already contains error correction information.\n"
|
||||
"Truncating image to data part (%" PRId64 " sectors).\n"),
|
||||
Closure->imageName, data_sectors);
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
else answer = TRUE;
|
||||
#endif
|
||||
|
||||
@@ -213,7 +213,7 @@ static void check_image(ecc_closure *ec)
|
||||
{ unsigned char buf[2048];
|
||||
int expected,n,err;
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->stopActions) /* User hit the Stop button */
|
||||
abort_encoding(ec, FALSE);
|
||||
#endif
|
||||
@@ -256,7 +256,7 @@ static void check_image(ecc_closure *ec)
|
||||
if(last_percent != percent)
|
||||
{ PrintProgress(_("Preparing image (checksums, adding space): %3d%%") ,percent);
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
SetProgress(ec->wl->encPBar1, percent, 100);
|
||||
#endif
|
||||
@@ -308,7 +308,7 @@ static void expand_image(ecc_closure *ec)
|
||||
{ unsigned char buf[2048];
|
||||
int n;
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->stopActions) /* User hit the Stop button */
|
||||
abort_encoding(ec, TRUE);
|
||||
#endif
|
||||
@@ -326,7 +326,7 @@ static void expand_image(ecc_closure *ec)
|
||||
PrintProgress(_("Preparing image (checksums taken from cache, adding space): %3d%%") ,percent);
|
||||
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), percent);
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
SetProgress(ec->wl->encPBar1, percent, 100);
|
||||
#endif
|
||||
@@ -340,7 +340,7 @@ static void expand_image(ecc_closure *ec)
|
||||
else PrintProgress(_("Preparing image (checksums, adding space): %3d%%"), 100);
|
||||
PrintProgress("\n");
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
SetProgress(ec->wl->encPBar1, 100, 100);
|
||||
#endif
|
||||
@@ -495,7 +495,7 @@ static gint32 *enc_alpha_to;
|
||||
|
||||
/*** Show the second progress bar */
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
{ ShowWidget(ec->wl->encPBar2);
|
||||
ShowWidget(ec->wl->encLabel2);
|
||||
@@ -607,7 +607,7 @@ static gint32 *enc_alpha_to;
|
||||
{ int offset = 0;
|
||||
unsigned char *par_idx = ec->parity;
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->stopActions) /* User hit the Stop button */
|
||||
abort_encoding(ec, TRUE);
|
||||
#endif
|
||||
@@ -997,7 +997,7 @@ static gint32 *enc_alpha_to;
|
||||
percent = (1000*progress)/max_percent;
|
||||
if(last_percent != percent)
|
||||
{
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
SetProgress(ec->wl->encPBar2, percent, 1000);
|
||||
else
|
||||
@@ -1060,7 +1060,7 @@ static gint32 *enc_alpha_to;
|
||||
|
||||
void RS02Create(void)
|
||||
{ Method *self = FindMethod("RS02");
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
RS02Widgets *wl = (RS02Widgets*)self->widgetList;
|
||||
#endif
|
||||
Image *image = NULL;
|
||||
@@ -1090,13 +1090,13 @@ void RS02Create(void)
|
||||
|
||||
ec->image = image;
|
||||
ec->self = self;
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
ec->wl = wl;
|
||||
#endif
|
||||
ec->eh = g_malloc0(sizeof(EccHeader));
|
||||
ec->timer = g_timer_new();
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode) /* Preliminary fill text for the head line */
|
||||
SetLabelText(GTK_LABEL(wl->encHeadline),
|
||||
_("<big>Augmenting the image with error correction data.</big>\n<i>%s</i>"),
|
||||
@@ -1113,7 +1113,7 @@ void RS02Create(void)
|
||||
|
||||
/*** Announce what we are going to do */
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode) /* Preliminary fill text for the head line */
|
||||
{ ec->msg = g_strdup_printf(_("Encoding with Method RS02: %" PRId64 " MiB data, %" PRId64 " MiB ecc (%d roots; %4.1f%% redundancy)."),
|
||||
lay->dataSectors/512, lay->eccSectors/512, lay->nroots, lay->redundancy);
|
||||
@@ -1180,7 +1180,7 @@ void RS02Create(void)
|
||||
(lay->dataSectors + lay->eccSectors)/512,
|
||||
lay->dataSectors+lay->eccSectors);
|
||||
|
||||
#ifndef CLI
|
||||
#ifndef WITH_CLI_ONLY_YES
|
||||
if(Closure->guiMode)
|
||||
{ SetProgress(wl->encPBar2, 100, 100);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user