graveman-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Graveman-cvs] Changes to graveman/current/src/matos.c


From: sylvain cresto
Subject: [Graveman-cvs] Changes to graveman/current/src/matos.c
Date: Mon, 28 Mar 2005 19:10:28 -0500

Index: graveman/current/src/matos.c
diff -u graveman/current/src/matos.c:1.24 graveman/current/src/matos.c:1.25
--- graveman/current/src/matos.c:1.24   Sun Mar 27 23:51:07 2005
+++ graveman/current/src/matos.c        Tue Mar 29 00:10:26 2005
@@ -338,7 +338,7 @@
    * l'operation */
   Lstatus = preparedata(Ag, Aerror);
 
-  _DEB("ici LDST => %s\n", Ldst);
+  _DEB("i1ci LDST => %s\n", Ldst);
   if (strcmp(Ldst, "iso")) {
     g_snprintf(Liso, MAXPATHLEN-1, "%s.iso", Ltmpdir);
     Ltodo+=(Lsimul ? 2 : 1); /* + 1 pour l'ecriture de l'image iso et 1 pour 
la simulation */
@@ -350,12 +350,14 @@
   }
 
   sc_grave_set_data(Ag, &Liso, "iso"); /* image iso */
+g_warning("tout debut !\n");
   if (Lstatus && *Labort==FALSE) {
+g_warning("tout debut 2!\n");
     Lextrapara = make_image_getextrapara(Ag, "data");
+g_warning("tout debut 3!\n");
     sc_grave_set_data(Ag, Lextrapara, "extrapara"); /* parametres 
supplementaires */
-    
+g_warning("oui on fais l'iso !\n");    
     Lstatus = make_iso(Ag, Aerror);
-    
     sc_grave_del_data(Ag, "extrapara");
     g_free(Lextrapara);
     if (strcmp(Ldst, "iso") && Lstatus && *Labort==FALSE) {
@@ -481,7 +483,7 @@
   }
 }
 
-extern Tdriveinfo *get_drive_cmb(GtkComboBox *Acombo)
+/*extern Tdriveinfo *get_drive_cmb(GtkComboBox *Acombo)
 {
   GtkTreeModel *Lmodel = gtk_combo_box_get_model(GTK_COMBO_BOX(Acombo));
   GtkTreeIter Liter;
@@ -491,7 +493,7 @@
   gtk_tree_model_get(Lmodel, &Liter, 3, &Lvalue, -1);
 
   return (Tdriveinfo *) g_slist_nth_data(Glistdrives, Lvalue);
-}
+}*/
 
 /* operation gravure dcd de donnee */
 gboolean burn_dvddata(Tgrave *Ag, GError **Aerror)
@@ -518,10 +520,10 @@
   /* on retourne dans ltmp le nom du repertoire temporraire utilise pour
    * l'operation */
   Lstatus = preparedata(Ag, Aerror);
-_DEB("ici LDST => %s\n", Ldst);
+_DEB("ici 1LDST => %s\n", Ldst);
 
   Lextrapara = make_image_getextrapara(Ag, "dvddata");
-  sc_grave_set_data(Ag, Lextrapara, "extradata"); /* parametres 
supplementaires */
+  sc_grave_set_data(Ag, Lextrapara, "extrapara"); /* parametres 
supplementaires */
 
   if (strcmp(Ldst, "iso")) {
     if (Lsimul) Ltodo++; /* 1 pour la simulation */
@@ -540,7 +542,7 @@
   sc_grave_del_data(Ag, "extrapara");
   g_free(Lextrapara);
 
-  deltempdir(Ltmpdir);
+  unlink(Ltmpdir);
 
   sc_grave_del_data(Ag, "todo");
   sc_grave_del_data(Ag, "done"); 
@@ -551,44 +553,41 @@
   return Lstatus;
 }
 
