| 12
 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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 
 | /// Fonction d'ouverture du fichier dans l'onglet
 
void ouvrir_fichier(GtkWidget *widget, Fenetre *window)
{
    gchar *utf8 = NULL;         /// permet la conversion vers utf8
    gchar *contenu = NULL;      /// contient le contenu du fichier
    onglet *onglet_actif=NULL;
    gint index;
 
    index = gtk_notebook_get_current_page(window->doc->onglet);
    printf("\n*******************\n");
    printf("Page courante : %d",index);
    onglet_actif = g_list_nth_data(window->doc->tous,index);
    if(onglet_actif != NULL)
    {
        printf("\nonglet actif : %d",index);
        printf("\n********************\n");
 
        onglet_actif->Chemin = findfic();
 
        if(onglet_actif->Chemin != NULL)
        {
            if(g_file_get_contents (onglet_actif->Chemin, &contenu, NULL, NULL))
            {
 
                onglet_actif->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(onglet_actif->zone_texte));
                gtk_text_buffer_get_iter_at_line (onglet_actif->buffer, &onglet_actif->iter, 0);
                utf8 = g_locale_to_utf8 (contenu, -1, NULL, NULL, NULL);
                g_free (contenu);
                contenu = NULL;
                gtk_text_buffer_insert (onglet_actif->buffer, &onglet_actif->iter, utf8, -1);
                g_free (utf8);
                utf8 = NULL;
 
                onglet_actif->nom = g_strrstr(onglet_actif->Chemin,"/")+1;
                printf("\n+++++++++++++++++\n");
                printf("Nom fichier : %s",onglet_actif->nom);
 
                gtk_label_set_text(GTK_LABEL(onglet_actif->label),onglet_actif->nom);
                printf("\nNom de l'onglet : %s",gtk_label_get_text(GTK_LABEL(onglet_actif->label)));
                printf("\n+++++++++++++++++\n");
 
                //gtk_widget_show_all(GTK_WIDGET(window->doc->onglet));
 
                onglet_actif->sauve = TRUE;
            }
        }
    } /// Fin de (onglet_actif != NULL)
} /// Fin de la fonction ouvrir_fichier() | 
Partager