]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/gtk_display.c
* ALL: the first libvlc commit.
[vlc] / plugins / gtk / gtk_display.c
index 339085387aa7adf78706c6bb35f2945ab72edc5b..23d2e14dc9f689bbc3c7c5153ae0e5d05f3041c8 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_display.c: Gtk+ tools for main interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.22 2002/05/30 08:17:04 gbazin Exp $
+ * $Id: gtk_display.c,v 1.23 2002/06/01 12:31:59 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -30,7 +30,8 @@
 #include <string.h>                                            /* strerror() */
 #include <stdio.h>
 
-#include <videolan/vlc.h>
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
 
 #ifdef MODULE_NAME_IS_gnome
 #   include <gnome.h>
 #   include <gtk/gtk.h>
 #endif
 
-#include "stream_control.h"
-#include "input_ext-intf.h"
-
-#include "interface.h"
-#include "intf_playlist.h"
-
-#include "video.h"
-#include "video_output.h"
-
 #include "gtk_callbacks.h"
 #include "gtk_interface.h"
 #include "gtk_support.h"
@@ -67,13 +59,13 @@ void GtkDisplayDate( GtkAdjustment *p_adj )
 
     p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
 
-    if( p_input_bank->pp_input[0] != NULL )
+    if( p_intf->p_sys->p_input )
     {
-#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
+#define p_area p_intf->p_sys->p_input->stream.p_selected_area
         char psz_time[ OFFSETTOTIME_MAX_SIZE ];
 
         gtk_frame_set_label( GTK_FRAME( p_intf->p_sys->p_slider_frame ),
-                            input_OffsetToTime( p_input_bank->pp_input[0], psz_time,
+                        input_OffsetToTime( p_intf->p_sys->p_input, psz_time,
                                    ( p_area->i_size * p_adj->value ) / 100 ) );
 #undef p_area
      }
@@ -94,7 +86,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
     GtkWidget *     p_slider;
     GtkWidget *     p_label;
     GtkWidget *     p_channel;
-    boolean_t       b_control;
+    vlc_bool_t      b_control;
 
 #define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
                            p_intf->p_sys->ptr ) , ( name ) ) )
@@ -120,9 +112,9 @@ gint GtkModeManage( intf_thread_t * p_intf )
     b_control = 0;
 
     /* show the box related to current input mode */
-    if( p_input_bank->pp_input[0] != NULL )
+    if( p_intf->p_sys->p_input )
     {
-        switch( p_input_bank->pp_input[0]->stream.i_method & 0xf0 )
+        switch( p_intf->p_sys->p_input->stream.i_method & 0xf0 )
         {
             case INPUT_METHOD_FILE:
 //intf_WarnMsg( 2, "intf info: file method" );
@@ -131,7 +123,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
                             p_intf->p_sys->p_window ),
                             "label_status" );
                 gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_input_bank->pp_input[0]->psz_source );
+                                    p_intf->p_sys->p_input->psz_source );
                 break;
             case INPUT_METHOD_DISC:
 //intf_WarnMsg( 2, "intf info: disc method" );
@@ -144,10 +136,10 @@ gint GtkModeManage( intf_thread_t * p_intf )
                             p_intf->p_sys->p_window ),
                             "network_address_label" );
                 gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_input_bank->pp_input[0]->psz_source );
+                                    p_intf->p_sys->p_input->psz_source );
                 p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
                            p_intf->p_sys->p_window ), "network_channel_box" ) );
-                if( config_GetIntVariable( "network-channel" ) )
+                if( config_GetInt( p_intf, "network-channel" ) )
                 {
                     gtk_widget_show( GTK_WIDGET( p_channel ) );
                 }
@@ -158,18 +150,18 @@ gint GtkModeManage( intf_thread_t * p_intf )
 
                 break;
             default:
-                intf_WarnMsg( 3, "intf: can't determine input method" );
+                msg_Warn( p_intf, "cannot determine input method" );
                 gtk_widget_show( GTK_WIDGET( p_file_box ) );
                 p_label = gtk_object_get_data( GTK_OBJECT(
                             p_intf->p_sys->p_window ),
                             "label_status" );
                 gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_input_bank->pp_input[0]->psz_source );
