]> git.sesse.net Git - vlc/blobdiff - plugins/gnome/intf_gnome.c
* Added DVD/VCD button and menu for quick DVD device selection to the
[vlc] / plugins / gnome / intf_gnome.c
index ba180191508f8f5bcdb386992c4935ff8b9e0712..65547301478b8081130ad4e4755ab4a2a03ff7da 100644 (file)
@@ -2,9 +2,9 @@
  * intf_gnome.c: Gnome interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gnome.c,v 1.13 2001/02/16 06:37:09 sam Exp $
+ * $Id: intf_gnome.c,v 1.19 2001/03/04 03:12:00 sam Exp $
  *
- * Authors:
+ * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +21,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME gnome
+#include "modules_inner.h"
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
@@ -90,7 +93,7 @@ void g_atexit( GVoidFunc func )
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-void intf_getfunctions( function_list_t * p_function_list )
+void _M( intf_getfunctions )( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = intf_Probe;
     p_function_list->functions.intf.pf_open  = intf_Open;
@@ -137,6 +140,9 @@ static int intf_Open( intf_thread_t *p_intf )
     p_intf->p_sys->pf_gtk_callback = NULL;
     p_intf->p_sys->pf_gdk_callback = NULL;
 
+    /* Initialize lock */
+    vlc_mutex_init( &p_intf->p_sys->change_lock );
+
     return( 0 );
 }
 
@@ -145,6 +151,9 @@ static int intf_Open( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Close( intf_thread_t *p_intf )
 {
+    /* Destroy lock */
+    vlc_mutex_destroy( &p_intf->p_sys->change_lock );
+
     /* Destroy structure */
     free( p_intf->p_sys );
 }
@@ -161,7 +170,7 @@ static void intf_Run( intf_thread_t *p_intf )
 {
     /* gnome_init needs to know the command line. We don't care, so we
      * give it an empty one */
-    char *p_args[] = { };
+    char *p_args[] = { "" };
 
     /* The data types we are allowed to receive */
     static GtkTargetEntry target_table[] =
@@ -173,29 +182,34 @@ static void intf_Run( intf_thread_t *p_intf )
     /* Initialize Gnome */
     gnome_init( p_main->psz_arg0, VERSION, 1, p_args );
 
-    /* create some useful widgets that will certainly be used */
+    /* Create some useful widgets that will certainly be used */
     p_intf->p_sys->p_window = create_intf_window( );
     p_intf->p_sys->p_popup = create_intf_popup( );
 
-    /* accept file drops on the main window */
+    /* Set the title of the main window */
+    gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
+                          VOUT_TITLE " (Gnome interface)");
+
+    /* Accept file drops on the main window */
     gtk_drag_dest_set( GTK_WIDGET( p_intf->p_sys->p_window ),
                        GTK_DEST_DEFAULT_ALL, target_table,
                        1, GDK_ACTION_COPY );
 
-    /* we don't create these ones yet because we perhaps won't need them */
+    /* We don't create these ones yet because we perhaps won't need them */
     p_intf->p_sys->p_about = NULL;
     p_intf->p_sys->p_playlist = NULL;
     p_intf->p_sys->p_modules = NULL;
     p_intf->p_sys->p_fileopen = NULL;
+    p_intf->p_sys->p_disc = NULL;
 
-    /* store p_sys to keep an eye on it */
+    /* Store p_intf to keep an eye on it */
     gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
                          "p_intf", p_intf );
 
     gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_popup),
                          "p_intf", p_intf );
 
-    /* show the control window */
+    /* Show the control window */
     gtk_widget_show( p_intf->p_sys->p_window );
 
     /* Sleep to avoid using all CPU - since some interfaces needs to access
@@ -204,7 +218,7 @@ static void intf_Run( intf_thread_t *p_intf )
                                                 GnomeManage, p_intf );
  
 
-    /* enter gnome mode */
+    /* Enter gnome mode */
     gtk_main();
 
     /* launch stored callbacks */
@@ -253,8 +267,9 @@ static gint GnomeManage( gpointer p_data )
         p_adj = gtk_range_get_adjustment ( GTK_RANGE( p_scale ) );
 
         /* Update the value */
-        p_adj->value = ( 100. * p_intf->p_input->stream.i_tell )
-                           / p_intf->p_input->stream.i_size;
+        p_adj->value = ( 100. *
+                         p_intf->p_input->stream.p_selected_area->i_tell ) /
+                         p_intf->p_input->stream.p_selected_area->i_size;
 
         /* Gtv does it this way. Why not. */
         gtk_range_set_adjustment ( GTK_RANGE( p_scale ), p_adj );