Support for browsing local media (not finished).
authorJean-Paul Saman <jpsaman@videolan.org>
Mon, 12 Aug 2002 20:38:19 +0000 (20:38 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Mon, 12 Aug 2002 20:38:19 +0000 (20:38 +0000)
modules/gui/familiar/callbacks.c
modules/gui/familiar/callbacks.h
modules/gui/familiar/familiar.c
modules/gui/familiar/familiar.glade
modules/gui/familiar/familiar.h
modules/gui/familiar/interface.c
modules/gui/familiar/support.c

index 4aaab55..67173a5 100644 (file)
@@ -2,7 +2,7 @@
  * callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: callbacks.c,v 1.2 2002/08/06 19:31:18 jpsaman Exp $
+ * $Id: callbacks.c,v 1.3 2002/08/12 20:38:19 jpsaman Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -33,6 +33,7 @@
 
 #include <unistd.h>
 #include <string.h>
+#include <dirent.h>
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
@@ -127,6 +128,32 @@ static void PreferencesURLOpenChanged( GtkEditable *editable, gpointer user_data
 //    gtk_container_add (GTK_CONTAINER (GTK_COMBO (combo)->list), item);
 }
 
+/*****************************************************************
+ * Read directory helper function.
+ ****************************************************************/
+static void ReadDirectory( GtkWidget *widget, char *psz_dir)
+{
+    struct dirent **namelist;
+    int n;
+
+    if (psz_dir)
+       n = scandir(psz_dir, &namelist, 0, alphasort);
+    else
+       n = scandir(".", &namelist, 0, alphasort);
+    if (n<0)
+        perror("scandir");
+    else
+    {
+        while(n--) /* reverse printed list */
+        {
+            /* add list to listMedia widget */
+            g_print("%s\n",namelist[n]->d_name);
+            free(namelist[n]);
+        }
+        free(namelist);
+    }
+}
+
 
 /*
  * Main interface callbacks
index 3c7d219..51e48ab 100644 (file)
@@ -2,7 +2,7 @@
  * callbacks.h : familiar plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: callbacks.h,v 1.2 2002/08/06 19:31:18 jpsaman Exp $
+ * $Id: callbacks.h,v 1.3 2002/08/12 20:38:19 jpsaman Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -25,6 +25,8 @@
 
 gboolean GtkExit                ( GtkWidget *, gpointer );
 
+static void ReadDirectory( GtkWidget *widget, char *psz_dir);
+
 gboolean
 on_familiar_destroy_event              (GtkWidget       *widget,
                                         GdkEvent        *event,
index 403dabb..94ea6c4 100644 (file)
@@ -2,7 +2,7 @@
  * familiar.c : familiar plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: familiar.c,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: familiar.c,v 1.2 2002/08/12 20:38:19 jpsaman Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -188,12 +188,18 @@ static void Run( intf_thread_t *p_intf )
         GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
 //    gtk_widget_hide( GTK_WIDGET(p_intf->p_sys->p_notebook) );
 
+    p_intf->p_sys->p_file_list = GTK_LIST( gtk_object_get_data(
+        GTK_OBJECT( p_intf->p_sys->p_notebook), "listMedia") );
+
     /* 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 );
     /* Show the control window */
     gtk_widget_show( p_intf->p_sys->p_window );
 
+    /* Testing routine */
+//    ReadDirectory( GTK_WIDGET(p_intf->p_sys->p_file_list), ".");
+
     /* Enter Gtk mode */
     gtk_main();
 
index cf5b9fd..4bb2c80 100644 (file)
@@ -6,19 +6,13 @@
   <program_name>familiar</program_name>
   <directory></directory>
   <source_directory></source_directory>
-  <pixmaps_directory>../../share</pixmaps_directory>
+  <pixmaps_directory>../../../share</pixmaps_directory>
   <language>C</language>
   <gnome_support>False</gnome_support>
   <gettext_support>True</gettext_support>
   <use_widget_names>True</use_widget_names>
   <output_main_file>False</output_main_file>
   <output_build_files>False</output_build_files>
-  <main_source_file>interface.c</main_source_file>
-  <main_header_file>interface.h</main_header_file>
-  <handler_source_file>callbacks.c</handler_source_file>
-  <handler_header_file>callbacks.h</handler_header_file>
-  <support_source_file>support.c</support_source_file>
-  <support_header_file>support.h</support_header_file>
 </project>
 
 <widget>
          <items>file://
 ftp://localhost
 http://localhost
-udp://localhost:1234/
+udpstream://@localhost:1234/
 </items>
 
          <widget>
@@ -373,7 +367,7 @@ udp://localhost:1234/
              <items>file://
 ftp://localhost
 http://localhost
-udp://localhost:1234/
+udpstream://@localhost:1234/
 </items>
 
              <widget>
index af44ab6..5650397 100644 (file)
@@ -2,7 +2,7 @@
  * familiar.h: private Gtk+ interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: familiar.h,v 1.1 2002/08/04 17:23:43 sam Exp $
+ * $Id: familiar.h,v 1.2 2002/08/12 20:38:19 jpsaman Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -34,6 +34,7 @@ struct intf_sys_t
 //    GtkWidget *         p_notebook_about;
 //    GtkWidget *         p_notebook_open;
 //    GtkWidget *         p_notebook_preferences;
+    GtkWidget *         p_file_list;
 
     /* The input thread */
     input_thread_t *    p_input;
index 476b334..212a3f5 100644 (file)
@@ -259,7 +259,7 @@ create_familiar (void)
   comboURL_items = g_list_append (comboURL_items, (gpointer) _("file://"));
   comboURL_items = g_list_append (comboURL_items, (gpointer) _("ftp://localhost"));
   comboURL_items = g_list_append (comboURL_items, (gpointer) _("http://localhost"));
-  comboURL_items = g_list_append (comboURL_items, (gpointer) _("udp://localhost:1234/"));
+  comboURL_items = g_list_append (comboURL_items, (gpointer) _("udpstream://@localhost:1234/"));
   gtk_combo_set_popdown_strings (GTK_COMBO (comboURL), comboURL_items);
   g_list_free (comboURL_items);
 
@@ -347,7 +347,7 @@ create_familiar (void)
   comboDefaultURL_items = g_list_append (comboDefaultURL_items, (gpointer) _("file://"));
   comboDefaultURL_items = g_list_append (comboDefaultURL_items, (gpointer) _("ftp://localhost"));
   comboDefaultURL_items = g_list_append (comboDefaultURL_items, (gpointer) _("http://localhost"));
-  comboDefaultURL_items = g_list_append (comboDefaultURL_items, (gpointer) _("udp://localhost:1234/"));
+  comboDefaultURL_items = g_list_append (comboDefaultURL_items, (gpointer) _("udpstream://@localhost:1234/"));
   gtk_combo_set_popdown_strings (GTK_COMBO (comboDefaultURL), comboDefaultURL_items);
   g_list_free (comboDefaultURL_items);
 
index 4af2461..5077e59 100644 (file)
@@ -113,7 +113,7 @@ create_pixmap                          (GtkWidget       *widget,
   /* If we haven't found the pixmap, try the source directory. */
   if (!found_filename)
     {
-      found_filename = check_file_exists ("../../share", filename);
+      found_filename = check_file_exists ("../../../share", filename);
     }
 
   if (!found_filename)