]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/intf_gnome.c
* Backported lool's fix for the Gtk+ playlist crash.
[vlc] / plugins / gtk / intf_gnome.c
index 1ddfcfb9bea0a2c6663d9f74b61564b153ac13bc..1cba9b38054f5a45addcfa56e7f4b4b17c434f07 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * intf_gnome.c: Gnome interface
  *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gnome.c,v 1.2 2001/05/30 17:03:12 sam Exp $
+ * Copyright (C) 1999-2001 VideoLAN
+ * $Id: intf_gnome.c,v 1.7.2.1 2001/12/29 23:35:10 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -37,8 +37,8 @@
 
 #include <gnome.h>
 
-#include "config.h"
 #include "common.h"
+#include "intf_msg.h"
 #include "threads.h"
 #include "mtime.h"
 #include "tests.h"
@@ -46,7 +46,6 @@
 #include "stream_control.h"
 #include "input_ext-intf.h"
 
-#include "intf_msg.h"
 #include "interface.h"
 #include "intf_playlist.h"
 
@@ -59,8 +58,6 @@
 #include "gtk_display.h"
 #include "intf_gtk.h"
 
-#include "main.h"
-
 #include "modules.h"
 #include "modules_export.h"
 
@@ -128,6 +125,13 @@ static int intf_Probe( probedata_t *p_data )
         return( 200 );
     }
 
+#ifndef WIN32
+    if( getenv( "DISPLAY" ) == NULL )
+    {
+        return( 15 );
+    }
+#endif
+
     return( 100 );
 }
 
@@ -145,6 +149,7 @@ static int intf_Open( intf_thread_t *p_intf )
     }
 
     /* Initialize Gnome thread */
+    p_intf->p_sys->b_playing = 1;
     p_intf->p_sys->b_popup_changed = 0;
     p_intf->p_sys->b_window_changed = 0;
     p_intf->p_sys->b_playlist_changed = 0;
@@ -185,6 +190,7 @@ static void intf_Run( intf_thread_t *p_intf )
     /* The data types we are allowed to receive */
     static GtkTargetEntry target_table[] =
     {
+        { "STRING", 0, DROP_ACCEPT_STRING },
         { "text/uri-list", 0, DROP_ACCEPT_TEXT_URI_LIST },
         { "text/plain",    0, DROP_ACCEPT_TEXT_PLAIN }
     };
@@ -323,6 +329,8 @@ static gint GnomeManage( gpointer p_data )
         if( p_intf->p_input->stream.b_changed )
         {
             GtkModeManage( p_intf );
+            GtkSetupMenus( p_intf );
+            p_intf->p_sys->b_playing = 1;
         }
 
         /* Manage the slider */
@@ -358,7 +366,6 @@ static gint GnomeManage( gpointer p_data )
             }
 #undef p_area
         }
-        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
 
         if( p_intf->p_sys->i_part !=
             p_intf->p_input->stream.p_selected_area->i_part )
@@ -367,10 +374,12 @@ static gint GnomeManage( gpointer p_data )
             GtkSetupMenus( p_intf );
         }
 
+        vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
     }
-    else if( !p_intf->b_die )
+    else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
         GtkModeManage( p_intf );
+        p_intf->p_sys->b_playing = 0;
     }
 
     /* Manage core vlc functions through the callback */