[vlc-devel] [RFC PATCH 2/7] dsm: change item i_browsable

Thomas Guillem thomas at gllm.fr
Fri Mar 20 17:38:33 CET 2015


Set i_browsable if the item is a share of a directory.
---
 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 6e30adc..4efe1c6 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
 {
@@ -560,7 +560,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;
@@ -571,7 +571,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;
@@ -623,7 +626,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;
     }
@@ -675,7 +678,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 af4f50b..b139f16 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