43 |
gboolean readcd_makeimage_callback(GIOChannel *Astd, GIOCondition Acond, gpointer Adata) |
gboolean readcd_makeimage_callback(GIOChannel *Astd, GIOCondition Acond, gpointer Adata) |
44 |
{ |
{ |
45 |
GIOStatus Lstatus; |
GIOStatus Lstatus; |
46 |
GHashTable *Lhash = (GHashTable *)Adata; |
Tgrave *Lg = (Tgrave *)Adata; |
47 |
GtkLabel *Ltitle = GTK_LABEL(g_hash_table_lookup(Lhash, "gravetitle")); |
GtkLabel *Ltitle = GTK_LABEL(sc_grave_get_widget(Lg, "gravetitle")); |
48 |
GtkProgressBar *Lprogressbar = GTK_PROGRESS_BAR(g_hash_table_lookup(Lhash, "pb_total")); |
GtkProgressBar *Lprogressbar = GTK_PROGRESS_BAR(sc_grave_get_widget(Lg, "pb_total")); |
49 |
GtkProgressBar *Lprogressbar2 = GTK_PROGRESS_BAR(g_hash_table_lookup(Lhash, "pb_step")); |
GtkProgressBar *Lprogressbar2 = GTK_PROGRESS_BAR(sc_grave_get_widget(Lg, "pb_step")); |
50 |
gint *Lcont = (gint *) g_hash_table_lookup(Lhash, "cont"); /* on traite encore des donnees ? */ |
gint *Lcont = (gint *) sc_grave_get_data(Lg, "cont"); /* on traite encore des donnees ? */ |
51 |
GError **Lerreur = (GError **) g_hash_table_lookup(Lhash, "gerror"); /* pointeur erreur */ |
GError **Lerreur = (GError **) sc_grave_get_data(Lg, "gerror"); /* pointeur erreur */ |
52 |
gdouble *Lreadtodo = (gdouble *) g_hash_table_lookup(Lhash, "readtodo"); /* nombre de secteur a traiter */ |
gdouble *Lreadtodo = (gdouble *) sc_grave_get_data(Lg, "readtodo"); /* nombre de secteur a traiter */ |
53 |
gint *Ltodo = (gint *) g_hash_table_lookup(Lhash, "todo"); /* nombre de piste a traiter */ |
gint *Ltodo = (gint *) sc_grave_get_data(Lg, "todo"); /* nombre de piste a traiter */ |
54 |
gint *Ldone = (gint *) g_hash_table_lookup(Lhash, "done"); /* nombre de piste deja traite */ |
gint *Ldone = (gint *) sc_grave_get_data(Lg, "done"); /* nombre de piste deja traite */ |
55 |
gchar **Lvitesse = (gchar **) g_hash_table_lookup(Lhash, "tmpdir"); /* en fait la vitesse de lecture */ |
gchar **Lvitesse = (gchar **) sc_grave_get_data(Lg, "tmpdir"); /* en fait la vitesse de lecture */ |
56 |
gchar Lbuffer[_BUF_SIZE]; |
gchar Lbuffer[_BUF_SIZE]; |
57 |
gdouble Ltotaldone, Lpct, Ltava; |
gdouble Ltotaldone, Lpct, Ltava; |
58 |
gchar *e, *f; |
gchar *e, *f; |
130 |
return FALSE; |
return FALSE; |
131 |
} else if ((f=strstr(Lbuffer, READCD_DONE))) { |
} else if ((f=strstr(Lbuffer, READCD_DONE))) { |
132 |
/* fin de l'operation */ |
/* fin de l'operation */ |
133 |
gboolean *Lstatus = (gboolean *) g_hash_table_lookup(Lhash, "operationstatus"); |
gboolean *Lstatus = (gboolean *) sc_grave_get_data(Lg, "operationstatus"); |
134 |
*Lstatus = TRUE; |
*Lstatus = TRUE; |
135 |
} |
} |
136 |
|
|
138 |
} |
} |
139 |
|
|
140 |
/* creation d'une image iso */ |
/* creation d'une image iso */ |
141 |
gboolean make_image(GHashTable *Ahash, GError **Aerror) |
gboolean make_image(Tgrave *Ag, GError **Aerror) |
142 |
{ |
{ |
143 |
gchar **Lcmd; |
gchar **Lcmd; |
144 |
gchar *Lcommandline; |
gchar *Lcommandline; |
145 |
GIOChannel *Lcom, *Lcomerr; |
GIOChannel *Lcom, *Lcomerr; |
146 |
guint Lcomevent, Lcomerrevent; |
guint Lcomevent, Lcomerrevent; |
147 |
gint *Lcont = g_hash_table_lookup(Ahash, "cont"); |
gint *Lcont = sc_grave_get_data(Ag, "cont"); |
148 |
gboolean *Labort = (gboolean *) g_hash_table_lookup(Ahash, "gabort"); |
gboolean *Labort = (gboolean *) sc_grave_get_data(Ag, "gabort"); |
149 |
GtkLabel *Ltitle = GTK_LABEL(g_hash_table_lookup(Ahash, "gravetitle")); |
GtkLabel *Ltitle = GTK_LABEL(sc_grave_get_widget(Ag, "gravetitle")); |
150 |
gint *Lpid = (gint *) g_hash_table_lookup(Ahash, "pid"); |
gint *Lpid = (gint *) sc_grave_get_data(Ag, "pid"); |
151 |
GtkWidget *Lvitesse = g_hash_table_lookup(Ahash, "dstcopyspeed"); |
GtkWidget *Lvitesse = sc_grave_get_widget(Ag, "dstcopyspeed"); |
152 |
gchar **Liso = (gchar **)g_hash_table_lookup(Ahash, "iso"); /* image iso */ |
gchar **Liso = (gchar **)sc_grave_get_data(Ag, "iso"); /* image iso */ |
153 |
gdouble Lreadtodo = 0; |
gdouble Lreadtodo = 0; |
154 |
gint g_in, g_out, g_err, Lnbrarg; |
gint g_in, g_out, g_err, Lnbrarg; |
155 |
gboolean Lstatus = FALSE; |
gboolean Lstatus = FALSE; |
156 |
gchar *Lbufvitesse; |
gchar *Lbufvitesse; |
157 |
gchar *Lbuflect; |
gchar *Lbuflect; |
158 |
GtkWidget *Llecteur = g_hash_table_lookup(Ahash, "srccopycombo"); |
GtkWidget *Llecteur = sc_grave_get_widget(Ag, "srccopycombo"); |
159 |
|
|
160 |
gtk_label_set_text(Ltitle, _("Duplication will start shortly...")); |
gtk_label_set_text(Ltitle, _("Duplication will start shortly...")); |
161 |
|
|
182 |
return FALSE; |
return FALSE; |
183 |
} |
} |
184 |
*Lcont = 1; |
*Lcont = 1; |
185 |
g_hash_table_insert(Ahash, "readtodo", &Lreadtodo); |
sc_grave_set_data(Ag, &Lreadtodo, "readtodo"); |
186 |
|
|
187 |
Lcom = g_io_channel_unix_new( g_out ); |
Lcom = g_io_channel_unix_new( g_out ); |
188 |
g_io_channel_set_encoding (Lcom, NULL, NULL); |
g_io_channel_set_encoding (Lcom, NULL, NULL); |
189 |
g_io_channel_set_flags( Lcom, G_IO_FLAG_NONBLOCK, NULL ); |
g_io_channel_set_flags( Lcom, G_IO_FLAG_NONBLOCK, NULL ); |
190 |
Lcomevent = g_io_add_watch (Lcom, (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), |
Lcomevent = g_io_add_watch (Lcom, (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), |
191 |
readcd_makeimage_callback, Ahash); |
readcd_makeimage_callback, Ag); |
192 |
|
|
193 |
Lcomerr = g_io_channel_unix_new( g_err ); |
Lcomerr = g_io_channel_unix_new( g_err ); |
194 |
g_io_channel_set_encoding (Lcomerr, NULL, NULL); |
g_io_channel_set_encoding (Lcomerr, NULL, NULL); |
195 |
g_io_channel_set_flags( Lcomerr, G_IO_FLAG_NONBLOCK, NULL ); |
g_io_channel_set_flags( Lcomerr, G_IO_FLAG_NONBLOCK, NULL ); |
196 |
Lcomerrevent = g_io_add_watch (Lcomerr, (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), |
Lcomerrevent = g_io_add_watch (Lcomerr, (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI), |
197 |
readcd_makeimage_callback, Ahash); |
readcd_makeimage_callback, Ag); |
198 |
while (*Lcont>0 && *Labort == FALSE) { |
while (*Lcont>0 && *Labort == FALSE) { |
199 |
gtk_main_iteration(); |
gtk_main_iteration(); |
200 |
} |
} |
212 |
g_spawn_close_pid(*Lpid); |
g_spawn_close_pid(*Lpid); |
213 |
*Lpid = 0; |
*Lpid = 0; |
214 |
|
|
215 |
g_hash_table_remove(Ahash, "readtodo"); |
sc_grave_del_data(Ag, "readtodo"); |
216 |
|
|
217 |
if (*Aerror) { |
if (*Aerror) { |
218 |
_DEB("IL Y A UNE ERREUR !!"); |
_DEB("IL Y A UNE ERREUR !!"); |
259 |
gboolean readcd_getsize_callback(GIOChannel *Astd, GIOCondition Acond, gpointer Adata) |
gboolean readcd_getsize_callback(GIOChannel *Astd, GIOCondition Acond, gpointer Adata) |
260 |
{ |
{ |
261 |
GIOStatus Lstatus; |
GIOStatus Lstatus; |
262 |
GHashTable *Lhash = (GHashTable *)Adata; |
Tgrave *Lg = (Tgrave *)Adata; |
263 |
gint *Lcont = (gint *) g_hash_table_lookup(Lhash, "cont"); /* on traite encore des donnees ? */ |
gint *Lcont = (gint *) sc_grave_get_data(Lg, "cont"); /* on traite encore des donnees ? */ |
264 |
gint *Ltodo = (gint *) g_hash_table_lookup(Lhash, "todo"); /* nombre de piste a traiter */ |
gint *Ltodo = (gint *) sc_grave_get_data(Lg, "todo"); /* nombre de piste a traiter */ |
265 |
gchar *f, *e; |
gchar *f, *e; |
266 |
gchar *Lbuffer = NULL; |
gchar *Lbuffer = NULL; |
267 |
|
|