]> git.sesse.net Git - vlc/blob - src/interface/interaction.c
071a54c08ab5a77d398a52c2c60319c570f4ca42
[vlc] / src / interface / interaction.c
1 /*****************************************************************************
2  * interaction.c: User interaction functions
3  *****************************************************************************
4  * Copyright (C) 2005-2006 VideoLAN
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Felix Kühne <fkuehne@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /**
26  *   \file
27  *   This file contains functions related to user interaction management
28  */
29
30 /*****************************************************************************
31  * Preamble
32  *****************************************************************************/
33 #include <stdlib.h>                                      /* free(), strtol() */
34 #include <stdio.h>                                                   /* FILE */
35 #include <string.h>                                            /* strerror() */
36
37 #include <vlc/vlc.h>
38 #include <vlc/input.h>
39
40 #include "vlc_interaction.h"
41 #include "vlc_interface.h"
42 #include "vlc_playlist.h"
43
44 /*****************************************************************************
45  * Local prototypes
46  *****************************************************************************/
47 static void                  intf_InteractionInit( playlist_t *p_playlist );
48 static interaction_t *       intf_InteractionGet( vlc_object_t *p_this );
49 static void                  intf_InteractionSearchInterface( interaction_t *
50                                                           p_interaction );
51 static int                   intf_WaitAnswer( interaction_t *p_interact,
52                              interaction_dialog_t *p_dialog );
53 static int                   intf_Send( interaction_t *p_interact,
54                              interaction_dialog_t *p_dialog );
55 static interaction_dialog_t *intf_InteractionGetById( vlc_object_t* , int );
56 static void                  intf_InteractionDialogDestroy(
57                                               interaction_dialog_t *p_dialog );
58
59 /**
60  * Send an interaction element to the user
61  *
62  * \param p_this the calling vlc_object_t
63  * \param p_interact the interaction element
64  * \return VLC_SUCCESS or an error code
65  */
66 int  __intf_Interact( vlc_object_t *p_this, interaction_dialog_t *p_dialog )
67 {
68     interaction_t *p_interaction = intf_InteractionGet( p_this );
69
70     /* Get an id, if we don't already have one */
71     if( p_dialog->i_id == 0 )
72     {
73         p_dialog->i_id = ++p_interaction->i_last_id;
74     }
75
76     if( p_this->i_flags & OBJECT_FLAGS_NOINTERACT ) return VLC_EGENERIC;
77
78     if( !config_GetInt(p_this, "interact") ) return VLC_EGENERIC;
79
80     p_dialog->p_interaction = p_interaction;
81     p_dialog->p_parent = p_this;
82
83     if( p_dialog->i_type == INTERACT_DIALOG_TWOWAY )
84     {
85         return intf_WaitAnswer( p_interaction, p_dialog );
86     }
87     else
88     {
89         p_dialog->i_flags |=  DIALOG_GOT_ANSWER;
90         return intf_Send( p_interaction, p_dialog );
91     }
92 }
93
94 /**
95  * Destroy the interaction system
96  * \param The interaction object to destroy
97  * \return nothing
98  */
99 void intf_InteractionDestroy( interaction_t *p_interaction )
100 {
101     int i;
102
103     // Remove all dialogs - Interfaces must be able to clean up their data
104
105     for( i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
106     {
107         interaction_dialog_t * p_dialog = p_interaction->pp_dialogs[i];
108         intf_InteractionDialogDestroy( p_dialog );
109         REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
110     }
111
112     vlc_object_destroy( p_interaction );
113 }
114
115 /**
116  * The main interaction processing loop
117  * This function is called from the playlist loop
118  *
119  * \param p_playlist the parent playlist
120  * \return nothing
121  */
122 void intf_InteractionManage( playlist_t *p_playlist )
123 {
124     vlc_value_t val;
125     int i_index;
126     interaction_t *p_interaction;
127
128     p_interaction = p_playlist->p_interaction;
129
130     // Nothing to do
131     if( p_interaction->i_dialogs == 0 ) return;
132
133     vlc_mutex_lock( &p_interaction->object_lock );
134
135     intf_InteractionSearchInterface( p_interaction );
136
137     if( !p_interaction->p_intf )
138     {
139         // We mark all dialogs as answered with their "default" answer
140         for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
141         {
142             interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
143
144             // Give default answer
145             p_dialog->i_return = DIALOG_DEFAULT;
146             if( p_dialog->i_flags & DIALOG_OK_CANCEL )
147                 p_dialog->i_return = DIALOG_CANCELLED;
148
149             // Pretend we have hidden and destroyed it
150             if( p_dialog->i_status == HIDDEN_DIALOG )
151             {
152                 p_dialog->i_status = DESTROYED_DIALOG;
153             }
154             else
155             {
156                 p_dialog->i_status = HIDING_DIALOG;
157             }
158         }
159     }
160     else
161     {
162         vlc_object_yield( p_interaction->p_intf );
163     }
164
165     for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
166     {
167         interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
168         switch( p_dialog->i_status )
169         {
170         case ANSWERED_DIALOG:
171             // Ask interface to hide it
172             p_dialog->i_action = INTERACT_HIDE;
173             val.p_address = p_dialog;
174             if( p_interaction->p_intf )
175                 var_Set( p_interaction->p_intf, "interaction", val );
176             p_dialog->i_status = HIDING_DIALOG;
177             break;
178         case UPDATED_DIALOG:
179             p_dialog->i_action = INTERACT_UPDATE;
180             val.p_address = p_dialog;
181             if( p_interaction->p_intf )
182                 var_Set( p_interaction->p_intf, "interaction", val );
183             p_dialog->i_status = SENT_DIALOG;
184             break;
185         case HIDDEN_DIALOG:
186             if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break;
187             if( !(p_dialog->i_flags & DIALOG_REUSABLE) )
188             {
189                 p_dialog->i_action = INTERACT_DESTROY;
190                 val.p_address = p_dialog;
191                 if( p_interaction->p_intf )
192                     var_Set( p_interaction->p_intf, "interaction", val );
193             }
194             break;
195         case DESTROYED_DIALOG:
196             // Interface has now destroyed it, remove it
197             REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs,
198                          i_index);
199             i_index--;
200             intf_InteractionDialogDestroy( p_dialog );
201             break;
202         case NEW_DIALOG:
203             // This is truly a new dialog, send it.
204             p_dialog->i_action = INTERACT_NEW;
205             val.p_address = p_dialog;
206             if( p_interaction->p_intf )
207                 var_Set( p_interaction->p_intf, "interaction", val );
208             p_dialog->i_status = SENT_DIALOG;
209             break;
210         }
211     }
212
213     if( p_interaction->p_intf )
214     {
215         vlc_object_release( p_interaction->p_intf );
216     }
217
218     vlc_mutex_unlock( &p_playlist->p_interaction->object_lock );
219 }
220
221
222 #define INTERACT_INIT( new )                                            \
223         new = (interaction_dialog_t*)malloc(                            \
224                         sizeof( interaction_dialog_t ) );               \
225         new->psz_title = NULL;                                          \
226         new->psz_description = NULL;                                    \
227         new->p_private = NULL;                                          \
228         new->i_id = 0;                                                  \
229         new->i_flags = 0;                                               \
230         new->i_status = NEW_DIALOG;
231
232 #define INTERACT_FREE( new )                                            \
233         if( new->psz_title ) free( new->psz_title );                    \
234         if( new->psz_description ) free( new->psz_description );
235
236 /** Helper function to send an error message
237  *  \param p_this     Parent vlc_object
238  *  \param i_id       A predefined ID, 0 if not applicable
239  *  \param psz_title  Title for the dialog
240  *  \param psz_format The message to display
241  *  */
242 void __intf_UserFatal( vlc_object_t *p_this,
243                        const char *psz_title,
244                        const char *psz_format, ... )
245 {
246     va_list args;
247     interaction_dialog_t *p_new = NULL;
248     int i_id = DIALOG_ERRORS;
249
250     if( i_id > 0 )
251     {
252         p_new = intf_InteractionGetById( p_this, i_id );
253     }
254     if( !p_new )
255     {
256         INTERACT_INIT( p_new );
257         if( i_id > 0 ) p_new->i_id = i_id ;
258     }
259     else
260     {
261         p_new->i_status = UPDATED_DIALOG;
262     }
263
264     p_new->i_flags |= DIALOG_REUSABLE;
265
266     p_new->i_type = INTERACT_DIALOG_ONEWAY;
267     p_new->psz_title = strdup( psz_title );
268
269     va_start( args, psz_format );
270     vasprintf( &p_new->psz_description, psz_format, args );
271     va_end( args );
272
273     p_new->i_flags |= DIALOG_CLEAR_NOSHOW;
274
275     intf_Interact( p_this, p_new );
276 }
277
278 /** Helper function to ask a yes-no question
279  *  \param p_this           Parent vlc_object
280  *  \param psz_title        Title for the dialog
281  *  \param psz_description  A description
282  *  \return                 Clicked button code
283  */
284 int __intf_UserYesNo( vlc_object_t *p_this,
285                       const char *psz_title,
286                       const char *psz_description )
287 {
288     int i_ret;
289     interaction_dialog_t *p_new = NULL;
290
291     INTERACT_INIT( p_new );
292
293     p_new->i_type = INTERACT_DIALOG_TWOWAY;
294     p_new->psz_title = strdup( psz_title );
295     p_new->psz_description = strdup( psz_description );
296     p_new->i_flags = DIALOG_YES_NO_CANCEL;
297
298     i_ret = intf_Interact( p_this, p_new );
299
300     return i_ret;
301 }
302
303 /** Helper function to trigger a okay-cancel dialogue
304  *  \param p_this           Parent vlc_object
305  *  \param psz_title        Title for the dialog
306  *  \param psz_description  A description
307  *  \return                 Clicked button code
308  */
309 int __intf_UserOkayCancel( vlc_object_t *p_this,
310                       const char *psz_title,
311                       const char *psz_description )
312 {
313     int i_ret;
314     interaction_dialog_t *p_new = NULL;
315
316     INTERACT_INIT( p_new );
317
318     p_new->i_type = INTERACT_DIALOG_TWOWAY;
319     p_new->psz_title = strdup( psz_title );
320     p_new->psz_description = strdup( psz_description );
321     p_new->i_flags = DIALOG_OK_CANCEL;
322
323     i_ret = intf_Interact( p_this, p_new );
324
325     return i_ret;
326 }
327
328 /** Helper function to create a dialogue showing a progress-bar with some info
329  *  \param p_this           Parent vlc_object
330  *  \param psz_title        Title for the dialog
331  *  \param psz_status       Current status
332  *  \param f_position       Current position (0.0->100.0)
333  *  \return                 Dialog id, to give to UserProgressUpdate
334  */
335 int __intf_UserProgress( vlc_object_t *p_this,
336                          const char *psz_title,
337                          const char *psz_status,
338                          float f_pos )
339 {
340     int i_ret;
341     interaction_dialog_t *p_new = NULL;
342
343     INTERACT_INIT( p_new );
344
345     p_new->i_type = INTERACT_DIALOG_ONEWAY;
346     p_new->psz_title = strdup( psz_title );
347     p_new->psz_description = strdup( psz_status );
348     p_new->val.f_float = f_pos;
349
350     p_new->i_flags = DIALOG_USER_PROGRESS;
351
352     i_ret = intf_Interact( p_this, p_new );
353
354     return p_new->i_id;
355 }
356
357 /** Update a progress bar in a dialogue
358  *  \param p_this           Parent vlc_object
359  *  \param i_id             Identifier of the dialog
360  *  \param psz_status       New status
361  *  \param f_position       New position (0.0->100.0)
362  *  \return                 nothing
363  */
364 void __intf_UserProgressUpdate( vlc_object_t *p_this, int i_id,
365                                 const char *psz_status, float f_pos )
366 {
367     interaction_t *p_interaction = intf_InteractionGet( p_this );
368     interaction_dialog_t *p_dialog;
369
370     if( !p_interaction ) return;
371
372     vlc_mutex_lock( &p_interaction->object_lock );
373     p_dialog  =  intf_InteractionGetById( p_this, i_id );
374
375     if( !p_dialog )
376     {
377         vlc_mutex_unlock( &p_interaction->object_lock ) ;
378         return;
379     }
380
381     if( p_dialog->psz_description )
382         free( p_dialog->psz_description );
383     p_dialog->psz_description = strdup( psz_status );
384
385     p_dialog->val.f_float = f_pos;
386
387     p_dialog->i_status = UPDATED_DIALOG;
388     vlc_mutex_unlock( &p_interaction->object_lock) ;
389 }
390
391 /** Helper function to make a login/password dialogue
392  *  \param p_this           Parent vlc_object
393  *  \param psz_title        Title for the dialog
394  *  \param psz_description  A description
395  *  \param ppsz_login       Returned login
396  *  \param ppsz_password    Returned password
397  *  \return                 Clicked button code
398  */
399 int __intf_UserLoginPassword( vlc_object_t *p_this,
400                               const char *psz_title,
401                               const char *psz_description,
402                               char **ppsz_login,
403                               char **ppsz_password )
404 {
405
406     int i_ret;
407     interaction_dialog_t *p_new = NULL;
408
409     INTERACT_INIT( p_new );
410
411     p_new->i_type = INTERACT_DIALOG_TWOWAY;
412     p_new->psz_title = strdup( psz_title );
413     p_new->psz_description = strdup( psz_description );
414
415     p_new->i_flags = DIALOG_LOGIN_PW_OK_CANCEL;
416
417     i_ret = intf_Interact( p_this, p_new );
418
419     if( i_ret != DIALOG_CANCELLED )
420     {
421         *ppsz_login = strdup( p_new->psz_returned[0] );
422         *ppsz_password = strdup( p_new->psz_returned[1] );
423     }
424     return i_ret;
425 }
426
427 /** Helper function to make a dialogue asking the user for !password string
428  *  \param p_this           Parent vlc_object
429  *  \param psz_title        Title for the dialog
430  *  \param psz_description  A description
431  *  \param ppsz_usersString Returned login
432  *  \return                 Clicked button code
433  */
434 int __intf_UserStringInput( vlc_object_t *p_this,
435                               const char *psz_title,
436                               const char *psz_description,
437                               char **ppsz_usersString )
438 {
439
440     int i_ret;
441     interaction_dialog_t *p_new = NULL;
442
443     INTERACT_INIT( p_new );
444
445     p_new->i_type = INTERACT_DIALOG_TWOWAY;
446     p_new->psz_title = strdup( psz_title );
447     p_new->psz_description = strdup( psz_description );
448
449     p_new->i_flags = DIALOG_PSZ_INPUT_OK_CANCEL;
450
451     i_ret = intf_Interact( p_this, p_new );
452
453     if( i_ret != DIALOG_CANCELLED )
454     {
455         *ppsz_usersString = strdup( p_new->psz_returned[0] );
456     }
457     return i_ret;
458 }
459
460 /** Helper function to create a progress-bar in the main interface with a
461  *  single-line description
462  *  \param p_this           Parent vlc_object
463  *  \param psz_status       Current status
464  *  \param f_position       Current position (0.0->100.0)
465  *  \return                 Dialog id, to give to IntfProgressUpdate
466  */
467 int __intf_IntfProgress( vlc_object_t *p_this,
468                          const char *psz_status,
469                          float f_pos )
470 {
471     int i_ret;
472     interaction_dialog_t *p_new = NULL;
473
474     INTERACT_INIT( p_new );
475
476     p_new->i_type = INTERACT_DIALOG_ONEWAY;
477     p_new->psz_description = strdup( psz_status );
478     p_new->val.f_float = f_pos;
479
480     p_new->i_flags = DIALOG_INTF_PROGRESS;
481
482     i_ret = intf_Interact( p_this, p_new );
483
484     return p_new->i_id;
485 }
486
487 /** Update the progress bar in the main interface
488  *  \param p_this           Parent vlc_object
489  *  \param i_id             Identifier of the dialog
490  *  \param psz_status       New status
491  *  \param f_position       New position (0.0->100.0)
492  *  \return                 nothing
493  */
494 void __intf_IntfProgressUpdate( vlc_object_t *p_this, int i_id,
495                                 const char *psz_status, float f_pos )
496 {
497     interaction_t *p_interaction = intf_InteractionGet( p_this );
498     interaction_dialog_t *p_dialog;
499
500     if( !p_interaction ) return;
501
502     vlc_mutex_lock( &p_interaction->object_lock );
503     p_dialog  =  intf_InteractionGetById( p_this, i_id );
504
505     if( !p_dialog )
506     {
507         vlc_mutex_unlock( &p_interaction->object_lock ) ;
508         return;
509     }
510
511     if( p_dialog->psz_description )
512         free( p_dialog->psz_description );
513     p_dialog->psz_description = strdup( psz_status );
514
515     p_dialog->val.f_float = f_pos;
516
517     p_dialog->i_status = UPDATED_DIALOG;
518     vlc_mutex_unlock( &p_interaction->object_lock) ;
519 }
520
521 /** Hide an interaction dialog
522  * \param p_this the parent vlc object
523  * \param i_id the id of the item to hide
524  * \return nothing
525  */
526 void __intf_UserHide( vlc_object_t *p_this, int i_id )
527 {
528     interaction_t *p_interaction = intf_InteractionGet( p_this );
529     interaction_dialog_t *p_dialog;
530
531     if( !p_interaction ) return;
532
533     vlc_mutex_lock( &p_interaction->object_lock );
534     p_dialog  =  intf_InteractionGetById( p_this, i_id );
535
536     if( !p_dialog )
537     {
538        vlc_mutex_unlock( &p_interaction->object_lock );
539        return;
540     }
541
542     p_dialog->i_status = ANSWERED_DIALOG;
543     vlc_mutex_unlock( &p_interaction->object_lock );
544 }
545
546
547
548 /**********************************************************************
549  * The following functions are local
550  **********************************************************************/
551
552 /* Get the interaction object. Create it if needed */
553 static interaction_t * intf_InteractionGet( vlc_object_t *p_this )
554 {
555     playlist_t *p_playlist;
556     interaction_t *p_interaction;
557
558     p_playlist = (playlist_t*) vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
559                                                 FIND_ANYWHERE );
560
561     if( !p_playlist )
562     {
563         return NULL;
564     }
565
566     if( p_playlist->p_interaction == NULL )
567     {
568         intf_InteractionInit( p_playlist );
569     }
570
571     p_interaction = p_playlist->p_interaction;
572
573     vlc_object_release( p_playlist );
574
575     return p_interaction;
576 }
577
578 /* Create the interaction object in the given playlist object */
579 static void intf_InteractionInit( playlist_t *p_playlist )
580 {
581     interaction_t *p_interaction;
582
583     p_interaction = vlc_object_create( VLC_OBJECT( p_playlist ),
584                                        sizeof( interaction_t ) );
585     if( !p_interaction )
586     {
587         msg_Err( p_playlist,"out of memory" );
588         return;
589     }
590
591     p_interaction->i_dialogs = 0;
592     p_interaction->pp_dialogs = NULL;
593     p_interaction->p_intf = NULL;
594     p_interaction->i_last_id = DIALOG_LAST_PREDEFINED + 1;
595
596     vlc_mutex_init( p_interaction , &p_interaction->object_lock );
597
598     p_playlist->p_interaction  = p_interaction;
599 }
600
601 /* Look for an interface suitable for interaction */
602 static void intf_InteractionSearchInterface( interaction_t *p_interaction )
603 {
604     vlc_list_t  *p_list;
605     int          i_index;
606
607     p_interaction->p_intf = NULL;
608
609     p_list = vlc_list_find( p_interaction, VLC_OBJECT_INTF, FIND_ANYWHERE );
610     if( !p_list )
611     {
612         msg_Err( p_interaction, "unable to create module list" );
613         return;
614     }
615
616     for( i_index = 0; i_index < p_list->i_count; i_index ++ )
617     {
618         intf_thread_t *p_intf = (intf_thread_t *)
619                                         p_list->p_values[i_index].p_object;
620         if( p_intf->b_interaction )
621         {
622             p_interaction->p_intf = p_intf;
623             break;
624         }
625     }
626     vlc_list_release ( p_list );
627 }
628
629 /* Add a dialog to the queue and wait for answer */
630 static int intf_WaitAnswer( interaction_t *p_interact,
631                             interaction_dialog_t *p_dialog )
632 {
633     int i;
634     vlc_bool_t b_found = VLC_FALSE;
635     vlc_mutex_lock( &p_interact->object_lock );
636     for( i = 0 ; i< p_interact->i_dialogs; i++ )
637     {
638         if( p_interact->pp_dialogs[i]->i_id == p_dialog->i_id )
639         {
640             b_found = VLC_TRUE;
641         }
642     }
643     if( ! b_found )
644     {
645         INSERT_ELEM( p_interact->pp_dialogs,
646                      p_interact->i_dialogs,
647                      p_interact->i_dialogs,
648                      p_dialog );
649     }
650     else
651         p_dialog->i_status = UPDATED_DIALOG;
652     vlc_mutex_unlock( &p_interact->object_lock );
653
654     /// \todo Check that the initiating object is not dying
655     while( p_dialog->i_status != ANSWERED_DIALOG &&
656            p_dialog->i_status != HIDING_DIALOG &&
657            p_dialog->i_status != HIDDEN_DIALOG &&
658            !p_dialog->p_parent->b_die )
659     {
660         msleep( 100000 );
661     }
662     /// \todo locking
663     if( p_dialog->p_parent->b_die )
664     {
665         p_dialog->i_return = DIALOG_CANCELLED;
666         p_dialog->i_status = ANSWERED_DIALOG;
667     }
668     p_dialog->i_flags |= DIALOG_GOT_ANSWER;
669     return p_dialog->i_return;
670 }
671
672 /* Add a dialog to the queue and return */
673 static int intf_Send( interaction_t *p_interact,
674                       interaction_dialog_t *p_dialog )
675 {
676     int i;
677     vlc_bool_t b_found = VLC_FALSE;
678     if( p_interact == NULL ) return VLC_ENOOBJ;
679     vlc_mutex_lock( &p_interact->object_lock );
680
681     for( i = 0 ; i< p_interact->i_dialogs; i++ )
682     {
683         if( p_interact->pp_dialogs[i]->i_id == p_dialog->i_id )
684         {
685             b_found = VLC_TRUE;
686         }
687     }
688     if( !b_found )
689     {
690         INSERT_ELEM( p_interact->pp_dialogs,
691                      p_interact->i_dialogs,
692                      p_interact->i_dialogs,
693                      p_dialog );
694     }
695     else
696         p_dialog->i_status = UPDATED_DIALOG;
697     // Pretend we already retrieved the "answer"
698     p_dialog->i_flags |= DIALOG_GOT_ANSWER;
699     vlc_mutex_unlock( &p_interact->object_lock );
700     return VLC_SUCCESS;
701 }
702
703 /* Find an interaction dialog by its id */
704 static interaction_dialog_t *intf_InteractionGetById( vlc_object_t* p_this,
705                                                        int i_id )
706 {
707     interaction_t *p_interaction = intf_InteractionGet( p_this );
708     int i;
709
710     if( !p_interaction ) return NULL;
711
712     for( i = 0 ; i< p_interaction->i_dialogs; i++ )
713     {
714         if( p_interaction->pp_dialogs[i]->i_id == i_id )
715         {
716             return p_interaction->pp_dialogs[i];
717         }
718     }
719     return NULL;
720 }
721
722 #define FREE( i ) { if( i ) free( i ); i = NULL; }
723
724 static void intf_InteractionDialogDestroy( interaction_dialog_t *p_dialog )
725 {
726  /*   FREE( p_dialog->val.psz_string );
727
728     FREE( p_dialog->psz_title );
729     FREE( p_dialog->psz_description );
730     
731     FREE( p_dialog->psz_returned[0] );
732     FREE( p_dialog->psz_returned[1] ); */
733
734     free( p_dialog );
735 }