| 110 |
} |
} |
| 111 |
|
|
| 112 |
/* callback appele pour l'ajout de chaques fichiers */ |
/* callback appele pour l'ajout de chaques fichiers */ |
| 113 |
void _add_a_file(gchar *Anom, GtkTreeStore *ATreeStore, GtkTreeIter *Aparent, Tgrave *Ag, guint64 *Adatasize) |
gint _add_a_file(gchar *Anom, GtkTreeStore *ATreeStore, GtkTreeIter *Aparent, Tgrave *Ag, guint64 *Adatasize, GtkTreeIter *Aiter) |
| 114 |
{ |
{ |
| 115 |
GtkTreeIter Liter; |
GtkTreeIter Liter; |
| 116 |
gchar *LOnlyName; |
gchar *LOnlyName; |
| 117 |
struct stat Lfi; |
struct stat Lfi; |
| 118 |
DIR *Ldir; |
GDir *Lgdir; |
| 119 |
struct dirent *Lcurfic; |
const gchar *Ldirname; |
| 120 |
gchar *Lfullname; |
gchar *Lfullname; |
| 121 |
gchar *Lonlynameutf8, *Lnomutf8; |
gchar *Lonlynameutf8, *Lnomutf8; |
| 122 |
gchar *Lformatsizeutf8; |
gchar *Lformatsizeutf8; |
| 123 |
|
gboolean Lret; |
| 124 |
|
|
| 125 |
if ((LOnlyName=strrchr(Anom, '/'))) { |
if ((LOnlyName=strrchr(Anom, '/'))) { |
| 126 |
LOnlyName++; |
LOnlyName++; |
| 129 |
} |
} |
| 130 |
|
|
| 131 |
if (stat(Anom, &Lfi) == -1) { |
if (stat(Anom, &Lfi) == -1) { |
| 132 |
_WARN("erreur lecture fichier '%s'", Anom); |
_WARN("erreur lecture fichier '%s' err [%d]", Anom, errno); |
| 133 |
return; |
return errno; |
| 134 |
} |
} |
| 135 |
|
|
| 136 |
gtk_tree_store_append(ATreeStore, &Liter, Aparent); |
gtk_tree_store_append(ATreeStore, &Liter, Aparent); |
| 137 |
|
|
| 138 |
if (S_ISDIR(Lfi.st_mode)) { |
if (S_ISDIR(Lfi.st_mode)) { |
| 139 |
/* si c'est un repertoire alors on lis tout son contenu et on ajoute |
/* si c'est un repertoire alors on lis tout son contenu et on ajoute |
| 140 |
* les fich qu'il contient */ |
* les fichiers qu'il contient */ |
| 141 |
|
|
| 142 |
Lonlynameutf8 = _UTF8(LOnlyName); |
Lonlynameutf8 = _UTF8(LOnlyName); |
| 143 |
Lnomutf8 = _UTF8(Anom); |
Lnomutf8 = _UTF8(Anom); |
| 145 |
g_free(Lnomutf8); |
g_free(Lnomutf8); |
| 146 |
g_free(Lonlynameutf8); |
g_free(Lonlynameutf8); |
| 147 |
|
|
| 148 |
Ldir = opendir(Anom); |
Lgdir = g_dir_open(Anom, 0, NULL); |
| 149 |
if (!Ldir) { |
if (!Lgdir) { |
| 150 |
_WARN("erreur ouverture repertoire '%s'", Anom); |
_WARN("erreur ouverture repertoire '%s'", Anom); |
| 151 |
return; |
return errno; |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
while ((Lcurfic = readdir(Ldir))) { |
while ((Ldirname = g_dir_read_name(Lgdir))) { |
| 155 |
if (!strcmp(Lcurfic->d_name, ".") || !strcmp(Lcurfic->d_name, "..")) continue; |
if (!strcmp(Ldirname, ".") || !strcmp(Ldirname, "..")) continue; |
| 156 |
|
|
| 157 |
Lfullname = g_strdup_printf("%s/%s", Anom, Lcurfic->d_name); |
Lfullname = g_strdup_printf("%s/%s", Anom, Ldirname); |
| 158 |
_add_a_file(Lfullname, ATreeStore, &Liter, Ag, Adatasize); |
Lret = _add_a_file(Lfullname, ATreeStore, &Liter, Ag, Adatasize, NULL); |
| 159 |
g_free(Lfullname); |
g_free(Lfullname); |
| 160 |
|
|
| 161 |
|
if (Lret == ELOOP || Lret == EMLINK) break; |
| 162 |
} |
} |
| 163 |
closedir(Ldir); |
|
| 164 |
|
g_dir_close(Lgdir); |
| 165 |
|
|
| 166 |
} else { |
} else { |
| 167 |
Lonlynameutf8 = _UTF8(LOnlyName); |
Lonlynameutf8 = _UTF8(LOnlyName); |
| 175 |
|
|
| 176 |
*(Adatasize)=*(Adatasize) + Lfi.st_size; |
*(Adatasize)=*(Adatasize) + Lfi.st_size; |
| 177 |
} |
} |
| 178 |
|
|
| 179 |
|
if (Aiter) *Aiter = Liter; |
| 180 |
|
|
| 181 |
|
return Lret; |
| 182 |
} |
} |
| 183 |
|
|
| 184 |
/* creer un repertoire */ |
/* creer un repertoire */ |
| 549 |
Lfiles = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(Lfilesel)); |
Lfiles = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(Lfilesel)); |
| 550 |
|
|
| 551 |
for (Lcur = Lfiles; Lcur && Lcur->data; Lcur = Lcur->next) { |
for (Lcur = Lfiles; Lcur && Lcur->data; Lcur = Lcur->next) { |
| 552 |
_add_a_file((gchar *) Lcur->data, (GtkTreeStore *)Ltreemodel, &Liter, Lg, Ldatasize); |
_add_a_file((gchar *) Lcur->data, (GtkTreeStore *)Ltreemodel, &Liter, Lg, Ldatasize, NULL); |
| 553 |
|
|
| 554 |
} |
} |
| 555 |
g_slist_free(Lfiles); |
g_slist_free(Lfiles); |
| 611 |
|
|
| 612 |
Lfiles = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(Lfilesel)); |
Lfiles = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(Lfilesel)); |
| 613 |
for (Lcur = Lfiles; Lcur && Lcur->data; Lcur = Lcur->next) { |
for (Lcur = Lfiles; Lcur && Lcur->data; Lcur = Lcur->next) { |
| 614 |
_add_a_file((gchar *) Lcur->data, GTK_TREE_STORE(Ltreemodel), &Liter, Lg, Ldatasize); |
_add_a_file((gchar *) Lcur->data, GTK_TREE_STORE(Ltreemodel), &Liter, Lg, Ldatasize, NULL); |
| 615 |
|
|
| 616 |
} |
} |
| 617 |
g_slist_free(Lfiles); |
g_slist_free(Lfiles); |
| 1057 |
Ltxt = _("Do you really want to create an audio cd ?"); |
Ltxt = _("Do you really want to create an audio cd ?"); |
| 1058 |
Ltitle = _("Writing audio cd in progress..."); |
Ltitle = _("Writing audio cd in progress..."); |
| 1059 |
Ldevicename1 = get_drive_info(Lg, "dstaudiocombo"); |
Ldevicename1 = get_drive_info(Lg, "dstaudiocombo"); |
| 1060 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_BLANK)); |
Llmediarequis1 = manage_mediarequis(NULL, |
| 1061 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_APPENDABLE)); |
_MEDIA_CDR + _MEDIA_BLANK, _MEDIA_CDR + _MEDIA_APPENDABLE, |
| 1062 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_BLANK)); |
_MEDIA_CDRW + _MEDIA_BLANK, _MEDIA_CDRW + _MEDIA_APPENDABLE, |
| 1063 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_APPENDABLE)); |
_MEDIA_CDRW + _MEDIA_NOBLANK, -1); |
|
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_NOBLANK)); |
|
| 1064 |
Lmediatitle1 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
Lmediatitle1 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
| 1065 |
} else if (g_str_has_prefix(Lname, "btnburndata") || g_str_has_prefix(Lname, "btnburndvddata")) { |
} else if (g_str_has_prefix(Lname, "btnburndata") || g_str_has_prefix(Lname, "btnburndvddata")) { |
| 1066 |
GtkTreeIter Liter; |
GtkTreeIter Liter; |
| 1096 |
} |
} |
| 1097 |
if (!Liso) { |
if (!Liso) { |
| 1098 |
Ltitle = _("Writing data cd in progress..."); |
Ltitle = _("Writing data cd in progress..."); |
| 1099 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_BLANK)); |
Llmediarequis1 = manage_mediarequis(NULL, |
| 1100 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_APPENDABLE)); |
_MEDIA_CDR + _MEDIA_BLANK, _MEDIA_CDR + _MEDIA_APPENDABLE, |
| 1101 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_BLANK)); |
_MEDIA_CDRW + _MEDIA_BLANK, _MEDIA_CDRW + _MEDIA_APPENDABLE, |
| 1102 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_APPENDABLE)); |
_MEDIA_CDRW + _MEDIA_NOBLANK, -1); |
|
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_NOBLANK)); |
|
| 1103 |
Lmediatitle1 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
Lmediatitle1 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
| 1104 |
} else { |
} else { |
| 1105 |
Ltitle = _("Writing iso image in progress..."); |
Ltitle = _("Writing iso image in progress..."); |
| 1110 |
if (!Liso) { |
if (!Liso) { |
| 1111 |
Ltxt = _("Do you really want to create a data dvd ?"); |
Ltxt = _("Do you really want to create a data dvd ?"); |
| 1112 |
Ltitle = _("Writing data dvd in progress..."); |
Ltitle = _("Writing data dvd in progress..."); |
| 1113 |
|
|
| 1114 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDR_P + _MEDIA_BLANK)); |
Llmediarequis1 = manage_mediarequis(NULL, |
| 1115 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDR_P + _MEDIA_APPENDABLE)); |
_MEDIA_DVDR_P + _MEDIA_BLANK, _MEDIA_DVDR_P + _MEDIA_APPENDABLE, |
| 1116 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDR_M + _MEDIA_BLANK)); |
_MEDIA_DVDR_M + _MEDIA_BLANK, _MEDIA_DVDR_M + _MEDIA_APPENDABLE, |
| 1117 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDR_M + _MEDIA_APPENDABLE)); |
_MEDIA_DVD_RAM, _MEDIA_DVDP_RW, _MEDIA_DVDM_RW, -1); |
|
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVD_RAM)); |
|
|
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDP_RW)); |
|
|
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_DVDM_RW)); |
|
| 1118 |
Lmediatitle1 = _MEDIA_TITLE_DVDRew; |
Lmediatitle1 = _MEDIA_TITLE_DVDRew; |
| 1119 |
} else { |
} else { |
| 1120 |
/* creation image iso */ |
/* creation image iso */ |
| 1130 |
Ldevicename1 = get_drive_info(Lg, "srccopycombo"); |
Ldevicename1 = get_drive_info(Lg, "srccopycombo"); |
| 1131 |
Liso = !Ldevicename1; |
Liso = !Ldevicename1; |
| 1132 |
if (!Liso) { |
if (!Liso) { |
| 1133 |
Llmediarequis1 = g_slist_append(Llmediarequis1, GINT_TO_POINTER(_MEDIA_CD + _MEDIA_NOBLANK)); |
Llmediarequis1 = manage_mediarequis(NULL, _MEDIA_CD + _MEDIA_NOBLANK, -1); |
| 1134 |
Lmediatitle1 = _MEDIA_CD; |
Lmediatitle1 = _MEDIA_CD; |
| 1135 |
} |
} |
| 1136 |
Ldevicename2 = get_drive_info(Lg, "dstcopycombo"); |
Ldevicename2 = get_drive_info(Lg, "dstcopycombo"); |
| 1137 |
|
|
| 1138 |
if (Ldevicename2) { |
if (Ldevicename2) { |
| 1139 |
Llmediarequis2 = g_slist_append(Llmediarequis2, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_BLANK)); |
Llmediarequis2 = manage_mediarequis(NULL, |
| 1140 |
Llmediarequis2 = g_slist_append(Llmediarequis2, GINT_TO_POINTER(_MEDIA_CDR + _MEDIA_APPENDABLE)); |
_MEDIA_CDR + _MEDIA_BLANK, _MEDIA_CDR + _MEDIA_APPENDABLE, |
| 1141 |
Llmediarequis2 = g_slist_append(Llmediarequis2, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_BLANK)); |
_MEDIA_CDRW + _MEDIA_BLANK, _MEDIA_CDRW + _MEDIA_APPENDABLE, |
| 1142 |
Llmediarequis2 = g_slist_append(Llmediarequis2, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_APPENDABLE)); |
_MEDIA_CDRW + _MEDIA_NOBLANK, -1); |
| 1143 |
Llmediarequis2 = g_slist_append(Llmediarequis2, GINT_TO_POINTER(_MEDIA_CDRW + _MEDIA_NOBLANK)); |
|
| 1144 |
Lmediatitle2 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
Lmediatitle2 = _MEDIA_TITLE_BLANKORAPPENDABLE; |
| 1145 |
} |
} |
| 1146 |
} |
} |
| 1205 |
gtk_widget_destroy(Lconfirm); |
gtk_widget_destroy(Lconfirm); |
| 1206 |
} |
} |
| 1207 |
|
|
| 1208 |
|
g_slist_free(Llmediarequis2); |
| 1209 |
|
g_slist_free(Llmediarequis1); |
| 1210 |
|
|
| 1211 |
sc_grave_destroy(Ldialoghash); |
sc_grave_destroy(Ldialoghash); |
| 1212 |
} |
} |
| 1213 |
|
|
| 1809 |
gint i; |
gint i; |
| 1810 |
gchar **Lallname = g_strsplit(Aseldata->data, "\n", 0); |
gchar **Lallname = g_strsplit(Aseldata->data, "\n", 0); |
| 1811 |
gchar *Lfilename = NULL; |
gchar *Lfilename = NULL; |
| 1812 |
GtkTreeIter Liter; |
GtkTreeIter Liter, Lfirstiter; |
| 1813 |
GtkTreePath *Lpath = NULL; |
GtkTreePath *Lpath = NULL; |
| 1814 |
|
|
| 1815 |
gtk_tree_view_get_cursor(GTK_TREE_VIEW(Aliste), &Lpath, NULL); |
gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(Aliste), Ax, Ay, &Lpath, NULL); |
| 1816 |
if (!Lpath) { |
if (!Lpath) { |
| 1817 |
if (!gtk_tree_model_get_iter_first(Ltreemodel, &Liter)) { |
if (!gtk_tree_model_get_iter_first(Ltreemodel, &Liter)) { |
| 1818 |
gtk_drag_finish (Acontext, FALSE, FALSE, Atime); |
gtk_drag_finish (Acontext, FALSE, FALSE, Atime); |
| 1828 |
if (g_ascii_strncasecmp(Lunfic, "file://", 7)) continue; |
if (g_ascii_strncasecmp(Lunfic, "file://", 7)) continue; |
| 1829 |
if (!(Lfilename = g_filename_from_uri(Lunfic, NULL, NULL))) continue; |
if (!(Lfilename = g_filename_from_uri(Lunfic, NULL, NULL))) continue; |
| 1830 |
|
|
| 1831 |
_add_a_file(Lfilename, GTK_TREE_STORE(Ltreemodel), &Liter, Lg, Ldatasize); |
_add_a_file(Lfilename, GTK_TREE_STORE(Ltreemodel), &Liter, Lg, Ldatasize, |
| 1832 |
|
i == 0 ? &Lfirstiter : NULL); |
| 1833 |
|
|
| 1834 |
g_free(Lfilename); |
g_free(Lfilename); |
| 1835 |
} |
} |
| 1837 |
g_strfreev(Lallname); |
g_strfreev(Lallname); |
| 1838 |
|
|
| 1839 |
/* expand element ajoute */ |
/* expand element ajoute */ |
| 1840 |
if ((Lpath = gtk_tree_model_get_path(Ltreemodel, &Liter))) { |
if ((Lpath = gtk_tree_model_get_path(Ltreemodel, &Lfirstiter))) { |
| 1841 |
gtk_tree_view_expand_row(GTK_TREE_VIEW(Aliste), Lpath, TRUE); |
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(Aliste), Lpath); |
| 1842 |
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(Aliste), Lpath, NULL, FALSE, 0, 0); |
| 1843 |
|
gtk_tree_view_set_cursor(GTK_TREE_VIEW(Aliste), Lpath, NULL, TRUE); |
| 1844 |
gtk_tree_path_free(Lpath); |
gtk_tree_path_free(Lpath); |
| 1845 |
} |
} |
| 1846 |
|
|
| 1868 |
|
|
| 1869 |
gtk_tree_model_get_iter(Ltreemodel, &Litersrc, Lpathsrc); |
gtk_tree_model_get_iter(Ltreemodel, &Litersrc, Lpathsrc); |
| 1870 |
gtk_tree_model_get_iter(Ltreemodel, &Literdst, Lpathdst); |
gtk_tree_model_get_iter(Ltreemodel, &Literdst, Lpathdst); |
| 1871 |
|
|
| 1872 |
gtk_tree_model_get(Ltreemodel, &Literdst, 0, &Ltype, -1); |
gtk_tree_model_get(Ltreemodel, &Literdst, 0, &Ltype, -1); |
| 1873 |
|
|
| 1874 |
|
/* on ne deplace pas le CD root */ |
| 1875 |
|
if (Ltype == TYPE_CD) return; |
| 1876 |
|
|
| 1877 |
if (Ltype == TYPE_FILE) { |
if (Ltype == TYPE_FILE) { |
| 1878 |
gtk_tree_store_insert_after(GTK_TREE_STORE(Ltreemodel), &Liternew, NULL, &Literdst); |
gtk_tree_store_insert_after(GTK_TREE_STORE(Ltreemodel), &Liternew, NULL, &Literdst); |
| 1879 |
} else { |
} else { |