* enable the network channel box when selecting network channel input
[vlc.git] / modules / gui / gtk / open.c
index 022d8f4..99149a3 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_open.c : functions to handle file/disc/network open widgets.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: open.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: open.c,v 1.6 2003/01/10 11:02:21 asmax Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          St├ęphane Borel <stef@via.ecp.fr>
@@ -43,7 +43,6 @@
 #include "gtk_interface.h"
 #include "gtk_support.h"
 
-#include "playlist.h"
 #include "common.h"
 
 #include "netutils.h"
@@ -64,7 +63,8 @@ void GtkFileShow( GtkButton * button, gpointer user_data )
 {
     GtkWidget * p_file = create_intf_file();
 
-    gtk_object_set_data( GTK_OBJECT(p_file), "p_intf", GtkGetIntf( button ) );
+    gtk_object_set_data( GTK_OBJECT(p_file), "p_intf",
+                         GtkGetIntf( button ) );
 
     gtk_widget_show( p_file );
     gdk_window_raise( p_file->window );
@@ -273,8 +273,8 @@ static void GtkNetworkOpenChanged( GtkWidget *button, gpointer user_data )
     }
     else if( SELECTED( "network_http" ) )
     {
-        g_string_sprintfa( p_target, "http://%s",
-                           gtk_entry_get_text( GTK_ENTRY( lookup_widget(
+        g_string_assign( p_target,
+                         gtk_entry_get_text( GTK_ENTRY( lookup_widget(
                                GTK_WIDGET(button), "network_http_url" ) ) ) );
     }
 
@@ -437,6 +437,16 @@ static void GtkOpenShow( intf_thread_t *p_intf, int i_page )
         free( psz_var );
     }
 
+    /* Disc stuff */
+    psz_var = config_GetPsz( p_intf, "dvd" );
+    if( psz_var )
+    {
+        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+            GTK_OBJECT( p_intf->p_sys->p_open ), "disc_name" ) ),
+            psz_var );
+        free( psz_var );
+    }
+
     /* Network stuff */
     gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
         GTK_OBJECT( p_intf->p_sys->p_open ), "network_udp_port" ) ),
@@ -451,6 +461,10 @@ static void GtkOpenShow( intf_thread_t *p_intf, int i_page )
         free( psz_var );
     }
 
+    gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+        GTK_OBJECT( p_intf->p_sys->p_open ), "network_http_url" ) ),
+        "http://" );
+
     gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
         GTK_OBJECT( p_intf->p_sys->p_open ), "network_channel_port" ) ),
         config_GetInt( p_intf, "channel-port" ) );
@@ -459,6 +473,25 @@ static void GtkOpenShow( intf_thread_t *p_intf, int i_page )
         GTK_OBJECT( p_intf->p_sys->p_open ), "network_channel" ),
         config_GetInt( p_intf, "network-channel" ) );
 
+    /* Satellite stuff */
+    psz_var = config_GetPsz( p_intf, "frequency" );
+    if( psz_var )
+    {
+        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+            GTK_OBJECT( p_intf->p_sys->p_open ), "sat_freq" ) ),
+            psz_var );
+        free( psz_var );
+    }
+
+    psz_var = config_GetPsz( p_intf, "symbol-rate" );
+    if( psz_var )
+    {
+        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+            GTK_OBJECT( p_intf->p_sys->p_open ), "sat_srate" ) ),
+            psz_var );
+        free( psz_var );
+    }
+
     /* Set the right page */
 setpage:
     p_notebook = lookup_widget( GTK_WIDGET( p_intf->p_sys->p_open ),
@@ -499,6 +532,14 @@ void GtkOpenOk( GtkButton * button, gpointer user_data )
     GtkRebuildCList( p_playlist_clist, p_playlist );
 
     vlc_object_release( p_playlist );
+
+    /* Enable the channel box when network channel is selected */
+    if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
+                                               "network_channel" ) )->active )
+    {
+        p_intf->p_sys->b_playing = 1;
+    }
+    
 }
 
 void GtkOpenCancel( GtkButton * button, gpointer user_data )