]> git.sesse.net Git - vlc/commitdiff
Added a Service Discovery sub menu in playlist contextual menu.
authorJérome Decoodt <djc@videolan.org>
Mon, 24 Jan 2005 14:19:40 +0000 (14:19 +0000)
committerJérome Decoodt <djc@videolan.org>
Mon, 24 Jan 2005 14:19:40 +0000 (14:19 +0000)
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index ae36c854b58948e374f7707eec309fa110e7eada..bffb82d8352d00a89412ee2ee9b9987ec0a8a456 100644 (file)
                 "o_mi_play" = id; 
                 "o_mi_save_playlist" = id; 
                 "o_mi_selectall" = id; 
+                "o_mi_services" = id; 
                 "o_mi_sort_author" = id; 
                 "o_mi_sort_name" = id; 
+                "o_mu_services" = id; 
                 "o_outline_view" = id; 
                 "o_random_ckb" = id; 
                 "o_search_field" = id; 
index 5159d5eb0c4e6fe45996f7e6797204945e131392..5d23ed890a964f20b55bb08b55d91e9864ffbb89 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index d843b68c4d93f55d1c094f07d557a6a8ef6426ba..81b325666bd74a0d166b9f3b4c83594f16296641 100644 (file)
@@ -56,6 +56,9 @@
     IBOutlet id o_mi_selectall;
     IBOutlet id o_mi_sort_name;
     IBOutlet id o_mi_sort_author;
+    IBOutlet id o_mi_services;
+
+    IBOutlet id o_mu_services;
 
     NSImage *o_descendingSortingImage;
     NSImage *o_ascendingSortingImage;
@@ -80,6 +83,7 @@
 - (void)sortNode:(int)i_mode;
 - (void)updateRowSelection;
 
+- (IBAction)servicesChange:(id)sender;
 - (IBAction)playItem:(id)sender;
 - (IBAction)deleteItem:(id)sender;
 - (IBAction)selectAll:(id)sender;
index deb4f2618159c2c78d24cecf97ef819ab8d46277..fdb15f89065b76ee7ae08f077bad86f584df3f93 100644 (file)
 {
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
                                           FIND_ANYWHERE );
+    vlc_list_t *p_list = vlc_list_find( p_playlist, VLC_OBJECT_MODULE,
+                                        FIND_ANYWHERE );
+
+    int i_index;
     i_current_view = VIEW_CATEGORY;
     playlist_ViewUpdate( p_playlist, i_current_view );
-    vlc_object_release( p_playlist );
 
     [o_outline_view setTarget: self];
     [o_outline_view setDelegate: self];
@@ -147,6 +150,31 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     o_tc_sortColumn = nil;
 
+    for( i_index = 0; i_index < p_list->i_count; i_index++ )
+    {
+        NSMenuItem * o_lmi;
+        module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object ;
+
+        if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
+        {
+            o_lmi = [[o_mi_services submenu] addItemWithTitle:
+                     [NSString stringWithCString:
+                     p_parser->psz_longname ? p_parser->psz_longname :
+                     ( p_parser->psz_shortname ? p_parser->psz_shortname:
+                     p_parser->psz_object_name)]
+                                             action: @selector(servicesChange:)
+                                             keyEquivalent: @""];
+            [o_lmi setTarget: self];
+            [o_lmi setRepresentedObject:
+                   [NSString stringWithCString: p_parser->psz_object_name]];
+            if( playlist_IsServicesDiscoveryLoaded( p_playlist,
+                    p_parser->psz_object_name ) )
+                [o_lmi setState: NSOnState];
+        }
+    }
+    vlc_list_release( p_list );
+    vlc_object_release( p_playlist );
+
     [self initStrings];
     //[self playlistUpdated];
 }
@@ -160,6 +188,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     [o_mi_info setTitle: _NS("Properties")];
     [o_mi_sort_name setTitle: _NS("Sort Node by Name")];
     [o_mi_sort_author setTitle: _NS("Sort Node by Author")];
+    [o_mi_services setTitle: _NS("Services discovery")];
     [[o_tc_name headerCell] setStringValue:_NS("Name")];
     [[o_tc_author headerCell] setStringValue:_NS("Author")];
     [[o_tc_duration headerCell] setStringValue:_NS("Duration")];
@@ -401,6 +430,23 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 }
 
+- (IBAction)servicesChange:(id)sender
+{
+    NSMenuItem *o_mi = (NSMenuItem *)sender;
+    NSString *o_string = [o_mi representedObject];
+    playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
+                                          FIND_ANYWHERE );
+    if( !playlist_IsServicesDiscoveryLoaded( p_playlist, [o_string cString] ) )
+        playlist_ServicesDiscoveryAdd( p_playlist, [o_string cString] );
+    else
+        playlist_ServicesDiscoveryRemove( p_playlist, [o_string cString] );
+
+    [o_mi setState: playlist_IsServicesDiscoveryLoaded( p_playlist,
+                                          [o_string cString] ) ? YES : NO];
+    [self playlistUpdated];
+    return;
+}
+
 - (IBAction)selectAll:(id)sender
 {
     [o_outline_view selectAll: nil];