rem: devise de l'opÃ©ration */
add: devise de l'op©ration */
context: void demande_taux_de_change ( struct struct_devise *devise_compte,			      struct struct_devise *devise ,			      gint une_devise_compte_egale_x_devise_ope,			      gdouble taux_change,			      gdouble frais_change,			      gboolean force ){    GtkWidget *dialog, *label, *entree, *menu, *item, *hbox, *entree_frais, *paddingbox;    struct cached_exchange_rate * cache;    gint resultat;    if ( !force && 	 (cache = cached_exchange_rate ( devise_compte, devise )) )    {	taux_de_change[0] = cache -> rate;	taux_de_change[1] = cache -> fees;	return;    }    dialog = gtk_dialog_new_with_buttons ( _("Enter exchange rate"),					   GTK_WINDOW (window),					   GTK_DIALOG_MODAL,					   GTK_STOCK_OK, 0,					   NULL );    gtk_signal_connect ( GTK_OBJECT ( dialog), "delete_event",			 GTK_SIGNAL_FUNC ( blocage_boites_dialogues ),			 NULL );    paddingbox = new_paddingbox_with_title ( GTK_WIDGET ( GTK_DIALOG ( dialog ) -> vbox ), FALSE, 					     g_strdup_printf( _("Please enter exchange rate for %s"), 							      devise->nom_devise) );    gtk_container_set_border_width ( GTK_CONTAINER ( paddingbox ), 6 );    gtk_box_set_spacing ( GTK_BOX ( GTK_DIALOG (dialog)->vbox ), 6 );        /* crÃ©ation de la ligne du change */    hbox = gtk_hbox_new ( FALSE, 5 );    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,			 FALSE, FALSE, 0);    label = gtk_label_new ( POSTSPACIFY(_("A")) );    gtk_box_pack_start ( GTK_BOX ( hbox ), label,			 FALSE, FALSE, 0);    option_menu_devise_1= gtk_option_menu_new ();    gtk_box_pack_start ( GTK_BOX ( hbox ), option_menu_devise_1,			 TRUE, TRUE, 0);    label = gtk_label_new ( SPACIFY(_("equals")) );    gtk_box_pack_start ( GTK_BOX ( hbox ), label,			 FALSE, FALSE, 0);    entree = gtk_entry_new ();    gtk_widget_set_usize ( entree, 100, FALSE );    gtk_entry_set_activates_default ( GTK_ENTRY ( entree ),				      TRUE );    gtk_box_pack_start ( GTK_BOX ( hbox ), entree,			 TRUE, TRUE, 0);    option_menu_devise_2 = gtk_option_menu_new ();    gtk_box_pack_start ( GTK_BOX ( hbox ), option_menu_devise_2,			 TRUE, TRUE, 0);    /* crÃ©ation du menu de la 1Ãšre devise ( le menu comporte la devise       courante et celle associÃ©e ) */    menu = gtk_menu_new ();    item = gtk_menu_item_new_with_label ( devise -> nom_devise );    g_object_set_data ( G_OBJECT ( item ), "adr_devise", devise );    gtk_menu_append ( GTK_MENU ( menu ), item );    item = gtk_menu_item_new_with_label ( devise_compte -> nom_devise );    g_object_set_data ( G_OBJECT ( item ), "adr_devise", devise_compte );    gtk_menu_append ( GTK_MENU ( menu ), item );    gtk_option_menu_set_menu ( GTK_OPTION_MENU ( option_menu_devise_1 ), menu );    g_signal_connect ( G_OBJECT ( option_menu_devise_1 ),		       "changed",		       GTK_SIGNAL_FUNC ( devise_selectionnee ),		       NULL );    g_object_set_data ( G_OBJECT (option_menu_devise_1), "associate",			option_menu_devise_2 );    g_object_set_data ( G_OBJECT (option_menu_devise_1), "currency", devise );    /* crÃ©ation du menu de la 2Ãšme devise ( le menu comporte la devise       courante et celle associÃ©e ) */    menu = gtk_menu_new ();    item = gtk_menu_item_new_with_label ( devise -> nom_devise );    g_object_set_data ( G_OBJECT ( item ), "adr_devise", devise );    gtk_menu_append ( GTK_MENU ( menu ), item );    item = gtk_menu_item_new_with_label ( devise_compte -> nom_devise );    g_object_set_data ( G_OBJECT ( item ), "adr_devise", devise_compte );    gtk_menu_append ( GTK_MENU ( menu ), item );    gtk_option_menu_set_menu ( GTK_OPTION_MENU ( option_menu_devise_2 ), menu );    g_signal_connect ( G_OBJECT ( option_menu_devise_2 ),		       "changed",		       GTK_SIGNAL_FUNC ( devise_selectionnee ),		       GINT_TO_POINTER ( 1 ));    g_object_set_data ( G_OBJECT (option_menu_devise_2), "associate",			option_menu_devise_1 );    g_object_set_data ( G_OBJECT (option_menu_devise_2), "currency", devise );    /* crÃ©ation de la ligne des frais de change */    hbox = gtk_hbox_new ( FALSE, 5 );    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox,			 FALSE, FALSE, 5 );    label = gtk_label_new ( COLON(_("Exchange fees")) );    gtk_box_pack_start ( GTK_BOX ( hbox ), label,			 FALSE, FALSE, 5 );    entree_frais = gtk_entry_new ();    gtk_entry_set_activates_default ( GTK_ENTRY ( entree_frais ),				      TRUE );    gtk_box_pack_start ( GTK_BOX ( hbox ), entree_frais,			 TRUE, TRUE, 5 );    label = gtk_label_new ( devise_compte -> nom_devise );    gtk_box_pack_start ( GTK_BOX ( hbox ), label,			 FALSE, FALSE, 5 );    gtk_widget_show_all ( dialog );    /* choix des 1Ãšre et 2Ãšme devise */    if ( taux_change || frais_change )    {	if ( une_devise_compte_egale_x_devise_ope )	{	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_1 ),					  1 );	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_2 ),					  0 );	}	else	{	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_1 ),					  0 );	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_2 ),					  1 );	}	gtk_entry_set_text ( GTK_ENTRY ( entree ),			     g_strdup_printf ( "%f", taux_change ));	gtk_entry_set_text ( GTK_ENTRY ( entree_frais ),			     g_strdup_printf ( "%4.2f", fabs ( frais_change )));    }    else    {	/* vÃ©rifie s'il y a dÃ©jÃ  une association entre la devise du	   compte et la devise de l'opÃ©ration */	if ( devise_compte -> no_devise_en_rapport == devise -> no_devise )	{	    /* il y a une association de la devise du compte vers la	       devise de l'opÃ©ration */	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_1 ),					  devise_compte -> une_devise_1_egale_x_devise_2 );	    gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_2 ),					  !( devise_compte -> une_devise_1_egale_x_devise_2 ));	    /* si un change est dÃ©jÃ  entrÃ©, on l'affiche */	    if ( devise_compte -> date_dernier_change )		gtk_entry_set_text ( GTK_ENTRY ( entree ),				     g_strdup_printf ( "%f",						       devise_compte -> change ));	}	else	    if ( devise -> no_devise_en_rapport == devise_compte -> no_devise )	    {		/* il y a une association de la devise de l'opÃ©ration		   vers la devise du compte */		gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_1 ),					      !(devise -> une_devise_1_egale_x_devise_2 ));		gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_2 ),					      devise -> une_devise_1_egale_x_devise_2 );		/* si un change est dÃ©jÃ  entrÃ©, on l'affiche */		if ( devise -> date_dernier_change )		    gtk_entry_set_text ( GTK_ENTRY ( entree ),					 g_strdup_printf ( "%f",							   devise -> change ));	    }	    else	    {		/* il n'y a aucun rapport Ã©tabli entre les 2 devises */		gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_1 ),					      1 );		gtk_option_menu_set_history ( GTK_OPTION_MENU ( option_menu_devise_2 ),					      0 );	    }    }    /* on lance la fenetre */    resultat = gtk_dialog_run ( GTK_DIALOG ( dialog ));    if ( !resultat )    {	struct struct_devise *devise_tmp;	taux_de_change[0] = my_strtod ( (gchar *) gtk_entry_get_text ( GTK_ENTRY ( entree )),					NULL );	taux_de_change[1] = my_strtod ( (gchar *) gtk_entry_get_text ( GTK_ENTRY ( entree_frais )),					NULL );	/* FIXME: use gtk_menu_get_active + gtk_option_menu_get_menu ? */	devise_tmp = g_object_get_data ( G_OBJECT ( GTK_OPTION_MENU ( option_menu_devise_1 ) -> menu_item ),					 "adr_devise" );	if ( devise_tmp -> no_devise != devise -> no_devise )	    taux_de_change[0] = -taux_de_change[0];	update_exchange_rate_cache ( devise_compte, devise, 				     taux_de_change[0], taux_de_change[1] );    }    else    {	taux_de_change[0] = 0;	taux_de_change[1] = 0;    }    gtk_widget_destroy ( GTK_WIDGET ( dialog ));}