+                                    p_intf->p_sys->p_input->psz_source );
                 break;
         }
 
         /* initialize and show slider for seekable streams */
-        if( p_input_bank->pp_input[0]->stream.b_seekable )
+        if( p_intf->p_sys->p_input->stream.b_seekable )
         {
             p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
             gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
@@ -178,7 +170,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
         }
 
         /* control buttons for free pace streams */
-        b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
+        b_control = p_intf->p_sys->p_input->stream.b_pace_control;
 
         /* get ready for menu regeneration */
         p_intf->p_sys->b_program_update = 1;
@@ -187,13 +179,13 @@ gint GtkModeManage( intf_thread_t * p_intf )
         p_intf->p_sys->b_audio_update = 1;
         p_intf->p_sys->b_spu_update = 1;
         p_intf->p_sys->i_part = 0;
-
-        p_input_bank->pp_input[0]->stream.b_changed = 0;
-        intf_WarnMsg( 3, "intf: stream has changed, refreshing interface" );
+    
+        p_intf->p_sys->p_input->stream.b_changed = 0;
+        msg_Dbg( p_intf, "stream has changed, refreshing interface" );
     }
     else
     {
-        if( config_GetIntVariable( "network-channel" ) )
+        if( config_GetInt( p_intf, "network-channel" ) )
         {
             gtk_widget_show( GTK_WIDGET( p_network_box ) );
 
@@ -245,14 +237,27 @@ gint GtkModeManage( intf_thread_t * p_intf )
 /*****************************************************************************
  * GtkHideTooltips: show or hide the tooltips depending on the configuration
  *                  option gnome-tooltips
- *****************************************************************************
- * FIXME: we should get the intf as parameter
  *****************************************************************************/
-void GtkHideTooltips( void )
+void GtkHideTooltips( vlc_object_t *p_this )
 {
-    if( !config_GetIntVariable( "gnome-tooltips" ) )
-        gtk_tooltips_disable( p_main->p_intf->p_sys->p_tooltips );
-    else gtk_tooltips_enable( p_main->p_intf->p_sys->p_tooltips );
+    intf_thread_t *p_intf = vlc_object_find( p_this->p_vlc,
+                                             VLC_OBJECT_INTF, FIND_CHILD );
+
+    if( !p_intf )
+    {
+        return;
+    }
+
+    if( config_GetInt( p_this, "gnome-tooltips" ) )
+    {
+        gtk_tooltips_enable( p_intf->p_sys->p_tooltips );
+    }
+    else
+    {
+        gtk_tooltips_disable( p_intf->p_sys->p_tooltips );
+    }
+
+    vlc_object_release( p_intf );
 }
 
 #ifdef MODULE_NAME_IS_gnome
@@ -260,20 +265,29 @@ void GtkHideTooltips( void )
  * GtkHideToolbartext: show or hide the tooltips depending on the
  *                     configuration option gnome-toolbartext
  *****************************************************************************
- * FIXME: we should get the intf as parameter
  * FIXME: GNOME only because of missing icons in gtk interface
  *****************************************************************************/
-void GtkHideToolbarText( void )
+void GtkHideToolbarText( vlc_object_t *p_this )
 {
     GtkToolbarStyle style;
     GtkToolbar * p_toolbar;
 
-    style = config_GetIntVariable( "gnome-toolbartext" )
+    intf_thread_t *p_intf = vlc_object_find( p_this->p_vlc,
+                                             VLC_OBJECT_INTF, FIND_CHILD );
+
+    if( !p_intf )
+    {
+        return;
+    }
+
+    style = config_GetInt( p_this, "gnome-toolbartext" )
             ? GTK_TOOLBAR_BOTH
             : GTK_TOOLBAR_ICONS;
 
-    p_toolbar = GTK_TOOLBAR(lookup_widget( p_main->p_intf->p_sys->p_window,
-                            "toolbar" ));
+    p_toolbar = GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window,
+                                           "toolbar" ));
     gtk_toolbar_set_style( p_toolbar, style );
+
+    vlc_object_release( p_intf );
 }
 #endif