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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
typedef struct app
{
(...)
gchar* chemin;
}APP;
typedef struct dede
{
(...)
gchar* chemin;
}DEDE;
void recuperer_chemin (GtkWidget *bouton, GtkWidget *file_selection)
{
(...)
const gchar* prefixe = NULL;
const gchar* chemin = NULL;
chemin = gtk_file_selection_get_filename(GTK_FILE_SELECTION (file_selection) );
gtk_widget_destroy(file_selection);
(...)
prefixe = gtk_entry_get_text(GTK_ENTRY(pEntry));
break;
(...)
if(prefixe){
strcat((gchar*)chemin,"/");
strcat((gchar*)chemin,prefixe);
APP *app = creer_interface(chemin);
gtk_widget_show_all(app->window);
}
else{
(...)
}
}
APP* creer_interface(const gchar* chemin)
{
(...)
APP *app = NULL;
if((app = (APP*)malloc(sizeof(APP))) != NULL)
{
(...)
app->chemin = (char*)chemin;
(...)
/* Creation du boutton 'afficher' (insere dans la table) */
app->button = gtk_button_new_with_label ("Thanks to choose an area");
g_signal_connect (G_OBJECT (app->button), "clicked", G_CALLBACK (AffichRep), app);
gtk_table_attach_defaults(GTK_TABLE(app->table), app->button, 6, 11, 2, 7);
(...)
}
return app;
}
void AffichRep (GtkWidget *bouton, APP* app)
{
(...)
DEDE *dede;
(...)
if(app->affich){
dede = (DEDE*)malloc(sizeof(DEDE));
(...)
dede->chemin = app->chemin;
/* Création de l'image affichée (insérée dans la vbox2) */
for(k=0;k<256;k++)nom[k]=(int)NULL;
for(k=0;k<4;k++)num[k]=(int)NULL;
strcpy(nom,app->chemin);
sprintf(num,"%d",dede->etat);
strcat(nom,num);
strcat(nom,".bmp");
dede->pImg2 = gtk_image_new_from_file (nom);
gtk_box_pack_start (GTK_BOX (pVbox2), dede->pImg2, TRUE, TRUE, 0);
(...)
// Voila pourquoi j'utilises dede :
g_signal_connect(G_OBJECT(pSuiv), "clicked", G_CALLBACK(OnClickNext), dede);
(...)
gtk_widget_show_all (pWindow);
} |
Partager