]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/gtk_playlist.c
* ALL: internationalized all configuration strings.
[vlc] / plugins / gtk / gtk_playlist.c
index d38003ca550e7a824fd9605b2d24ca25686e6ba4..24aa1aa15b2ba65d391c8a286f8e3c730416f1c8 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_playlist.c : Interface for the playlist dialog
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: gtk_playlist.c,v 1.23 2001/12/29 11:36:00 lool Exp $
+ * $Id: gtk_playlist.c,v 1.30 2002/02/15 20:02:21 gbazin Exp $
  *
  * Authors: Pierre Baillet <oct@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #include <stdlib.h>
 #include <string.h>
 
+#include <videolan/vlc.h>
+
 #include <sys/types.h>          /* for readdir  and stat stuff */
 
-#ifndef WIN32
+#if (!defined( WIN32 ) || defined(__MINGW32__))
+/* Mingw has its own version of dirent */
 #   include <dirent.h>
 #endif
 
 #include <sys/stat.h>
 #include <unistd.h>
 
-#define gtk 12
-#define gnome 42
-#if ( MODULE_NAME == gtk )
-#   include <gtk/gtk.h>
-#elif ( MODULE_NAME == gnome )
+#ifdef MODULE_NAME_IS_gnome
 #   include <gnome.h>
+#else
+#   include <gtk/gtk.h>
 #endif
-#undef gtk
-#undef gnome
-
-#include "common.h"
-#include "intf_msg.h"
-#include "threads.h"
-#include "mtime.h"
 
 #include "stream_control.h"
 #include "input_ext-intf.h"
@@ -64,9 +56,7 @@
 #include "gtk_interface.h"
 #include "gtk_support.h"
 #include "gtk_playlist.h"
-#include "intf_gtk.h"
-
-#include "modules_export.h"
+#include "gtk_common.h"
 
 /****************************************************************************
  * Playlist window management
@@ -113,14 +103,12 @@ gboolean GtkPlaylistPrev( GtkWidget       *widget,
                           GdkEventButton  *event,
                           gpointer         user_data )
 {
-    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
-
-    if( p_intf->p_input != NULL )
+    if( p_input_bank->pp_input[0] != NULL )
     {
         /* FIXME: temporary hack */
         intf_PlaylistPrev( p_main->p_playlist );
         intf_PlaylistPrev( p_main->p_playlist );
-        p_intf->p_input->b_eof = 1;
+        p_input_bank->pp_input[0]->b_eof = 1;
     }
 
     return TRUE;
@@ -131,12 +119,10 @@ gboolean GtkPlaylistNext( GtkWidget       *widget,
                           GdkEventButton  *event,
                           gpointer         user_data)
 {
-    intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), (char*)user_data );
-
-    if( p_intf->p_input != NULL )
+    if( p_input_bank->pp_input[0] != NULL )
     {
         /* FIXME: temporary hack */
-        p_intf->p_input->b_eof = 1;
+        p_input_bank->pp_input[0]->b_eof = 1;
     }
 
     return TRUE;
@@ -292,10 +278,10 @@ gboolean GtkPlaylistEvent( GtkWidget * widget,
                     (event->button).y, &i_row, &i_col ) == 1 )
         {
             /* clicked is in range. */
-            if( p_intf->p_input != NULL )
+            if( p_input_bank->pp_input[0] != NULL )
             {
                 /* FIXME: temporary hack */
-                p_intf->p_input->b_eof = 1;
+                p_input_bank->pp_input[0]->b_eof = 1;
             }
 
             intf_PlaylistJumpto( p_main->p_playlist, i_row - 1 );
@@ -442,12 +428,12 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
         {
             char i_save;
 
-           i_save = p_temp[0];
-           p_temp[0] = '\0';
-           p_protocol = strdup( p_string );
-           p_temp[0] = i_save;
-           p_temp++;
-           
+            i_save = p_temp[0];
+            p_temp[0] = '\0';
+            p_protocol = strdup( p_string );
+            p_temp[0] = i_save;
+            p_temp++;
+
             /* Allowed things are proto: or proto:// */
             if( p_temp[0] == '/' && p_temp[1] == '/')
             {
@@ -471,11 +457,11 @@ void GtkDropDataReceived( intf_thread_t * p_intf,
         {
             p_files = g_list_concat( p_files, GtkReadFiles( p_string ) ); 
         }
-       else
-       {
+        else
+        {
             p_files = g_list_concat( p_files,
                       g_list_append( NULL, g_strdup( p_string ) ) );
-       }
+        }
        
         /* free the malloc and go on... */
         free( p_protocol );
@@ -518,7 +504,7 @@ void GtkDeleteGListItem( gpointer data, gpointer param )
     if( p_intf->p_sys->i_playing == i_cur_row )
     {
         /* next ! */
-        p_intf->p_input->b_eof = 1;
+        p_input_bank->pp_input[0]->b_eof = 1;
         /* this has to set the slider to 0 */
         
         /* step minus one */
@@ -706,26 +692,24 @@ void GtkRebuildCList( GtkCList * p_clist, playlist_t * p_playlist )
     for( i_dummy = 0; i_dummy < p_playlist->i_size ; i_dummy++ )
     {
 #ifdef WIN32 /* WIN32 HACK */
-        ppsz_text[0] = g_strdup( "" );
+        ppsz_text[0] = "";
 #else
-        ppsz_text[0] = rindex( (char *)(p_playlist->p_item[
-                p_playlist->i_size - 1 - i_dummy].psz_name), '/' );
+        ppsz_text[0] = rindex( p_playlist->p_item[
+                p_playlist->i_size - 1 - i_dummy].psz_name, '/' );
         if ( ppsz_text[0] == NULL )
         {
-            ppsz_text[0] = g_strdup( (char *)(p_playlist->p_item[
-                    p_playlist->i_size - 1 - i_dummy].psz_name));
+            ppsz_text[0] =
+              p_playlist->p_item[ p_playlist->i_size - 1 - i_dummy ].psz_name;
         }
         else
         {
-            ppsz_text[0] = g_strdup( ppsz_text[0] + 1 );
+            /* Skip leading '/' */
+            ppsz_text[0]++;
         }
 #endif
-        ppsz_text[1] = g_strdup( "no info" );
+        ppsz_text[1] = "no info";
         
         gtk_clist_insert( p_clist, 0, ppsz_text );
-        
-        free( ppsz_text[0] );
-        free( ppsz_text[1] );
     }
     gtk_clist_set_background( p_clist, p_playlist->i_index, &red);
     gtk_clist_thaw( p_clist );