/[graveman]/graveman/current/src/matos.c
ViewVC logotype

Diff of /graveman/current/src/matos.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by scresto, Sun Mar 27 23:51:07 2005 UTC revision 1.25 by scresto, Tue Mar 29 00:10:26 2005 UTC
# Line 338  gboolean burn_data(Tgrave *Ag, GError ** Line 338  gboolean burn_data(Tgrave *Ag, GError **
338     * l'operation */     * l'operation */
339    Lstatus = preparedata(Ag, Aerror);    Lstatus = preparedata(Ag, Aerror);
340    
341    _DEB("ici LDST => %s\n", Ldst);    _DEB("i1ci LDST => %s\n", Ldst);
342    if (strcmp(Ldst, "iso")) {    if (strcmp(Ldst, "iso")) {
343      g_snprintf(Liso, MAXPATHLEN-1, "%s.iso", Ltmpdir);      g_snprintf(Liso, MAXPATHLEN-1, "%s.iso", Ltmpdir);
344      Ltodo+=(Lsimul ? 2 : 1); /* + 1 pour l'ecriture de l'image iso et 1 pour la simulation */      Ltodo+=(Lsimul ? 2 : 1); /* + 1 pour l'ecriture de l'image iso et 1 pour la simulation */
# Line 350  gboolean burn_data(Tgrave *Ag, GError ** Line 350  gboolean burn_data(Tgrave *Ag, GError **
350    }    }
351    
352    sc_grave_set_data(Ag, &Liso, "iso"); /* image iso */    sc_grave_set_data(Ag, &Liso, "iso"); /* image iso */
353    g_warning("tout debut !\n");
354    if (Lstatus && *Labort==FALSE) {    if (Lstatus && *Labort==FALSE) {
355    g_warning("tout debut 2!\n");
356      Lextrapara = make_image_getextrapara(Ag, "data");      Lextrapara = make_image_getextrapara(Ag, "data");
357    g_warning("tout debut 3!\n");
358      sc_grave_set_data(Ag, Lextrapara, "extrapara"); /* parametres supplementaires */      sc_grave_set_data(Ag, Lextrapara, "extrapara"); /* parametres supplementaires */
359        g_warning("oui on fais l'iso !\n");    
360      Lstatus = make_iso(Ag, Aerror);      Lstatus = make_iso(Ag, Aerror);
       
361      sc_grave_del_data(Ag, "extrapara");      sc_grave_del_data(Ag, "extrapara");
362      g_free(Lextrapara);      g_free(Lextrapara);
363      if (strcmp(Ldst, "iso") && Lstatus && *Labort==FALSE) {      if (strcmp(Ldst, "iso") && Lstatus && *Labort==FALSE) {
# Line 481  void put_devicelabel(Tdriveinfo *Adrive, Line 483  void put_devicelabel(Tdriveinfo *Adrive,
483    }    }
484  }  }
485    
486  extern Tdriveinfo *get_drive_cmb(GtkComboBox *Acombo)  /*extern Tdriveinfo *get_drive_cmb(GtkComboBox *Acombo)
487  {  {
488    GtkTreeModel *Lmodel = gtk_combo_box_get_model(GTK_COMBO_BOX(Acombo));    GtkTreeModel *Lmodel = gtk_combo_box_get_model(GTK_COMBO_BOX(Acombo));
489    GtkTreeIter Liter;    GtkTreeIter Liter;
# Line 491  extern Tdriveinfo *get_drive_cmb(GtkComb Line 493  extern Tdriveinfo *get_drive_cmb(GtkComb
493    gtk_tree_model_get(Lmodel, &Liter, 3, &Lvalue, -1);    gtk_tree_model_get(Lmodel, &Liter, 3, &Lvalue, -1);
494    
495    return (Tdriveinfo *) g_slist_nth_data(Glistdrives, Lvalue);    return (Tdriveinfo *) g_slist_nth_data(Glistdrives, Lvalue);
496  }  }*/
497    
498  /* operation gravure dcd de donnee */  /* operation gravure dcd de donnee */
499  gboolean burn_dvddata(Tgrave *Ag, GError **Aerror)  gboolean burn_dvddata(Tgrave *Ag, GError **Aerror)
# Line 518  gboolean burn_dvddata(Tgrave *Ag, GError Line 520  gboolean burn_dvddata(Tgrave *Ag, GError
520    /* on retourne dans ltmp le nom du repertoire temporraire utilise pour    /* on retourne dans ltmp le nom du repertoire temporraire utilise pour
521     * l'operation */     * l'operation */
522    Lstatus = preparedata(Ag, Aerror);    Lstatus = preparedata(Ag, Aerror);
523  _DEB("ici LDST => %s\n", Ldst);  _DEB("ici 1LDST => %s\n", Ldst);
524    
525    Lextrapara = make_image_getextrapara(Ag, "dvddata");    Lextrapara = make_image_getextrapara(Ag, "dvddata");
526    sc_grave_set_data(Ag, Lextrapara, "extradata"); /* parametres supplementaires */    sc_grave_set_data(Ag, Lextrapara, "extrapara"); /* parametres supplementaires */
527    
528    if (strcmp(Ldst, "iso")) {    if (strcmp(Ldst, "iso")) {
529      if (Lsimul) Ltodo++; /* 1 pour la simulation */      if (Lsimul) Ltodo++; /* 1 pour la simulation */
# Line 540  _DEB("ici LDST => %s\n", Ldst); Line 542  _DEB("ici LDST => %s\n", Ldst);
542    sc_grave_del_data(Ag, "extrapara");    sc_grave_del_data(Ag, "extrapara");
543    g_free(Lextrapara);    g_free(Lextrapara);
544    
545    deltempdir(Ltmpdir);    unlink(Ltmpdir);
546    
547    sc_grave_del_data(Ag, "todo");    sc_grave_del_data(Ag, "todo");
548    sc_grave_del_data(Ag, "done");    sc_grave_del_data(Ag, "done");
# Line 551  _DEB("ici LDST => %s\n", Ldst); Line 553  _DEB("ici LDST => %s\n", Ldst);
553    return Lstatus;    return Lstatus;
554  }  }
555    
556  void set_waitwindow_title(gboolean Ainsert, gint Atypecd, gint Anum, Tgrave *Awaitg)  void set_waitwindow_title(gboolean Ainsert, gint Atypecd, Tgrave *Awaitg)
557  {  {
558    gchar Lcd[_BUF_SIZE];    gchar Lcd[_BUF_SIZE];
559    gchar Ltitle[_BUF_SIZE];    gchar Ltitle[_BUF_SIZE];
560    gchar *Ldrivelib = sc_grave_get_datav(Awaitg, "devicetitle%d", Anum);    Tdriveinfo *Ldevice = (Tdriveinfo *)sc_grave_get_data(Awaitg, "device1");
561    GtkLabel *Llabel = GTK_LABEL(sc_grave_get_widgetv(Awaitg, "label%d", Anum));    GtkLabel *Llabel = GTK_LABEL(sc_grave_get_widget(Awaitg, "label1"));
562  printf("la man ?\n");  printf("oui ?!\n");  
563    printf("typecd ==== [%d]\n", Atypecd);
564    *Ltitle=0;    *Ltitle=0;
565    *Lcd = 0;    *Lcd = 0;
566    if (Atypecd & _MEDIA_BLANKORAPPENDABLE) {    if (Atypecd & _MEDIA_BLANKORAPPENDABLE) {
567      g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR/RW"));      g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR/RW"));
568    } else if (Atypecd & _MEDIA_CDR) {    } else if ((Atypecd & _MEDIA_DVDPRW) || (Atypecd & _MEDIA_DVDMRW)) {
569      g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR"));      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDRW"));
570    } else if (Atypecd & _MEDIA_CDRW) {    } else if (Atypecd & _MEDIA_DVDRew) {
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDRW"));  
   } else if (Atypecd & _MEDIA_CD) {  
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a CD"));  
   }  
   if (*Lcd && (Atypecd & _MEDIA_IS_DVD)) {  
     strncat(Lcd, _(" or "), sizeof(Lcd)-1);  
   }  
   if (Atypecd & _MEDIA_DVDRew) {  
571      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDR/RW"));      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDR/RW"));
572    } else if (Atypecd & _MEDIA_DVDR) {    } else if (Atypecd & _MEDIA_DVDR) {
573      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDR"));      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDR"));
   } else if ((Atypecd & _MEDIA_DVDPRW) || (Atypecd & _MEDIA_DVDMRW)) {  
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDRW"));  
574    } else if (Atypecd & _MEDIA_DVD) {    } else if (Atypecd & _MEDIA_DVD) {
575      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVD"));      g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVD"));
576      } else if (Atypecd & _MEDIA_CDRW) {
577        g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDRW"));
578      } else if (Atypecd & _MEDIA_CDR) {
579        g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR"));
580      } else if (Atypecd & _MEDIA_CD) {
581        g_snprintf(Lcd, sizeof(Lcd)-1, _("a CD"));
582    }    }
583    
584  printf("la man 2?\n");  printf("la man 2?\n");
585  printf("cd [%s]\n", Lcd);  printf("cd [%s]\n", Lcd);
586  printf("drv [%s]\n", Ldrivelib);  printf("drv [%s]\n", Ldevice->name);
587    if (Ainsert) {    if (Ainsert) {
588      g_snprintf(Ltitle, sizeof(Ltitle)-1, _("Please insert %s in drive %s to continue..."), Lcd, Ldrivelib);      g_snprintf(Ltitle, sizeof(Ltitle)-1, _("Please insert %s in drive %s to continue..."), Lcd, Ldevice->name);
589    } else {    } else {
590      g_snprintf(Ltitle, sizeof(Ltitle)-1, _("Ok there is %s in drive %s."), Lcd, Ldrivelib);      g_snprintf(Ltitle, sizeof(Ltitle)-1, _("Ok there is %s in drive %s."), Lcd, Ldevice->name);
591    }    }
592  printf("ca chie?\n");  printf("ca chie?\n");
593    gtk_label_set_text(Llabel, Ltitle);    gtk_label_set_text(Llabel, Ltitle);
# Line 601  gboolean callback_waiting_for_user(gpoin Line 600  gboolean callback_waiting_for_user(gpoin
600    Tgrave *Lg = (Tgrave *)Adata;    Tgrave *Lg = (Tgrave *)Adata;
601    gint *Lcont = (gint *)sc_grave_get_data(Lg, "cont");    gint *Lcont = (gint *)sc_grave_get_data(Lg, "cont");
602    gint *Ldetect = NULL;    gint *Ldetect = NULL;
   gchar *Ldrive;  
