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
| void recuperer_chemin (GtkWidget *bouton, GtkWidget *file_selection)
{
const gchar* chemin;
GtkWidget *pImage;
GdkPixbuf *pixbuf;
GError *error = NULL;
GtkWidget *dialog;
chemin = gtk_file_selection_get_filename(GTK_FILE_SELECTION (file_selection) );
/* Chargement d'une image a partir d'un fichier */
// pixbuf = gdk_pixbuf_new_from_file(chemin, &error);
// if(!error)
// {
// GdkPixbuf *pixbuf_mini = NULL;
// int w = gdk_pixbuf_get_width(pixbuf);
// int h = gdk_pixbuf_get_height(pixbuf);
//
// double W = 1200 * 0.7;
// double H = 600;
//
// double coeff = 1;
//
// if (w > h) {
// coeff = W / w;
// }
// else {
// coeff = H / h;
// }
//
// W = w * coeff;
// H = h * coeff;
//
// pixbuf_mini = gdk_pixbuf_scale_simple(pixbuf, W, H, GDK_INTERP_NEAREST);
// pImage = gtk_image_new_from_pixbuf(pixbuf_mini);
// gtk_box_pack_start(GTK_BOX(pVBox), pImage, FALSE, FALSE, 5);
// }
// else
// {
// g_critical(error->message);
// }
dialog = gtk_message_dialog_new(GTK_WINDOW(file_selection),
GTK_DIALOG_MODAL,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Vous avez choisi :\n%s", chemin);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
gtk_widget_destroy(file_selection);
} |
Partager