"Fossies" - the Fresh Open Source Software Archive

Member "xcdroast-1.19/src/duplicate.c" (5 Nov 2018, 128986 Bytes) of package /linux/misc/xcdroast-1.19.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "duplicate.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.18_vs_1.19.

    1 /*
    2  *  duplicate.c
    3  *
    4  *  Duplicate Disc functions
    5  *  15.5.99 tn
    6  *
    7  *
    8  *  Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    9  *
   10  *  This file is part of xcdroast.
   11  *
   12  *  This program is free software; you can redistribute it and/or modify
   13  *  it under the terms of the GNU General Public License as published by
   14  *  the Free Software Foundation; either version 2 of the License, or
   15  *  (at your option) any later version.
   16  *
   17  *  This program is distributed in the hope that it will be useful,
   18  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20  *  GNU General Public License for more details.
   21  *
   22  *  You should have received a copy of the GNU General Public License
   23  *  along with this program; if not, write to the Free Software
   24  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   25  */
   26 
   27 
   28 #ifdef HAVE_CONFIG_H
   29 # include <config.h>
   30 #endif
   31 
   32 #include "largefile.h"
   33 
   34 #include <locale.h>
   35 #include "gettext.h"
   36 
   37 #include <stdio.h>
   38 #include <stdlib.h>
   39 #include <string.h>
   40 #include <strings.h>
   41 
   42 #if ENABLE_NLS
   43 # define _(String) gettext (String)
   44 # define N_(String) gettext_noop (String)
   45 #else
   46 # define _(String) (String)
   47 # define N_(String) (String)
   48 #endif
   49 
   50 #include <gtk/gtk.h>
   51 #include <gdk/gdk.h>
   52 #include "xcdrdata.h"
   53 #include "xcdroast.h"
   54 #include "main.h"
   55 #include "../xpms/minidata.xpm"
   56 #include "../xpms/miniaudio.xpm"
   57 #include "../xpms/mininodata.xpm"
   58 #include "../xpms/mininoaudio.xpm"
   59 #include "../xpms/minitoc.xpm"
   60 #include "../xpms/disc_eject.xpm"
   61 #include "../xpms/disc_load.xpm"
   62 
   63 extern GtkWidget *toplevel;
   64 extern GtkWidget *sidespace;
   65 extern GtkWidget *workspace;
   66 
   67 extern GList *imagelist;
   68 extern writerreader_devices_t **writerreaderdevs;
   69 extern track_read_set_t trackreadset;
   70 extern GList *tocfiles;
   71 extern setup_data_t setupdata;
   72 extern current_set_t curset;
   73 extern cd_info_t cdinfo;
   74 extern track_info_t **trackinfo;
   75 extern gint wav_in;
   76 extern GtkWidget *wav_quit_button;
   77 extern gint wavplay_quit;
   78 extern gint submenu;
   79 extern gchar sharedir[MAXLINE];
   80 extern img_logo_t img;
   81 
   82 GtkWidget *actionspace;
   83 GtkCList *cdlist, *imglist, *play_clist;
   84 GtkWidget *cdlist_l1, *cdlist_l2, *cdlist_l3, *cdlist_l4;
   85 GtkWidget *vrylist_l1, *vrylist_l2, *vrylist_l3, *vrylist_l4;
   86 GtkWidget *imglist_l1, *imglist_l2, *imglist_l3;
   87 GtkWidget *dupl_cd_mode_omenu, *crea_cd_mode_omenu, *crea_cd_burnfree_check, *crea_cd_nofixate_check;
   88 guint side_handlers2[8];
   89 GtkWidget *side_widgets2[8];
   90 
   91 static GtkWidget *write_toc_menu;
   92 static GtkWidget *edit_cdtext_btn;
   93 static GtkWidget *dupl_cd_burnfree_check;
   94 static GtkWidget *rdr_spd_spin, *cdr_spd_spin;
   95 
   96 /*
   97  * some stuff for the select-functions of the sidebar buttons
   98  */
   99 static guint side_handlers[7];
  100 static GtkWidget *side_widgets[7];
  101 static GtkWidget *locked_button;
  102 
  103 extern void fill_read_tracks(gint dontupdatecd);
  104 extern void fill_verify_tracks(gint dontupdateimglist);
  105 extern void fill_write_tracks();
  106 extern void fill_master_write_menu();
  107 extern void reset_duplicate_buttons2(GtkWidget *exclude, gint fromunlock);
  108 
  109 static void reset_duplicate_buttons(GtkWidget *exclude);
  110 static void fill_read_menu();
  111 static void fill_verify_menu();
  112 static void fill_write_menu();
  113 static void fill_delete_menu();
  114 static void tocwrite_selected(GtkWidget *item, gpointer val);
  115 void set_image_prefix_callback(GtkWidget *widget, gpointer data);
  116 
  117 
  118 /*
  119  * lock complete sidebar when doing stuff that takes a while (e.g. reload)
  120  */
  121 void do_lock(gint plusgrab) {
  122 int i;
  123 
  124     if (submenu == 1) {
  125         /* lock all and save currently selected button */
  126         for (i = 0; i < 7; i++) {
  127             gtk_signal_handler_block(GTK_OBJECT(side_widgets[i]),
  128                 side_handlers[i]);
  129             if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
  130                 side_widgets[i])) == 1) {
  131                 locked_button = side_widgets[i];
  132             }
  133         }
  134     }
  135     if (submenu == 2) {
  136         /* lock all and save currently selected button */
  137         for (i = 0; i < 8; i++) {
  138             gtk_signal_handler_block(GTK_OBJECT(side_widgets2[i]),
  139                 side_handlers2[i]);
  140             if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
  141                 side_widgets2[i])) == 1) {
  142                 locked_button = side_widgets2[i];
  143             }
  144         }
  145     }
  146 
  147     /* grab the button, so everything else is not active */
  148     if (plusgrab) {
  149         gtk_grab_add(locked_button);
  150     }
  151 }
  152 
  153 
  154 /*
  155  * free the lock after we are done
  156  */
  157 void do_unlock(gint plusgrab) {
  158 int i;
  159 
  160     if (plusgrab) {
  161         gtk_grab_remove(locked_button);
  162     }
  163 
  164     if (submenu == 1) {
  165         for (i = 0; i < 7; i++) {
  166             gtk_signal_handler_unblock(GTK_OBJECT(side_widgets[i]),
  167                 side_handlers[i]);
  168         }
  169         reset_duplicate_buttons(locked_button);
  170     }
  171     if (submenu == 2) {
  172         for (i = 0; i < 8; i++) {
  173             gtk_signal_handler_unblock(GTK_OBJECT(side_widgets2[i]),
  174                 side_handlers2[i]);
  175         }
  176         reset_duplicate_buttons2(locked_button, 1);
  177     }
  178 }
  179 
  180 
  181 /*
  182  * fill the disc-info-list with data
  183  */
  184 void fill_cdlist() {
  185 GtkStyle *style;
  186 gchar *data[2];
  187 GdkPixmap *pixmap1, *pixmap2;
  188 GdkBitmap *mask1, *mask2;
  189 gint i, lcount, disc_type;
  190 gchar tmp[MAXLINE];
  191 gchar tmp2[MAXLINE];
  192 
  193     /* clean up first */
  194     gtk_clist_clear(cdlist);
  195 
  196     /* disc loaded? */
  197     if (cdinfo.nr_tracks == -1) {
  198         gtk_entry_set_text(GTK_ENTRY(cdlist_l1), _("No Disc loaded"));  
  199         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
  200         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");    
  201         return;
  202     }
  203     if (cdinfo.nr_tracks == -2) {
  204         gtk_entry_set_text(GTK_ENTRY(cdlist_l1), return_media_type(curset.reader_devnr));   
  205         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
  206         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");    
  207         return;
  208     }
  209 
  210     style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(cdlist)));
  211     pixmap1 = gdk_pixmap_create_from_xpm_d(cdlist->clist_window,
  212         &mask1, &style->bg[GTK_STATE_NORMAL],(gchar **)minidata_xpm);
  213     pixmap2 = gdk_pixmap_create_from_xpm_d(cdlist->clist_window,
  214         &mask2, &style->bg[GTK_STATE_NORMAL],(gchar **)miniaudio_xpm);
  215 
  216     data[0] = NULL;
  217     lcount = 0;
  218 
  219     for (i = 0; i < cdinfo.nr_tracks; i++) {
  220         if (trackinfo[i]->type == 0) {
  221             convert_frames2mbstring(trackinfo[i]->size,tmp2);
  222             g_snprintf(tmp,MAXLINE,"%2d. %s [%s]",
  223                 trackinfo[i]->track_nr,
  224                 _("data track"), tmp2);
  225             data[1] = convert_for_gtk2(tmp);
  226             gtk_clist_append(cdlist,data);
  227             gtk_clist_set_pixmap(cdlist,lcount,0,pixmap1,mask1);
  228             lcount++;
  229         } else {
  230             convert_frames2minstring(trackinfo[i]->size,tmp2);
  231             g_snprintf(tmp,MAXLINE,"%2d. %s [%s]",
  232                 trackinfo[i]->track_nr,
  233                 _("audio track"), tmp2);
  234             data[1] = convert_for_gtk2(tmp);
  235             gtk_clist_append(cdlist,data);
  236             gtk_clist_set_pixmap(cdlist,lcount,0,pixmap2,mask2);
  237             lcount++;
  238         }
  239 
  240         /* we have cd-text for this track? */
  241         if (setupdata.option_displaycdtext) {
  242             if (trackinfo[i]->title != NULL && 
  243                 trackinfo[i]->title[0] != '\0' ) {
  244                 g_snprintf(tmp,MAXLINE,"  CD-Text: %s", 
  245                     trackinfo[i]->title);
  246                 data[1] = convert_for_gtk2(tmp);
  247                 gtk_clist_append(cdlist,data);
  248                 set_clist_row_font(cdlist,lcount, PANGO_ITALIC);
  249                 lcount++;
  250             }
  251         }
  252 
  253         /* have we a cddb-title for this track? */
  254         if (trackinfo[i]->cddb_ttitle != NULL) {
  255             g_snprintf(tmp,MAXLINE,"     CDDB: %s", 
  256                 trackinfo[i]->cddb_ttitle);
  257             data[1] = convert_for_gtk2(tmp);
  258             gtk_clist_append(cdlist,data);
  259             set_clist_row_font(cdlist,lcount, PANGO_ITALIC);
  260             lcount++;   
  261         } else
  262         if (trackinfo[i]->volname != NULL) {
  263             convert_kbytes2mbstring(trackinfo[i]->isosize*2,tmp2);
  264             g_snprintf(tmp,MAXLINE,"     ISO9660: %s [%s]", 
  265                 trackinfo[i]->volname,tmp2);
  266             data[1] = convert_for_gtk2(tmp);
  267             gtk_clist_append(cdlist,data);
  268             set_clist_row_font(cdlist,lcount, PANGO_ITALIC);
  269             lcount++;   
  270         } 
  271 
  272     }
  273 
  274     /* get and display disc type */
  275     disc_type = determine_disc_type(tmp,0);
  276     gtk_entry_set_text(GTK_ENTRY(cdlist_l1), tmp);  
  277 
  278     /* display CD label */
  279     if (cdinfo.title && cdinfo.artist && 
  280         cdinfo.title[0] != '\0' && setupdata.option_displaycdtext) {
  281         g_snprintf(tmp,MAXLINE,"%s / %s", cdinfo.title, cdinfo.artist);
  282         gtk_entry_set_text(GTK_ENTRY(cdlist_l2), tmp);
  283         gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
  284     } else 
  285     if (cdinfo.cddb_dtitle != NULL) {
  286         gtk_entry_set_text(GTK_ENTRY(cdlist_l2), cdinfo.cddb_dtitle);   
  287         gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
  288     } else {
  289         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
  290     }
  291 
  292     /* display disc size */
  293     if (disc_type == 1 || disc_type == 2) { /* Audio or Mixed Mode CD */
  294         convert_frames2mbminstring(cdinfo.total_size, tmp);
  295     } else {                        /* Data CD/DVD/BD and CD Extra */
  296         convert_sectors2mbminstring(cdinfo.total_size, tmp);
  297     }
  298     gtk_entry_set_text(GTK_ENTRY(cdlist_l3), tmp);  
  299 }
  300 
  301 
  302 /*
  303  * fill the image-info-list with data
  304  */
  305 void fill_imglist() {
  306 GtkStyle *style;
  307 gchar *data[2];
  308 GdkPixmap *pixmap1, *pixmap2, *pixmap3, *pixmap4, *pixmap5;
  309 GdkBitmap *mask1, *mask2, *mask3, *mask4, *mask5;
  310 gchar tmp[MAXLINE];
  311 gchar tmp2[MAXLINE];
  312 gchar basename[MAXLINE], oldbase[MAXLINE], fname[MAXLINE], *p;
  313 GList *loop;
  314 image_files_t *entry;
  315 gint lcount, count;
  316 gint sizecount;
  317 
  318     /* clean up first */
  319     gtk_clist_clear(imglist);
  320 
  321     style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(imglist)));
  322     pixmap1 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
  323         &mask1, &style->bg[GTK_STATE_NORMAL],(gchar **)minidata_xpm);
  324     pixmap2 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
  325         &mask2, &style->bg[GTK_STATE_NORMAL],(gchar **)miniaudio_xpm);
  326     pixmap3 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
  327         &mask3, &style->bg[GTK_STATE_NORMAL],(gchar **)mininodata_xpm);
  328     pixmap4 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
  329         &mask4, &style->bg[GTK_STATE_NORMAL],(gchar **)mininoaudio_xpm);
  330     pixmap5 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
  331         &mask5, &style->bg[GTK_STATE_NORMAL],(gchar **)minitoc_xpm);
  332 
  333     data[0] = NULL;
  334     strcpy(oldbase,"");
  335     lcount = 0;
  336     count = 1;
  337     sizecount = 0;
  338 
  339     loop = g_list_first(imagelist);
  340     while (loop) {
  341         entry = loop->data;
  342 
  343         /* get the base-dirname */
  344         strncpy(basename,entry->path,MAXLINE);  
  345         p = rindex(basename,'/');
  346         *p = '\0';
  347         if (strcmp(basename,"") == 0) {
  348             strcpy(basename,"/");
  349         }
  350         strcpy(fname,p+1);
  351 
  352         /* new path found? */
  353         if (strcmp(basename,oldbase) != 0) {
  354             g_snprintf(tmp,MAXLINE,"%s: %s",_("Path"), basename);
  355             data[1] = convert_for_gtk2(tmp);
  356             gtk_clist_append(imglist,data);
  357             set_clist_row_font(imglist,lcount, PANGO_BOLD);
  358             lcount++;
  359             strcpy(oldbase,basename);
  360         }
  361 
  362         /* iso9600-track/ unknown  */
  363         if (entry->type == 0 || entry->type == 3) {
  364             convert_frames2mbstring((gint)((off_t)entry->size/DATASECTORSIZE),
  365                 tmp2);
  366             g_snprintf(tmp,MAXLINE,"%2d. %s [%s]",
  367                 count, fname, tmp2);
  368             data[1] = convert_for_gtk2(tmp);
  369             gtk_clist_append(imglist,data);
  370             if (entry->readable == 1 && entry->type == 0) {
  371                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap1,mask1);   
  372             } else {
  373                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap3,mask3);   
  374             }
  375             lcount++;
  376             sizecount+=(gint)((off_t)entry->size >> 10);
  377             count++;
  378         }
  379 
  380         /* valid/invalid wav-file */
  381         if (entry->type == 1 || entry->type == 2) {
  382             convert_frames2minstring((gint)((off_t)entry->size/CDDAFRAME), tmp2);
  383             g_snprintf(tmp,MAXLINE,"%2d. %s [%s]",
  384                 count, fname, tmp2);
  385             data[1] = convert_for_gtk2(tmp);
  386             gtk_clist_append(imglist,data);
  387             if (entry->readable == 1 && entry->type == 1) {
  388                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap2,mask2);   
  389             } else {
  390                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap4,mask4);   
  391             }
  392             lcount++;
  393             sizecount+=(gint)((off_t)entry->size >> 10);
  394             count++;
  395         }   
  396 
  397         /* toc-file */
  398         if (entry->type == 4) {
  399             g_snprintf(tmp,MAXLINE,"--. %s",fname);
  400             data[1] = convert_for_gtk2(tmp);
  401             gtk_clist_append(imglist,data);
  402             gtk_clist_set_pixmap(imglist,lcount,0,pixmap5, mask5);
  403             lcount++;
  404         }
  405 
  406         /* cd-text */
  407         if (entry->title && entry->artist && 
  408             strcmp(entry->title,"") && strcmp(entry->artist,"")) {
  409             g_snprintf(tmp,MAXLINE,"     (%s / %s)",
  410                 entry->title, entry->artist);
  411             data[1] = convert_for_gtk2(tmp);
  412             gtk_clist_append(imglist,data);
  413             set_clist_row_font(imglist,lcount, PANGO_ITALIC);
  414             lcount++;   
  415         } else 
  416         if (entry->title && strcmp(entry->title,"")) {
  417             g_snprintf(tmp,MAXLINE,"     (%s)",
  418                 entry->title);
  419             data[1] = convert_for_gtk2(tmp);
  420             gtk_clist_append(imglist,data);
  421             set_clist_row_font(imglist,lcount, PANGO_ITALIC);
  422             lcount++;   
  423         } else 
  424         if (entry->cddb_ttitle && strcmp(entry->cddb_ttitle,"")) {
  425             g_snprintf(tmp,MAXLINE,"     (%s)",
  426                 entry->cddb_ttitle);
  427             data[1] = convert_for_gtk2(tmp);
  428             gtk_clist_append(imglist,data);
  429             set_clist_row_font(imglist,lcount, PANGO_ITALIC);
  430             lcount++;   
  431         } else 
  432         if (entry->volname && strcmp(entry->volname,"")) {
  433             if (entry->next_session_start > 0) {
  434                 g_snprintf(tmp,MAXLINE,
  435                     "     (%s / ISO9660-multisession)",
  436                     entry->volname);
  437             } else {
  438                 g_snprintf(tmp,MAXLINE,"     (%s / ISO9660)",
  439                     entry->volname);
  440             }
  441             data[1] = convert_for_gtk2(tmp);
  442             gtk_clist_append(imglist,data);
  443             set_clist_row_font(imglist,lcount, PANGO_ITALIC);
  444             lcount++;   
  445         } else 
  446         if (entry->type == 0 && entry->next_session_start > 0) {
  447             strcpy(tmp,"     (ISO9660-multisession)"); 
  448             data[1] = convert_for_gtk2(tmp);
  449             gtk_clist_append(imglist,data);
  450             set_clist_row_font(imglist,lcount, PANGO_ITALIC);
  451             lcount++;   
  452         }
  453 
  454         loop = loop->next;
  455     }
  456 
  457     /* total size of files */
  458     convert_kbytes2mbminstring(sizecount, tmp);
  459     gtk_entry_set_text(GTK_ENTRY(imglist_l1), tmp); 
  460 }
  461 
  462 
  463 /*
  464  * callbacks for button in info-screen
  465  */
  466 static void cddb_clicked(GtkWidget *widget, gpointer data) {
  467 
  468     /* no disc loaded */
  469     if (cdinfo.nr_tracks < 0) {
  470         show_dialog(ICO_WARN,_("No Disc loaded in read device."),T_OK,NULL,NULL,0);
  471         return;
  472     }
  473 
  474     if (show_cddb_query(NULL, 0) == 0) {
  475         /* new data received - update display */
  476         fill_cdlist();
  477     }
  478 }
  479 
  480 void edit_cdtext_clicked(GtkWidget *widget, gpointer data) {
  481 gint mode;
  482 
  483     mode = GPOINTER_TO_INT(data);
  484 
  485     if (mode == 0) 
  486         show_edit_cdtext(mode, NULL);
  487     else if (mode == 1) {
  488         if (strcmp(curset.tocfile,"-") == 0) {
  489             /* on-the-fly setting? */
  490             show_edit_cdtext(3, write_toc_menu);
  491         } else {
  492             show_edit_cdtext(1, write_toc_menu);
  493         }
  494     }
  495     else if (mode == 2) 
  496         show_edit_cdtext(mode, NULL);
  497 }
  498 
  499 
  500 static void update_clicked(GtkWidget *widget, gpointer data) {
  501 GdkCursor *cursor;
  502 
  503     do_lock(1);
  504     /* change cursor to watch */
  505     cursor = gdk_cursor_new(GDK_WATCH);
  506     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  507 
  508     while (gtk_events_pending())
  509         gtk_main_iteration();
  510 
  511     if (curset.reader_devnr != -1) {
  512         get_cd_toc_and_volid(curset.reader_devnr);
  513         fill_cdlist();
  514     }
  515     scan_imagedirs();
  516     fill_imglist();
  517 
  518     /* reset cursor */
  519     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
  520     gdk_cursor_destroy (cursor);
  521     do_unlock(1);
  522 
  523 }
  524 
  525 /*
  526  * the update-button in the read menu
  527  */
  528 static void update_readvrfy_clicked(GtkWidget *widget, gpointer read) {
  529 GdkCursor *cursor;
  530 gint isread;
  531 
  532     isread = GPOINTER_TO_INT(read);
  533 
  534     do_lock(1);
  535     /* change cursor to watch */
  536     cursor = gdk_cursor_new(GDK_WATCH);
  537     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  538 
  539     while (gtk_events_pending())
  540         gtk_main_iteration();
  541 
  542     if (curset.reader_devnr != -1) {
  543         get_cd_toc_and_volid(curset.reader_devnr);
  544     }
  545     if (isread) {
  546         fill_read_menu();
  547     } else {
  548         fill_verify_menu();
  549     }
  550     /* reset cursor */
  551     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
  552     gdk_cursor_destroy (cursor);
  553     do_unlock(1);
  554 }
  555 
  556 
  557 static void eject_clicked(GtkWidget *widget, gpointer load) {
  558 GdkCursor *cursor;
  559 
  560     do_lock(1);
  561     /* change cursor to watch */
  562     cursor = gdk_cursor_new(GDK_WATCH);
  563     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  564 
  565     while (gtk_events_pending())
  566         gtk_main_iteration();
  567 
  568     if (curset.reader_devnr != -1) {
  569         if (GPOINTER_TO_INT(load)) 
  570             load_cd(curset.reader_devnr);
  571         else
  572             eject_cd(curset.reader_devnr);
  573     }
  574 
  575     /* reset cursor */
  576     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
  577     gdk_cursor_destroy (cursor);
  578 
  579     /*
  580      * After we ejected or loaded automatically then update screen.
  581      * In which menu are we right now?
  582      * Info menu?
  583      */
  584     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[0])) == 1) {
  585         update_clicked(widget,0);
  586     }
  587     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[0])) == 1) {
  588         update_clicked(widget,0);
  589     }
  590     do_unlock(1);
  591 }
  592 
  593 
  594 /*
  595  * callbacks for devices_setup_read
  596  */
  597 static void readdev_selected(GtkWidget *item, gpointer devnr) {
  598 GdkCursor *cursor;
  599 gint i;
  600 
  601     do_lock(1);
  602     /* change cursor to watch */
  603     cursor = gdk_cursor_new(GDK_WATCH);
  604     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  605 
  606     while (gtk_events_pending())
  607         gtk_main_iteration();
  608 
  609     curset.reader_devnr = GPOINTER_TO_INT(devnr);
  610     i = get_writerreaderdevs_index(curset.reader_devnr);
  611 
  612     /* update speed display */
  613     if (rdr_spd_spin) {
  614         gtk_spin_button_set_value(GTK_SPIN_BUTTON(rdr_spd_spin),
  615             (gfloat)writerreaderdevs[i]->audioread_speed);
  616     }
  617     if (curset.reader_devnr != -1) {
  618         get_cd_toc_and_volid(curset.reader_devnr);
  619     }
  620 
  621     /*
  622      * In which menu are we right now?
  623      * Info menu?
  624      */
  625     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[0])) == 1) {
  626         fill_cdlist();
  627     }
  628     /* info menu 2? */
  629     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[0])) == 1) {
  630         fill_cdlist();
  631     }
  632     /* read menu? */
  633     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[1])) == 1) {
  634         fill_read_menu();
  635     }
  636     /* read menu 2? */
  637     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[1])) == 1) {
  638         fill_read_tracks(0);
  639     }
  640     /* verify menu? */
  641     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[2])) == 1) {
  642         fill_verify_menu();
  643     }
  644     /* verify menu2? */
  645     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[2])) == 1) {
  646         fill_verify_tracks(1);
  647     }
  648     /* write menu? */
  649     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[4])) == 1) {
  650         fill_write_menu();
  651     }
  652     /* write menu2? */
  653     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[5])) == 1) {
  654         fill_write_tracks();
  655     }
  656 
  657     /* reset cursor */
  658     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
  659     gdk_cursor_destroy (cursor);
  660     do_unlock(1);
  661 }
  662 
  663 
  664 static void readdev_speed(GtkWidget *item, GtkSpinButton *spin) {
  665 gint i;
  666 
  667     i = get_writerreaderdevs_index(curset.reader_devnr);
  668     writerreaderdevs[i]->audioread_speed = gtk_spin_button_get_value_as_int(spin);
  669 }
  670 
  671 
  672 /*
  673  * draw the device-setup-read line
  674  */
  675 void devices_setup_read(gint row, GtkWidget *tbl, gint showspeed) {
  676 GtkWidget *omenu;
  677 GtkWidget *menu;
  678 GtkWidget *menu_item;
  679 GtkWidget *l1;
  680 GtkWidget *eject_btn, *eject_xpm;
  681 GtkWidget *load_btn, *load_xpm;
  682 GdkPixmap *pmap;
  683 GdkBitmap *mask;
  684 GtkStyle *style;
  685 gchar tmp[MAXLINE];
  686 GtkWidget *speed1;
  687 GtkObject *adj;
  688 gint menuidx, menuhistory;
  689 gint i;
  690     
  691     rdr_spd_spin = NULL;
  692 
  693     /* no reader so far selected? set default primary reader */
  694     if (curset.reader_devnr == -1) {
  695         curset.reader_devnr = setupdata.reader_devnr;
  696     }   
  697 
  698     /* device still valid? */
  699     if (get_writerreaderdevs_index(curset.reader_devnr) == -1) {
  700         /* invalid device, pick the first available instead */
  701         if (writerreaderdevs[0]) {
  702             curset.reader_devnr = writerreaderdevs[0]->devnr;
  703         }
  704     }
  705 
  706     /* read device */
  707     l1 = rightjust_gtk_label_new(_("Read Device:"));
  708     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,4*4,row,row+1);
  709     gtk_widget_show(l1);
  710 
  711     omenu = gtk_option_menu_new ();
  712     menu = gtk_menu_new();
  713     menuidx = 0; menuhistory = -1;
  714     i = 0;
  715 
  716     while(writerreaderdevs[i] != NULL) {
  717         if (convert_devnr2devstring(writerreaderdevs[i]->devnr,tmp) == 0) {
  718                         menu_item = gtk_menu_item_new_with_label(tmp);
  719                         gtk_signal_connect(GTK_OBJECT(menu_item),
  720                                 "activate", GTK_SIGNAL_FUNC(readdev_selected),
  721                                 GINT_TO_POINTER(writerreaderdevs[i]->devnr));
  722                     gtk_menu_append (GTK_MENU (menu), menu_item);
  723 
  724                         if (curset.reader_devnr == writerreaderdevs[i]->devnr) { menuhistory = menuidx; }
  725                         menuidx++;
  726                         gtk_widget_show (menu_item);
  727                 }
  728                 i++;
  729         }
  730 
  731     gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
  732     if (menuhistory != -1) {
  733         gtk_option_menu_set_history(GTK_OPTION_MENU (omenu), menuhistory);
  734     } else {
  735         /*
  736          * if we are here we have an invalid reader setting
  737          * set to default
  738          */
  739         curset.reader_devnr = setupdata.reader_devnr;
  740         gtk_option_menu_set_history(GTK_OPTION_MENU (omenu), 0);
  741     }
  742     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,4*4,12*4,row,row+1);
  743     gtk_widget_show(omenu);
  744     define_tooltip(omenu, _("Select the device you want use now for all read-operations on Discs."));
  745 
  746     if (showspeed) { 
  747         l1 = rightjust_gtk_label_new(_("Speed:"));
  748         gtk_table_attach_defaults(GTK_TABLE(tbl),l1,12*4,15*4-1,row,row+1);
  749         gtk_widget_show(l1);
  750 
  751         adj = gtk_adjustment_new(0.0,0.0,64.0,1.0,1.0,0.0);
  752         speed1 = gtk_spin_button_new(GTK_ADJUSTMENT(adj),0,0);
  753         rdr_spd_spin = speed1; 
  754         gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
  755             GTK_SIGNAL_FUNC (readdev_speed),speed1);
  756         gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(speed1),1);
  757         gtk_table_attach_defaults(GTK_TABLE(tbl),speed1,15*4-1,16*4,row,row+1);
  758         i = get_writerreaderdevs_index(curset.reader_devnr);
  759         if (i >= 0) {
  760             gtk_spin_button_set_value(GTK_SPIN_BUTTON(speed1),
  761                 (gfloat)writerreaderdevs[i]->audioread_speed);
  762         } else {
  763                     gtk_widget_set_sensitive(speed1,FALSE);
  764         }
  765         gtk_widget_show(speed1);
  766         define_tooltip(speed1, _("Select the speed which should be used for audio-extraction."));
  767 
  768             if (!isroot() && !setupdata.root_option_change_readparam) {
  769                     gtk_widget_set_sensitive(speed1,FALSE);
  770         }
  771     } else {
  772         /* if not showing speed, show eject/load buttons */
  773         gtk_widget_realize(tbl);
  774         style = gtk_widget_get_style(tbl);
  775 
  776         pmap = gdk_pixmap_create_from_xpm_d(tbl->window, &mask,
  777             &style->bg[GTK_STATE_NORMAL], (gchar **) disc_eject);
  778         eject_xpm = gtk_image_new_from_pixmap(pmap,mask);
  779         eject_btn = gtk_button_new();
  780         gtk_signal_connect (GTK_OBJECT (eject_btn), "clicked",
  781             GTK_SIGNAL_FUNC (eject_clicked), GINT_TO_POINTER(0));
  782         gtk_table_attach_defaults(GTK_TABLE(tbl),eject_btn,
  783             14*4,15*4,row,row+1);
  784         gtk_widget_show(eject_btn);
  785         gtk_container_add(GTK_CONTAINER(eject_btn), eject_xpm);
  786         gtk_widget_show(eject_xpm);
  787         define_tooltip(eject_btn, _("Ejects a Disc from this device."));
  788 
  789         pmap = gdk_pixmap_create_from_xpm_d(tbl->window, &mask,
  790             &style->bg[GTK_STATE_NORMAL], (gchar **) disc_load);
  791         load_xpm = gtk_image_new_from_pixmap(pmap,mask);
  792         load_btn = gtk_button_new();
  793         gtk_signal_connect (GTK_OBJECT (load_btn), "clicked",
  794             GTK_SIGNAL_FUNC (eject_clicked), GINT_TO_POINTER(1));
  795         gtk_table_attach_defaults(GTK_TABLE(tbl),load_btn,
  796             15*4,16*4,row,row+1);
  797         gtk_widget_show(load_btn);
  798         gtk_container_add(GTK_CONTAINER(load_btn), load_xpm);
  799         gtk_widget_show(load_xpm);
  800         define_tooltip(load_btn, _("Loads a Disc in this device."));
  801     }
  802 }
  803 
  804 
  805 static void imagedir_selected(GtkWidget *item, gpointer val) {
  806 GdkCursor *cursor;
  807 
  808     do_lock(1);
  809     /* change cursor to watch */
  810     cursor = gdk_cursor_new(GDK_WATCH);
  811     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  812 
  813     while (gtk_events_pending())
  814         gtk_main_iteration();
  815 
  816     curset.image_index = GPOINTER_TO_INT(val);
  817 
  818     /* which sub-menu are we in? */
  819     /* read menu? */
  820     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[1])) == 1) {
  821         fill_read_menu();
  822     }
  823     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[1])) == 1) {
  824         fill_read_tracks(1);
  825     }
  826     /* verify menu? */
  827     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[2])) == 1) {
  828         fill_verify_menu();
  829     }
  830     /* verify menu2? */
  831     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[2])) == 1) {
  832         fill_verify_tracks(0);
  833     }
  834     /* write menu? */
  835     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[4])) == 1) {
  836         fill_write_menu();
  837     }
  838     /* write menu2? */
  839     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[5])) == 1) {
  840         fill_write_tracks();
  841     }
  842     /* delete menu? */
  843     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[5])) == 1) {
  844         fill_delete_menu();
  845     }
  846     /* delete menu2? */
  847     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[6])) == 1) {
  848         fill_delete_menu();
  849     }
  850     /* master menu */
  851     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[4])) == 1) {
  852         fill_master_write_menu();
  853     }
  854     /* reset cursor */
  855     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
  856     gdk_cursor_destroy (cursor);
  857     do_unlock(1);
  858 }
  859 
  860 
  861 /*
  862  * draw the device-setup-image line
  863  */
  864 void devices_setup_image(gint row, GtkWidget *tbl) {
  865 GtkWidget *omenu;
  866 GtkWidget *menu;
  867 GtkWidget *menu_item;
  868 GtkWidget *l1;
  869 GList *loop;
  870 gchar tmp[MAXLINE];
  871 gint i, menuidx, menuhistory;
  872 
  873     /* default curset.image_index is -1...so we are fine here */
  874 
  875     /* image directory */
  876     l1 = rightjust_gtk_label_new(_("Image Directory:"));
  877     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,4*4,row,row+1);
  878     gtk_widget_show(l1);
  879 
  880     omenu = gtk_option_menu_new ();
  881     menu = gtk_menu_new();
  882 
  883     /* automatic setting */
  884     menuidx = 0; menuhistory = -1;
  885     menu_item = gtk_menu_item_new_with_label(_("Automatic"));
  886     gtk_signal_connect(GTK_OBJECT(menu_item),
  887         "activate", GTK_SIGNAL_FUNC(imagedir_selected),
  888         GINT_TO_POINTER(-1));
  889     gtk_menu_append (GTK_MENU (menu), menu_item);
  890     if (curset.image_index == -1) { menuhistory = menuidx; }
  891     menuidx++;
  892     gtk_widget_show (menu_item);
  893 
  894     /* add image dirs */
  895     i = 0;
  896     loop = g_list_first(setupdata.image_dirs);
  897     while(loop) {
  898         strcpy(tmp,(gchar *)loop->data);
  899 
  900         menu_item = gtk_menu_item_new_with_label(tmp);
  901         gtk_signal_connect(GTK_OBJECT(menu_item),
  902             "activate", GTK_SIGNAL_FUNC(imagedir_selected),
  903             GINT_TO_POINTER(i));
  904         gtk_menu_append (GTK_MENU (menu), menu_item);
  905         if (curset.image_index == i) { menuhistory = menuidx; }
  906         menuidx++;
  907         gtk_widget_show (menu_item);
  908 
  909         loop = loop->next;
  910         i++;
  911     }
  912 
  913     gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
  914     if (menuhistory != -1) {
  915         gtk_option_menu_set_history(GTK_OPTION_MENU (omenu),menuhistory);
  916     } else {
  917         /* looks we got an invalid setting...set to default */
  918         curset.image_index = -1;
  919         gtk_option_menu_set_history(GTK_OPTION_MENU (omenu),0);
  920 
  921     }
  922     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,4*4,12*4,row,row+1);
  923     gtk_widget_show(omenu);
  924     define_tooltip(omenu, _("The directory on the hard disk you want to store/read tracks from. The setting \"Automatic\" selects all available directories at once."));
  925 }
  926 
  927 
  928 /*
  929  * configure an option menu with write modes for a given device
  930  */
  931 void preselect_write_mode_menu(GtkWidget *omenu, gint devnr) {
  932 gint i,j;
  933 GtkMenuShell *menu_shell;
  934 GtkWidget *menuitem;
  935 GList *loop;
  936 
  937     i = get_writerreaderdevs_index(devnr);
  938 
  939     if (i == -1) {
  940                 gtk_widget_set_sensitive(omenu, FALSE);
  941         return;
  942     }
  943 
  944     /* set write mode and update possible settings */
  945     gtk_option_menu_set_history(GTK_OPTION_MENU (omenu),
  946             writerreaderdevs[i]->writer_mode);
  947         menu_shell = GTK_MENU_SHELL(GTK_OPTION_MENU (omenu)->menu);
  948 
  949         /* loop through all given menu entries */
  950         j = 0;
  951         loop = g_list_first(menu_shell->children);
  952         while(loop) {
  953                 menuitem = loop->data;  
  954                 if (!writemode_supported(j, devnr)) {
  955                         gtk_widget_set_sensitive(menuitem, FALSE);
  956                 } else {
  957                         gtk_widget_set_sensitive(menuitem, TRUE);
  958                 }
  959                 j++;
  960                 loop = loop->next;
  961         }               
  962 }
  963 
  964 
  965 /*
  966  * callbacks for devices_setup_write
  967  */
  968 static void writedev_selected(GtkWidget *item, gpointer devnr) {
  969 GdkCursor *cursor;
  970 gint i;
  971 
  972     do_lock(1);
  973     /* change cursor to watch */
  974     cursor = gdk_cursor_new(GDK_WATCH);
  975     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
  976 
  977     while (gtk_events_pending())
  978         gtk_main_iteration();
  979 
  980         curset.writer_devnr = GPOINTER_TO_INT(devnr);
  981         i = get_writerreaderdevs_index(curset.writer_devnr);
  982 
  983         /* update speed display */
  984         if (cdr_spd_spin) {
  985                 gtk_spin_button_set_value(GTK_SPIN_BUTTON(cdr_spd_spin),
  986                         (gfloat)writerreaderdevs[i]->writer_speed);
  987         }
  988 
  989     /* update any writer specific stuff for a given menu */
  990 
  991     /* write menu? */
  992     if (submenu == 1 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets[4])) == 1) {
  993         if (dupl_cd_mode_omenu) {
  994             preselect_write_mode_menu(dupl_cd_mode_omenu, 
  995                 curset.writer_devnr);
  996         }
  997         if (dupl_cd_burnfree_check) {
  998             if (!does_support_burnproof(curset.writer_devnr)) {
  999                         gtk_widget_set_sensitive(dupl_cd_burnfree_check,FALSE);
 1000             } else {
 1001                         gtk_widget_set_sensitive(dupl_cd_burnfree_check,TRUE);
 1002             }
 1003         }  
 1004     }
 1005 
 1006     /* write menu2? */
 1007     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[5])) == 1) {
 1008         if (crea_cd_mode_omenu) {
 1009             preselect_write_mode_menu(crea_cd_mode_omenu, 
 1010                 curset.writer_devnr);
 1011         }
 1012         if (crea_cd_burnfree_check) {
 1013             if (!does_support_burnproof(curset.writer_devnr)) {
 1014                         gtk_widget_set_sensitive(crea_cd_burnfree_check,FALSE);
 1015             } else {
 1016                         gtk_widget_set_sensitive(crea_cd_burnfree_check,TRUE);
 1017             }
 1018         }
 1019     }
 1020 
 1021     /* master menu */
 1022     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[4])) == 1) {
 1023         if (crea_cd_mode_omenu) {
 1024             preselect_write_mode_menu(crea_cd_mode_omenu, 
 1025                 curset.writer_devnr);
 1026         }
 1027         if (crea_cd_burnfree_check) {
 1028             if (!does_support_burnproof(curset.writer_devnr)) {
 1029                         gtk_widget_set_sensitive(crea_cd_burnfree_check,FALSE);
 1030             } else {
 1031                         gtk_widget_set_sensitive(crea_cd_burnfree_check,TRUE);
 1032             }
 1033         }
 1034     }
 1035 
 1036     /* reset cursor */
 1037     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
 1038     gdk_cursor_destroy (cursor);
 1039     do_unlock(1);
 1040 }
 1041 
 1042 
 1043 static void writedev_speed(GtkWidget *item, GtkSpinButton *spin) {
 1044 gint i;
 1045 
 1046     i = get_writerreaderdevs_index(curset.writer_devnr);
 1047         writerreaderdevs[i]->writer_speed = gtk_spin_button_get_value_as_int(spin);
 1048 }
 1049 
 1050 
 1051 /*
 1052  * draw the device-setup-write line
 1053  */
 1054 void devices_setup_write(gint row, GtkWidget *tbl) {
 1055 GtkWidget *omenu;
 1056 GtkWidget *menu;
 1057 GtkWidget *menu_item;
 1058 GtkWidget *l1;
 1059 GtkWidget *speed1;
 1060 GtkObject *adj;
 1061 gint menuidx, menuhistory;
 1062 gchar tmp[MAXLINE];
 1063 gint i;
 1064 
 1065     cdr_spd_spin = NULL;
 1066 
 1067     /* select primary writer */
 1068     if (curset.writer_devnr == -1) {
 1069         curset.writer_devnr = setupdata.writer_devnr;
 1070     }
 1071 
 1072     /* device still valid? */
 1073     if (get_writerreaderdevs_index(curset.writer_devnr) == -1) {
 1074         /* invalid device, pick the first available instead */
 1075         i = 0;
 1076         while(writerreaderdevs[i] != NULL) {
 1077                     if (writerreaderdevs[i]->is_cdrwriter ||
 1078                             writerreaderdevs[i]->is_dvdwriter) {
 1079     
 1080                 curset.writer_devnr = writerreaderdevs[i]->devnr;
 1081                 break;
 1082             }
 1083             i++;
 1084         }
 1085     }
 1086     
 1087     /* write device */
 1088     l1 = rightjust_gtk_label_new(_("Write Device:"));
 1089     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,4*4,row,row+1);
 1090     gtk_widget_show(l1);
 1091 
 1092     omenu = gtk_option_menu_new ();
 1093     menu = gtk_menu_new();
 1094     menuidx = 0; menuhistory = -1;
 1095     i = 0;
 1096 
 1097     while(writerreaderdevs[i] != NULL) {
 1098 
 1099                 /* only show writers here */
 1100                 if (writerreaderdevs[i]->is_cdrwriter ||
 1101                     writerreaderdevs[i]->is_dvdwriter) {
 1102 
 1103                         if (convert_devnr2devstring(writerreaderdevs[i]->devnr,tmp) == 0) {
 1104                                 menu_item = gtk_menu_item_new_with_label(tmp);
 1105                                 gtk_signal_connect(GTK_OBJECT(menu_item),
 1106                                         "activate", GTK_SIGNAL_FUNC(writedev_selected),
 1107                                         GINT_TO_POINTER(writerreaderdevs[i]->devnr));
 1108                                 gtk_menu_append (GTK_MENU (menu), menu_item);
 1109                                 if (curset.writer_devnr == writerreaderdevs[i]->devnr) { menuhistory = menuidx; }
 1110                                 menuidx++;
 1111                                 gtk_widget_show (menu_item);
 1112                         }
 1113                 }
 1114                 i++;
 1115         }
 1116 
 1117     gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
 1118         if (menuhistory != -1) {
 1119                 gtk_option_menu_set_history(GTK_OPTION_MENU (omenu),menuhistory);
 1120         } else {
 1121                 /* nothing valid preselected */
 1122                 curset.writer_devnr = setupdata.writer_devnr;
 1123                 gtk_option_menu_set_history(GTK_OPTION_MENU (omenu), 0);
 1124         }
 1125     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,4*4,12*4,row,row+1);
 1126     gtk_widget_show(omenu);
 1127     define_tooltip(omenu, _("The Writer you want to use now to burn your Discs."));
 1128 
 1129     l1 = rightjust_gtk_label_new(_("Speed:"));
 1130     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,12*4,15*4-1,row,row+1);
 1131     gtk_widget_show(l1);
 1132 
 1133     adj = gtk_adjustment_new(0.0,0.0,64.0,1.0,1.0,0.0);
 1134     speed1 = gtk_spin_button_new(GTK_ADJUSTMENT(adj),0,0);
 1135     cdr_spd_spin = speed1;
 1136     gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
 1137         GTK_SIGNAL_FUNC (writedev_speed),speed1);
 1138     gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(speed1),1);
 1139     gtk_table_attach_defaults(GTK_TABLE(tbl),speed1,15*4-1,16*4,row,row+1);
 1140 
 1141     i = get_writerreaderdevs_index(curset.writer_devnr);
 1142     if (i >= 0) {
 1143         gtk_spin_button_set_value(GTK_SPIN_BUTTON(speed1),
 1144             (gfloat)writerreaderdevs[i]->writer_speed);
 1145     } else {
 1146                 gtk_widget_set_sensitive(speed1,FALSE);
 1147     }
 1148     gtk_widget_show(speed1);
 1149     define_tooltip(speed1, _("The speed you want to burn Discs with. (Depends on your current Disc.)"));
 1150 
 1151         if (!isroot() && !setupdata.root_option_change_writeparam) {
 1152                 gtk_widget_set_sensitive(speed1,FALSE);
 1153     }
 1154 }
 1155 
 1156 
 1157 /*
 1158  * function to remove all selections on a clist
 1159  */
 1160 void undo_selections(GtkWidget *clist, gint row, gint column,
 1161     GdkEventButton *event, gpointer data) {
 1162 
 1163     gtk_clist_unselect_all(GTK_CLIST(clist));
 1164 }
 1165 
 1166 
 1167 /*
 1168  * draw the disc-info-menu
 1169  */
 1170 void draw_info_menu() {
 1171 GtkWidget *hbox, *vbox;
 1172 GtkWidget *f1,*f2;
 1173 GtkWidget *b1, *b_update;
 1174 GtkWidget *e1;
 1175 GtkWidget *l1;
 1176 GtkWidget *tbl;
 1177 GtkWidget *cd_list, *img_list;
 1178 gchar *titles[2];
 1179 GtkWidget *scrolled_win;
 1180 
 1181     /* prepare draw area */
 1182     clear_actionspace();
 1183 
 1184     f1 = gtk_frame_new(_("Devices-Setup"));
 1185     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 1186     gtk_box_pack_start(GTK_BOX(actionspace),f1,FALSE,FALSE,5);
 1187     gtk_widget_show(f1);
 1188 
 1189     tbl = gtk_table_new(1,16*4,TRUE);   
 1190     gtk_table_set_col_spacing(GTK_TABLE(tbl),4*4-1,5);
 1191     gtk_table_set_col_spacing(GTK_TABLE(tbl),15*4-1,5);
 1192     gtk_container_set_border_width(GTK_CONTAINER (tbl),5);
 1193     gtk_container_add(GTK_CONTAINER(f1),tbl);
 1194     gtk_widget_show(tbl);
 1195 
 1196     devices_setup_read(0, tbl, 0);
 1197 
 1198 
 1199     /* left and right info-frames */
 1200     tbl = gtk_table_new(1,2,TRUE);
 1201     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1202     gtk_box_pack_start(GTK_BOX(actionspace),tbl,TRUE,TRUE,10);
 1203     gtk_widget_show(tbl);
 1204     if (!curset.isProDVD) {
 1205         f1 = gtk_frame_new(_("Disc-Information"));
 1206     } else {
 1207         f1 = gtk_frame_new(_("CD/DVD-Information"));
 1208     }
 1209     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 1210     gtk_table_attach_defaults(GTK_TABLE(tbl),f1,0,1,0,1);
 1211     gtk_widget_show(f1);
 1212     f2 = gtk_frame_new(_("Image-Information"));
 1213     set_font_and_color_frame(f2,PANGO_BOLD,NULL);
 1214     gtk_table_attach_defaults(GTK_TABLE(tbl),f2,1,2,0,1);
 1215     gtk_widget_show(f2);
 1216 
 1217     /* button bar at the bottom */
 1218     hbox = gtk_hbox_new(TRUE,10);
 1219     gtk_box_pack_start(GTK_BOX(actionspace),hbox,FALSE,TRUE,10);
 1220     gtk_widget_show(hbox);
 1221     b1 = gtk_button_new_with_label(_("Query CDDB"));
 1222     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 1223     gtk_widget_show(b1);
 1224     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 1225         GTK_SIGNAL_FUNC(cddb_clicked), NULL);
 1226     define_tooltip(b1,_("Download the track titles for current CD. Requires a connection to the Internet."));
 1227 
 1228     b1 = gtk_button_new_with_label(_("Edit titles for CD-Text"));
 1229     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 1230     gtk_widget_show(b1);
 1231     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 1232         GTK_SIGNAL_FUNC(edit_cdtext_clicked), GINT_TO_POINTER(0));
 1233     define_tooltip(b1,_("Edits the title and performer information before any tracks are read from the inserted CD. Only required to author a CD with CD-Text."));
 1234 
 1235     b_update = gtk_button_new_with_label(_("Update"));
 1236     gtk_box_pack_start(GTK_BOX(hbox),b_update,TRUE,TRUE,10);
 1237     gtk_widget_show(b_update);
 1238     gtk_signal_connect(GTK_OBJECT(b_update), "clicked",
 1239         GTK_SIGNAL_FUNC(update_clicked), NULL);
 1240     define_tooltip(b_update,_("Refreshes the content of the information windows (e.g. after a Disc change)."));
 1241 
 1242 
 1243     /* left info frame */
 1244     vbox = gtk_vbox_new(FALSE,0);
 1245     gtk_container_add(GTK_CONTAINER(f1),vbox);
 1246     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 1247     gtk_widget_show(vbox);
 1248 
 1249     scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 1250     gtk_box_pack_start(GTK_BOX(vbox),scrolled_win,TRUE,TRUE,0);
 1251     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
 1252         GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
 1253     gtk_widget_show(scrolled_win);
 1254     
 1255     titles[0] = g_strdup("");
 1256     titles[1] = _("Tracks");
 1257     cd_list = gtk_clist_new_with_titles(2,titles);
 1258     gtk_signal_connect(GTK_OBJECT(cd_list), "select_row",
 1259         GTK_SIGNAL_FUNC(undo_selections), NULL);
 1260     gtk_container_add (GTK_CONTAINER (scrolled_win), cd_list);
 1261     cdlist = GTK_CLIST(cd_list);
 1262     gtk_clist_set_column_width(cdlist, 0, 16);
 1263     gtk_clist_set_column_auto_resize(cdlist, 1, TRUE);
 1264     gtk_widget_show(cd_list);
 1265 
 1266     tbl = gtk_table_new(3,8,TRUE);
 1267     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 1268     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1269     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 1270     gtk_widget_show(tbl);
 1271     
 1272     l1 = rightjust_gtk_label_new(_("Type:"));
 1273     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,0,1);
 1274     gtk_widget_show(l1);
 1275 
 1276     e1 = gtk_entry_new();
 1277     cdlist_l1 = e1;
 1278     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1279     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,0,1);
 1280     gtk_widget_show(e1);
 1281 
 1282     l1 = rightjust_gtk_label_new(_("Label:"));
 1283     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,1,2);
 1284     gtk_widget_show(l1);
 1285 
 1286     e1 = gtk_entry_new();
 1287     cdlist_l2 = e1;
 1288     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1289     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,1,2);
 1290     gtk_widget_show(e1);
 1291 
 1292     l1 = rightjust_gtk_label_new(_("Size:"));
 1293     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,2,3);
 1294     gtk_widget_show(l1);
 1295 
 1296     e1 = gtk_entry_new();
 1297     cdlist_l3 = e1;
 1298     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1299     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,2,3);
 1300     gtk_widget_show(e1);
 1301 
 1302 
 1303     /* right info frame */
 1304     vbox = gtk_vbox_new(FALSE,0);
 1305     gtk_container_add(GTK_CONTAINER(f2),vbox);
 1306     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 1307     gtk_widget_show(vbox);
 1308 
 1309     scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 1310     gtk_box_pack_start(GTK_BOX(vbox),scrolled_win,TRUE,TRUE,0);
 1311     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
 1312         GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
 1313     gtk_widget_show(scrolled_win);
 1314     
 1315     titles[0] = g_strdup("");
 1316     titles[1] = _("Images");
 1317     img_list = gtk_clist_new_with_titles(2,titles);
 1318     gtk_signal_connect(GTK_OBJECT(img_list), "select_row",
 1319         GTK_SIGNAL_FUNC(undo_selections), NULL);
 1320     gtk_container_add (GTK_CONTAINER (scrolled_win), img_list);
 1321     imglist = GTK_CLIST(img_list);
 1322     gtk_clist_set_column_width(imglist, 0, 16);
 1323     gtk_clist_set_column_auto_resize(imglist, 1, TRUE);
 1324     gtk_widget_show(img_list);
 1325 
 1326     tbl = gtk_table_new(1,8,TRUE);
 1327     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 1328     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1329     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 1330     gtk_widget_show(tbl);
 1331     
 1332     l1 = rightjust_gtk_label_new(_("Total Size:"));
 1333     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,0,1);
 1334     gtk_widget_show(l1);
 1335 
 1336     e1 = gtk_entry_new();
 1337     imglist_l1 = e1;
 1338     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1339     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,0,1);
 1340     gtk_widget_show(e1);
 1341     define_tooltip(e1,_("Data / Audio"));
 1342 
 1343     gtk_widget_show(actionspace);
 1344 
 1345     while (gtk_events_pending())
 1346         gtk_main_iteration();
 1347 
 1348     /* now update screen */
 1349     gtk_button_clicked(GTK_BUTTON(b_update));
 1350 }
 1351 
 1352 
 1353 /*
 1354  * calculate the space that would be recycled on the hard disk
 1355  * when reading tracks and overwriting the ones with same names.
 1356  * This is used to show the user what space really is free 
 1357  * dependant of the name he chooses for his files
 1358  */
 1359 static gint get_free_space_by_overwriting_trackfiles(gint *biggest) {
 1360 track_read_param_t *trackparam;
 1361 gfloat per;
 1362 gint i;
 1363 gint overwrite;
 1364 gint overwritebiggest;
 1365 
 1366     /* disc loaded? */
 1367     if (cdinfo.nr_tracks < 0) {
 1368         /* no disc in drive - no files to read */
 1369         *biggest = 0;
 1370         return 0;
 1371     }
 1372 
 1373     /* free structure first */
 1374     clear_trackreadset();
 1375 
 1376     /* fill structure */
 1377     trackreadset.nrtracks = cdinfo.nr_tracks;
 1378 
 1379     for(i=0; i<cdinfo.nr_tracks; i++) {
 1380 
 1381         /* allocate memory */
 1382         trackparam = g_new0(track_read_param_t,1);
 1383 
 1384         trackparam->trackinfo_index = i;
 1385         trackparam->starttrack = trackinfo[i]->track_nr;
 1386         trackparam->endtrack = 0;
 1387         trackparam->tracktype = trackinfo[i]->type;
 1388         per = (gfloat)trackinfo[i]->size * 100.0  / cdinfo.total_size;
 1389         trackparam->percent = per;
 1390         
 1391         if (trackparam->tracktype == 0) {
 1392             /* data track */
 1393             trackparam->kbyte = trackinfo[i]->size *
 1394                 (DATASECTORSIZE/1024);
 1395             trackparam->frames = trackinfo[i]->size;
 1396             trackparam->startoffset = trackinfo[i]->start_sec;
 1397             if (i == cdinfo.nr_tracks-1) {
 1398                 /* last track - leadout is track-end */
 1399                 trackparam->endoffset = cdinfo.leadout - 2;     
 1400             } else {
 1401                 /* sub 150 (2 sec leadout),
 1402                    sub 2 (2 run out sectors) */
 1403                 trackparam->endoffset = 
 1404                     trackinfo[i+1]->start_sec -150-2;   
 1405             }
 1406         } else {
 1407             /* audio */
 1408             trackparam->kbyte = trackinfo[i]->size *
 1409                 CDDAFRAME/1024;
 1410             trackparam->frames = trackinfo[i]->size;
 1411         }
 1412 
 1413         trackreadset.trackparams = g_list_append(
 1414             trackreadset.trackparams, trackparam);
 1415     }
 1416 
 1417     /* assign disk space */
 1418     allocate_track_filenames(&overwrite, &overwritebiggest); 
 1419 
 1420     *biggest = overwritebiggest;
 1421     return overwrite;
 1422 }
 1423 
 1424 
 1425 /*
 1426  * callbacks for button in read-screen
 1427  */
 1428 static void readalltracks_clicked(GtkWidget *widget, gpointer data) {
 1429 gchar path[MAXLINE];
 1430 gchar tmp[MAXLINE];
 1431 track_read_param_t *trackparam;
 1432 gfloat per;
 1433 gint i, ret, sectorstoread;
 1434 gint overwrite, overwritebiggest, stat;
 1435 gint datacount, audiocount, sectsize;
 1436 GList *loop;
 1437 
 1438     /* no disc reader defined */
 1439     if (curset.reader_devnr == -1) {
 1440         show_dialog(ICO_ERROR,_("No disc reader defined in Setup."), T_OK, NULL, NULL, 0);
 1441         return;
 1442     }
 1443 
 1444         datacount = 0;
 1445         audiocount = 0;
 1446         sectsize = get_sectorsize(curset.reader_devnr);
 1447 
 1448 
 1449     /* now check if our disc information is still valid */
 1450     get_cd_toc_and_volid(curset.reader_devnr);
 1451 
 1452     /* disc loaded? */
 1453     if (cdinfo.nr_tracks < 0) {
 1454         /* update screen ... */
 1455         fill_read_menu();
 1456         show_dialog(ICO_WARN,_("No Disc loaded in read device."),T_OK,NULL,NULL,0);
 1457         return;
 1458     }
 1459 
 1460     /* now check for CD-Extra because
 1461        we don't handle this currently */
 1462     if (determine_disc_type(tmp,0) == 3) {
 1463         show_dialog(ICO_INFO,_("This test release does currently not\nsupport copying of CD-Extra."),T_OK,NULL,NULL,0);
 1464         return;
 1465     }
 1466     
 1467     /* ok, the user wants to read all tracks */
 1468     /* lets check if the file-prefix-entry is up to date */
 1469     set_image_prefix_callback(imglist_l1, NULL); 
 1470 
 1471     /* free structure first */
 1472     clear_trackreadset();
 1473 
 1474     /* fill structure */
 1475     trackreadset.nrtracks = cdinfo.nr_tracks;
 1476 
 1477     for(i=0; i<cdinfo.nr_tracks; i++) {
 1478 
 1479         /* allocate memory */
 1480         trackparam = g_new0(track_read_param_t,1);
 1481 
 1482         trackparam->trackinfo_index = i;
 1483         trackparam->starttrack = trackinfo[i]->track_nr;
 1484         trackparam->endtrack = 0;
 1485         trackparam->tracktype = trackinfo[i]->type;
 1486         per = (gfloat)trackinfo[i]->size * 100.0  / cdinfo.total_size;
 1487         trackparam->percent = per;
 1488         
 1489         if (trackparam->tracktype == 0) {
 1490             /* data track */
 1491             datacount++;
 1492             trackparam->kbyte = trackinfo[i]->size *
 1493                 (DATASECTORSIZE/1024);
 1494             trackparam->frames = trackinfo[i]->size;
 1495             trackparam->startoffset = trackinfo[i]->start_sec;
 1496             if (i == cdinfo.nr_tracks-1) {
 1497                 /* last track - leadout is track-end */
 1498                 trackparam->endoffset = cdinfo.leadout - 2;     
 1499             } else {
 1500                 /* sub 150 (2 sec leadout),
 1501                    sub 2 (2 run out sectors) */
 1502                 trackparam->endoffset = 
 1503                     trackinfo[i+1]->start_sec -150-2;   
 1504             }
 1505             /*
 1506              * now do a paranoia check
 1507              * in some cases we skip to much of a track
 1508              */
 1509             sectorstoread = trackparam->endoffset - 
 1510                 trackparam->startoffset;
 1511             if (sectorstoread < trackinfo[i]->isosize) {
 1512                 trackparam->endoffset =
 1513                     trackparam->startoffset + 
 1514                         trackinfo[i]->isosize;
 1515                 trackparam->kbyte = trackinfo[i]->isosize * 2;
 1516                 dodebug(1,"readalltracks_clicked: corrected data track size from %d to %d sectors.\n", sectorstoread, trackinfo[i]->isosize);
 1517             }
 1518         } else {
 1519             /* audio */
 1520             audiocount++;
 1521             trackparam->kbyte = trackinfo[i]->size *
 1522                 CDDAFRAME/1024;
 1523             trackparam->frames = trackinfo[i]->size;
 1524         }
 1525 
 1526         trackreadset.trackparams = g_list_append(
 1527             trackreadset.trackparams, trackparam);
 1528     }
 1529 
 1530         /* sectorsize firmware bug detection */
 1531         if (datacount > 0 && sectsize != 2048) {
 1532                 ret = show_dialog(ICO_WARN,_("Your drive seems to have a faulty firmware which will not allow to read\ndata tracks reliably. Try to install a firmwire update or read your\ndata Discs with another drive. It is not recommended to continue."), T_ANYWAY, T_CANCEL, NULL, 1);
 1533                 if (ret == 1) {
 1534                         /* abort */
 1535                         return;
 1536                 }
 1537         }
 1538 
 1539 
 1540     /* assign disk space */
 1541     stat = allocate_track_filenames(&overwrite, &overwritebiggest);
 1542 
 1543     if (stat == 1) {
 1544         /* not enough space */
 1545         ret = show_dialog(ICO_WARN,_("Not enough disk space available!\nDo you want to continue anyway or to abort?"), T_ANYWAY, T_CANCEL, NULL, 1);
 1546         if (ret == 1) {
 1547             /* abort */
 1548             return;
 1549         }
 1550     }
 1551 
 1552         /* no writeable dirs */
 1553         if (stat == 2) {
 1554         show_dialog(ICO_WARN,_("No image-directories with write permissions found.\nPlease check your settings in the Setup."), T_OK, NULL, NULL, 1);
 1555                 return;
 1556         }
 1557 
 1558     /* overwriting a link? */
 1559     if (stat == 3) {
 1560         /* FIX HERE USING GETTEXT FOR NEXT RELEASE */
 1561         show_dialog(ICO_WARN,"Not allowing to overwrite a symlink.\nChoose another \"File prefix\".", T_OK, NULL, NULL, 1);
 1562         return;
 1563     }
 1564 
 1565     /* warn we are going to overwrite some files */
 1566     if (setupdata.option_overwritewarn == 1 && overwrite > 0) {
 1567         ret = show_dialog(ICO_WARN,_("You are going to overwrite old track images on your\nhard disk. Cancel now, if you don't want to do that\nand choose another \"File prefix\"."), T_ANYWAY, T_CANCEL, NULL, 1);
 1568         if (ret == 1) {
 1569             /* abort */
 1570             return;
 1571         }
 1572     }
 1573     
 1574     /* assign now a toc-file name */
 1575     strcpy(path, "");
 1576     if (curset.image_index == -1) {
 1577         /* automatic setting */
 1578         loop = g_list_first(setupdata.image_dirs);
 1579         while(loop) {
 1580             strncpy(path,(gchar *)loop->data, MAXLINE);
 1581 
 1582             /* dir writeable? */
 1583                         if (is_dir_writeable(path) == 0) {
 1584                 /* yes? take this */
 1585                 break;
 1586             }
 1587             loop = loop->next;
 1588         }
 1589     } else {
 1590         strncpy(path,(gchar *)g_list_nth_data(setupdata.image_dirs,
 1591             curset.image_index), MAXLINE);
 1592     }
 1593     g_snprintf(tmp,MAXLINE,"%s/%s.toc",path,curset.file_prefix);
 1594     g_free(trackreadset.tocfile);
 1595     trackreadset.tocfile = g_strdup(tmp);
 1596 
 1597     /* now all parameters for reading are set - lets begin */
 1598     show_and_do_read_tracks(curset.reader_devnr, 1);
 1599 }
 1600 
 1601 
 1602 /*
 1603  * fill the entries in the read_disc_menu
 1604  */
 1605 static void fill_read_menu() {
 1606 gchar tmp[MAXLINE];
 1607 gchar tmp2[MAXLINE];
 1608 gchar tmp3[MAXLINE];
 1609 gint overwritefree, normalfree, biggestfree, overwritefreebiggest, disc_type;
 1610 
 1611     /* file prefix */
 1612     if (strcmp(curset.file_prefix,"") == 0) {
 1613         g_free(curset.file_prefix);
 1614         curset.file_prefix = g_strdup(IMGFILEPREFIX);
 1615     }
 1616     gtk_entry_set_text(GTK_ENTRY(imglist_l1), curset.file_prefix);
 1617     gtk_entry_set_position(GTK_ENTRY(imglist_l1), 0);
 1618 
 1619     /* now check if the current filename has any influence on
 1620        the available space */
 1621     overwritefree = 
 1622         get_free_space_by_overwriting_trackfiles(&overwritefreebiggest);
 1623 
 1624     /* free size */
 1625     normalfree = determine_free_space(&biggestfree);
 1626     convert_kbytes2mbminstring(normalfree,tmp3);
 1627 
 1628     /* additional free space when overwriting files? */
 1629     if (cdinfo.nr_tracks > 0 && overwritefree > 0) {
 1630         convert_kbytes2mbstring(normalfree+overwritefree, tmp2);
 1631         g_snprintf(tmp,MAXLINE,"%s (%s)", tmp3, tmp2);
 1632     } else {
 1633         strcpy(tmp,tmp3);
 1634     }
 1635     gtk_entry_set_text(GTK_ENTRY(imglist_l2), tmp);
 1636     gtk_entry_set_position(GTK_ENTRY(imglist_l2), 0);
 1637 
 1638     /* biggest free block */
 1639     convert_kbytes2mbminstring(biggestfree,tmp3);
 1640 
 1641     if (cdinfo.nr_tracks > 0 && overwritefreebiggest > 0) {
 1642         convert_kbytes2mbstring(biggestfree+overwritefreebiggest, tmp2);
 1643         g_snprintf(tmp,MAXLINE,"%s (%s)", tmp3, tmp2);
 1644     } else {
 1645         strcpy(tmp,tmp3);
 1646     }
 1647     gtk_entry_set_text(GTK_ENTRY(imglist_l3), tmp);
 1648     gtk_entry_set_position(GTK_ENTRY(imglist_l3), 0);
 1649 
 1650 
 1651     /* disc loaded? */
 1652     if (cdinfo.nr_tracks == -1) {
 1653         gtk_entry_set_text(GTK_ENTRY(cdlist_l1), _("No Disc loaded"));    
 1654         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
 1655         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");    
 1656         gtk_entry_set_text(GTK_ENTRY(cdlist_l4),"");    
 1657         return;
 1658         }
 1659     if (cdinfo.nr_tracks == -2) {
 1660         gtk_entry_set_text(GTK_ENTRY(cdlist_l1),  return_media_type(curset.reader_devnr));    
 1661         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
 1662         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");    
 1663         gtk_entry_set_text(GTK_ENTRY(cdlist_l4),"");    
 1664         return;
 1665         }
 1666 
 1667     /* get and display disc type */
 1668     disc_type = determine_disc_type(tmp,0);
 1669     gtk_entry_set_text(GTK_ENTRY(cdlist_l1), tmp); 
 1670 
 1671     /* display CD label */
 1672     if (cdinfo.title && cdinfo.artist && 
 1673         cdinfo.title[0] != '\0' && setupdata.option_displaycdtext) {
 1674         g_snprintf(tmp,MAXLINE,"%s / %s", cdinfo.title, cdinfo.artist);
 1675         gtk_entry_set_text(GTK_ENTRY(cdlist_l2), tmp);
 1676         gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
 1677     } else 
 1678     if (cdinfo.cddb_dtitle != NULL) {
 1679         gtk_entry_set_text(GTK_ENTRY(cdlist_l2), cdinfo.cddb_dtitle);   
 1680         gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
 1681     } else {
 1682         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");    
 1683     }
 1684 
 1685     /* display disc size */
 1686     if (disc_type == 1 || disc_type == 2) { /* Audio or Mixed Mode CD */
 1687         convert_frames2mbminstring(cdinfo.total_size, tmp);
 1688     } else {                        /* Data CD/DVD/BD and CD Extra */
 1689         convert_sectors2mbminstring(cdinfo.total_size, tmp);
 1690     }
 1691     gtk_entry_set_text(GTK_ENTRY(cdlist_l3), tmp);
 1692 
 1693     /* nr tracks */ 
 1694     g_snprintf(tmp,MAXLINE,"%d",cdinfo.nr_tracks);
 1695     gtk_entry_set_text(GTK_ENTRY(cdlist_l4), tmp);
 1696 }
 1697 
 1698 
 1699 void set_image_prefix_callback(GtkWidget *widget, gpointer data) {
 1700 gchar tmp[MAXLINE];
 1701 
 1702     g_free(curset.file_prefix);
 1703     strcpy(tmp,gtk_entry_get_text(GTK_ENTRY(widget)));
 1704     /* now check for illegal chars */
 1705     if (remove_illegal_chars(tmp) == 1) {
 1706         gtk_entry_set_text(GTK_ENTRY(widget), tmp);
 1707         show_dialog(ICO_WARN,_("Illegal chars found in entry field.\nSubstituted them by \"_\" chars"),T_OK,NULL,NULL, 0);
 1708     }
 1709     curset.file_prefix = g_strdup(tmp);
 1710 
 1711     /* empty-file? */
 1712     if (strcmp(curset.file_prefix,"") == 0) {
 1713         g_free(curset.file_prefix);
 1714         curset.file_prefix = g_strdup(IMGFILEPREFIX);
 1715         gtk_entry_set_text(GTK_ENTRY(widget), curset.file_prefix);
 1716     }
 1717 
 1718     /* update free overwrite size */
 1719     if (submenu == 1) {
 1720         fill_read_menu();
 1721     }
 1722 
 1723     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[1])) == 1) {
 1724         fill_read_tracks(1);
 1725     }
 1726     if (submenu == 2 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(side_widgets2[4])) == 1) {
 1727         fill_master_write_menu();
 1728     }
 1729 
 1730 }
 1731 
 1732 
 1733 void readoptions_selected(GtkWidget *item, gpointer nr) {
 1734 gint sel;
 1735 
 1736     sel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(item));
 1737 
 1738     switch(GPOINTER_TO_INT(nr)) {
 1739         case 0:
 1740             curset.indexscan = sel;
 1741             break;
 1742         case 1:
 1743             curset.deemphasize = sel;
 1744             break;
 1745 
 1746     }
 1747 }
 1748 
 1749 
 1750 /*
 1751  * draw the read disc menu
 1752  */
 1753 static void draw_read_menu() {
 1754 gchar tmp[MAXLINE];
 1755 GtkWidget *hbox, *vbox;
 1756 GtkWidget *f1,*f2, *f3;
 1757 GtkWidget *b1, *b_update;
 1758 GtkWidget *e1;
 1759 GtkWidget *l1;
 1760 GtkWidget *tbl, *check;
 1761 
 1762     /* prepare draw area */
 1763     clear_actionspace();
 1764 
 1765     f1 = gtk_frame_new(_("Devices-Setup"));
 1766     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 1767     gtk_box_pack_start(GTK_BOX(actionspace),f1,FALSE,FALSE,5);
 1768     gtk_widget_show(f1);
 1769 
 1770     tbl = gtk_table_new(2,16*4,TRUE);   
 1771     gtk_table_set_col_spacing(GTK_TABLE(tbl),4*4-1,5);
 1772     gtk_table_set_col_spacing(GTK_TABLE(tbl),15*4-2 ,5);
 1773     gtk_container_set_border_width(GTK_CONTAINER (tbl),5);
 1774     gtk_container_add(GTK_CONTAINER(f1),tbl);
 1775     gtk_widget_show(tbl);
 1776 
 1777     devices_setup_read(0, tbl, 1);
 1778     devices_setup_image(1, tbl);
 1779     /* devices_setup_write(2, tbl); */
 1780 
 1781     /* left and right info-frames */
 1782     tbl = gtk_table_new(1,2,TRUE);
 1783     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1784     gtk_box_pack_start(GTK_BOX(actionspace),tbl,TRUE,TRUE,10);
 1785     gtk_widget_show(tbl);
 1786     vbox = gtk_vbox_new(FALSE,10);
 1787     gtk_table_attach_defaults(GTK_TABLE(tbl),vbox,0,1,0,1);
 1788     if (!curset.isProDVD) {
 1789         f1 = gtk_frame_new(_("Disc-Information"));
 1790     } else {
 1791         f1 = gtk_frame_new(_("CD/DVD-Information"));
 1792     }
 1793     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 1794     gtk_box_pack_start(GTK_BOX(vbox),f1,TRUE,TRUE,0);
 1795     gtk_widget_show(f1);
 1796     f3 = gtk_frame_new(_("Read options"));
 1797     set_font_and_color_frame(f3,PANGO_BOLD,NULL);
 1798     gtk_box_pack_start(GTK_BOX(vbox),f3,FALSE,FALSE,0);
 1799     gtk_widget_show(f3);
 1800     f2 = gtk_frame_new(_("Image-Information"));
 1801     set_font_and_color_frame(f2,PANGO_BOLD,NULL);
 1802     gtk_table_attach_defaults(GTK_TABLE(tbl),f2,1,2,0,1);
 1803     gtk_widget_show(f2);
 1804     gtk_widget_show(vbox);
 1805 
 1806     /* button bar at the bottom */
 1807     hbox = gtk_hbox_new(TRUE,10);
 1808     gtk_box_pack_start(GTK_BOX(actionspace),hbox,FALSE,TRUE,10);
 1809     gtk_widget_show(hbox);
 1810     b1 = gtk_button_new_with_label(_("Read all tracks"));
 1811     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 1812     gtk_widget_show(b1);
 1813     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 1814         GTK_SIGNAL_FUNC(readalltracks_clicked), NULL);
 1815     define_tooltip(b1, _("Reads all tracks from the current Disc and saves them in the image directories on the hard disk."));
 1816 
 1817     b_update = gtk_button_new_with_label(_("Update"));
 1818     gtk_box_pack_start(GTK_BOX(hbox),b_update,TRUE,TRUE,10);
 1819     gtk_widget_show(b_update);
 1820     gtk_signal_connect(GTK_OBJECT(b_update), "clicked",
 1821         GTK_SIGNAL_FUNC(update_readvrfy_clicked), GINT_TO_POINTER(1));
 1822     define_tooltip(b_update,_("Refreshes the content of the information windows (e.g. after a Disc change)."));
 1823 
 1824 
 1825     /* left info frame */
 1826     vbox = gtk_vbox_new(FALSE,0);
 1827     gtk_container_add(GTK_CONTAINER(f1),vbox);
 1828     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 1829     gtk_widget_show(vbox);
 1830 
 1831     tbl = gtk_table_new(4,8,TRUE);
 1832     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 1833     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1834     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 1835     gtk_widget_show(tbl);
 1836     
 1837     l1 = rightjust_gtk_label_new(_("Type:"));
 1838     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,0,1);
 1839     gtk_widget_show(l1);
 1840 
 1841     e1 = gtk_entry_new();
 1842     cdlist_l1 = e1;
 1843     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1844     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,0,1);
 1845     gtk_widget_show(e1);
 1846 
 1847     l1 = rightjust_gtk_label_new(_("Label:"));
 1848     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,1,2);
 1849     gtk_widget_show(l1);
 1850 
 1851     e1 = gtk_entry_new();
 1852     cdlist_l2 = e1;
 1853     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1854     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,1,2);
 1855     gtk_widget_show(e1);
 1856 
 1857     l1 = rightjust_gtk_label_new(_("Size:"));
 1858     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,2,3);
 1859     gtk_widget_show(l1);
 1860 
 1861     e1 = gtk_entry_new();
 1862     cdlist_l3 = e1;
 1863     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1864     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,2,3);
 1865     gtk_widget_show(e1);
 1866 
 1867     l1 = rightjust_gtk_label_new(_("Tracks:"));
 1868     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,3,4);
 1869     gtk_widget_show(l1);
 1870 
 1871     e1 = gtk_entry_new();
 1872     cdlist_l4 = e1;
 1873     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1874     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,3,4);
 1875     gtk_widget_show(e1);
 1876 
 1877     /* options frame */
 1878     vbox = gtk_vbox_new(FALSE,0);
 1879     gtk_container_add(GTK_CONTAINER(f3),vbox);
 1880     gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 1881     gtk_widget_show(vbox);
 1882 
 1883     tbl = gtk_table_new(1,8,TRUE);
 1884     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1885     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 1886     gtk_widget_show(tbl);
 1887 
 1888     /* index scan? */
 1889     check = gtk_check_button_new_with_label(_("Do index scan"));
 1890     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 1891         GTK_SIGNAL_FUNC(readoptions_selected),GINT_TO_POINTER(0));
 1892     gtk_table_attach_defaults(GTK_TABLE(tbl),check,1,8,0,1);
 1893     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 1894                 curset.indexscan);
 1895     define_tooltip(check, _("Long-lasting audio tracks may be subdivided with indices, some audio CDs are recorded with pre-emphasis. If this option is enabled, the copy will be exactly as the original. Please note that some drives may need a little time to scan."));
 1896     gtk_widget_show(check);
 1897 
 1898     /* deemphasize? */
 1899     check = gtk_check_button_new_with_label(_("Audio deemphasis"));
 1900     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 1901         GTK_SIGNAL_FUNC(readoptions_selected),GINT_TO_POINTER(1));
 1902     gtk_table_attach_defaults(GTK_TABLE(tbl),check,1,8,1,2);
 1903     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 1904                 curset.deemphasize);
 1905     define_tooltip(check, _("Some audio CDs are recorded with pre-emphasis. This option detects and deemphasizes such audio tracks. This is mandatory if you want to convert the files e.g. to flac, ogg or mp3. By contrast, all Audio CD players would perform the deemphasis automatically."));
 1906     gtk_widget_show(check);
 1907 
 1908 
 1909     /* right info frame */
 1910     vbox = gtk_vbox_new(FALSE,0);
 1911     gtk_container_add(GTK_CONTAINER(f2),vbox);
 1912     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 1913     gtk_widget_show(vbox);
 1914 
 1915     tbl = gtk_table_new(4,8,TRUE);
 1916     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 1917     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 1918     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 1919     gtk_widget_show(tbl);
 1920     
 1921     l1 = rightjust_gtk_label_new(_("File prefix:"));
 1922     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,4,0,1);
 1923     gtk_widget_show(l1);
 1924 
 1925     e1 = gtk_entry_new();
 1926     gtk_entry_set_max_length(GTK_ENTRY(e1), MAXENTRY);
 1927     imglist_l1 = e1;
 1928     gtk_signal_connect(GTK_OBJECT(e1), "activate",
 1929         GTK_SIGNAL_FUNC(set_image_prefix_callback),NULL);
 1930     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,4,8,0,1);
 1931     gtk_widget_show(e1);
 1932     g_snprintf(tmp,MAXLINE,"%s %s", _("This is the prefix of the filenames of the tracks saved to the hard disk."), _("Change this name if you want to read another Disc or to create another Disc image."));
 1933     define_tooltip(e1,tmp);         /* concatenated text */
 1934 
 1935     l1 = rightjust_gtk_label_new(_("Free space:"));
 1936     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,4,1,2);
 1937     gtk_widget_show(l1);
 1938 
 1939     e1 = gtk_entry_new();
 1940     imglist_l2 = e1;
 1941     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1942     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,4,8,1,2);
 1943     gtk_widget_show(e1);
 1944     define_tooltip(e1, _("If the Image Directory is set to \"Automatic\" this is the free hard disk space of all the image directories: Data / Audio"));
 1945 
 1946     l1 = leftjust_gtk_label_new(_("biggest available block of that:"));
 1947     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,1,8,2,3);
 1948     gtk_widget_show(l1);
 1949 
 1950     e1 = gtk_entry_new();
 1951     imglist_l3 = e1;
 1952     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 1953     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,4,8,3,4);
 1954     gtk_widget_show(e1);
 1955     define_tooltip(e1, _("The largest free space currently straight available: Data / Audio"));
 1956 
 1957     gtk_widget_show(actionspace);
 1958 
 1959     /* fill entries */
 1960     fill_read_menu();
 1961 }
 1962 
 1963 
 1964 /*
 1965  * fill the entries in the verify_disc_menu
 1966  */
 1967 static void fill_verify_menu() {
 1968 gchar tmp[MAXLINE];
 1969 GList *loop;
 1970 GtkWidget *menu;
 1971 GtkWidget *menu_item, *menuselitem;
 1972 gint menuidx, menuhistory;
 1973 gint i, len, disc_type;
 1974 
 1975     /* get list of toc-files (save in tocfiles var) */
 1976     scan_for_toc_files();
 1977 
 1978     /* clear out the old menu first (if any) */
 1979     gtk_option_menu_remove_menu(GTK_OPTION_MENU (write_toc_menu));
 1980 
 1981     menu = gtk_menu_new();
 1982     menuselitem = NULL;
 1983     menu_item = NULL;
 1984     menuidx = 0; menuhistory = 0;
 1985     i = 0;
 1986     loop = g_list_first(tocfiles);  
 1987     while (loop) {
 1988         /*
 1989          * a bug in GTK won't allow overlong option menus...
 1990          * well, then strip off the strings (not nice,
 1991          * but so far the only way I can think of)
 1992          */
 1993         len = strlen((gchar *)loop->data);
 1994         if (len > 24) {
 1995             strcpy(tmp, ".. ");
 1996             strcat(tmp, (gchar *)loop->data + len - 24);
 1997         } else {
 1998             strcpy(tmp, (gchar *)loop->data);
 1999         }
 2000         menu_item = gtk_menu_item_new_with_label(tmp);
 2001         if (menuselitem == NULL) {
 2002             /* default first element */
 2003             menuselitem = menu_item;
 2004         } 
 2005         gtk_signal_connect(GTK_OBJECT(menu_item),
 2006             "activate", GTK_SIGNAL_FUNC(tocwrite_selected),
 2007             GINT_TO_POINTER(i));
 2008         if (strcmp(curset.tocfile, (gchar *)loop->data) == 0) {
 2009             menuhistory = menuidx;
 2010             menuselitem = menu_item;
 2011         }
 2012         gtk_menu_append (GTK_MENU (menu), menu_item);
 2013         gtk_widget_show (menu_item);
 2014         loop = loop->next;
 2015         menuidx++;
 2016         i++;
 2017     }
 2018 
 2019     /* no toc file found? */
 2020     if (i == 0) {
 2021     
 2022         menu_item = gtk_menu_item_new_with_label(_(" - "));
 2023         gtk_signal_connect(GTK_OBJECT(menu_item),
 2024             "activate", GTK_SIGNAL_FUNC(tocwrite_selected),
 2025             GINT_TO_POINTER(-2));
 2026         if (strcmp(curset.tocfile, "-") == 0) {
 2027             menuhistory = menuidx;
 2028             menuselitem = menu_item;
 2029         }
 2030         gtk_menu_append (GTK_MENU (menu), menu_item);
 2031         gtk_widget_show (menu_item);
 2032     }
 2033     gtk_option_menu_set_menu (GTK_OPTION_MENU (write_toc_menu), menu);
 2034     gtk_option_menu_set_history(GTK_OPTION_MENU (write_toc_menu),menuhistory);
 2035     /* toggle currently active menu */ 
 2036     if (menuselitem != NULL) {
 2037         gtk_menu_item_activate(GTK_MENU_ITEM (menuselitem));
 2038     } else {
 2039         /* if no active menu, activate the last set
 2040            (on-the-fly in this case) */
 2041         gtk_menu_item_activate(GTK_MENU_ITEM (menu_item));
 2042     }   
 2043 
 2044 
 2045     /* ---------------- */
 2046 
 2047     /* disc loaded? */
 2048     if (cdinfo.nr_tracks == -1) {
 2049         gtk_entry_set_text(GTK_ENTRY(vrylist_l1), _("No Disc loaded"));    
 2050         gtk_entry_set_text(GTK_ENTRY(vrylist_l2),"");   
 2051         gtk_entry_set_text(GTK_ENTRY(vrylist_l3),"");   
 2052         gtk_entry_set_text(GTK_ENTRY(vrylist_l4),"");   
 2053         return;
 2054         }
 2055     if (cdinfo.nr_tracks == -2) {
 2056         gtk_entry_set_text(GTK_ENTRY(vrylist_l1),  return_media_type(curset.reader_devnr));    
 2057         gtk_entry_set_text(GTK_ENTRY(vrylist_l2),"");   
 2058         gtk_entry_set_text(GTK_ENTRY(vrylist_l3),"");   
 2059         gtk_entry_set_text(GTK_ENTRY(vrylist_l4),"");   
 2060         return;
 2061         }
 2062 
 2063     /* get and display disc type */
 2064     disc_type = determine_disc_type(tmp,0);
 2065     gtk_entry_set_text(GTK_ENTRY(vrylist_l1), tmp); 
 2066 
 2067     /* display CD label */
 2068     if (cdinfo.title && cdinfo.artist && 
 2069         cdinfo.title[0] != '\0' && setupdata.option_displaycdtext) {
 2070         g_snprintf(tmp,MAXLINE,"%s / %s", cdinfo.title, cdinfo.artist);
 2071         gtk_entry_set_text(GTK_ENTRY(vrylist_l2), tmp);
 2072         gtk_entry_set_position(GTK_ENTRY(vrylist_l2),0);
 2073     } else 
 2074     if (cdinfo.cddb_dtitle != NULL) {
 2075         gtk_entry_set_text(GTK_ENTRY(vrylist_l2), cdinfo.cddb_dtitle);
 2076         gtk_entry_set_position(GTK_ENTRY(vrylist_l2),0);
 2077     } else {
 2078         gtk_entry_set_text(GTK_ENTRY(vrylist_l2),"");    
 2079     }
 2080 
 2081     /* display disc size */
 2082     if (disc_type == 1 || disc_type == 2) { /* Audio or Mixed Mode CD */
 2083         convert_frames2mbminstring(cdinfo.total_size, tmp);
 2084     } else {                        /* Data CD/DVD/BD and CD Extra */
 2085         convert_sectors2mbminstring(cdinfo.total_size, tmp);
 2086     }
 2087     gtk_entry_set_text(GTK_ENTRY(vrylist_l3), tmp);
 2088 
 2089     /* nr tracks */ 
 2090     g_snprintf(tmp,MAXLINE,"%d",cdinfo.nr_tracks);
 2091     gtk_entry_set_text(GTK_ENTRY(vrylist_l4), tmp);
 2092 
 2093 }
 2094 
 2095 
 2096 /*
 2097  * callbacks for verify-screen
 2098  */
 2099 static void verify_clicked(GtkWidget *widget, gpointer data) {
 2100 gint stat;
 2101 gint ret;
 2102 track_read_param_t *trackparam;
 2103 GList *loop;
 2104 gint i, sectorstoread;
 2105 gint datat,audio;
 2106 gint datasize;
 2107 
 2108     /* no disc reader defined */
 2109     if (curset.reader_devnr == -1) {
 2110         show_dialog(ICO_ERROR,_("No disc reader defined in Setup."), T_OK, NULL, NULL, 0);
 2111         return;
 2112     }
 2113 
 2114         /* now check if our disc information is still valid */
 2115         get_cd_toc_and_volid(curset.reader_devnr);
 2116 
 2117     /* disc loaded? */
 2118     if (cdinfo.nr_tracks < 0) {
 2119         fill_verify_menu();
 2120         show_dialog(ICO_WARN,_("No Disc loaded in read device."),T_OK,NULL,NULL,0);
 2121         return;
 2122     }
 2123 
 2124     /* no tocfile selected */
 2125     if (strcmp(curset.tocfile,"-") == 0) {
 2126         show_dialog(ICO_WARN,_("No TOC file selected which specifies\nwhich tracks are to verify."),T_OK,NULL,NULL,0);
 2127         return;
 2128     }
 2129     
 2130     /* first check if all tracks we need are available on hd */
 2131     stat = check_write_files(0);
 2132     switch(stat) {
 2133     /* files with wrong size */
 2134     case 1:
 2135         ret = show_dialog(ICO_QUEST,_("Some tracks do have a different file-size as expected.\nPerhaps the tracks are outdated or belong to another Disc.\nDo you want to continue anyway or to abort?"),T_ANYWAY,T_CANCEL, 
 2136             NULL, 1);
 2137         if (ret == 1) {
 2138             /* aborted */
 2139             return;
 2140         }   
 2141         break;
 2142     /* files missing */
 2143     case 2:
 2144         show_dialog(ICO_ERROR,_("Some tracks belonging to the Disc you want to write are missing.\nPerhaps the TOC file is outdated and the tracks\nwere already removed from the hard drive."),T_OK,NULL,NULL,0);
 2145         return;
 2146 
 2147     /* no permission/invalid */
 2148     case 3:
 2149         show_dialog(ICO_ERROR,_("You don't have permission to read all the track-files or\nthe tracks are not regular files on the hard drive."),T_OK,NULL,NULL,0);
 2150         return;
 2151 
 2152     default:
 2153         break;
 2154     }
 2155 
 2156     /*
 2157      * now check if we have the correct disc to verify in the drive
 2158      * allow an offset of 15 sectors (padding)
 2159      */
 2160     if (trackreadset.nrtracks != cdinfo.nr_tracks ||
 2161         (cdinfo.total_size-trackreadset.cdsize) > 15) {
 2162 
 2163         show_dialog(ICO_WARN,_("TOC file does not match the Disc in the drive.\nVerifying is therefore impossible."),T_OK,NULL,NULL,0);
 2164         return;
 2165     }
 2166 
 2167 
 2168     datat = 0;
 2169     audio = 0;
 2170     datasize = 0;
 2171 
 2172     /* fill some additional data in the trackreadset-structure */
 2173     loop = g_list_first(trackreadset.trackparams);
 2174     for(i=0; i<cdinfo.nr_tracks; i++) {
 2175 
 2176         if (loop == NULL) {
 2177             /* should never happen */
 2178             show_dialog(ICO_WARN,_("TOC file does not match the Disc in the drive.\nVerifying is therefore impossible."),T_OK,NULL,NULL,0);
 2179             return;
 2180         }
 2181         trackparam = loop->data;
 2182         
 2183         trackparam->trackinfo_index = i;
 2184 
 2185         /* does the tracktypes match? */
 2186         if (trackparam->tracktype != trackinfo[i]->type) {
 2187             show_dialog(ICO_WARN,_("TOC file does not match the Disc in the drive.\nVerifying is therefore impossible."),T_OK,NULL,NULL,0);
 2188             return;
 2189         }
 2190 
 2191         if (trackparam->tracktype == 0) {
 2192             /* data track */
 2193             trackparam->kbyte = trackinfo[i]->size *
 2194                 (DATASECTORSIZE/1024);
 2195             trackparam->startoffset = trackinfo[i]->start_sec;
 2196             if (i == cdinfo.nr_tracks-1) {
 2197                 /* last track - leadout is track-end */
 2198                 trackparam->endoffset = cdinfo.leadout - 2;
 2199             } else {
 2200                 /* sub 150 (2 sec leadout),
 2201                    sub 2 (2 run out sectors) */
 2202                 trackparam->endoffset =
 2203                     trackinfo[i+1]->start_sec -150-2;
 2204             }
 2205             /*
 2206              * now do a paranoia check
 2207              * in some cases we skip to much of a track
 2208              */
 2209             sectorstoread = trackparam->endoffset - 
 2210                 trackparam->startoffset;
 2211             if (sectorstoread < trackinfo[i]->isosize) {
 2212                 trackparam->endoffset =
 2213                     trackparam->startoffset + 
 2214                         trackinfo[i]->isosize;
 2215                 trackparam->kbyte = trackinfo[i]->isosize * 2;
 2216                 dodebug(1,"verify_clicked: corrected data track size from %d to %d sectors.\n", sectorstoread, trackinfo[i]->isosize);
 2217             }
 2218 
 2219             datat++;
 2220             datasize += trackparam->frames;
 2221         } else {
 2222             /* audio */
 2223             trackparam->kbyte = trackinfo[i]->size *
 2224                 CDDAFRAME/1024;
 2225             audio++;
 2226         }   
 2227         loop = loop->next;
 2228     }
 2229 
 2230 
 2231     /*
 2232      * OK...now we know we have the correct disc in the drive and a fully 
 2233      * functional set of image-files on the HD. All set for verifying.
 2234      */
 2235 
 2236     /* check if are allowed to verify audio */
 2237     if (curset.noaudioverify == 1 && datat == 0 && audio > 0) {
 2238         show_dialog(ICO_WARN,_("The Disc contains only audio tracks and you set that\naudio tracks should not be verified. Verifying is therefore impossible."), T_OK, NULL, NULL, 0);
 2239         return;
 2240     }
 2241 
 2242     /* do we have to recalc the percentages because we don't want
 2243        to verify audio? */
 2244     if (curset.noaudioverify == 1 && audio > 0 && datat > 0) {
 2245         loop = g_list_first(trackreadset.trackparams);
 2246         while(loop) {
 2247             trackparam = loop->data;
 2248             /* only take data-tracks in account */
 2249             trackparam->percent = 
 2250                 (gfloat)trackparam->frames / datasize;
 2251             loop = loop->next; 
 2252         }
 2253     }
 2254 
 2255     show_and_do_verify_tracks(curset.reader_devnr);
 2256 }
 2257 
 2258 
 2259 void verifyoptions_selected(GtkWidget *item, gpointer nr) {
 2260 gint sel;
 2261 
 2262     sel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(item));
 2263 
 2264     switch(GPOINTER_TO_INT(nr)) {
 2265         case 0:
 2266             curset.noaudioverify = sel;
 2267             break;
 2268         case 1:
 2269             curset.verifyfailabort = sel;
 2270             break;
 2271     }
 2272 }
 2273 
 2274 
 2275 /*
 2276  * draw the verify-info-menu
 2277  */
 2278 static void draw_verify_menu() {
 2279 GtkWidget *hbox, *vbox;
 2280 GtkWidget *f1, *f2, *f3;
 2281 GtkWidget *b1, *b_update;
 2282 GtkWidget *e1;
 2283 GtkWidget *l1;
 2284 GtkWidget *tbl, *omenu, *check;
 2285 
 2286     /* prepare draw area */
 2287     clear_actionspace();
 2288 
 2289     edit_cdtext_btn = NULL;
 2290 
 2291     f1 = gtk_frame_new(_("Devices-Setup"));
 2292     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 2293     gtk_box_pack_start(GTK_BOX(actionspace),f1,FALSE,FALSE,5);
 2294     gtk_widget_show(f1);
 2295 
 2296     tbl = gtk_table_new(2,16*4,TRUE);   
 2297     gtk_table_set_col_spacing(GTK_TABLE(tbl),4*4-1,5);
 2298     gtk_table_set_col_spacing(GTK_TABLE(tbl),15*4-2,5);
 2299     gtk_container_set_border_width(GTK_CONTAINER (tbl),5);
 2300     gtk_container_add(GTK_CONTAINER(f1),tbl);
 2301     gtk_widget_show(tbl);
 2302 
 2303     devices_setup_read(0, tbl, 1);
 2304     devices_setup_image(1, tbl);
 2305 
 2306     /* left and right info-frames */
 2307     tbl = gtk_table_new(1,2,TRUE);
 2308     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 2309     gtk_box_pack_start(GTK_BOX(actionspace),tbl,TRUE,TRUE,10);
 2310     gtk_widget_show(tbl);
 2311     vbox = gtk_vbox_new(FALSE,10);
 2312     gtk_table_attach_defaults(GTK_TABLE(tbl),vbox,0,1,0,1);
 2313     if (!curset.isProDVD) {
 2314         f1 = gtk_frame_new(_("Disc-Information"));
 2315     } else {
 2316         f1 = gtk_frame_new(_("CD/DVD-Information"));
 2317     }
 2318     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 2319     gtk_box_pack_start(GTK_BOX(vbox),f1,TRUE,TRUE,0);
 2320     gtk_widget_show(f1);
 2321     f3 = gtk_frame_new(_("Verify options"));
 2322     set_font_and_color_frame(f3,PANGO_BOLD,NULL);
 2323     gtk_box_pack_start(GTK_BOX(vbox),f3,FALSE,FALSE,0);
 2324     gtk_widget_show(f3);
 2325     f2 = gtk_frame_new(_("Tracks to verify"));
 2326     set_font_and_color_frame(f2,PANGO_BOLD,NULL);
 2327     gtk_table_attach_defaults(GTK_TABLE(tbl),f2,1,2,0,1);
 2328     gtk_widget_show(f2);
 2329     gtk_widget_show(vbox);
 2330 
 2331     /* button bar at the bottom */
 2332     hbox = gtk_hbox_new(TRUE,10);
 2333     gtk_box_pack_start(GTK_BOX(actionspace),hbox,FALSE,TRUE,10);
 2334     gtk_widget_show(hbox);
 2335     b1 = gtk_button_new_with_label(_("Verify tracks"));
 2336     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 2337     gtk_widget_show(b1);
 2338     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 2339         GTK_SIGNAL_FUNC(verify_clicked), NULL);
 2340     define_tooltip(b1, _("Reads all tracks from the current Disc again and does compare them with the tracks on the hard disk as specified in the selected TOC file."));
 2341 
 2342     b_update = gtk_button_new_with_label(_("Update"));
 2343     gtk_box_pack_start(GTK_BOX(hbox),b_update,TRUE,TRUE,10);
 2344     gtk_widget_show(b_update);
 2345     gtk_signal_connect(GTK_OBJECT(b_update), "clicked",
 2346         GTK_SIGNAL_FUNC(update_readvrfy_clicked), GINT_TO_POINTER(0));
 2347     define_tooltip(b_update,_("Refreshes the content of the information windows (e.g. after a Disc change)."));
 2348 
 2349 
 2350     /* left info frame */
 2351     vbox = gtk_vbox_new(FALSE,0);
 2352     gtk_container_add(GTK_CONTAINER(f1),vbox);
 2353     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 2354     gtk_widget_show(vbox);
 2355 
 2356     tbl = gtk_table_new(4,8,TRUE);
 2357     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 2358     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 2359     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 2360     gtk_widget_show(tbl);
 2361     
 2362     l1 = rightjust_gtk_label_new(_("Type:"));
 2363     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,0,1);
 2364     gtk_widget_show(l1);
 2365 
 2366     e1 = gtk_entry_new();
 2367     vrylist_l1 = e1;
 2368     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2369     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,0,1);
 2370     gtk_widget_show(e1);
 2371 
 2372     l1 = rightjust_gtk_label_new(_("Label:"));
 2373     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,1,2);
 2374     gtk_widget_show(l1);
 2375 
 2376     e1 = gtk_entry_new();
 2377     vrylist_l2 = e1;
 2378     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2379     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,1,2);
 2380     gtk_widget_show(e1);
 2381 
 2382     l1 = rightjust_gtk_label_new(_("Size:"));
 2383     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,2,3);
 2384     gtk_widget_show(l1);
 2385 
 2386     e1 = gtk_entry_new();
 2387     vrylist_l3 = e1;
 2388     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2389     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,2,3);
 2390     gtk_widget_show(e1);
 2391 
 2392     l1 = rightjust_gtk_label_new(_("Tracks:"));
 2393     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,2,3,4);
 2394     gtk_widget_show(l1);
 2395 
 2396     e1 = gtk_entry_new();
 2397     vrylist_l4 = e1;
 2398     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2399     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,2,8,3,4);
 2400     gtk_widget_show(e1);
 2401 
 2402     /* options frame */
 2403     vbox = gtk_vbox_new(FALSE,0);
 2404     gtk_container_add(GTK_CONTAINER(f3),vbox);
 2405     gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 2406     gtk_widget_show(vbox);
 2407 
 2408     tbl = gtk_table_new(2,8,TRUE);
 2409     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 2410     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,10);
 2411     gtk_widget_show(tbl);
 2412 
 2413     check = gtk_check_button_new_with_label(_("Don't verify audio tracks"));
 2414     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 2415         GTK_SIGNAL_FUNC(verifyoptions_selected),GINT_TO_POINTER(0));
 2416     gtk_table_attach_defaults(GTK_TABLE(tbl),check,1,8,0,1);
 2417     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 2418         curset.noaudioverify);
 2419     gtk_widget_show(check);
 2420     define_tooltip(check, _("Skips verification of audio tracks, because a lot of optical disc drives are not able to read audio data reliably."));
 2421     
 2422     check = gtk_check_button_new_with_label(_("Abort after verify fail"));
 2423     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 2424         GTK_SIGNAL_FUNC(verifyoptions_selected),GINT_TO_POINTER(1));
 2425     gtk_table_attach_defaults(GTK_TABLE(tbl),check,1,8,1,2);
 2426     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 2427         curset.verifyfailabort);
 2428     gtk_widget_show(check);
 2429     define_tooltip(check, _("Abort Verifying when one mismatch was found. Otherwise X-CD-Roast does continue to verify the other tracks anyway."));
 2430     
 2431 
 2432     /* right info frame */
 2433     vbox = gtk_vbox_new(FALSE,0);
 2434     gtk_container_add(GTK_CONTAINER(f2),vbox);
 2435     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 2436     gtk_widget_show(vbox);
 2437 
 2438     tbl = gtk_table_new(5,8,FALSE);
 2439     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 2440     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 2441     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,0);
 2442     gtk_widget_show(tbl);
 2443     
 2444     l1 = rightjust_gtk_label_new(_("TOC-File:"));
 2445     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,0,1);
 2446     gtk_widget_show(l1);
 2447 
 2448     omenu = gtk_option_menu_new();
 2449     write_toc_menu = omenu;
 2450     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,3,8,0,1);
 2451     gtk_widget_show(omenu);
 2452     define_tooltip(omenu, _("Select which tracks should be verified against the current Disc. The TOC file must match the Disc, of course."));
 2453 
 2454     l1 = rightjust_gtk_label_new(_("Type:"));
 2455     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,1,2);
 2456     gtk_widget_show(l1);
 2457 
 2458     e1 = gtk_entry_new();
 2459     cdlist_l1 = e1;
 2460     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2461     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,1,2);
 2462     gtk_widget_show(e1);
 2463 
 2464     l1 = rightjust_gtk_label_new(_("Label:"));
 2465     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,2,3);
 2466     gtk_widget_show(l1);
 2467 
 2468     e1 = gtk_entry_new();
 2469     cdlist_l2 = e1;
 2470     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2471     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,2,3);
 2472     gtk_widget_show(e1);
 2473 
 2474     l1 = rightjust_gtk_label_new(_("Size:"));
 2475     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,3,4);
 2476     gtk_widget_show(l1);
 2477 
 2478     e1 = gtk_entry_new();
 2479     cdlist_l3 = e1;
 2480     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2481     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,3,4);
 2482     gtk_widget_show(e1);
 2483 
 2484     l1 = rightjust_gtk_label_new(_("Tracks:"));
 2485     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,4,5);
 2486     gtk_widget_show(l1);
 2487 
 2488     e1 = gtk_entry_new();
 2489     cdlist_l4 = e1;
 2490     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 2491     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,4,5);
 2492     gtk_widget_show(e1);
 2493 
 2494 
 2495     gtk_widget_show(actionspace);
 2496 
 2497     /* fill entries */
 2498     fill_verify_menu();
 2499 }
 2500 
 2501 
 2502 /*
 2503  * what do to when user selects a track from the list
 2504  */
 2505 static void playlist_select_row(GtkWidget *clist, gint row, gint col,
 2506     GdkEventButton *event, gpointer data) {
 2507 
 2508     /* double click? */
 2509     if (event && event->type == GDK_2BUTTON_PRESS) {
 2510         /* stop current song and play selected */
 2511         wavplay_dodouble();
 2512     }
 2513 }
 2514 
 2515 
 2516 /*
 2517  * draw the play-tracks-menu
 2518  */
 2519 void draw_play_tracks_menu() {
 2520 GtkWidget *scrolled_win;
 2521 gchar tmp[MAXLINE];
 2522 gchar tmp2[MAXLINE];
 2523 gchar tmp3[MAXLINE];
 2524 gchar tmp4[MAXLINE];
 2525 gchar *titles[5];
 2526 gchar *data[5];
 2527 GtkWidget *list;
 2528 GtkCList *clist;
 2529 GdkPixmap *pixmap1;
 2530 GdkBitmap *mask1;
 2531 GtkStyle *style;
 2532 GList *loop;
 2533 image_files_t *entry;
 2534 gint count;
 2535 
 2536     /* prepare draw area */
 2537     clear_actionspace();
 2538 
 2539     scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 2540     gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
 2541     gtk_box_pack_start(GTK_BOX(actionspace),scrolled_win,TRUE,TRUE,5);
 2542     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
 2543         GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
 2544     gtk_widget_show(scrolled_win);
 2545     
 2546     titles[0] = "";
 2547     titles[1] = _("Nr.");
 2548     titles[2] = _("Track title");
 2549     titles[3] = _("Length");
 2550     titles[4] = _("Filename");
 2551 
 2552     list = gtk_clist_new_with_titles(5,titles);
 2553     gtk_container_add (GTK_CONTAINER (scrolled_win), list);
 2554     gtk_widget_realize(list);
 2555     clist = GTK_CLIST(list);
 2556     gtk_clist_set_column_auto_resize(clist, 4, TRUE);
 2557     play_clist = clist;
 2558     gtk_signal_connect(GTK_OBJECT(list), "select_row",
 2559         GTK_SIGNAL_FUNC(playlist_select_row), NULL);
 2560 
 2561     style = gtk_style_copy(gtk_widget_get_style(list));
 2562     pixmap1 = gdk_pixmap_create_from_xpm_d(clist->clist_window,
 2563         &mask1, &style->bg[GTK_STATE_NORMAL],(gchar **)miniaudio_xpm);
 2564     data[0] = NULL;
 2565 
 2566     gtk_clist_set_row_height(clist, tbf(20));
 2567     gtk_clist_set_column_width(clist, 0, tbf(20));
 2568     gtk_clist_set_column_width(clist, 1, tbf(30));
 2569     gtk_clist_set_column_justification(clist, 1, GTK_JUSTIFY_CENTER);
 2570     gtk_clist_set_column_width(clist, 2, tbf(250));
 2571     gtk_clist_set_column_width(clist, 3, tbf(80));
 2572     gtk_widget_show(list);
 2573 
 2574     /* fill clist with valid audio-tracks */
 2575     count = 1;
 2576     loop = g_list_first(imagelist);
 2577     while (loop) {
 2578         entry = loop->data;
 2579         if (entry->type == 1) {
 2580             g_snprintf(tmp,MAXLINE,"%d.",count);
 2581             data[1] = convert_for_gtk2(tmp);
 2582             if (entry->title && entry->artist &&
 2583                 strcmp(entry->title,"") && strcmp(entry->artist,"")) {
 2584                 g_snprintf(tmp3,MAXLINE,"%s / %s",
 2585                     entry->title, entry->artist);
 2586                 data[2] = convert_for_gtk2(tmp3);
 2587             } else 
 2588             if (entry->title && strcmp(entry->title,"")) {
 2589                 strncpy(tmp3, entry->title, MAXLINE);
 2590                 data[2] = convert_for_gtk2(tmp3);
 2591             } else 
 2592             if (entry->cddb_ttitle && strcmp(entry->cddb_ttitle,"")) {
 2593                 strncpy(tmp3, entry->cddb_ttitle, MAXLINE);
 2594                 data[2] = convert_for_gtk2(tmp3);
 2595             } else {
 2596                 data[2] = NULL;
 2597             } 
 2598             convert_frames2minstring((gint)((off_t)entry->size/CDDAFRAME), tmp2);
 2599             data[3] = convert_for_gtk2(tmp2);
 2600             strncpy(tmp4, entry->path, MAXLINE);
 2601             data[4] = convert_for_gtk2(tmp4);
 2602             gtk_clist_append(clist,data);
 2603             gtk_clist_set_pixmap(clist,count-1,0,pixmap1,mask1);
 2604 
 2605             count++;
 2606         }
 2607         loop = loop->next;
 2608     }
 2609 
 2610     /* add wavplayer */
 2611     wavplay_frontend(actionspace);
 2612 
 2613     gtk_widget_show(actionspace);
 2614 }
 2615 
 2616 
 2617 /*
 2618  * callbacks for buttons in write-screen
 2619  */
 2620 void blankcd_clicked(GtkWidget *widget, gpointer data) {
 2621     
 2622     /* no disc writer defined */
 2623     if (curset.writer_devnr == -1) {
 2624         show_dialog(ICO_ERROR,_("No disc writer defined in Setup."), T_OK, NULL, NULL, 0);
 2625         return;
 2626     }
 2627 
 2628     display_blank_cdrw(curset.writer_devnr);
 2629 }
 2630 
 2631 void adv_write_options_clicked(GtkWidget *widget, gpointer data) {
 2632 
 2633     /* no disc writer defined */
 2634     if (curset.writer_devnr == -1) {
 2635         show_dialog(ICO_ERROR,_("No disc writer defined in Setup."), T_OK, NULL, NULL, 0);
 2636         return;
 2637     }
 2638 
 2639     display_advwriteoptions(curset.writer_devnr);
 2640 }
 2641 
 2642 void show_atip_info(GtkWidget *widget, gpointer data) {
 2643 
 2644     /* no disc writer defined */
 2645     if (curset.writer_devnr == -1) {
 2646         show_dialog(ICO_ERROR,_("No disc writer defined in Setup."), T_OK, NULL, NULL, 0);
 2647         return;
 2648     }
 2649 
 2650     display_atip_info(curset.writer_devnr);
 2651 }
 2652 
 2653 void cdrtype_selected(GtkWidget *item, gpointer mode) {
 2654 
 2655     curset.cdrtype = GPOINTER_TO_INT(mode);
 2656     /*
 2657      * enable selection of write modes for CD and no multisession
 2658      * if the user has got the permission;
 2659      * disable it for DVD and BD in menus "Write Disc" and "Write Tracks"
 2660      */
 2661     if ((isroot() || setupdata.root_option_change_writeparam)
 2662       && (curset.cdrtype < 1000 && !curset.multisession)) {
 2663         if (dupl_cd_mode_omenu) {
 2664             gtk_widget_set_sensitive(dupl_cd_mode_omenu, TRUE);
 2665         }
 2666         if (crea_cd_mode_omenu) {
 2667             gtk_widget_set_sensitive(crea_cd_mode_omenu, TRUE);
 2668         }
 2669     } else if (curset.cdrtype > 1000) {
 2670         if (dupl_cd_mode_omenu) {
 2671             gtk_widget_set_sensitive(dupl_cd_mode_omenu, FALSE);
 2672         }
 2673         if (crea_cd_mode_omenu) {
 2674             gtk_widget_set_sensitive(crea_cd_mode_omenu, FALSE);
 2675         }
 2676     }
 2677 }
 2678 
 2679 void writemode_selected(GtkWidget *item, gpointer data) {
 2680 gint i;
 2681     i = get_writerreaderdevs_index(curset.writer_devnr);
 2682     writerreaderdevs[i]->writer_mode = GPOINTER_TO_INT(data);
 2683 }
 2684 
 2685 void writeoptions_selected(GtkWidget *item, gpointer nr) {
 2686 gint sel;
 2687 
 2688     sel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(item));
 2689 
 2690     switch(GPOINTER_TO_INT(nr)) {
 2691         case 0:
 2692             curset.writesimul = sel;
 2693             break;
 2694         case 1:
 2695             curset.writeeject = sel;
 2696             break;
 2697         case 2:
 2698             curset.writepad = sel;
 2699             break;
 2700         case 3:
 2701             curset.writeswap = sel;
 2702             break;
 2703         case 4:
 2704             curset.nofixate = sel;
 2705             break;
 2706         case 5:
 2707             curset.multisession = sel;
 2708             /*
 2709              * disable/enable write mode selector in "Create Disc" menu
 2710              * also depends on the rights the user has got and on cdrtype;
 2711              * disable/enable the nofixate checkbox as well
 2712              */
 2713             if (sel) {
 2714                 if (crea_cd_mode_omenu && curset.writer_devnr != -1) {
 2715                     gtk_widget_set_sensitive(crea_cd_mode_omenu, FALSE);
 2716                 }
 2717                 if (crea_cd_nofixate_check && curset.writer_devnr != -1) {
 2718                     gtk_widget_set_sensitive(crea_cd_nofixate_check,FALSE);
 2719                 }
 2720             } else {
 2721                 if ((isroot() || setupdata.root_option_change_writeparam)
 2722                   && curset.cdrtype < 1000
 2723                   && crea_cd_mode_omenu && curset.writer_devnr != -1) {
 2724                     gtk_widget_set_sensitive(crea_cd_mode_omenu, TRUE);
 2725                 }
 2726                 if (crea_cd_nofixate_check && curset.writer_devnr != -1) {
 2727                     gtk_widget_set_sensitive(crea_cd_nofixate_check,TRUE);
 2728                 }
 2729             }
 2730             break;
 2731         case 6: 
 2732             curset.writecdtext = sel;
 2733             break;
 2734         case 7:
 2735             curset.writeoverburn = sel;
 2736             break;
 2737         case 8:
 2738             curset.writeburnfree = sel;
 2739             break;  
 2740         case 9: 
 2741             curset.writeaudiomaster = sel;
 2742             break;
 2743         case 10:
 2744             curset.writeforcespeed = sel;
 2745             break;
 2746         case 11:
 2747             curset.writeignsize = sel;
 2748             break;
 2749         case 12:
 2750             curset.writeimmed = sel;
 2751             break;
 2752     }
 2753 }
 2754 
 2755 
 2756 /*
 2757  * callback for toc-selector in write menu
 2758  */
 2759 static void tocwrite_selected(GtkWidget *item, gpointer val) {
 2760 GList *lelement;
 2761 gchar tmp[MAXLINE];
 2762 GdkCursor *cursor;
 2763 gint disc_type;
 2764 
 2765     strcpy(tmp,"");
 2766     if (GPOINTER_TO_INT(val) >= 0) {
 2767         lelement = g_list_nth(tocfiles, GPOINTER_TO_INT(val));
 2768         if (lelement != NULL) {
 2769             strcpy(tmp,(gchar *)lelement->data);
 2770         }
 2771     } else
 2772     if (GPOINTER_TO_INT(val) == -1)  {
 2773         /* on the fly setting */
 2774         strcpy(tmp,"-");
 2775     } else {
 2776         /* empty setting (verify menu) */
 2777         g_free(curset.tocfile);
 2778         curset.tocfile = g_strdup("-");
 2779         gtk_entry_set_text(GTK_ENTRY(cdlist_l1),"");
 2780         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");
 2781         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");
 2782         gtk_entry_set_text(GTK_ENTRY(cdlist_l4),"");
 2783         return;
 2784     }
 2785 
 2786     /*
 2787      * save current setting
 2788      * use full path string here because
 2789      * the index-number can get lost too easily
 2790      */
 2791     g_free(curset.tocfile);
 2792     curset.tocfile = g_strdup(tmp);
 2793 
 2794     do_lock(1);
 2795     /* ok, now do some work - change cursor to watch */
 2796     cursor = gdk_cursor_new(GDK_WATCH);
 2797     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,cursor);
 2798 
 2799     while (gtk_events_pending())
 2800         gtk_main_iteration();
 2801 
 2802     if (strcmp(curset.tocfile,"-") != 0) {
 2803         read_copy_cd_toc_file(curset.tocfile);
 2804     
 2805         /* get and display disc type */
 2806         disc_type = determine_disc_type(tmp,1);
 2807         gtk_entry_set_text(GTK_ENTRY(cdlist_l1), tmp);  
 2808 
 2809         /* disc title */
 2810         gtk_entry_set_text(GTK_ENTRY(cdlist_l2), 
 2811             trackreadset.cdtitle);
 2812         
 2813         /* display track size */
 2814         if (disc_type == 1 || disc_type == 2) { /* Audio or Mixed Mode CD */
 2815             convert_frames2mbminstring(trackreadset.cdsize, tmp);
 2816         } else {                        /* Data CD/DVD/BD and CD Extra */
 2817             convert_sectors2mbminstring(trackreadset.cdsize, tmp);
 2818         }
 2819         gtk_entry_set_text(GTK_ENTRY(cdlist_l3), tmp);
 2820     
 2821         /* nr tracks */
 2822         g_snprintf(tmp,MAXLINE,"%d",trackreadset.nrtracks); 
 2823         gtk_entry_set_text(GTK_ENTRY(cdlist_l4), tmp);
 2824 
 2825     } else {
 2826         /* we copy on the fly... */
 2827         gtk_entry_set_text(GTK_ENTRY(cdlist_l2),"");
 2828         gtk_entry_set_text(GTK_ENTRY(cdlist_l3),"");
 2829         gtk_entry_set_text(GTK_ENTRY(cdlist_l4),"");
 2830         if (cdinfo.nr_tracks == -1) {
 2831             gtk_entry_set_text(GTK_ENTRY(cdlist_l1), _("No Disc loaded"));
 2832         } else 
 2833         if (cdinfo.nr_tracks == -2) {
 2834             gtk_entry_set_text(GTK_ENTRY(cdlist_l1),  return_media_type(curset.reader_devnr));
 2835         } else {
 2836             /* disc is inserted - get and display type */
 2837             disc_type = determine_disc_type(tmp,0);
 2838             gtk_entry_set_text(GTK_ENTRY(cdlist_l1), tmp);
 2839 
 2840             /* display CD label */
 2841             if (cdinfo.title && cdinfo.artist && 
 2842                 cdinfo.title[0] != '\0' && 
 2843                 setupdata.option_displaycdtext) {
 2844                 g_snprintf(tmp,MAXLINE,"%s / %s", 
 2845                     cdinfo.title, cdinfo.artist);
 2846                 gtk_entry_set_text(GTK_ENTRY(cdlist_l2), tmp);
 2847                 gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
 2848             } else 
 2849                 if (cdinfo.cddb_dtitle != NULL) {
 2850                 gtk_entry_set_text(GTK_ENTRY(cdlist_l2), 
 2851                     cdinfo.cddb_dtitle);   
 2852                 gtk_entry_set_position(GTK_ENTRY(cdlist_l2),0);
 2853             }
 2854 
 2855             /* display disc size */
 2856             if (disc_type == 1 || disc_type == 2) { /* Audio or Mixed Mode CD */
 2857                 convert_frames2mbminstring(cdinfo.total_size, tmp);
 2858             } else {                        /* Data CD/DVD/BD and CD Extra */
 2859                 convert_sectors2mbminstring(cdinfo.total_size, tmp);
 2860             }
 2861             gtk_entry_set_text(GTK_ENTRY(cdlist_l3), tmp);
 2862 
 2863             /* nr tracks */ 
 2864             g_snprintf(tmp,MAXLINE,"%d",cdinfo.nr_tracks);
 2865             gtk_entry_set_text(GTK_ENTRY(cdlist_l4), tmp);
 2866         }
 2867     }
 2868 
 2869     /* reset cursor */
 2870     gdk_window_set_cursor(GTK_WIDGET(toplevel)->window,NULL);
 2871     gdk_cursor_destroy (cursor);
 2872     do_unlock(1);
 2873 }
 2874 
 2875 
 2876 /*
 2877  * callback for write button in write menu
 2878  */
 2879 static void writetracks_clicked(GtkWidget *widget, gpointer data) {
 2880 gint stat;
 2881 gint ret,i;
 2882 gint onthefly;
 2883 gint spaceneededoncd;
 2884 gint outofspace;
 2885 gint64 tmpsize;
 2886 GList *loop;
 2887 track_read_param_t *trackparam;
 2888 gint datacount, audiocount;
 2889 gint readspeed, writespeed;
 2890 
 2891     /* no disc writer defined */
 2892     if (curset.writer_devnr == -1) {
 2893         show_dialog(ICO_ERROR,_("No disc writer defined in Setup."), T_OK, NULL, NULL, 0);
 2894         return;
 2895     }
 2896 
 2897     /* on the fly setting? */
 2898     if (strcmp(curset.tocfile,"-") == 0) {
 2899         onthefly = 1;
 2900 
 2901         spaceneededoncd = cdinfo.total_size;
 2902 
 2903         if (cdinfo.nr_tracks < 0) {
 2904             show_dialog(ICO_WARN,_("No Disc loaded in read device."),T_OK,NULL,NULL,0);
 2905             return;
 2906         }
 2907 
 2908         /* now check if read device is different from write device */
 2909         if (curset.reader_devnr == curset.writer_devnr) {
 2910             show_dialog(ICO_WARN,_("Read device is the same as the write device!\nOn the fly copy is only possible with different devices\n"),T_OK,NULL,NULL,0);
 2911             return;
 2912         }
 2913 
 2914         /* check write speeds */
 2915         i = get_writerreaderdevs_index(curset.reader_devnr);
 2916         readspeed = writerreaderdevs[i]->audioread_speed;
 2917         i = get_writerreaderdevs_index(curset.writer_devnr);
 2918         writespeed = writerreaderdevs[i]->writer_speed;
 2919 
 2920         if (writespeed > readspeed && readspeed != 0) {
 2921             ret = show_dialog(ICO_WARN,_("When copy on the fly it is not advised to use a\nhigher speed to write then to read."),T_ANYWAY,T_CANCEL, 
 2922                 NULL, 1);
 2923             if (ret == 1) {
 2924                 /* aborted */
 2925                 return;
 2926             }
 2927         }
 2928 
 2929         audiocount = 0;
 2930         datacount = 0;
 2931                 /* check cdinfo-structure */
 2932                 for (i = 0; i < cdinfo.nr_tracks; i++) {
 2933                         if (trackinfo[i]->type == 0) {
 2934                                 datacount++;
 2935                         } else {
 2936                                 audiocount++;
 2937                         }
 2938         }
 2939 
 2940             /*
 2941              * alpha version of the cdrtools installed, allow
 2942              * copy of audio (and simple data and cd-extra)
 2943              */
 2944             if ((datacount > 0 && audiocount > 0 && trackinfo[0]->type != 1) ||
 2945                 datacount > 1) {
 2946                 show_dialog(ICO_WARN,_("Currently on-the-fly copy is only supported\nfor simple data CDs, audio CDs or CDs with a data track\nafter several audio tracks (CD-Extra)."),T_OK,NULL,NULL,0);
 2947                 return;
 2948             }   
 2949 
 2950             /* warn when cd-extra */
 2951             if (datacount > 0 && audiocount > 0 && trackinfo[0]->type == 1) {
 2952                 ret = show_dialog(ICO_WARN,_("That CD contains both audio and data tracks. X-CD-Roast\nwill only copy the audio tracks in on-the-fly mode."),T_OK,T_CANCEL,NULL,0);
 2953                 if (ret == 1) {
 2954                     return;
 2955                 }
 2956             }
 2957         /* ok...everything seems to be fine */
 2958 
 2959     } else {
 2960         onthefly = 0;
 2961         spaceneededoncd = trackreadset.cdsize;
 2962 
 2963         /* first check if all tracks we need are available on hd */
 2964         stat = check_write_files(0);
 2965         switch(stat) {
 2966         /* files with wrong size */
 2967         case 1:
 2968             ret = show_dialog(ICO_QUEST,_("Some tracks do have a different file-size as expected.\nPerhaps the tracks are outdated or belong to another Disc.\nDo you want to continue anyway or to abort?"),T_ANYWAY,T_CANCEL, 
 2969                 NULL, 1);
 2970             if (ret == 1) {
 2971                 /* aborted */
 2972                 return;
 2973             }   
 2974             break;
 2975         /* files missing */
 2976         case 2:
 2977             show_dialog(ICO_ERROR,_("Some tracks belonging to the Disc you want to write are missing.\nPerhaps the TOC file is outdated and the tracks\nwere already removed from the hard drive."),T_OK,NULL,NULL,0);
 2978             return;
 2979 
 2980         /* no permission/invalid */
 2981         case 3:
 2982             show_dialog(ICO_ERROR,_("You don't have permission to read all the track-files or\nthe tracks are not regular files on the hard drive."),T_OK,NULL,NULL,0);
 2983             return;
 2984 
 2985                 /* invalid isrc or mcn */
 2986                 case 4:
 2987                         ret = show_dialog(ICO_WARN,_("Some of the audio files you want to write have been recorded\nwith an invalid ISRC or MCN id. X-CD-Roast can clear these\ninvalid ids for you and continue or you have to abort now."),"Clear and continue",T_CANCEL,NULL,1);
 2988                         if (ret == 1) {
 2989                                 /* abort */
 2990                                 return;
 2991                         } else {
 2992                                 /* clear ids */
 2993                                 stat = clear_isrc_mcn_from_tracks();
 2994                                 if (stat == 1) {
 2995                                         /* error resetting ids */
 2996                                         show_dialog(ICO_ERROR,_("Failed to clear the ISRC or MCN id in all tracks.\nPerhaps you have no write permission on the .inf files?\nPlease correct the problem and try again."),T_OK,NULL,NULL,0);
 2997                                         return;
 2998                                 }
 2999                         }
 3000                         break;
 3001         }
 3002     }
 3003 
 3004     /* check if enough space on disc? */
 3005     dodebug(2,"Sectors required: %d, Mediatype = %d\n", spaceneededoncd,
 3006         curset.cdrtype);
 3007     outofspace = 0;
 3008     if (curset.cdrtype < 1000) {
 3009         /* minutes to check */
 3010         if (spaceneededoncd > (curset.cdrtype*60*75)) {
 3011             outofspace = 1;
 3012         }
 3013     } else {
 3014         /*
 3015          * DVD sizes are declared with decimal prefix
 3016          *  - we use MB.
 3017          * We have to add 1 MB to avoid
 3018          * the 'out of space' warning.
 3019          * first the capacity of a DVD in Bytes
 3020          */
 3021         tmpsize = (gint64)(curset.cdrtype +1) * 1000 * 1000;
 3022         /* and now in sectors */
 3023         tmpsize = tmpsize / 2048;
 3024 
 3025         if (spaceneededoncd > (gint)tmpsize) {
 3026             outofspace = 1;
 3027         }
 3028     }
 3029     if (outofspace) {
 3030         if (!is_dvdwriter(curset.writer_devnr)) {
 3031             ret = show_dialog(ICO_WARN,_("There may be not enough space on the CD-R available.\nYou can continue at own risk, but the resulting CD\nmight not be readable."),T_ANYWAY,T_CANCEL,NULL,1);
 3032         } else {
 3033             /* perhaps we want to write a dvd? */
 3034             ret = show_dialog(ICO_WARN,_("There may be not enough space on the CD-R available.\nPerhaps you want to write a DVD, but you have not selected\nthe correct media size? You can continue at own\nrisk, but the resulting CD might not be readable."),T_ANYWAY,T_CANCEL,NULL,1);
 3035         }
 3036         if (ret == 1) {
 3037             /* aborted */
 3038             return;
 3039         }   
 3040     }
 3041 
 3042     /*
 3043      * check if wrong write mode
 3044      * for CD-Text is selected
 3045      */
 3046     if (curset.writecdtext) {
 3047         gshort i, wrmode;
 3048         i = get_writerreaderdevs_index(curset.writer_devnr);
 3049         wrmode = (writerreaderdevs[i]->writer_mode);
 3050         if (wrmode != 0 && wrmode != 3 && wrmode != 4) {
 3051             ret = show_dialog(ICO_WARN,_("Hint: The CD-Text will not be written.\nFor this, you need the Write Mode:\n \"DAO\" or \"raw96r\" or \"raw96p\"."),T_ANYWAY,T_CANCEL,NULL,1);
 3052             if (ret) {
 3053                 return;
 3054             }
 3055         }
 3056     }
 3057 
 3058     /*
 3059      * ok, now we are sure that all tracks are fine
 3060      * ...prompt for disc
 3061      */
 3062     ret = show_dialog(ICO_INFO,pleaseinsertmedia(),T_OK,T_CANCEL,NULL,0);
 3063     if (ret != 0) {
 3064         return;
 3065     }
 3066 
 3067     /*
 3068      * if we have to write CD-Text then
 3069      * edit the .inf files from cdda2wav
 3070      */
 3071     if (curset.writecdtext && !onthefly) {
 3072         loop = g_list_first(trackreadset.trackparams);
 3073         while(loop) {
 3074             trackparam = loop->data;
 3075             if (trackparam->trackfile != NULL) {
 3076                 edit_xinf_for_cd_text(trackparam->trackfile,
 3077                     curset.tocfile);
 3078             }
 3079             loop = loop->next;
 3080         }   
 3081 
 3082     }
 3083 
 3084     /* start writing */
 3085     show_and_do_write_tracks(curset.writer_devnr, curset.reader_devnr, onthefly);
 3086 }
 3087 
 3088 
 3089 /*
 3090  * fill the entries in the write disc menu
 3091  */
 3092 static void fill_write_menu() {
 3093 GList *loop;
 3094 GtkWidget *menu;
 3095 GtkWidget *menu_item, *menuselitem;
 3096 gchar tmp[MAXLINE];
 3097 gint menuidx, menuhistory;
 3098 gint i, len;
 3099 
 3100     /* get list of toc-files (save in tocfiles var) */
 3101     scan_for_toc_files();
 3102 
 3103     /* clear out the old menu first (if any) */
 3104     gtk_option_menu_remove_menu(GTK_OPTION_MENU (write_toc_menu));
 3105 
 3106     menu = gtk_menu_new();
 3107     menuselitem = NULL;
 3108     menuidx = 0; menuhistory = 0;
 3109     i = 0;
 3110     loop = g_list_first(tocfiles);  
 3111     while (loop) {
 3112         /*
 3113          * a bug in GTK won't allow overlong option menus...
 3114          * well, then strip off the strings (not nice,
 3115          * but so far the only way I can think of)
 3116          */
 3117         len = strlen((gchar *)loop->data);
 3118         if (len > 24) {
 3119             strcpy(tmp, ".. ");
 3120             strcat(tmp, (gchar *)loop->data + len - 24);
 3121         } else {
 3122             strcpy(tmp, (gchar *)loop->data);
 3123         }
 3124         menu_item = gtk_menu_item_new_with_label(tmp);
 3125         if (menuselitem == NULL) {
 3126             /* default first element */
 3127             menuselitem = menu_item;
 3128         } 
 3129         gtk_signal_connect(GTK_OBJECT(menu_item),
 3130             "activate", GTK_SIGNAL_FUNC(tocwrite_selected),
 3131             GINT_TO_POINTER(i));
 3132         if (strcmp(curset.tocfile, (gchar *)loop->data) == 0) {
 3133             menuhistory = menuidx;
 3134             menuselitem = menu_item;
 3135         }
 3136         gtk_menu_append (GTK_MENU (menu), menu_item);
 3137         gtk_widget_show (menu_item);
 3138         loop = loop->next;
 3139         menuidx++;
 3140         i++;
 3141     }
 3142     /* on the fly setting */
 3143     menu_item = gtk_menu_item_new_with_label(_("Copy on the fly"));
 3144     gtk_signal_connect(GTK_OBJECT(menu_item),
 3145         "activate", GTK_SIGNAL_FUNC(tocwrite_selected),
 3146         GINT_TO_POINTER(-1));
 3147     if (strcmp(curset.tocfile, "-") == 0) {
 3148         menuhistory = menuidx;
 3149         menuselitem = menu_item;
 3150     }
 3151     gtk_menu_append (GTK_MENU (menu), menu_item);
 3152     gtk_widget_show (menu_item);
 3153 
 3154     gtk_option_menu_set_menu (GTK_OPTION_MENU (write_toc_menu), menu);
 3155     gtk_option_menu_set_history(GTK_OPTION_MENU (write_toc_menu),menuhistory);
 3156     /* toggle currently active menu */ 
 3157     if (menuselitem != NULL) {
 3158         gtk_menu_item_activate(GTK_MENU_ITEM (menuselitem));
 3159     } else {
 3160         /* if no active menu, activate the last set
 3161            (one the fly in this case) */
 3162         gtk_menu_item_activate(GTK_MENU_ITEM (menu_item));
 3163     }   
 3164 
 3165 }
 3166 
 3167 
 3168 /*
 3169  * draw the write disc menu
 3170  */
 3171 static void draw_write_menu() {
 3172 gchar tmp[MAXLINE];
 3173 gchar tmp2[MAXLINE];
 3174 GtkWidget *hbox, *vbox;
 3175 GtkWidget *f1,*f2;
 3176 GtkWidget *b1;
 3177 GtkWidget *e1, *check;
 3178 GtkWidget *l1;
 3179 GtkWidget *tbl;
 3180 GtkWidget *sep;
 3181 GtkWidget *omenu;
 3182 GtkWidget *menu;
 3183 GtkWidget *menu_item;
 3184 gint cdrtypes[] = CDR_TYPES_MIN;
 3185 gint dvdtypes[] = DVD_TYPES_MB;
 3186 static const gchar *writemodes[] = WRITE_MODES;
 3187 static const gchar *helpwritemodes[] = HELP_WRITE_MODES;
 3188 gint i, tmpval;
 3189 gint menuidx, menuhistory;
 3190 
 3191     /*
 3192      * fixed settings for nofixate and multisession
 3193      * since there is no checkbox for them
 3194      * in "Duplicate Disc" menu
 3195      */
 3196     curset.nofixate = FALSE;
 3197     curset.multisession = FALSE;
 3198 
 3199     /* prepare draw area */
 3200     clear_actionspace();
 3201 
 3202     /* initializion of global pointers */
 3203     crea_cd_mode_omenu = NULL;
 3204     dupl_cd_mode_omenu = NULL;
 3205     dupl_cd_burnfree_check = NULL;
 3206 
 3207     f1 = gtk_frame_new(_("Devices-Setup"));
 3208     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 3209     gtk_box_pack_start(GTK_BOX(actionspace),f1,FALSE,FALSE,5);
 3210     gtk_widget_show(f1);
 3211 
 3212     tbl = gtk_table_new(3,16*4,TRUE);   
 3213     gtk_table_set_col_spacing(GTK_TABLE(tbl),4*4-1,5);
 3214     gtk_table_set_col_spacing(GTK_TABLE(tbl),15*4-2,5);
 3215     gtk_container_set_border_width(GTK_CONTAINER (tbl),5);
 3216     gtk_container_add(GTK_CONTAINER(f1),tbl);
 3217     gtk_widget_show(tbl);
 3218 
 3219     devices_setup_read(0, tbl, 1);
 3220     devices_setup_image(1, tbl);
 3221     devices_setup_write(2, tbl);
 3222 
 3223     /* left and right info-frames */
 3224     tbl = gtk_table_new(1,2,TRUE);
 3225     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 3226     gtk_box_pack_start(GTK_BOX(actionspace),tbl,TRUE,TRUE,10);
 3227     gtk_widget_show(tbl);
 3228     if (!curset.isProDVD) {
 3229         f1 = gtk_frame_new(_("Disc to write"));
 3230     } else {
 3231         f1 = gtk_frame_new(_("CD/DVD to write"));
 3232     }
 3233     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 3234     gtk_table_attach_defaults(GTK_TABLE(tbl),f1,0,1,0,1);
 3235     gtk_widget_show(f1);
 3236     f2 = gtk_frame_new(_("Write parameters"));
 3237     set_font_and_color_frame(f2,PANGO_BOLD,NULL);
 3238     gtk_table_attach_defaults(GTK_TABLE(tbl),f2,1,2,0,1);
 3239     gtk_widget_show(f2);
 3240 
 3241     /* button bar at the bottom */
 3242     hbox = gtk_hbox_new(TRUE,10);
 3243     gtk_box_pack_start(GTK_BOX(actionspace),hbox,FALSE,TRUE,5);
 3244     gtk_widget_show(hbox);
 3245     if (!curset.isProDVD) {
 3246         b1 = gtk_button_new_with_label(_("Write Disc"));
 3247     } else {
 3248         b1 = gtk_button_new_with_label(_("Write CD/DVD"));
 3249     }
 3250     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 3251     gtk_widget_show(b1);
 3252     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 3253         GTK_SIGNAL_FUNC(writetracks_clicked), NULL);
 3254     define_tooltip(b1,_("Writes all tracks specified by the TOC file to a Disc."));
 3255 
 3256     if (!curset.isProDVD) {
 3257         b1 = gtk_button_new_with_label(_("Blank Disc"));
 3258     } else {
 3259         b1 = gtk_button_new_with_label(_("Blank CD/DVD+-RW"));
 3260     }
 3261     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 3262     gtk_widget_show(b1);
 3263     gtk_signal_connect(GTK_OBJECT(b1), "clicked",
 3264         GTK_SIGNAL_FUNC(blankcd_clicked), NULL);
 3265     define_tooltip(b1,_("Blanks a rewritable Disc inserted in the Writer."));
 3266 
 3267 
 3268     /* left info frame */
 3269     vbox = gtk_vbox_new(FALSE,0);
 3270     gtk_container_add(GTK_CONTAINER(f1),vbox);
 3271     gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
 3272     gtk_widget_show(vbox);
 3273 
 3274     tbl = gtk_table_new(5,8,FALSE);
 3275     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 3276     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 3277     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,0);
 3278     gtk_widget_show(tbl);
 3279     
 3280     l1 = rightjust_gtk_label_new(_("TOC-File:"));
 3281     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,0,1);
 3282     gtk_widget_show(l1);
 3283 
 3284     omenu = gtk_option_menu_new();
 3285     write_toc_menu = omenu;
 3286     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,3,8,0,1);
 3287     gtk_widget_show(omenu);
 3288     define_tooltip(omenu,_("Select the TOC file that specifies which tracks should be written to Disc. The setting \"Copy on the fly\" will read the tracks directly from the Disc reader instead from the harddisk."));
 3289 
 3290     l1 = rightjust_gtk_label_new(_("Type:"));
 3291     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,1,2);
 3292     gtk_widget_show(l1);
 3293 
 3294     e1 = gtk_entry_new();
 3295     cdlist_l1 = e1;
 3296     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3297     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,1,2);
 3298     gtk_widget_show(e1);
 3299 
 3300     l1 = rightjust_gtk_label_new(_("Label:"));
 3301     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,2,3);
 3302     gtk_widget_show(l1);
 3303 
 3304     e1 = gtk_entry_new();
 3305     cdlist_l2 = e1;
 3306     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3307     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,2,3);
 3308     gtk_widget_show(e1);
 3309 
 3310     l1 = rightjust_gtk_label_new(_("Size:"));
 3311     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,3,4);
 3312     gtk_widget_show(l1);
 3313 
 3314     e1 = gtk_entry_new();
 3315     cdlist_l3 = e1;
 3316     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3317     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,3,4);
 3318     gtk_widget_show(e1);
 3319 
 3320     l1 = rightjust_gtk_label_new(_("Tracks:"));
 3321     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,3,4,5);
 3322     gtk_widget_show(l1);
 3323 
 3324     e1 = gtk_entry_new();
 3325     cdlist_l4 = e1;
 3326     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3327     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,3,8,4,5);
 3328     gtk_widget_show(e1);
 3329 
 3330 
 3331     /* right info frame */
 3332     vbox = gtk_vbox_new(FALSE,0);
 3333     gtk_container_add(GTK_CONTAINER(f2),vbox);
 3334     gtk_container_set_border_width (GTK_CONTAINER (vbox), 7);
 3335     gtk_widget_show(vbox);
 3336 
 3337     tbl = gtk_table_new(8,16,FALSE);
 3338     gtk_table_set_row_spacing(GTK_TABLE(tbl),0,2);
 3339     gtk_table_set_row_spacing(GTK_TABLE(tbl),1,5);
 3340     gtk_table_set_row_spacing(GTK_TABLE(tbl),2,5);
 3341     gtk_table_set_col_spacings(GTK_TABLE(tbl),2);
 3342     gtk_box_pack_start(GTK_BOX(vbox),tbl,FALSE,FALSE,0);
 3343     gtk_widget_show(tbl);
 3344     
 3345     /* disc type */
 3346 
 3347     l1 = rightjust_gtk_label_new(_("Disc Type:"));
 3348     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,6,0,1);
 3349     gtk_widget_show(l1);
 3350 
 3351     omenu = gtk_option_menu_new();
 3352     menu = gtk_menu_new();
 3353     menuidx = 0; menuhistory = 0;
 3354 
 3355     i = 0;
 3356     tmpval = curset.cdrtype;
 3357     while (cdrtypes[i] != 0) {
 3358         /* construct minute-list */
 3359         g_snprintf(tmp,MAXLINE,"%d min",abs(cdrtypes[i]));
 3360 
 3361         menu_item = gtk_menu_item_new_with_label(tmp);
 3362         gtk_signal_connect(GTK_OBJECT(menu_item),
 3363             "activate", GTK_SIGNAL_FUNC(cdrtype_selected),
 3364             GINT_TO_POINTER(abs(cdrtypes[i])));
 3365         gtk_menu_append (GTK_MENU (menu), menu_item);
 3366         if (tmpval == abs(cdrtypes[i])) { 
 3367             menuhistory = menuidx;
 3368         }
 3369         /* default set defined by negativ value */
 3370         if (tmpval == 0 && cdrtypes[i] < 0) {
 3371             menuhistory = menuidx;
 3372             curset.cdrtype = abs(cdrtypes[i]);
 3373         }
 3374         menuidx++;
 3375         gtk_widget_show (menu_item);
 3376         i++;
 3377     }
 3378 
 3379     i = 0;
 3380     tmpval = curset.cdrtype;
 3381     while (dvdtypes[i] != 0) {
 3382         /* construct GB-list */
 3383         g_snprintf(tmp2,MAXLINE,"%.2f", (gfloat)dvdtypes[i]/1000);
 3384         if (tmp2[strlen(tmp2)-1] == '0') {
 3385             tmp2[strlen(tmp2)-1] = '\0'; /* strip off last 0 */
 3386         }
 3387         g_snprintf(tmp,MAXLINE,"%s GB",tmp2); /*decimal prefix*/
 3388 
 3389         menu_item = gtk_menu_item_new_with_label(tmp);
 3390         gtk_signal_connect(GTK_OBJECT(menu_item),
 3391         "activate", GTK_SIGNAL_FUNC(cdrtype_selected),
 3392         GINT_TO_POINTER(dvdtypes[i]));
 3393         gtk_menu_append (GTK_MENU (menu), menu_item);
 3394         if (tmpval == abs(dvdtypes[i])) { 
 3395             menuhistory = menuidx;
 3396         }
 3397         menuidx++;
 3398         gtk_widget_show (menu_item);
 3399         i++;
 3400     }
 3401 
 3402     gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
 3403     gtk_option_menu_set_history(GTK_OPTION_MENU (omenu),menuhistory);
 3404     gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,6,10,0,1);
 3405     gtk_widget_show(omenu);
 3406     define_tooltip(omenu,_("The capacity of the currently used Disc."));
 3407 
 3408     b1 = gtk_button_new_with_label(_("ATIP-Info"));
 3409     gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 3410         GTK_SIGNAL_FUNC(show_atip_info),NULL);
 3411     gtk_table_attach_defaults(GTK_TABLE(tbl),b1,10,16,0,1);
 3412     gtk_widget_show(b1);
 3413     define_tooltip(b1,_("Read detailed information from a (empty) Disc."));
 3414 
 3415 
 3416     /* write mode */
 3417     l1 = rightjust_gtk_label_new(_("Write Mode:"));
 3418     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,6,1,2);
 3419     gtk_widget_show(l1);
 3420 
 3421         omenu = gtk_option_menu_new ();
 3422         menu = gtk_menu_new();
 3423     dupl_cd_mode_omenu = omenu;
 3424 
 3425         i = 0;
 3426         while (writemodes[i]) {
 3427                 menu_item = gtk_menu_item_new_with_label(_(writemodes[i]));
 3428                 gtk_signal_connect(GTK_OBJECT(menu_item), "activate",
 3429                         GTK_SIGNAL_FUNC(writemode_selected),
 3430                         GINT_TO_POINTER(i));
 3431                 gtk_menu_append (GTK_MENU (menu), menu_item);
 3432                 gtk_widget_show (menu_item);
 3433                 if (helpwritemodes[i])
 3434                         define_tooltip(menu_item,(gchar *)_(helpwritemodes[i]));
 3435                 i++;
 3436         }
 3437 
 3438         gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
 3439     preselect_write_mode_menu(omenu, curset.writer_devnr);
 3440         gtk_table_attach_defaults(GTK_TABLE(tbl),omenu,6,16,1,2);
 3441         gtk_widget_show(omenu);
 3442         g_snprintf(tmp,MAXLINE,"%s %s",_("Choose which mode you want to use for writing CDs. Try \"DAO\" first, because this is the best one for all modern disc writers."), _("Click an option and hold the button to get additional help for each mode."));
 3443         define_tooltip(omenu,tmp);  /* concatenated text */
 3444 
 3445     /*
 3446      * disable selection of write modes
 3447      * if the user hasn't got the permission
 3448      * or if DVD or BD or if multisession
 3449      */
 3450     if ((!isroot() && !setupdata.root_option_change_writeparam)
 3451       || curset.cdrtype > 1000 || curset.multisession) {
 3452         gtk_widget_set_sensitive(omenu,FALSE);
 3453     }
 3454 
 3455     sep = gtk_hseparator_new();
 3456     gtk_table_attach_defaults(GTK_TABLE(tbl),sep,0,16,2,3);
 3457     gtk_widget_show(sep);
 3458 
 3459     check = gtk_check_button_new_with_label(_("Simulation write"));
 3460     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 3461         GTK_SIGNAL_FUNC(writeoptions_selected),GINT_TO_POINTER(0));
 3462     gtk_table_attach_defaults(GTK_TABLE(tbl),check,2,16,3,4);
 3463     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 3464         curset.writesimul);
 3465     gtk_widget_show(check);
 3466     define_tooltip(check,_("Just simulate the burning process. Please note that DVD+ media and Blu-ray media do not support simulation writes."));
 3467 
 3468     check = gtk_check_button_new_with_label(_("Eject after write"));
 3469     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 3470         GTK_SIGNAL_FUNC(writeoptions_selected),GINT_TO_POINTER(1));
 3471     gtk_table_attach_defaults(GTK_TABLE(tbl),check,2,16,4,5);
 3472     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 3473         curset.writeeject);
 3474     gtk_widget_show(check);
 3475     define_tooltip(check,_("Eject the Disc after the burning was completed."));
 3476     
 3477     check = gtk_check_button_new_with_label(_("Pad Tracks"));
 3478     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 3479         GTK_SIGNAL_FUNC(writeoptions_selected),GINT_TO_POINTER(2));
 3480     gtk_table_attach_defaults(GTK_TABLE(tbl),check,2,16,5,6);
 3481     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 3482         curset.writepad);
 3483     gtk_widget_show(check);
 3484     define_tooltip(check,_("Pads data-tracks with zeros to eliminate reading problems on some systems and adapts the length of audio-tracks for CD writing. This must be enabled when you want to burn wav-files not created with X-CD-Roast."));
 3485     
 3486     check = gtk_check_button_new_with_label(_("Enable protection from Buffer Underruns"));
 3487     dupl_cd_burnfree_check = check;
 3488  
 3489     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 3490         GTK_SIGNAL_FUNC(writeoptions_selected),GINT_TO_POINTER(8));
 3491     gtk_table_attach_defaults(GTK_TABLE(tbl),check,2,16,6,7);
 3492     if (does_support_burnproof(curset.writer_devnr)) {
 3493         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 3494             curset.writeburnfree);
 3495     }
 3496     gtk_widget_show(check);
 3497     define_tooltip(check,_("When available it does enable protection from Buffer Underrun errors. Supported are Sanyo BURN-Proof, Ricoh Just-Link and similar."));
 3498 
 3499     if (!does_support_burnproof(curset.writer_devnr))
 3500                 gtk_widget_set_sensitive(check,FALSE);
 3501 
 3502     check = gtk_check_button_new_with_label(_("Write CD-Text"));
 3503     gtk_signal_connect(GTK_OBJECT(check),"clicked",
 3504         GTK_SIGNAL_FUNC(writeoptions_selected),GINT_TO_POINTER(6));
 3505     gtk_table_attach_defaults(GTK_TABLE(tbl),check,2,8,7,8);
 3506     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
 3507         curset.writecdtext);
 3508     gtk_widget_show(check);
 3509     define_tooltip(check,_("Writes CD-Text information to the CD-R/RW when your CD Writer is supporting it. This usually works only when writing in DAO or raw96 mode."));
 3510 
 3511         b1 = gtk_button_new_with_label(_("Edit titles"));
 3512     edit_cdtext_btn = b1;
 3513         gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 3514                 GTK_SIGNAL_FUNC(edit_cdtext_clicked), GINT_TO_POINTER(1));
 3515         gtk_table_attach_defaults(GTK_TABLE(tbl),b1,8,16,7,8);
 3516         gtk_widget_show(b1);
 3517         define_tooltip(b1,_("Edits the title and performer information of your tracks before they are written to a CD-R/RW with CD-Text."));
 3518 
 3519 
 3520         b1 = gtk_button_new_with_label(_("Advanced options"));
 3521         gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 3522                 GTK_SIGNAL_FUNC(adv_write_options_clicked), NULL);
 3523     gtk_box_pack_end(GTK_BOX(vbox),b1,FALSE,FALSE,0);
 3524         gtk_widget_show(b1);
 3525         define_tooltip(b1,_("Set additional write options for advanced users."));
 3526 
 3527     
 3528     gtk_widget_show(actionspace);
 3529 
 3530 
 3531     /* fill entries */
 3532     fill_write_menu();
 3533 
 3534 }
 3535 
 3536 
 3537 /*
 3538  * fill the list with the tracks to delete
 3539  */
 3540 static void fill_delete_menu() {
 3541 GtkStyle *style;
 3542 gchar *data[5];
 3543 GdkPixmap *pixmap1, *pixmap2, *pixmap3, *pixmap4, *pixmap5;
 3544 GdkBitmap *mask1, *mask2, *mask3, *mask4, *mask5;
 3545 gchar tmp[MAXLINE];
 3546 gchar tmp2[MAXLINE];
 3547 gchar tmp3[MAXLINE];
 3548 gchar tmp4[MAXLINE];
 3549 gchar basename[MAXLINE], imgdir[MAXLINE], *p;
 3550 GList *loop;
 3551 image_files_t *entry;
 3552 gint lcount, count;
 3553 gint sizecount;
 3554 gint dummy;
 3555 
 3556     /* clean up first */
 3557     gtk_clist_clear(imglist);
 3558 
 3559     style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(imglist)));
 3560     pixmap1 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
 3561         &mask1, &style->bg[GTK_STATE_NORMAL],(gchar **)minidata_xpm);
 3562     pixmap2 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
 3563         &mask2, &style->bg[GTK_STATE_NORMAL],(gchar **)miniaudio_xpm);
 3564     pixmap3 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
 3565         &mask3, &style->bg[GTK_STATE_NORMAL],(gchar **)mininodata_xpm);
 3566     pixmap4 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
 3567         &mask4, &style->bg[GTK_STATE_NORMAL],(gchar **)mininoaudio_xpm);
 3568     pixmap5 = gdk_pixmap_create_from_xpm_d(imglist->clist_window,
 3569         &mask5, &style->bg[GTK_STATE_NORMAL],(gchar **)minitoc_xpm);
 3570 
 3571     data[0] = NULL;
 3572     strcpy(imgdir,"");
 3573     lcount = 0;
 3574     count = 1;
 3575     sizecount = 0;
 3576 
 3577     /* check image-selector */
 3578     if (curset.image_index != -1) {
 3579         /* no automatic setting? */
 3580         strncpy(imgdir,(gchar *)g_list_nth_data(setupdata.image_dirs,
 3581             curset.image_index), MAXLINE);
 3582     }
 3583 
 3584     loop = g_list_first(imagelist);
 3585     while (loop) {
 3586         entry = loop->data;
 3587 
 3588         /* get the base-dirname */
 3589         strncpy(basename,entry->path,MAXLINE);  
 3590         p = rindex(basename,'/');
 3591         *p = '\0';
 3592         if (strcmp(basename,"") == 0) {
 3593             strcpy(basename,"/");
 3594         }
 3595         if (strcmp(basename,imgdir) != 0 && imgdir[0] != '\0') {
 3596             /* skip not selected dirs */
 3597             loop = loop->next;
 3598             continue;
 3599         }
 3600 
 3601         /* count */
 3602         g_snprintf(tmp,MAXLINE,"%d.",count);
 3603         data[1] = convert_for_gtk2(tmp); 
 3604 
 3605         /* title */
 3606         if (entry->title && entry->artist &&
 3607             strcmp(entry->title,"") && strcmp(entry->artist,"")) {
 3608             g_snprintf(tmp3,MAXLINE,"%s / %s",
 3609                 entry->title, entry->artist);
 3610                 data[2] = convert_for_gtk2(tmp3); 
 3611         } else 
 3612         if (entry->title && strcmp(entry->title,"")) {
 3613             strncpy(tmp3, entry->title, MAXLINE);
 3614             data[2] = convert_for_gtk2(tmp3); 
 3615         } else 
 3616          if (entry->cddb_ttitle && strcmp(entry->cddb_ttitle,"")) {
 3617             strncpy(tmp3, entry->cddb_ttitle, MAXLINE);
 3618             data[2] = convert_for_gtk2(tmp3); 
 3619         } else 
 3620         if (entry->volname && strcmp(entry->volname,"")) {
 3621             g_snprintf(tmp3,MAXLINE,"%s / ISO9660",
 3622                 entry->volname);
 3623             data[2] = convert_for_gtk2(tmp3); 
 3624         } else {
 3625             data[2] = NULL;
 3626         }
 3627 
 3628         /* path */
 3629         strncpy(tmp4, entry->path, MAXLINE);
 3630         data[4] = convert_for_gtk2(tmp4); 
 3631 
 3632         /* iso9600-track/ unknown  */
 3633         if (entry->type == 0 || entry->type == 3) {
 3634             convert_frames2mbstring((gint)((off_t)entry->size/DATASECTORSIZE),
 3635                 tmp2);
 3636             data[3] = convert_for_gtk2(tmp2); 
 3637             gtk_clist_append(imglist,data);
 3638             if (entry->readable == 1 && entry->type == 0) {
 3639                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap1,mask1);   
 3640             } else {
 3641                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap3,mask3);   
 3642             }
 3643             lcount++;
 3644             sizecount+=(gint)((off_t)entry->size >> 10);
 3645             count++;
 3646         }
 3647 
 3648         /* valid/invalid wav-file */
 3649         if (entry->type == 1 || entry->type == 2) {
 3650             convert_frames2minstring((gint)((off_t)entry->size/CDDAFRAME), tmp2);
 3651             data[3] = convert_for_gtk2(tmp2); 
 3652             gtk_clist_append(imglist,data);
 3653             if (entry->readable == 1 && entry->type == 1) {
 3654                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap2,mask2);   
 3655             } else {
 3656                 gtk_clist_set_pixmap(imglist,lcount,0,pixmap4,mask4);   
 3657             }
 3658             lcount++;
 3659             sizecount+=(gint)((off_t)entry->size >> 10);
 3660             count++;
 3661         }   
 3662 
 3663         /* toc-file */
 3664         if (entry->type == 4) {
 3665             data[3] = NULL; 
 3666             gtk_clist_append(imglist,data);
 3667             gtk_clist_set_pixmap(imglist,lcount,0,pixmap5, mask5);
 3668             count++;
 3669             lcount++;
 3670         }
 3671 
 3672         loop = loop->next;
 3673     }
 3674 
 3675     /* nothing selected - no size of files */
 3676     convert_kbytes2mbminstring(0, tmp);
 3677     gtk_entry_set_text(GTK_ENTRY(imglist_l1), tmp);  
 3678 
 3679     /* free size */
 3680     convert_kbytes2mbminstring(determine_free_space(&dummy),tmp);
 3681     gtk_entry_set_text(GTK_ENTRY(imglist_l2), tmp);
 3682 }
 3683 
 3684 
 3685 /*
 3686  * select a row with a given filename
 3687  */
 3688 static void select_delete_row_by_filename(gchar *fname) {
 3689 gint i;
 3690 gchar *cell;
 3691 
 3692     /* loop through all rows */
 3693     for (i = 0; i < imglist->rows; i++) {
 3694         gtk_clist_get_text(imglist,i,4,&cell);
 3695         if (strcmp(cell, fname) == 0) {
 3696             /* match found - select row */
 3697             gtk_clist_select_row(imglist, i, 0);
 3698         }
 3699     }
 3700 }
 3701 
 3702 
 3703 /*
 3704  * update currently selected track-size
 3705  */
 3706 static void update_delete_size(gint doubleclick, gint clickrow) {
 3707 GList *sel;
 3708 gint row,type;
 3709 gchar *cell;
 3710 off_t size;
 3711 gint sizecount;
 3712 gchar tmp[MAXLINE];
 3713 GList *loop;
 3714 track_read_param_t *trackparam;
 3715 
 3716     sizecount = 0;
 3717 
 3718     /* check for doubleclick on list */
 3719     if (doubleclick) {
 3720         gtk_clist_get_text(imglist,clickrow,4,&cell);
 3721         type = get_type_from_imagelist(cell);
 3722         /* is it a toc-file? (type 4) */
 3723         if (type == 4) {
 3724             /* now scan toc file */
 3725             read_copy_cd_toc_file(cell);
 3726             /*
 3727              * select all files to delete
 3728              * which are in the toc-file
 3729              */
 3730             loop = g_list_first(trackreadset.trackparams);
 3731             while(loop) {
 3732                 trackparam = loop->data;
 3733                 select_delete_row_by_filename(
 3734                     trackparam->trackfile);
 3735 
 3736                 loop = loop->next;
 3737             }
 3738         }
 3739     }
 3740 
 3741     /* loop through all selected tracks */
 3742     sel = imglist->selection;
 3743     while (sel) {
 3744         row = GPOINTER_TO_INT(sel->data);       
 3745         gtk_clist_get_text(imglist,row,4,&cell);
 3746         size = get_size_from_imagelist(cell);
 3747         sizecount += (gint)((off_t)size >> 10);
 3748         sel = sel->next;
 3749     }
 3750 
 3751     convert_kbytes2mbminstring(sizecount, tmp);
 3752     gtk_entry_set_text(GTK_ENTRY(imglist_l1), tmp);
 3753 }
 3754 
 3755 
 3756 /*
 3757  * start the delete job
 3758  */
 3759 static void do_delete_press(GtkWidget *widget, gpointer data) {
 3760 GList *sel;
 3761 gint row;
 3762 gchar *cell;
 3763 gint count,ret;
 3764 gchar tmp[MAXLINE];
 3765 GList *delfiles;
 3766 
 3767     delfiles = NULL;
 3768     count = 0;
 3769     /*
 3770      * loop through all selected tracks
 3771      * create a glist containing all files names to delete
 3772      */
 3773     sel = imglist->selection;
 3774     while (sel) {
 3775         row = GPOINTER_TO_INT(sel->data);       
 3776         gtk_clist_get_text(imglist,row,4,&cell);
 3777         delfiles = g_list_append(delfiles,g_strdup(cell));
 3778         count++;
 3779         sel = sel->next;
 3780     }
 3781 
 3782     if (count == 0) {
 3783         show_dialog(ICO_WARN,_("No tracks selected to delete"), T_OK, NULL, NULL, 0);
 3784         return;
 3785     } else 
 3786     if (count == 1) {
 3787         ret = show_dialog(ICO_QUEST,_("Are you sure you want to delete one track?"),T_YES,T_NO,NULL,0);
 3788     } else {
 3789         g_snprintf(tmp,MAXLINE,_("Are you sure you want to delete %d tracks?"),count);
 3790         ret = show_dialog(ICO_QUEST,tmp,T_YES,T_NO,NULL,0);
 3791     }
 3792 
 3793     if (ret == 1) {
 3794         /* not sure - abort */
 3795         return;
 3796     }
 3797 
 3798     /* create menu showing deletion */
 3799     show_and_do_delete(delfiles);
 3800 
 3801     free_glist(&delfiles);
 3802 
 3803     /* now update image-list */
 3804     scan_imagedirs();
 3805     fill_delete_menu();
 3806 }
 3807 
 3808 static void delete_select_all(GtkWidget *widget, gpointer data) {
 3809 
 3810     gtk_clist_select_all(imglist);
 3811 }
 3812 
 3813 static void delete_select_none(GtkWidget *widget, gpointer data) {
 3814 
 3815     gtk_clist_unselect_all(imglist);
 3816 }
 3817 
 3818 static void delete_select_row(GtkWidget *clist, gint row, gint col,
 3819     GdkEventButton *event, gpointer data) {
 3820 
 3821     /* double click? */
 3822     if (event && event->type == GDK_2BUTTON_PRESS) {
 3823         update_delete_size(1, row);
 3824     } else {
 3825         update_delete_size(0, row);
 3826     }
 3827 }
 3828 
 3829 
 3830 /*
 3831  * draw the delete-tracks menu
 3832  */
 3833 void draw_delete_menu() {
 3834 GtkWidget *hbox;
 3835 GtkWidget *f1;
 3836 GtkWidget *b1;
 3837 GtkWidget *list;
 3838 gchar *titles[5];
 3839 GtkCList *clist;
 3840 GtkWidget *e1;
 3841 GtkWidget *l1;
 3842 GtkWidget *tbl;
 3843 GtkWidget *sep, *dummy;
 3844 GtkWidget *scrolled_win;
 3845 
 3846     /* prepare draw area */
 3847     clear_actionspace();
 3848 
 3849     f1 = gtk_frame_new(_("Devices-Setup"));
 3850     set_font_and_color_frame(f1,PANGO_BOLD,NULL);
 3851     gtk_box_pack_start(GTK_BOX(actionspace),f1,FALSE,FALSE,5);
 3852     gtk_widget_show(f1);
 3853 
 3854     tbl = gtk_table_new(1,16*4,TRUE);   
 3855     gtk_table_set_col_spacing(GTK_TABLE(tbl),4*4-1,5);
 3856     gtk_table_set_col_spacing(GTK_TABLE(tbl),15*4-2,5);
 3857     gtk_container_set_border_width(GTK_CONTAINER (tbl),5);
 3858     gtk_container_add(GTK_CONTAINER(f1),tbl);
 3859     gtk_widget_show(tbl);
 3860 
 3861     devices_setup_image(0, tbl);
 3862 
 3863     scrolled_win = gtk_scrolled_window_new (NULL, NULL);
 3864     gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 10);
 3865     gtk_box_pack_start(GTK_BOX(actionspace),scrolled_win,TRUE,TRUE,0);
 3866     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
 3867         GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
 3868     gtk_widget_show(scrolled_win);
 3869     
 3870     titles[0] = "";
 3871     titles[1] = _("Nr.");
 3872     titles[2] = _("Track title");
 3873     titles[3] = _("Length");
 3874     titles[4] = _("Filename");
 3875 
 3876     list = gtk_clist_new_with_titles(5,titles);
 3877     gtk_container_add (GTK_CONTAINER (scrolled_win), list);
 3878     gtk_widget_realize(list);
 3879     clist = GTK_CLIST(list);
 3880     imglist = clist;
 3881     gtk_clist_set_column_auto_resize(clist, 4, TRUE);
 3882     gtk_signal_connect(GTK_OBJECT(clist), "select_row",
 3883         GTK_SIGNAL_FUNC(delete_select_row),NULL);
 3884     gtk_signal_connect(GTK_OBJECT(clist), "unselect_row",
 3885         GTK_SIGNAL_FUNC(delete_select_row),NULL);
 3886 
 3887     gtk_clist_set_row_height(clist, tbf(20));
 3888     gtk_clist_set_column_width(clist, 0, tbf(20));
 3889     gtk_clist_set_column_width(clist, 1, tbf(30));
 3890     gtk_clist_set_column_justification(clist, 1, GTK_JUSTIFY_CENTER);
 3891     gtk_clist_set_column_width(clist, 2, tbf(250));
 3892     gtk_clist_set_column_width(clist, 3, tbf(80));
 3893     gtk_clist_set_selection_mode (clist, GTK_SELECTION_MULTIPLE);
 3894     gtk_widget_show(list);
 3895 
 3896     tbl = gtk_table_new(2,16,TRUE);
 3897     gtk_table_set_row_spacings(GTK_TABLE(tbl),10);
 3898     gtk_table_set_col_spacings(GTK_TABLE(tbl),10);
 3899     gtk_box_pack_start(GTK_BOX(actionspace),tbl,FALSE,FALSE,10);
 3900     gtk_widget_show(tbl);
 3901     
 3902     l1 = rightjust_gtk_label_new(_("Size of selected tracks:"));
 3903     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,6,0,1);
 3904     gtk_widget_show(l1);
 3905     e1 = gtk_entry_new();
 3906     imglist_l1 = e1;
 3907     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3908     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,6,10,0,1);
 3909     gtk_widget_show(e1);
 3910 
 3911     l1 = rightjust_gtk_label_new(_("Free space:"));
 3912     gtk_table_attach_defaults(GTK_TABLE(tbl),l1,0,6,1,2);
 3913     gtk_widget_show(l1);
 3914     e1 = gtk_entry_new();
 3915     imglist_l2 = e1;
 3916     gtk_entry_set_editable(GTK_ENTRY(e1),FALSE);
 3917     gtk_table_attach_defaults(GTK_TABLE(tbl),e1,6,10,1,2);
 3918     gtk_widget_show(e1);
 3919     define_tooltip(e1, _("If the Image Directory is set to \"Automatic\" this is the free hard disk space of all the image directories: Data / Audio"));
 3920 
 3921     sep = gtk_hseparator_new();
 3922     gtk_box_pack_start(GTK_BOX(actionspace),sep,FALSE,FALSE,10);
 3923     gtk_widget_show(sep);
 3924 
 3925     /* button bar at the bottom */
 3926     hbox = gtk_hbox_new(FALSE,5);
 3927     gtk_box_pack_start(GTK_BOX(actionspace),hbox,FALSE,TRUE,0);
 3928     gtk_widget_show(hbox);
 3929 
 3930     b1 = gtk_button_new_with_label(_("Select all"));
 3931     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 3932     gtk_widget_show(b1);
 3933     gtk_signal_connect(GTK_OBJECT(b1),"clicked",
 3934         GTK_SIGNAL_FUNC(delete_select_all), NULL);
 3935     define_tooltip(b1,_("Selects all displayed tracks."));
 3936 
 3937     b1 = gtk_button_new_with_label(_("Select none"));
 3938     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 3939     gtk_widget_show(b1);
 3940     gtk_signal_connect(GTK_OBJECT(b1),"clicked",
 3941         GTK_SIGNAL_FUNC(delete_select_none), NULL);
 3942     define_tooltip(b1,_("Deselects all tracks."));
 3943 
 3944     dummy = gtk_label_new("");
 3945     gtk_box_pack_start(GTK_BOX(hbox),dummy,FALSE,FALSE,10);
 3946     gtk_widget_show(dummy);
 3947 
 3948     b1 = gtk_button_new_with_label(_("Delete selected tracks"));
 3949     gtk_box_pack_start(GTK_BOX(hbox),b1,TRUE,TRUE,10);
 3950     gtk_widget_show(b1);
 3951     gtk_signal_connect(GTK_OBJECT(b1),"clicked",
 3952         GTK_SIGNAL_FUNC(do_delete_press), NULL);
 3953     define_tooltip(b1,_("Deletes all selected Tracks. Hint: A doubleclick on a TOC-file in the list will select all tracks specified in it."));
 3954 
 3955     gtk_widget_show(actionspace);
 3956 
 3957     /* fill entries */
 3958     fill_delete_menu();
 3959 }
 3960 
 3961 
 3962 /*
 3963  * unselects all buttons on the sidebar (except the one given)
 3964  * So there is always only one selected
 3965  */
 3966 static void reset_duplicate_buttons(GtkWidget *exclude) {
 3967 int i;
 3968 
 3969     for (i = 0; i < 7; i++) {
 3970         if (side_widgets[i] != exclude) {
 3971             gtk_signal_handler_block(GTK_OBJECT(side_widgets[i]),side_handlers[i]);
 3972             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(side_widgets[i]),0);
 3973             gtk_signal_handler_unblock(GTK_OBJECT(side_widgets[i]),side_handlers[i]);
 3974         }
 3975     }
 3976 
 3977     /*
 3978      * since this is called whenever somebody clicks on a
 3979      * sidebar button, we can here check if the wav-player
 3980      * process from "play track" is still running, when the
 3981      * user quits this menu. So lets care here that it is
 3982      * terminated in a nice way
 3983      */
 3984     if (wav_in != -1) {
 3985         do_lock(0);
 3986 
 3987         /* we want to quit the wavplayer.. */
 3988         wavplay_quit = 1;
 3989 
 3990         /* simulate quit-button-press */
 3991         gtk_button_clicked(GTK_BUTTON(wav_quit_button));
 3992 
 3993         /* now wait until we are really finished */
 3994         while (wav_in != -1) {
 3995             wait_and_process_events();
 3996         }
 3997 
 3998         /* now give gtk some extra time to initialize */
 3999         for (i = 0; i < 3; i++) {
 4000             wait_and_process_events();
 4001         }
 4002 
 4003         do_unlock(0);
 4004     }
 4005 } 
 4006 
 4007 static void menu_duplicate_info(GtkWidget *widget, gpointer data) {
 4008 
 4009     /* if button already pressed ignore and undo click */
 4010     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4011         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[0]);
 4012         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4013         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[0]);
 4014         return;
 4015     }
 4016     reset_duplicate_buttons(widget);
 4017 
 4018     dolog(2, "Entering duplicate: info menu\n");
 4019     draw_info_menu();
 4020 }
 4021 
 4022 static void menu_duplicate_read(GtkWidget *widget, gpointer data) {
 4023 
 4024     /* if button already pressed ignore and undo click */
 4025     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4026         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[1]);
 4027         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4028         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[1]);
 4029         return;
 4030     }
 4031     reset_duplicate_buttons(widget);
 4032 
 4033     dolog(2, "Entering duplicate: read menu\n");
 4034     draw_read_menu();
 4035 }
 4036 
 4037 static void menu_duplicate_verify(GtkWidget *widget, gpointer data) {
 4038 
 4039     /* if button already pressed ignore and undo click */
 4040     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4041         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[2]);
 4042         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4043         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[2]);
 4044         return;
 4045     }
 4046     reset_duplicate_buttons(widget);
 4047 
 4048     dolog(2, "Entering duplicate: verify menu\n");
 4049     draw_verify_menu();
 4050 }
 4051 
 4052 static void menu_duplicate_play(GtkWidget *widget, gpointer data) {
 4053 
 4054     /* if button already pressed ignore and undo click */
 4055     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4056         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[3]);
 4057         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4058         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[3]);
 4059         return;
 4060     }
 4061     reset_duplicate_buttons(widget);
 4062 
 4063     dolog(2, "Entering duplicate: play menu\n");
 4064     draw_play_tracks_menu();
 4065 }
 4066 
 4067 static void menu_duplicate_write(GtkWidget *widget, gpointer data) {
 4068 
 4069     /* if button already pressed ignore and undo click */
 4070     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4071         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[4]);
 4072         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4073         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[4]);
 4074         return;
 4075     }
 4076     reset_duplicate_buttons(widget);
 4077 
 4078     dolog(2, "Entering duplicate: write menu\n");
 4079     draw_write_menu();
 4080 }
 4081 
 4082 static void menu_duplicate_delete(GtkWidget *widget, gpointer data) {
 4083 
 4084     /* if button already pressed ignore and undo click */
 4085     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == 0) {
 4086         gtk_signal_handler_block(GTK_OBJECT(widget),side_handlers[5]);
 4087         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),1);
 4088         gtk_signal_handler_unblock(GTK_OBJECT(widget),side_handlers[5]);
 4089         return;
 4090     }
 4091 
 4092     reset_duplicate_buttons(widget);
 4093 
 4094     dolog(2, "Entering duplicate: delete menu\n");
 4095     draw_delete_menu();
 4096 }
 4097 
 4098 static void menu_duplicate_back(GtkWidget *widget, gpointer data) {
 4099 
 4100     reset_duplicate_buttons(widget);
 4101     create_main(0);
 4102 }
 4103 
 4104 
 4105 /*
 4106  * called by the duplicate-button
 4107  */
 4108 void create_duplicate() {
 4109 GtkWidget *side_t;
 4110 GtkWidget *head,*head_l;
 4111 GtkWidget *b1;
 4112 GtkWidget *xcdroast_logo;
 4113 
 4114     submenu = 1;
 4115     clear_sidespace();
 4116     clear_workspace();
 4117 
 4118         /* load the small xcdrlogo logo */
 4119     xcdroast_logo = display_logo(img.xcdrlogo_small, "[LOGO]");
 4120 
 4121     /* sidespace */
 4122     side_t = gtk_table_new(10,1, TRUE);
 4123     gtk_table_set_row_spacings(GTK_TABLE(side_t),10);
 4124     gtk_box_pack_start(GTK_BOX(sidespace), side_t,TRUE,TRUE,0);
 4125 
 4126     head = gtk_frame_new(NULL);
 4127     gtk_frame_set_shadow_type(GTK_FRAME(head),GTK_SHADOW_NONE);
 4128     gtk_widget_set_size_request(head, -1, 45);
 4129     gtk_table_attach_defaults(GTK_TABLE(side_t), head, 0,1,0,1);
 4130     gtk_widget_show(head);
 4131     gtk_container_add(GTK_CONTAINER(head), xcdroast_logo);
 4132 #if DISPLAY_SIDEBAR_LOGO
 4133         gtk_widget_show(xcdroast_logo);
 4134 #endif
 4135 
 4136     b1 = gtk_toggle_button_new_with_label(_("Disc/Image Info"));
 4137     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,1,2);
 4138     /* preselect the first button */
 4139     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),1);
 4140     gtk_widget_show(b1);
 4141     side_handlers[0] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4142         GTK_SIGNAL_FUNC(menu_duplicate_info),NULL); 
 4143     side_widgets[0] = b1;
 4144     define_tooltip(b1,_("Displays information about the currently inserted Disc and tracks stored on the hard disk."));
 4145 
 4146     if (!curset.isProDVD) {
 4147         b1 = gtk_toggle_button_new_with_label(_("Read Disc"));
 4148     } else {
 4149         b1 = gtk_toggle_button_new_with_label(_("Read CD/DVD"));
 4150     }
 4151     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,2,3);
 4152     gtk_widget_show(b1);
 4153     side_handlers[1] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4154         GTK_SIGNAL_FUNC(menu_duplicate_read),NULL); 
 4155     side_widgets[1] = b1;
 4156     define_tooltip(b1,_("Reads all tracks of a Disc and copy them to the hard disk."));
 4157 
 4158     if (!curset.isProDVD) {
 4159         b1 = gtk_toggle_button_new_with_label(_("Verify Disc"));
 4160     } else {
 4161         b1 = gtk_toggle_button_new_with_label(_("Verify CD/DVD"));
 4162     }
 4163     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,3,4);
 4164     gtk_widget_show(b1);
 4165     side_handlers[2] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4166         GTK_SIGNAL_FUNC(menu_duplicate_verify),NULL);   
 4167     side_widgets[2] = b1;
 4168     define_tooltip(b1,_("Reads all tracks of a Disc again and compares them with the tracks saved on the hard disk."));
 4169 
 4170     b1 = gtk_toggle_button_new_with_label(_("Play Audio-Tracks"));
 4171     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,4,5);
 4172     gtk_widget_show(b1);
 4173     side_handlers[3] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4174         GTK_SIGNAL_FUNC(menu_duplicate_play),NULL); 
 4175     side_widgets[3] = b1;
 4176     define_tooltip(b1,_("Plays audio tracks (.wav files) from the hard disk via soundcard."));
 4177 
 4178     if (!curset.isProDVD) {
 4179         b1 = gtk_toggle_button_new_with_label(_("Write Disc"));
 4180     } else {
 4181         b1 = gtk_toggle_button_new_with_label(_("Write CD/DVD"));
 4182     }
 4183     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,5,6);
 4184     gtk_widget_show(b1);
 4185     side_handlers[4] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4186         GTK_SIGNAL_FUNC(menu_duplicate_write),NULL);    
 4187     side_widgets[4] = b1;
 4188     define_tooltip(b1,_("Writes tracks to a Disc: Will read the tracks from the hard disk or copies them on-the-fly from from another Disc."));
 4189 
 4190     b1 = gtk_toggle_button_new_with_label(_("Delete Tracks"));
 4191     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,6,7);
 4192     gtk_widget_show(b1);
 4193     side_handlers[5] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4194         GTK_SIGNAL_FUNC(menu_duplicate_delete),NULL);   
 4195     side_widgets[5] = b1;
 4196     define_tooltip(b1,_("Deletes saved Tracks from the hard disk to free up space."));
 4197 
 4198     b1 = gtk_toggle_button_new_with_label(_("Back to main menu"));
 4199     gtk_table_attach_defaults(GTK_TABLE(side_t), b1, 0,1,8,9);
 4200     gtk_widget_show(b1);
 4201     side_handlers[6] = gtk_signal_connect (GTK_OBJECT (b1), "clicked",
 4202         GTK_SIGNAL_FUNC(menu_duplicate_back),NULL); 
 4203     side_widgets[6] = b1;
 4204     define_tooltip(b1,_("Quits the duplicate menu and returns to the main menu."));
 4205 
 4206     gtk_widget_show(side_t);
 4207     gtk_widget_show(sidespace);
 4208 
 4209     /* draw workspace */
 4210 
 4211     head = gtk_frame_new(NULL);
 4212     gtk_frame_set_shadow_type(GTK_FRAME(head),GTK_SHADOW_IN);
 4213     gtk_widget_set_size_request(head, -1, 45);
 4214     gtk_box_pack_start(GTK_BOX(workspace), head,FALSE,FALSE,0);
 4215     gtk_widget_show(head);
 4216     head_l = gtk_label_new(_("Duplicate Disc"));
 4217     set_font_and_color(head_l,PANGO_BIG,NULL);
 4218     gtk_container_add(GTK_CONTAINER(head),head_l);
 4219     gtk_widget_show(head_l);
 4220 
 4221     /* space where sub-windows are placed */
 4222     actionspace = gtk_vbox_new(FALSE,0);
 4223     gtk_box_pack_start(GTK_BOX(workspace), actionspace,TRUE,FALSE,0);
 4224 
 4225     gtk_widget_show(workspace);
 4226 
 4227     /* the default submenu for a start */
 4228     draw_info_menu();   
 4229 }
 4230