]> git.sesse.net Git - vlc/blob - modules/gui/pda/pda_callbacks.c
PDA Interface:
[vlc] / modules / gui / pda / pda_callbacks.c
1 /*****************************************************************************
2  * pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin.
3  *****************************************************************************
4  * Copyright (C) 2000, 2001 VideoLAN
5  * $Id: pda_callbacks.c,v 1.12 2003/11/09 19:49:48 jpsaman Exp $
6  *
7  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <sys/types.h>                                              /* off_t */
28 #include <stdlib.h>
29 #include <vlc/vlc.h>
30 #include <vlc/intf.h>
31 #include <vlc/vout.h>
32
33 #include <stdio.h>
34 #include <string.h>
35 #include <dirent.h>
36 #include <sys/stat.h>
37 #include <unistd.h>
38
39 #ifdef HAVE_CONFIG_H
40 #  include <config.h>
41 #endif
42
43 #include <gtk/gtk.h>
44
45 #include "pda_callbacks.h"
46 #include "pda_interface.h"
47 #include "pda_support.h"
48 #include "pda.h"
49
50 #define VLC_MAX_MRL     256
51
52 static char* get_file_stat(const char *path, uid_t *uid, gid_t *gid, off_t *size);
53
54 /*****************************************************************************
55  * Useful function to retrieve p_intf
56  ****************************************************************************/
57 void * E_(__GtkGetIntf)( GtkWidget * widget )
58 {
59     void *p_data;
60
61     if( GTK_IS_MENU_ITEM( widget ) )
62     {
63         /* Look for a GTK_MENU */
64         while( widget->parent && !GTK_IS_MENU( widget ) )
65         {
66             widget = widget->parent;
67         }
68
69         /* Maybe this one has the data */
70         p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
71         if( p_data )
72         {
73             return p_data;
74         }
75
76         /* Otherwise, the parent widget has it */
77         widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
78     }
79
80     /* We look for the top widget */
81     widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) );
82
83     p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
84
85     return p_data;
86 }
87
88 void PlaylistRebuildListStore( GtkListStore * p_list, playlist_t * p_playlist )
89 {
90     GtkTreeIter iter;
91     int         i_dummy;
92     gchar *     ppsz_text[2];
93     GdkColor    red;
94     red.red     = 65535;
95     red.blue    = 0;
96     red.green   = 0;
97
98     vlc_mutex_lock( &p_playlist->object_lock );
99     for( i_dummy = p_playlist->i_size ; i_dummy-- ; )
100     {
101         ppsz_text[0] = p_playlist->pp_items[i_dummy]->psz_name;
102         ppsz_text[1] = "no info";
103         gtk_list_store_append (p_list, &iter);
104         gtk_list_store_set (p_list, &iter,
105                             0, ppsz_text[0],
106                             1, ppsz_text[1],
107                             -1);
108     }
109     vlc_mutex_unlock( &p_playlist->object_lock );
110 }
111
112
113 /*****************************************************************************
114  * Helper functions for URL changes in Media and Preferences notebook pages.
115  ****************************************************************************/
116 void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
117 {
118     intf_thread_t *p_intf = GtkGetIntf( widget );
119     playlist_t   *p_playlist;
120     GtkTreeView  *p_tvplaylist;
121
122     p_playlist = (playlist_t *)
123              vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
124
125     if( p_playlist ==  NULL)
126     {
127         return;
128     }
129
130     if( p_playlist )
131     {
132         if (p_intf->p_sys->b_autoplayfile)
133         {
134             playlist_Add( p_playlist, (char*)psz_url, 0, 0,
135                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END);
136         }
137         else
138         {
139             playlist_Add( p_playlist, (char*)psz_url, 0, 0,
140                           PLAYLIST_APPEND, PLAYLIST_END );
141         }
142         vlc_object_release(  p_playlist );
143
144         p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(widget), "tvPlaylist" );
145         if (p_tvplaylist)
146         {
147             GtkListStore *p_liststore;
148             p_liststore = (GtkListStore *) gtk_tree_view_get_model(p_tvplaylist);
149             PlaylistRebuildListStore(p_liststore, p_playlist);
150         }
151     }
152 }
153
154 /*****************************************************************
155  * Read directory helper function.
156  ****************************************************************/
157 void ReadDirectory(GtkListStore *p_list, char *psz_dir )
158 {
159     GtkTreeIter iter;
160     struct dirent **namelist;
161     int n=-1, status=-1;
162
163     g_print("changing to dir %s\n", psz_dir);
164     if (psz_dir)
165     {
166        status = chdir(psz_dir);
167        if (status<0)
168           g_print( "permision denied\n" );
169     }
170     n = scandir(".", &namelist, 0, alphasort);
171
172     if (n<0)
173         perror("scandir");
174     else
175     {
176         int i;
177         uint32_t uid;
178         uint32_t gid;
179         off_t  size;
180         gchar *ppsz_text[5];
181
182         /* XXX : kludge temporaire pour yopy */
183         ppsz_text[0]="..";
184         ppsz_text[1] = get_file_stat("..", &uid, &gid, &size);
185         ppsz_text[2] = "";
186         ppsz_text[3] = "";
187         ppsz_text[4] = "";
188
189         /* Add a new row to the model */
190         gtk_list_store_append (p_list, &iter);
191         gtk_list_store_set (p_list, &iter,
192                             0, ppsz_text[0],
193                             1, ppsz_text[1],
194                             2, size,
195                             3, ppsz_text[3],
196                             4, ppsz_text[4],
197                             -1);
198
199         if (ppsz_text[1]) free(ppsz_text[1]);
200
201         /* kludge */
202         for (i=0; i<n; i++)
203         {
204             if (namelist[i]->d_name[0] != '.')
205             {
206                 /* This is a list of strings. */
207                 ppsz_text[0] = namelist[i]->d_name;
208                 ppsz_text[1] = get_file_stat(namelist[i]->d_name, &uid, &gid, &size);
209                 ppsz_text[2] = "";
210                 ppsz_text[3] = "";
211                 ppsz_text[4] = "";
212 #if 0
213                 g_print( "(%d) file: %s permission: %s user: %ull group: %ull size: %ull\n", i, ppsz_text[0], ppsz_text[1], uid, gid, size );
214 #endif
215                 gtk_list_store_append (p_list, &iter);
216                 gtk_list_store_set (p_list, &iter,
217                                     0, ppsz_text[0],
218                                     1, ppsz_text[1],
219                                     2, size,
220                                     3, ppsz_text[3],
221                                     4, ppsz_text[4],
222                                     -1);
223
224                 if (ppsz_text[1]) free(ppsz_text[1]);
225             }
226         }
227         free(namelist);
228     }
229 }
230
231 static char* get_file_stat(const char *path, uid_t *uid, gid_t *gid, off_t *size)
232 {
233     struct stat st;
234     char *perm;
235
236     perm = (char *) malloc(sizeof(char)*10);
237     strncpy( perm, "----------", sizeof("----------"));
238     if (lstat(path, &st)==0)
239     {
240         /* user, group, filesize */
241         *uid = st.st_uid;
242         *gid = st.st_gid;
243         *size = st.st_size;
244         /* determine permission modes */
245         if (S_ISLNK(st.st_mode))
246             perm[0]= 'l';
247         else if (S_ISDIR(st.st_mode))
248             perm[0]= 'd';
249         else if (S_ISCHR(st.st_mode))
250             perm[0]= 'c';
251         else if (S_ISBLK(st.st_mode))
252             perm[0]= 'b';
253         else if (S_ISFIFO(st.st_mode))
254             perm[0]= 'f';
255         else if (S_ISSOCK(st.st_mode))
256             perm[0]= 's';
257         else if (S_ISREG(st.st_mode))
258             perm[0]= '-';
259         else /* Unknown type is an error */
260             perm[0]= '?';
261         /* Get file permissions */
262         /* User */
263         if (st.st_mode & S_IRUSR)
264             perm[1]= 'r';
265         if (st.st_mode & S_IWUSR)
266             perm[2]= 'w';
267         if (st.st_mode & S_IXUSR)
268         {
269             if (st.st_mode & S_ISUID)
270                 perm[3] = 's';
271             else
272                 perm[3]= 'x';
273         }
274         else if (st.st_mode & S_ISUID)
275             perm[3] = 'S';
276         /* Group */
277         if (st.st_mode & S_IRGRP)
278             perm[4]= 'r';
279         if (st.st_mode & S_IWGRP)
280             perm[5]= 'w';
281         if (st.st_mode & S_IXGRP)
282         {
283             if (st.st_mode & S_ISGID)
284                 perm[6] = 's';
285             else
286                 perm[6]= 'x';
287         }
288         else if (st.st_mode & S_ISGID)
289             perm[6] = 'S';
290         /* Other */
291         if (st.st_mode & S_IROTH)
292             perm[7]= 'r';
293         if (st.st_mode & S_IWOTH)
294             perm[8]= 'w';
295         if (st.st_mode & S_IXOTH)
296         {
297             // 'sticky' bit
298             if (st.st_mode &S_ISVTX)
299                 perm[9] = 't';
300             else
301                 perm[9]= 'x';
302         }
303         else if (st.st_mode &S_ISVTX)
304             perm[9]= 'T';
305     }
306     return perm;
307 }
308
309 /*
310  * Main interface callbacks
311  */
312
313 gboolean
314 onPDADeleteEvent                       (GtkWidget       *widget,
315                                         GdkEvent        *event,
316                                         gpointer         user_data)
317 {
318     intf_thread_t *p_intf = GtkGetIntf( widget );
319
320     msg_Dbg( p_intf, "about to exit vlc ... " );
321     vlc_mutex_lock( &p_intf->change_lock );
322     p_intf->p_vlc->b_die = VLC_TRUE;
323     vlc_mutex_unlock( &p_intf->change_lock );
324     msg_Dbg( p_intf, "about to exit vlc ... signalled" );
325
326     return TRUE;
327 }
328
329
330 void
331 onRewind                               (GtkButton       *button,
332                                         gpointer         user_data)
333 {
334     intf_thread_t *  p_intf = GtkGetIntf( button );
335
336     if (p_intf->p_sys->p_input != NULL)
337     {
338         input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
339     }
340 }
341
342
343 void
344 onPause                                (GtkButton       *button,
345                                         gpointer         user_data)
346 {
347     intf_thread_t *  p_intf = GtkGetIntf( button );
348
349     if (p_intf->p_sys->p_input != NULL)
350     {
351         input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
352     }
353 }
354
355
356 void
357 onPlay                                 (GtkButton       *button,
358                                         gpointer         user_data)
359 {
360     intf_thread_t *  p_intf = GtkGetIntf( GTK_WIDGET( button ) );
361     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
362
363     if (p_playlist)
364     {
365         vlc_mutex_lock( &p_playlist->object_lock );
366         if (p_playlist->i_size)
367         {
368             vlc_mutex_unlock( &p_playlist->object_lock );
369             playlist_Play( p_playlist );
370         }
371         else
372         {
373             vlc_mutex_unlock( &p_playlist->object_lock );
374         }
375         vlc_object_release( p_playlist );
376     }
377 }
378
379
380 void
381 onStop                                 (GtkButton       *button,
382                                         gpointer         user_data)
383 {
384     intf_thread_t *  p_intf = GtkGetIntf( GTK_WIDGET( button ) );
385     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
386                                                        FIND_ANYWHERE );
387     if (p_playlist)
388     {
389         playlist_Stop( p_playlist );
390         vlc_object_release( p_playlist );
391     }
392 }
393
394
395 void
396 onForward                              (GtkButton       *button,
397                                         gpointer         user_data)
398 {
399     intf_thread_t *p_intf = GtkGetIntf( button );
400
401     if (p_intf->p_sys->p_input != NULL)
402     {
403         input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
404     }
405 }
406
407
408 void
409 onAbout                                (GtkButton       *button,
410                                         gpointer         user_data)
411 {
412     intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(button) );
413
414     // Toggle notebook
415     if (p_intf->p_sys->p_notebook)
416     {
417         gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
418         gtk_notebook_set_page(p_intf->p_sys->p_notebook,6);
419     }
420 }
421
422
423 gboolean
424 SliderRelease                          (GtkWidget       *widget,
425                                         GdkEventButton  *event,
426                                         gpointer         user_data)
427 {
428     intf_thread_t *p_intf = GtkGetIntf( widget );
429
430     vlc_mutex_lock( &p_intf->change_lock );
431     p_intf->p_sys->b_slider_free = 1;
432     vlc_mutex_unlock( &p_intf->change_lock );
433
434     return TRUE;
435 }
436
437
438 gboolean
439 SliderPress                            (GtkWidget       *widget,
440                                         GdkEventButton  *event,
441                                         gpointer         user_data)
442 {
443     intf_thread_t *p_intf = GtkGetIntf( widget );
444
445     vlc_mutex_lock( &p_intf->change_lock );
446     p_intf->p_sys->b_slider_free = 0;
447     vlc_mutex_unlock( &p_intf->change_lock );
448
449     return TRUE;
450 }
451
452 void addSelectedToPlaylist(GtkTreeModel *model,
453                                GtkTreePath *path,
454                                GtkTreeIter *iter,
455                                gpointer *userdata)
456 {
457     GtkTreeView  *p_tvplaylist = NULL;
458     gchar *filename;
459
460     gtk_tree_model_get(model, iter, 0, &filename, -1);
461
462     /* Add to playlist object. */
463     p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(userdata), "tvPlaylist");
464     if (p_tvplaylist)
465     {
466         GtkTreeModel *p_play_model;
467         GtkTreeIter   p_play_iter;
468
469         p_play_model = gtk_tree_view_get_model(p_tvplaylist);
470
471         if (p_play_model)
472         {
473             /* Add a new row to the playlist treeview model */
474             gtk_list_store_append (GTK_LIST_STORE(p_play_model), &p_play_iter);
475             gtk_list_store_set (GTK_LIST_STORE(p_play_model), &p_play_iter,
476                                     0, filename,   /* Add path to it !!! */
477                                     1, "no info",
478                                     -1 );
479         }
480     }
481 }
482
483 void
484 onFileListRow                          (GtkTreeView     *treeview,
485                                         GtkTreePath     *path,
486                                         GtkTreeViewColumn *column,
487                                         gpointer         user_data)
488 {
489     GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
490
491     if (gtk_tree_selection_count_selected_rows(selection) == 1)
492     {
493         struct stat st;
494         GtkTreeModel *model;
495         GtkTreeIter   iter;
496         gchar        *filename;
497
498         /* This might be a directory selection */
499         model = gtk_tree_view_get_model(treeview);
500         if (!model)
501             g_print( "Error: model is a null pointer\n" );
502         if (!gtk_tree_model_get_iter(model, &iter, path))
503             g_print( "Error: could not get iter from model\n" );
504
505         gtk_tree_model_get(model, &iter, 0, &filename, -1);
506
507         if (stat((char*)filename, &st)==0)
508         {
509             if (S_ISDIR(st.st_mode))
510             {
511                 GtkListStore *p_model = NULL;
512
513                 /* Get new directory listing */
514                 p_model = gtk_list_store_new (5,
515                                            G_TYPE_STRING,
516                                            G_TYPE_STRING,
517                                            G_TYPE_UINT64,
518                                            G_TYPE_STRING,
519                                            G_TYPE_STRING);
520                 if (p_model)
521                 {               
522                     ReadDirectory(p_model, filename);
523
524                     /* Update TreeView with new model */
525                     gtk_tree_view_set_model(treeview, (GtkTreeModel*) p_model);
526                     g_object_unref(p_model);
527                 }
528             }
529             else
530             {
531                 gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) &addSelectedToPlaylist, (gpointer) treeview);
532             }
533         }
534     }
535     else
536     {
537         gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc) &addSelectedToPlaylist, (gpointer) treeview);
538     }
539 }
540
541
542 void
543 onFileListColumns                      (GtkTreeView     *treeview,
544                                         gpointer         user_data)
545 {
546     g_print("onFileListColumn\n");
547 }
548
549
550 gboolean
551 onFileListRowSelected                  (GtkTreeView     *treeview,
552                                         gboolean         start_editing,
553                                         gpointer         user_data)
554 {
555     g_print("onFileListRowSelected\n");
556     return FALSE;
557 }
558
559
560 void
561 onAddFileToPlaylist                    (GtkButton       *button,
562                                         gpointer         user_data)
563 {
564     GtkTreeView       *treeview = NULL;
565
566     treeview = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvFileList");
567     if (treeview)
568     {
569         onFileListRow(treeview, NULL, NULL, NULL );
570     }
571 }
572
573
574 void
575 NetworkBuildMRL                        (GtkEditable     *editable,
576                                         gpointer         user_data)
577 {
578     GtkSpinButton *networkPort = NULL;
579     GtkEntry      *entryMRL = NULL;
580     GtkEntry      *networkType = NULL;
581     GtkEntry      *networkAddress = NULL;
582     GtkEntry      *networkProtocol = NULL;
583     const gchar   *mrlNetworkType;
584     const gchar   *mrlAddress;
585     const gchar   *mrlProtocol;
586     gint           mrlPort;
587     char           text[VLC_MAX_MRL];
588     int            pos = 0;
589
590     entryMRL = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryMRL" );
591
592     networkType     = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkType" );
593     networkAddress  = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkAddress" );
594     networkPort     = (GtkSpinButton*) lookup_widget( GTK_WIDGET(editable), "entryNetworkPort" );
595     networkProtocol = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkProtocolType" );
596
597     mrlNetworkType = gtk_entry_get_text(GTK_ENTRY(networkType));
598     mrlAddress     = gtk_entry_get_text(GTK_ENTRY(networkAddress));
599     mrlPort        = gtk_spin_button_get_value_as_int(networkPort);
600     mrlProtocol    = gtk_entry_get_text(GTK_ENTRY(networkProtocol));
601
602     /* Build MRL from parts ;-) */
603     pos = snprintf( &text[0], VLC_MAX_MRL, "%s://", (char*)mrlProtocol);
604     if (strncasecmp( (char*)mrlNetworkType, "multicast",9)==0)
605     {
606         pos += snprintf( &text[pos], VLC_MAX_MRL - pos, "@" );
607     }
608     pos += snprintf( &text[pos], VLC_MAX_MRL - pos, "%s:%d", (char*)mrlAddress, (int)mrlPort );
609
610     if (pos >= VLC_MAX_MRL)
611         text[VLC_MAX_MRL-1]='\0';
612
613     gtk_entry_set_text(entryMRL,text);
614 }
615
616 void
617 onAddNetworkPlaylist                   (GtkButton       *button,
618                                         gpointer         user_data)
619 {
620     GtkEntry     *p_mrl = NULL;
621     GtkTreeView  *p_tvplaylist = NULL;
622     GtkTreeModel *p_play_model;
623     GtkTreeIter   p_play_iter;
624     const gchar  *mrl_name;
625
626     p_mrl = (GtkEntry*) lookup_widget(GTK_WIDGET(button),"entryMRL" );
627     if (p_mrl)
628     {
629         mrl_name = gtk_entry_get_text(p_mrl);
630
631         p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvPlaylist");
632         if (NULL != p_tvplaylist)
633         {
634             p_play_model = gtk_tree_view_get_model(p_tvplaylist);
635
636             /* Add a new row to the playlist treeview model */
637             gtk_list_store_append (GTK_LIST_STORE(p_play_model), &p_play_iter);
638             gtk_list_store_set (GTK_LIST_STORE(p_play_model), &p_play_iter,
639                                     0, mrl_name,   /* Add path to it !!! */
640                                     1, "no info",
641                                     -1 );
642         }
643     }
644 }
645
646
647 void
648 onAddCameraToPlaylist                  (GtkButton       *button,
649                                         gpointer         user_data)
650 {
651     GtkTreeView  *p_tvplaylist = NULL;
652     GtkTreeModel *p_play_model;
653     GtkTreeIter   p_play_iter;
654
655     GtkSpinButton *entryV4LChannel = NULL;
656     GtkSpinButton *entryV4LFrequency = NULL;
657     GtkSpinButton *entryV4LSampleRate = NULL;
658     GtkSpinButton *entryV4LQuality = NULL;
659     GtkSpinButton *entryV4LTuner = NULL;
660     gint    i_v4l_channel;
661     gint    i_v4l_frequency;
662     gint    i_v4l_samplerate;
663     gint    i_v4l_quality;
664     gint    i_v4l_tuner;
665
666     GtkEntry      *entryV4LVideoDevice = NULL;
667     GtkEntry      *entryV4LAudioDevice = NULL;
668     GtkEntry      *entryV4LNorm = NULL;
669     GtkEntry      *entryV4LSize = NULL;
670     GtkEntry      *entryV4LSoundDirection = NULL;
671     const gchar   *p_v4l_video_device;
672     const gchar   *p_v4l_audio_device;
673     const gchar   *p_v4l_norm;
674     const gchar   *p_v4l_size;
675     const gchar   *p_v4l_sound_direction;
676
677     /* MJPEG only */
678     GtkCheckButton *checkV4LMJPEG = NULL;
679     GtkSpinButton  *entryV4LDecimation = NULL;
680     gboolean        b_v4l_mjpeg;
681     gint            i_v4l_decimation;
682     /* end MJPEG only */
683
684     char v4l_mrl[VLC_MAX_MRL];
685     int pos;
686
687     pos = snprintf( &v4l_mrl[0], VLC_MAX_MRL, "v4l://");
688
689     entryV4LChannel    = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LChannel" );
690     entryV4LFrequency  = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LFrequency" );
691     entryV4LSampleRate = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LSampleRate" );
692     entryV4LQuality    = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LQuality" );
693     entryV4LTuner      = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LTuner" );
694
695     entryV4LVideoDevice  = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LVideoDevice" );
696     entryV4LAudioDevice  = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LAudioDevice" );
697     entryV4LNorm  = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LNorm" );
698     entryV4LSize  = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LSize" );
699     entryV4LSoundDirection  = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LSoundDirection" );
700
701     i_v4l_channel = gtk_spin_button_get_value_as_int(entryV4LChannel);
702     i_v4l_frequency = gtk_spin_button_get_value_as_int(entryV4LFrequency);
703     i_v4l_samplerate = gtk_spin_button_get_value_as_int(entryV4LSampleRate);
704     i_v4l_quality = gtk_spin_button_get_value_as_int(entryV4LQuality);
705     i_v4l_tuner = gtk_spin_button_get_value_as_int(entryV4LTuner);
706
707     p_v4l_video_device = gtk_entry_get_text(GTK_ENTRY(entryV4LVideoDevice));
708     p_v4l_audio_device = gtk_entry_get_text(GTK_ENTRY(entryV4LAudioDevice));
709     p_v4l_norm = gtk_entry_get_text(GTK_ENTRY(entryV4LNorm));
710     p_v4l_size  = gtk_entry_get_text(GTK_ENTRY(entryV4LSize));
711     p_v4l_sound_direction = gtk_entry_get_text(GTK_ENTRY(entryV4LSoundDirection));
712
713     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":%s", (char*)p_v4l_video_device );
714     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":adev=%s", (char*)p_v4l_audio_device );
715     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":norm=%s", (char*)p_v4l_norm );
716     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":size=%s", (char*)p_v4l_size );
717     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":%s", (char*)p_v4l_sound_direction );
718
719     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":channel=%d", (int)i_v4l_channel );
720     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":frequency=%d", (int)i_v4l_frequency );
721     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":samplerate=%d", (int)i_v4l_samplerate );
722     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":quality=%d", (int)i_v4l_quality );
723     pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":tuner=%d", (int)i_v4l_tuner );
724
725     /* MJPEG only */
726     checkV4LMJPEG      = (GtkCheckButton*) lookup_widget( GTK_WIDGET(button), "checkV4LMJPEG" );
727     b_v4l_mjpeg = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkV4LMJPEG));
728     if (b_v4l_mjpeg)
729     {
730         entryV4LDecimation = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LDecimation" );
731         i_v4l_decimation = gtk_spin_button_get_value_as_int(entryV4LDecimation);
732         pos += snprintf( &v4l_mrl[pos], VLC_MAX_MRL - pos, ":mjpeg:%d", (int)i_v4l_decimation );
733     }
734     /* end MJPEG only */
735
736     if (pos >= VLC_MAX_MRL)
737         v4l_mrl[VLC_MAX_MRL-1]='\0';
738
739     g_print( "%s\n", v4l_mrl );
740     p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvPlaylist");
741     if (NULL != p_tvplaylist)
742     {
743         p_play_model = gtk_tree_view_get_model(p_tvplaylist);
744
745         /* Add a new row to the playlist treeview model */
746         gtk_list_store_append (GTK_LIST_STORE(p_play_model), &p_play_iter);
747         gtk_list_store_set (GTK_LIST_STORE(p_play_model), &p_play_iter,
748                                 0, &v4l_mrl,
749                                 1, "no info",
750                                 -1 );
751     }
752 }
753
754
755 gboolean
756 PlaylistEvent                          (GtkWidget       *widget,
757                                         GdkEvent        *event,
758                                         gpointer         user_data)
759 {
760     g_print("onPlaylistEvent\n");
761     return FALSE;
762 }
763
764
765 void
766 onPlaylistColumnsChanged               (GtkTreeView     *treeview,
767                                         gpointer         user_data)
768 {
769     g_print("onPlaylistColumnsChanged\n");
770 }
771
772
773 gboolean
774 onPlaylistRowSelected                  (GtkTreeView     *treeview,
775                                         gboolean         start_editing,
776                                         gpointer         user_data)
777 {
778   g_print("onPlaylistRowSelected\n");
779   return FALSE;
780 }
781
782
783 void
784 onPlaylistRow                          (GtkTreeView     *treeview,
785                                         GtkTreePath     *path,
786                                         GtkTreeViewColumn *column,
787                                         gpointer         user_data)
788 {
789     g_print("onPlaylistRow\n");
790 }
791
792
793 void
794 onUpdatePlaylist                       (GtkButton       *button,
795                                         gpointer         user_data)
796 {
797
798 }
799
800
801 void
802 onDeletePlaylist                       (GtkButton       *button,
803                                         gpointer         user_data)
804 {
805
806 }
807
808
809 void
810 onClearPlaylist                        (GtkButton       *button,
811                                         gpointer         user_data)
812 {
813
814 }
815
816
817 void
818 onPreferenceSave                       (GtkButton       *button,
819                                         gpointer         user_data)
820 {
821
822 }
823
824
825 void
826 onPreferenceApply                      (GtkButton       *button,
827                                         gpointer         user_data)
828 {
829
830 }
831
832
833 void
834 onPreferenceCancel                     (GtkButton       *button,
835                                         gpointer         user_data)
836 {
837
838 }
839
840
841
842 void
843 onNetworkMRLAdd                        (GtkContainer    *container,
844                                         GtkWidget       *widget,
845                                         gpointer         user_data)
846 {
847
848 }
849
850 void
851 onAddTranscodeToPlaylist               (GtkButton       *button,
852                                         gpointer         user_data)
853 {
854
855 }
856
857