1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| void LectureRepertoire(GtkWidget *Widget, gchar *Nom_Dossier)
{
/*Widgets nécessaires*/
GtkWidget *Fenetre_Repertoire;
GtkWidget *VBox;
GtkWidget *HBox;
GtkWidget *Bouton;
/*Initialisation des différents widgets*/
Fenetre_Repertoire = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(Fenetre_Repertoire), "Sélection des morceaux");
gtk_window_set_position(GTK_WINDOW(Fenetre_Repertoire), GTK_WIN_POS_CENTER);
VBox = gtk_vbox_new(FALSE, 0);
HBox = gtk_hbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(Fenetre_Repertoire), GTK_WIDGET(VBox));
GDir *Repertoire = g_dir_open(Nom_Dossier, 0, NULL);
if (Repertoire)
{
const gchar *Nom_Fichier = NULL;
printf("Contenu du dossier \"%s\" : \n", Nom_Dossier);
while((Nom_Fichier = g_dir_read_name(Repertoire)))
{
printf("%s\n", Nom_Fichier);
Bouton = gtk_check_button_new_with_label(Nom_Fichier);
gtk_box_pack_start(GTK_BOX(VBox), Bouton, FALSE, FALSE, 0);
}
gtk_container_add(GTK_CONTAINER(VBox), GTK_WIDGET(HBox));
Bouton = gtk_button_new_from_stock(GTK_STOCK_OK);
gtk_container_add(GTK_CONTAINER(HBox), GTK_WIDGET(Bouton));
g_signal_connect(G_OBJECT(Bouton), "clicked", G_CALLBACK(AjouterDansPlayList), (GtkWidget*)VBox);
Bouton = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
gtk_container_add(GTK_CONTAINER(HBox), GTK_WIDGET(Bouton));
g_dir_close(Repertoire), Repertoire = NULL;
gtk_widget_show_all(Fenetre_Repertoire);
}
} |
Partager