-void set_waitwindow_title(gboolean Ainsert, gint Atypecd, gint Anum, Tgrave 
*Awaitg)
+void set_waitwindow_title(gboolean Ainsert, gint Atypecd, Tgrave *Awaitg)
 {
   gchar Lcd[_BUF_SIZE];
   gchar Ltitle[_BUF_SIZE];
-  gchar *Ldrivelib = sc_grave_get_datav(Awaitg, "devicetitle%d", Anum);
-  GtkLabel *Llabel = GTK_LABEL(sc_grave_get_widgetv(Awaitg, "label%d", Anum));
-printf("la man ?\n");
+  Tdriveinfo *Ldevice = (Tdriveinfo *)sc_grave_get_data(Awaitg, "device1");
+  GtkLabel *Llabel = GTK_LABEL(sc_grave_get_widget(Awaitg, "label1"));
+printf("oui ?!\n");  
+printf("typecd ==== [%d]\n", Atypecd);
   *Ltitle=0;
   *Lcd = 0;
   if (Atypecd & _MEDIA_BLANKORAPPENDABLE) {
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR/RW"));
-  } else if (Atypecd & _MEDIA_CDR) {
-    g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR"));
-  } else if (Atypecd & _MEDIA_CDRW) {
-    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) {
+  } else if ((Atypecd & _MEDIA_DVDPRW) || (Atypecd & _MEDIA_DVDMRW)) {
+    g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDRW"));
+  } else if (Atypecd & _MEDIA_DVDRew) {
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVDR/RW"));
   } else if (Atypecd & _MEDIA_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"));
   } else if (Atypecd & _MEDIA_DVD) {
     g_snprintf(Lcd, sizeof(Lcd)-1, _("a DVD"));
+  } else if (Atypecd & _MEDIA_CDRW) {
+    g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDRW"));
+  } else if (Atypecd & _MEDIA_CDR) {
+    g_snprintf(Lcd, sizeof(Lcd)-1, _("a CDR"));
+  } else if (Atypecd & _MEDIA_CD) {
+    g_snprintf(Lcd, sizeof(Lcd)-1, _("a CD"));
   }
 
 printf("la man 2?\n");
 printf("cd [%s]\n", Lcd);
-printf("drv [%s]\n", Ldrivelib);
+printf("drv [%s]\n", Ldevice->name);
   if (Ainsert) {
-    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);
   } else {
-    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);
   }
 printf("ca chie?\n");
   gtk_label_set_text(Llabel, Ltitle);
@@ -601,42 +600,45 @@
   Tgrave *Lg = (Tgrave *)Adata;
   gint *Lcont = (gint *)sc_grave_get_data(Lg, "cont");
   gint *Ldetect = NULL;
-  gchar *Ldrive;
   GSList *Lrequis, *Lcur;
-  gint *Ltitle;
+  Tdriveinfo *Ldrive = NULL;
+  gint *Lmediatitle;
   gint Lmedialu;
   gint Lmediatest;
   gboolean Lstatusmedia = TRUE;
-  gint i;
   gboolean *Linitdisp = (gboolean *) sc_grave_get_data(Lg, "initdisp");
   
