[vlc-devel] [PATCH 2/3] dsm: set item browsable if it's a share or a directory

Thomas Guillem thomas at gllm.fr
Mon Feb 2 17:45:41 CET 2015


---
 modules/access/dsm/access.c | 14 +++++++++-----
 modules/access/dsm/sd.c     |  5 +++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 1ea8e75..d19e697 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -108,7 +108,7 @@ static int login( access_t *p_access );
 static void backslash_path( vlc_url_t *p_url );
 static bool get_path( access_t *p_access );
 static int add_item( access_t *p_access,  input_item_node_t *p_node,
-                     const char *psz_name );
+                     const char *psz_name, bool b_browsable );
 
 struct access_sys_t
 {
@@ -562,7 +562,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
 }
 
 static int add_item( access_t *p_access, input_item_node_t *p_node,
-                     const char *psz_name )
+                     const char *psz_name, bool b_browsable )
 {
     access_sys_t *p_sys = p_access->p_sys;
     input_item_t *p_item;
@@ -573,7 +573,10 @@ static int add_item( access_t *p_access, input_item_node_t *p_node,
     if( i_ret == -1 )
         return VLC_ENOMEM;
 
-    p_item = input_item_New( psz_uri, psz_name );
+    p_item = input_item_NewWithTypeExt( psz_uri, psz_name, 0, NULL, 0, -1,
+                                        ITEM_TYPE_NET,
+                                        b_browsable ? ITEM_BROWSABLE
+                                                    : ITEM_NOT_BROWSABLE );
     free( psz_uri );
     if( p_item == NULL )
         return VLC_ENOMEM;
@@ -625,7 +628,7 @@ static int BrowseShare( access_t *p_access, input_item_node_t *p_node )
         if( psz_name[strlen( psz_name ) - 1] == '$')
             continue;
 
-        i_ret = add_item( p_access, p_node, psz_name );
+        i_ret = add_item( p_access, p_node, psz_name, true );
         if( i_ret != VLC_SUCCESS )
             goto error;
     }
@@ -677,7 +680,8 @@ static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node )
         if( !strcmp( psz_name, ".") || !strcmp( psz_name, "..") )
             continue;
 
-        i_ret = add_item( p_access, p_node, psz_name );
+        i_ret = add_item( p_access, p_node, psz_name,
+                          smb_stat_get( st, SMB_STAT_ISDIR ) );
         if( i_ret != VLC_SUCCESS )
             goto error;
     }
diff --git a/modules/access/dsm/sd.c b/modules/access/dsm/sd.c
index d72a048..ae5df26 100644
--- a/modules/access/dsm/sd.c
+++ b/modules/access/dsm/sd.c
@@ -120,8 +120,9 @@ static void netbios_ns_discover_on_entry_added( void *p_opaque,
         if( asprintf(&psz_mrl, "smb://%s", name) < 0 )
             return;
 
-        p_item = input_item_NewWithType( psz_mrl, name, 0, NULL,
-                                         0, -1, ITEM_TYPE_NODE );
+        p_item = input_item_NewWithTypeExt( psz_mrl, name, 0, NULL,
+                                            0, -1, ITEM_TYPE_NODE,
+                                            ITEM_BROWSABLE );
         msg_Dbg( p_sd, "Adding item %s", psz_mrl );
         free(psz_mrl);
 
-- 
2.1.3




More information about the vlc-devel mailing list