603    GSList *Lrequis, *Lcur;    GSList *Lrequis, *Lcur;
604    gint *Ltitle;    Tdriveinfo *Ldrive = NULL;
605      gint *Lmediatitle;
606    gint Lmedialu;    gint Lmedialu;
607    gint Lmediatest;    gint Lmediatest;
608    gboolean Lstatusmedia = TRUE;    gboolean Lstatusmedia = TRUE;
   gint i;  
609    gboolean *Linitdisp = (gboolean *) sc_grave_get_data(Lg, "initdisp");    gboolean *Linitdisp = (gboolean *) sc_grave_get_data(Lg, "initdisp");
610        
611    for (i=1; 1; i++) {    Ldrive = sc_grave_get_data(Lg, "device1");
612      Ldrive = sc_grave_get_datav(Lg, "device%d", i);    if (!Ldrive) return TRUE;
613      if (!Ldrive) break;  printf("get1\n");
614            Lrequis = (GSList *) sc_grave_get_data(Lg, "devicerequis1");
615      Lrequis = (GSList *) sc_grave_get_datav(Lg, "devicerequis%d", i);  printf("get2\n");
616      Ldetect = (gint *) sc_grave_get_datav(Lg, "detect%d", i);    Ldetect = (gint *) sc_grave_get_data(Lg, "detect1");
617      Ltitle = (gint *)sc_grave_get_datav(Lg, "devicetitle%d", i);  printf("get3\n");
618      Lmedialu = 0;    Lmediatitle = (gint *)sc_grave_get_data(Lg, "mediatitle1");
619    printf("get4\n");
620      if (Linitdisp && *Linitdisp) {    Lmedialu = 0;
621        set_waitwindow_title(Lstatusmedia, *Ltitle, i, Lg);  
622        gtk_widget_show(GTK_WIDGET(sc_grave_get_data(Lg, "window")));    if (Linitdisp && *Linitdisp) {
623        gdk_flush ();  printf("get6\n");
624        *Linitdisp = FALSE;      set_waitwindow_title(Lstatusmedia, *Lmediatitle, Lg);
625      }  printf("get7\n");
626        gtk_widget_show(GTK_WIDGET(sc_grave_get_data(Lg, "window")));
627        gdk_flush ();
628        *Linitdisp = FALSE;
629      }
630            
631     printf("la DVD ?!\n");   printf("la DVD ?!\n");
632  /*    if (*Lrequis & _MEDIA_IS_DVD) {*/  /*    if (*Lrequis & _MEDIA_IS_DVD) {*/
633        Lmedialu += get_dvdinfo(Lg, Ldrive, NULL);    Lmedialu += get_dvdinfo(Lg, Ldrive, NULL);
634  /*    }*/  /*    }*/
635    
636     printf("la CD ?!\n");    printf("la CD ?!\n");
637  /*    if (*Lrequis & _MEDIA_IS_CD) {*/  /*    if (*Lrequis & _MEDIA_IS_CD) {*/
638        Lmedialu += get_cdinfo(Lg, Ldrive, NULL);    Lmedialu += get_cdinfo(Lg, Ldrive, NULL);
639  /*    }*/  /*    }*/
640    
641      if (Ldetect) *Ldetect = Lmedialu;    if (Ldetect) *Ldetect = Lmedialu;
642  /*    Lstatusmedia = (!(_MEDIA_CMP_CD(*Lrequis, Lmedialu) || _MEDIA_CMP_DVD(*Lrequis, Lmedialu))) ||  /*    Lstatusmedia = (!(_MEDIA_CMP_CD(*Lrequis, Lmedialu) || _MEDIA_CMP_DVD(*Lrequis, Lmedialu))) ||
643                      ((*Lrequis & _MEDIA_BLANKORAPPENDABLE) &&                      ((*Lrequis & _MEDIA_BLANKORAPPENDABLE) &&
644                          ((!(Lmedialu  & _MEDIA_BLANK)) && (!(Lmedialu & _MEDIA_APPENDABLE)))) ||                          ((!(Lmedialu  & _MEDIA_BLANK)) && (!(Lmedialu & _MEDIA_APPENDABLE)))) ||
# Line 645  gboolean callback_waiting_for_user(gpoin Line 647  gboolean callback_waiting_for_user(gpoin
647                       ((*Lrequis & _MEDIA_APPENDABLE) && (!(Lmedialu & _MEDIA_APPENDABLE)));                       ((*Lrequis & _MEDIA_APPENDABLE) && (!(Lmedialu & _MEDIA_APPENDABLE)));
648      if (Lstatusmedia) LnewCont = TRUE;*/      if (Lstatusmedia) LnewCont = TRUE;*/
649  printf("on a LU [%d]\n", Lmedialu);  printf("on a LU [%d]\n", Lmedialu);
650      for (Lcur = Lrequis; Lcur; Lcur = g_slist_next(Lcur)) {    for (Lcur = Lrequis; Lcur; Lcur = g_slist_next(Lcur)) {
651        Lmediatest = (int ) Lcur->data;      Lmediatest = (int ) Lcur->data;
652  printf("et on TEST [%d]\n", Lmediatest);  printf("et on TEST [%d]\n", Lmediatest);
653  printf("resu du test [%d]\n", (Lmediatest & Lmedialu));  printf("resu du test [%d]\n", (Lmediatest & Lmedialu));
654        if ((Lmediatest & Lmedialu) == Lmediatest) {      if ((Lmediatest & Lmedialu) == Lmediatest) {
655          *Lcont  = 0;        *Lcont  = 0;
656          Lstatusmedia = FALSE;        Lstatusmedia = FALSE;
657          break;        break;
       }  
658      }      }
     set_waitwindow_title(Lstatusmedia, *Ltitle, i, Lg);  
     gdk_flush ();  
   
     if (Lstatusmedia == FALSE) break;  
659    }    }
660      set_waitwindow_title(Lstatusmedia, *Lmediatitle, Lg);
661      gdk_flush ();
662    
663    
664    return TRUE;    return TRUE;
665  }  }
666    
667  /* attente que l'utilisateur ai bien insere un cd */  /* attente que l'utilisateur ai bien insere un cd */
668  gboolean waiting_for_user(gint Atitle, Tgrave *Ag, GSList *Arequiscd1, gint *Adetectcd1, gchar *Ldriveident1)  gboolean waiting_for_user(gint Atitle, Tgrave *Ag, GSList *Arequiscd1, gint *Adetectcd1, Tdriveinfo *Ldriveident1)
669  {  {
670    Tgrave *Lwaitg = sc_grave_load("window_waiting_cd.glade");    Tgrave *Lwaitg = sc_grave_load("window_waiting_cd.glade");
671    GtkWidget *Lparent = sc_grave_get_widget(Ag, "topwindow");    GtkWidget *Lparent = sc_grave_get_widget(Ag, "topwindow");
672    GtkWidget *Lwindow;    GtkWidget *Lwindow;
673    gchar *Lident1 = NULL, *Ldevicetitle1 = NULL;    gchar *Ldevicetitle1 = NULL;
674    gchar *Lident2 = NULL, *Ldevicetitle2 = NULL;    gchar *Ldevicetitle2 = NULL;
675    gint Lcont = 2;    gint Lcont = 2;
676    gint Lpid = 0;    gint Lpid = 0;
677    gboolean Labort = FALSE;    gboolean Labort = FALSE;
678    gboolean Linit = TRUE;    gboolean Linit = TRUE;
679    guint Ltimeout = 0;    guint Ltimeout = 0;
   GtkTreeIter Liter;  
680    
681    if (Atitle == _MEDIA_NONE) return TRUE;    if (Atitle == _MEDIA_NONE) return TRUE;
682        
# Line 691  gboolean waiting_for_user(gint Atitle, T Line 690  gboolean waiting_for_user(gint Atitle, T
690    sc_grave_set_data(Lwaitg, &Labort, "gabort");    sc_grave_set_data(Lwaitg, &Labort, "gabort");
691    sc_grave_set_data(Lwaitg, &Lpid, "pid");    sc_grave_set_data(Lwaitg, &Lpid, "pid");
692        
693    if (Ldriveident1 && *Ldriveident1) {    if (Ldriveident1) {
694      GtkComboBox *Lcombob1 = GTK_COMBO_BOX(sc_grave_get_widget(Ag, Ldriveident1));      sc_grave_set_data(Lwaitg, Ldriveident1, "device1");
695      GtkTreeModel *Lmodelb1 = gtk_combo_box_get_model(Lcombob1);      sc_grave_set_data(Lwaitg, Adetectcd1, "detect1");
696      if (gtk_combo_box_get_active_iter(Lcombob1, &Liter)) {      sc_grave_set_data(Lwaitg, &Atitle, "mediatitle1");
697        gtk_tree_model_get(Lmodelb1, &Liter, 0, &Lident1, 2, &Ldevicetitle1, -1);      sc_grave_set_data(Lwaitg, Arequiscd1, "devicerequis1");
   
       sc_grave_set_data(Lwaitg, Lident1, "device1");  
       sc_grave_set_data(Lwaitg, Adetectcd1, "detect1");  
       sc_grave_set_data(Lwaitg, &Atitle, "devicetitle1");  
       sc_grave_set_data(Lwaitg, Arequiscd1, "devicerequis1");  
698    
699        set_waitwindow_title(TRUE, Atitle, 1, Lwaitg);      set_waitwindow_title(TRUE, Atitle, Lwaitg);
     }  
700    }    }
701    
702    gtk_window_set_transient_for(GTK_WINDOW(Lwindow), GTK_WINDOW(Lparent));    gtk_window_set_transient_for(GTK_WINDOW(Lwindow), GTK_WINDOW(Lparent));
# Line 715  gboolean waiting_for_user(gint Atitle, T Line 708  gboolean waiting_for_user(gint Atitle, T
708     * deja inseré le bon cd qui va bien */     * deja inseré le bon cd qui va bien */
709    sc_grave_set_data(Lwaitg, &Linit, "initdisp");    sc_grave_set_data(Lwaitg, &Linit, "initdisp");
710    callback_waiting_for_user(Lwaitg);    callback_waiting_for_user(Lwaitg);
711    sc_grave_del_data(Lwaitg, "initdisp");    Linit = FALSE;
 printf("la !!!! !\n");  
712    
713    if (Lcont == 2 && Labort == FALSE) {    if (Lcont == 2 && Labort == FALSE) {
714      /* apparement non, on affiche la fenetre d'attente */      /* apparement non, on affiche la fenetre d'attente */
# Line 725  printf("la !!!! !\n"); Line 717  printf("la !!!! !\n");
717        gtk_main_iteration();        gtk_main_iteration();
718      } while (Lcont == 2 && Labort == FALSE);      } while (Lcont == 2 && Labort == FALSE);
719    }    }
720      sc_grave_del_data(Lwaitg, "initdisp");
721    
722    /* fin du timeout */    /* fin du timeout */
723    if (Ltimeout) g_source_remove(Ltimeout);    if (Ltimeout) g_source_remove(Ltimeout);
724    
725    gtk_widget_destroy(Lwindow);    gtk_widget_destroy(Lwindow);
726    
727    g_free(Lident1); g_free(Lident2);  /*  g_free(Lident1); g_free(Lident2);*/
728    g_free(Ldevicetitle1); g_free(Ldevicetitle2);    g_free(Ldevicetitle1); g_free(Ldevicetitle2);
729    
730    sc_grave_destroy(Lwaitg);    sc_grave_destroy(Lwaitg);
# Line 740  printf("lcont => %d %d\n", Lcont, Labort Line 733  printf("lcont => %d %d\n", Lcont, Labort
733    return (Lcont == 0 && Labort == FALSE);    return (Lcont == 0 && Labort == FALSE);
734  }  }
735    
736    Tdriveinfo *get_drive_info(Tgrave *Ag, gchar *Aname)
737    {
738      return get_combo_value(sc_grave_get_widget(Ag, Aname));
739    }
740    
741    gchar *get_dvdrwtools_bus(Tdriveinfo *Adrive)
742    {
743      GSList *Lcur;
744      gchar *Lcurbus;
745      gint i = 0;
746    
747      for (Lcur = Adrive->bus; Lcur; Lcur = g_slist_next(Lcur), i++) {
748        Lcurbus = (gchar *) Lcur->data;
749    
750        if (!strcmp(Lcurbus, "IDE") || !strcmp(Lcurbus, "DSCSI")) {
751          return g_slist_nth_data(Adrive->dev, i);
752        }
753      }
754    
755      return NULL;
756    }
757    
758  gboolean is_an_iso(Tgrave *Ag, gchar *Aname)  gboolean is_an_iso(Tgrave *Ag, gchar *Aname)
759  {  {
760    gboolean Lstatus = FALSE;    Tdriveinfo *Ldrive = get_combo_value(sc_grave_get_widget(Ag, Aname));
   gchar *Liso = get_combo_value(sc_grave_get_widget(Ag, Aname));  
   Lstatus = !strcmp(Liso, "iso");  
761    
762    return Lstatus;    return Ldrive ? TRUE : FALSE;
763  }  }
764    
765  /*  /*

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26