-  for (i=1; 1; i++) {
-    Ldrive = sc_grave_get_datav(Lg, "device%d", i);
-    if (!Ldrive) break;
-      
-    Lrequis = (GSList *) sc_grave_get_datav(Lg, "devicerequis%d", i);
-    Ldetect = (gint *) sc_grave_get_datav(Lg, "detect%d", i);
-    Ltitle = (gint *)sc_grave_get_datav(Lg, "devicetitle%d", i);
-    Lmedialu = 0;
-
-    if (Linitdisp && *Linitdisp) {
-      set_waitwindow_title(Lstatusmedia, *Ltitle, i, Lg);
-      gtk_widget_show(GTK_WIDGET(sc_grave_get_data(Lg, "window")));
-      gdk_flush ();
-      *Linitdisp = FALSE;
-    }
+  Ldrive = sc_grave_get_data(Lg, "device1");
+  if (!Ldrive) return TRUE;
+printf("get1\n");
+  Lrequis = (GSList *) sc_grave_get_data(Lg, "devicerequis1");
+printf("get2\n");
+  Ldetect = (gint *) sc_grave_get_data(Lg, "detect1");
+printf("get3\n");
+  Lmediatitle = (gint *)sc_grave_get_data(Lg, "mediatitle1");
+printf("get4\n");
+  Lmedialu = 0;
+
+  if (Linitdisp && *Linitdisp) {
+printf("get6\n");
+    set_waitwindow_title(Lstatusmedia, *Lmediatitle, Lg);
+printf("get7\n");
+    gtk_widget_show(GTK_WIDGET(sc_grave_get_data(Lg, "window")));
+    gdk_flush ();
+    *Linitdisp = FALSE;
+  }
     
-   printf("la DVD ?!\n"); 
+ printf("la DVD ?!\n"); 
 /*    if (*Lrequis & _MEDIA_IS_DVD) {*/
-      Lmedialu += get_dvdinfo(Lg, Ldrive, NULL);
+  Lmedialu += get_dvdinfo(Lg, Ldrive, NULL);
 /*    }*/
 
-   printf("la CD ?!\n"); 
+  printf("la CD ?!\n"); 
 /*    if (*Lrequis & _MEDIA_IS_CD) {*/
-      Lmedialu += get_cdinfo(Lg, Ldrive, NULL);
+  Lmedialu += get_cdinfo(Lg, Ldrive, NULL);
 /*    }*/
 
-    if (Ldetect) *Ldetect = Lmedialu;
+  if (Ldetect) *Ldetect = Lmedialu;
 /*    Lstatusmedia = (!(_MEDIA_CMP_CD(*Lrequis, Lmedialu) || 
_MEDIA_CMP_DVD(*Lrequis, Lmedialu))) ||
                     ((*Lrequis & _MEDIA_BLANKORAPPENDABLE) &&
                         ((!(Lmedialu  & _MEDIA_BLANK)) && (!(Lmedialu & 
_MEDIA_APPENDABLE)))) ||
@@ -645,39 +647,36 @@
                      ((*Lrequis & _MEDIA_APPENDABLE) && (!(Lmedialu & 
_MEDIA_APPENDABLE)));
     if (Lstatusmedia) LnewCont = TRUE;*/
 printf("on a LU [%d]\n", Lmedialu);
-    for (Lcur = Lrequis; Lcur; Lcur = g_slist_next(Lcur)) {
-      Lmediatest = (int ) Lcur->data;
+  for (Lcur = Lrequis; Lcur; Lcur = g_slist_next(Lcur)) {
+    Lmediatest = (int ) Lcur->data;
 printf("et on TEST [%d]\n", Lmediatest);
 printf("resu du test [%d]\n", (Lmediatest & Lmedialu));
-      if ((Lmediatest & Lmedialu) == Lmediatest) {
-        *Lcont  = 0;
-        Lstatusmedia = FALSE;
-        break;
-      }
+    if ((Lmediatest & Lmedialu) == Lmediatest) {
+      *Lcont  = 0;
+      Lstatusmedia = FALSE;
+      break;
     }
-    set_waitwindow_title(Lstatusmedia, *Ltitle, i, Lg);
-    gdk_flush ();
-
-    if (Lstatusmedia == FALSE) break;
   }
+  set_waitwindow_title(Lstatusmedia, *Lmediatitle, Lg);
+  gdk_flush ();
+
 
   return TRUE;
 }
 
 /* attente que l'utilisateur ai bien insere un cd */
-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)
 {
   Tgrave *Lwaitg = sc_grave_load("window_waiting_cd.glade");
   GtkWidget *Lparent = sc_grave_get_widget(Ag, "topwindow");
   GtkWidget *Lwindow;
-  gchar *Lident1 = NULL, *Ldevicetitle1 = NULL;
-  gchar *Lident2 = NULL, *Ldevicetitle2 = NULL;
+  gchar *Ldevicetitle1 = NULL;
+  gchar *Ldevicetitle2 = NULL;
   gint Lcont = 2;
   gint Lpid = 0;
   gboolean Labort = FALSE;
   gboolean Linit = TRUE;
   guint Ltimeout = 0;
-  GtkTreeIter Liter;
 
   if (Atitle == _MEDIA_NONE) return TRUE;
   
@@ -691,19 +690,13 @@
   sc_grave_set_data(Lwaitg, &Labort, "gabort");
   sc_grave_set_data(Lwaitg, &Lpid, "pid");
   
-  if (Ldriveident1 && *Ldriveident1) {
-    GtkComboBox *Lcombob1 = GTK_COMBO_BOX(sc_grave_get_widget(Ag, 
Ldriveident1));
-    GtkTreeModel *Lmodelb1 = gtk_combo_box_get_model(Lcombob1);
-    if (gtk_combo_box_get_active_iter(Lcombob1, &Liter)) {
-      gtk_tree_model_get(Lmodelb1, &Liter, 0, &Lident1, 2, &Ldevicetitle1, -1);
-
-      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");
+  if (Ldriveident1) {
+    sc_grave_set_data(Lwaitg, Ldriveident1, "device1");
+    sc_grave_set_data(Lwaitg, Adetectcd1, "detect1");
+    sc_grave_set_data(Lwaitg, &Atitle, "mediatitle1");
+    sc_grave_set_data(Lwaitg, Arequiscd1, "devicerequis1");
 
-      set_waitwindow_title(TRUE, Atitle, 1, Lwaitg);
-    }
+    set_waitwindow_title(TRUE, Atitle, Lwaitg);
   }
 
   gtk_window_set_transient_for(GTK_WINDOW(Lwindow), GTK_WINDOW(Lparent));
@@ -715,8 +708,7 @@
    * deja inseré le bon cd qui va bien */
   sc_grave_set_data(Lwaitg, &Linit, "initdisp");
   callback_waiting_for_user(Lwaitg);
-  sc_grave_del_data(Lwaitg, "initdisp");
-printf("la !!!! !\n");
+  Linit = FALSE;
 
   if (Lcont == 2 && Labort == FALSE) {
     /* apparement non, on affiche la fenetre d'attente */
@@ -725,13 +717,14 @@
       gtk_main_iteration(); 
     } while (Lcont == 2 && Labort == FALSE);
   }
+  sc_grave_del_data(Lwaitg, "initdisp");
 
   /* fin du timeout */ 
   if (Ltimeout) g_source_remove(Ltimeout);
 
   gtk_widget_destroy(Lwindow);
 
-  g_free(Lident1); g_free(Lident2);
+/*  g_free(Lident1); g_free(Lident2);*/
   g_free(Ldevicetitle1); g_free(Ldevicetitle2);
 
   sc_grave_destroy(Lwaitg);
@@ -740,13 +733,33 @@
   return (Lcont == 0 && Labort == FALSE);
 }
 
+Tdriveinfo *get_drive_info(Tgrave *Ag, gchar *Aname)
+{
+  return get_combo_value(sc_grave_get_widget(Ag, Aname));
+}
+
+gchar *get_dvdrwtools_bus(Tdriveinfo *Adrive)
+{
+  GSList *Lcur;
+  gchar *Lcurbus;
+  gint i = 0;
+
+  for (Lcur = Adrive->bus; Lcur; Lcur = g_slist_next(Lcur), i++) {
+    Lcurbus = (gchar *) Lcur->data;
+
+    if (!strcmp(Lcurbus, "IDE") || !strcmp(Lcurbus, "DSCSI")) {
+      return g_slist_nth_data(Adrive->dev, i);
+    }
+  }
+
+  return NULL;
+}
+
 gboolean is_an_iso(Tgrave *Ag, gchar *Aname)
 {
-  gboolean Lstatus = FALSE;
-  gchar *Liso = get_combo_value(sc_grave_get_widget(Ag, Aname));
-  Lstatus = !strcmp(Liso, "iso");
+  Tdriveinfo *Ldrive = get_combo_value(sc_grave_get_widget(Ag, Aname));
 
-  return Lstatus;
+  return Ldrive ? TRUE : FALSE;
 }
 
 /*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]