Changeset 2771 in MondoRescue


Ignore:
Timestamp:
Apr 22, 2011, 1:49:03 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Adds GUI support for compresion type. Fix half of #468.
Location:
branches/2.2.9/mondo/src/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2769 r2771  
    3535/*@unused@*/
    3636//static char cvsid[] = "$Id$";
     37//
     38
     39extern char *which_compression_type();
    3740
    3841extern int g_current_media_number;
     
    21662169    char *sz_size;
    21672170    char *command;
     2171    char *compression_type = NULL;
    21682172    char *comment;
    21692173    char *prompt;
     
    22232227                    bkpinfo->manual_cd_tray = TRUE;
    22242228                }
     2229            }
     2230            if ((compression_type = which_compression_type()) == NULL) {
     2231                log_to_screen("User has chosen not to backup the PC");
     2232                finish(1);
    22252233            }
    22262234            if ((bkpinfo->compression_level =
     
    24102418        }
    24112419        if (archiving_to_media) {
     2420            if ((compression_type = which_compression_type()) == NULL) {
     2421                log_to_screen("User has chosen not to backup the PC");
     2422                finish(1);
     2423            }
    24122424            if ((bkpinfo->compression_level =
    24132425                 which_compression_level()) == -1) {
     
    24442456            }
    24452457            if (!bkpinfo->restore_data) {
     2458                if ((compression_type = which_compression_type()) == NULL) {
     2459                    log_to_screen("User has chosen not to backup the PC");
     2460                    finish(1);
     2461                }
    24462462                if ((bkpinfo->compression_level =
    24472463                     which_compression_level()) == -1) {
     
    25752591            }
    25762592            if (archiving_to_media) {
     2593                if ((compression_type = which_compression_type()) == NULL) {
     2594                    log_to_screen("User has chosen not to backup the PC");
     2595                    finish(1);
     2596                }
    25772597                if ((bkpinfo->compression_level =
    25782598                     which_compression_level()) == -1) {
     
    27322752#endif
    27332753        bkpinfo->backup_data = TRUE;
     2754        if (strcmp(compression_type,"lzo") == 0) {
     2755            strcpy(bkpinfo->zip_exe, "lzop");
     2756            strcpy(bkpinfo->zip_suffix, "lzo");
     2757        } else if (strcmp(compression_type,"gzip") == 0) {
     2758            strcpy(bkpinfo->zip_exe, "gzip");
     2759            strcpy(bkpinfo->zip_suffix, "gz");
     2760        //} else if (strcmp(compression_type,"lzma") == 0) {
     2761            //strcpy(bkpinfo->zip_exe, "xy");
     2762            //strcpy(bkpinfo->zip_suffix, "xy");
     2763        } else if (strcmp(compression_type,"bzip2") == 0) {
     2764            strcpy(bkpinfo->zip_exe, "bzip2");
     2765            strcpy(bkpinfo->zip_suffix, "bz2");
     2766        } else {
     2767            bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';
     2768        }
    27342769        bkpinfo->verify_data =
    27352770            ask_me_yes_or_no
  • branches/2.2.9/mondo/src/common/newt-specific.c

    r2769 r2771  
    13611361
    13621362
     1363
     1364
     1365/**
     1366 * Ask the user which compression type they would like to use.
     1367 * The choices are "bzip2", "gzip", "lzo". NULL for exit
     1368 */
     1369    char *which_compression_type() {
     1370
     1371        /*@ char ************************************************************ */
     1372        char *output = NULL;
     1373
     1374
     1375        /*@ newt ************************************************************ */
     1376
     1377        newtComponent b1;
     1378        newtComponent b2;
     1379        newtComponent b3;
     1380        //newtComponent b4;
     1381        newtComponent b5;
     1382        newtComponent b_res;
     1383        newtComponent myForm;
     1384
     1385        newtDrawRootText(18, 0, WELCOME_STRING);
     1386        newtPushHelpLine
     1387            ("   Please specify the type of compression that you want.");
     1388        newtCenteredWindow(34, 13, "Type of compression?");
     1389        b1 = newtButton(4, 1, "bzip2");
     1390        b2 = newtButton(18, 1, "gzip");
     1391        b3 = newtButton(4, 5, "lzo");
     1392        //b4 = newtButton(18, 5, "lzma");
     1393        b5 = newtButton(4, 9, "         Exit        ");
     1394        myForm = newtForm(NULL, NULL, 0);
     1395        newtFormAddComponents(myForm, b1, b3, b2, b5, NULL);
     1396        b_res = newtRunForm(myForm);
     1397        newtFormDestroy(myForm);
     1398        newtPopWindow();
     1399        if (b_res == b1) {
     1400            mr_asprintf(&output, "%s", "bzip2");
     1401        } else if (b_res == b2) {
     1402            mr_asprintf(&output, "%s", "gzip");
     1403        } else if (b_res == b3) {
     1404            mr_asprintf(&output, "%s", "lzo");
     1405        //} else if (b_res == b4) {
     1406            //mr_asprintf(&output, "%s", "lzma");
     1407        }
     1408        newtPopHelpLine();
     1409        return(output);
     1410    }
    13631411
    13641412
Note: See TracChangeset for help on using the changeset viewer.