]> git.sesse.net Git - vlc/commitdiff
Mac OS X gui: Quick Preferences fix.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 4 May 2007 13:29:15 +0000 (13:29 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 4 May 2007 13:29:15 +0000 (13:29 +0000)
modules/gui/macosx/prefs.m
modules/gui/macosx/prefs_widgets.m

index 133bd027d26d3e24bed96821cc98baf73c5226b7..c980477353a1f7203615153d6ca0882972087c66 100644 (file)
@@ -566,7 +566,7 @@ static VLCTreeItem *o_root_item = nil;
                     msg_Err( p_intf, "invalid preference item found" );
                     break;
                 }
-                if( p_item < p_end )
+                if( p_item > p_end )
                     break;
                 switch(p_item->i_type)
                 {
@@ -636,7 +636,7 @@ static VLCTreeItem *o_root_item = nil;
                     msg_Err( p_intf, "invalid preference item found" );
                     break;
                 }
-                if( p_item < p_end )
+                if( p_item > p_end )
                     break;
                 switch( p_item->i_type )
                 {
index 1092cf092e872a9c75710668d220abbd5daadce4..d4f979d87560f89c70dcb59307eed18a28858042 100644 (file)
             [[VLCMain sharedInstance]
                 localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
         if( p_item->value.psz )
-            o_textfieldString = [[VLCMain sharedInstance]
-                                    localizedString: (char *)p_item->value.psz];
+            o_textfieldString = [NSString stringWithFormat: @"%s", (char *)p_item->value.psz];
         else
             o_textfieldString = [NSString stringWithString: @""];
         ADD_TEXTFIELD( o_textfield, mainFrame, 12, 2, mainFrame.size.width -
         int i_index;
         vlc_list_t *p_list;
         module_t *p_parser;
-        module_config_t *p_end;
         i_view_type = CONFIG_ITEM_MODULE;
 
         /* add the label */
         for( i_index = 0; i_index < p_list->i_count; i_index++ )
         {
             p_parser = (module_t *)p_list->p_values[i_index].p_object;
-            p_end = p_item + p_parser->confsize;
+
             if( p_item->i_type == CONFIG_ITEM_MODULE )
             {
                 if( !strcmp( p_parser->psz_capability,
             }
             else
             {
-                module_config_t *p_config;
+                int i;
+
                 if( !strcmp( p_parser->psz_object_name, "main" ) )
-                      continue;
+                    continue;
 
-                p_config = p_parser->p_config;
-                if( p_config ) do
+                for ( i = 0; i < p_parser->confsize; i++ )
                 {
+                    module_config_t *p_config = p_parser->p_config + i;
                     /* Hack: required subcategory is stored in i_min */
                     if( p_config->i_type == CONFIG_SUBCATEGORY &&
                         p_config->value.i == p_item->min.i )
                                                 p_parser->psz_object_name) )
                             [o_popup selectItem:[o_popup lastItem]];
                     }
-                } while( p_item < p_end && p_config++ );
+                } 
             }
         }
         vlc_list_release( p_list );
 {
     NSString *newval = [o_popup titleOfSelectedItem];
     char *returnval = NULL;
-    int i_index;
+    int i_module_index;
     vlc_list_t *p_list;
     module_t *p_parser;
-    module_config_t *p_end;
 
     p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
-    for( i_index = 0; i_index < p_list->i_count; i_index++ )
+    for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
     {
-        p_parser = (module_t *)p_list->p_values[i_index].p_object;
-         p_end = p_item + p_parser->confsize;
+        p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
+
         if( p_item->i_type == CONFIG_ITEM_MODULE )
         {
             if( !strcmp( p_parser->psz_capability,
         }
         else
         {
-            module_config_t *p_config;
+            int i;
+
             if( !strcmp( p_parser->psz_object_name, "main" ) )
-                  continue;
+                continue;
 
-            p_config = p_parser->p_config;
-            if( p_config ) do
+            for ( i = 0; i < p_parser->confsize; i++ )
             {
+                module_config_t *p_config = p_parser->p_config + i;
                 /* Hack: required subcategory is stored in i_min */
                 if( p_config->i_type == CONFIG_SUBCATEGORY &&
                     p_config->value.i == p_item->min.i )
                         break;
                     }
                 }
-            } while( p_item < p_end && p_config++ );
+            }
         }
     }
     vlc_list_release( p_list );
            withView: (NSView *)o_parent_view
 {
     NSRect mainFrame = [o_parent_view frame];
-    NSString *o_labelString, *o_tooltip, *o_textfieldString;
+    NSString *o_labelString, *o_tooltip;
     mainFrame.size.height = 23;
     mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
     mainFrame.origin.x = LEFTMARGIN;
         [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
         [self addSubview: o_stepper];
 
-        /* build the textfield */
-        if( p_item->value.psz )
-            o_textfieldString = [[VLCMain sharedInstance]
-                                    localizedString: (char *)p_item->value.psz];
-        else
-            o_textfieldString = [NSString stringWithString: @""];
         ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
             1, 49, o_tooltip, @"" )
         [o_textfield setIntValue: p_item->value.i];
            withView: (NSView *)o_parent_view
 {
     NSRect mainFrame = [o_parent_view frame];
-    NSString *o_labelString, *o_tooltip, *o_textfieldString;
+    NSString *o_labelString, *o_tooltip;
     mainFrame.size.height = 23;
     mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
     mainFrame.origin.x = LEFTMARGIN;
         [self addSubview: o_stepper];
 
         /* build the textfield */
-        if( p_item->value.psz )
-            o_textfieldString = [[VLCMain sharedInstance]
-                                    localizedString: (char *)p_item->value.psz];
-        else
-            o_textfieldString = [NSString stringWithString: @""];
         ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
             1, 49, o_tooltip, @"" )
         [o_textfield setFloatValue: p_item->value.f];
@@ -2060,27 +2048,27 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
 //Fill our array to know how may items we have...
     vlc_list_t *p_list;
     module_t *p_parser;
-    module_config_t *p_end;
-    int i_index;
+    int i_module_index;
     NSRect mainFrame = [o_parent_view frame];
     NSString *o_labelString, *o_textfieldString, *o_tooltip;
 
     o_modulearray = [[NSMutableArray alloc] initWithCapacity:10];
     /* build a list of available modules */
     p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
-    for( i_index = 0; i_index < p_list->i_count; i_index++ )
+    for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
     {
-        p_parser = (module_t *)p_list->p_values[i_index].p_object;
-        p_end = p_item + p_parser->confsize;
+        int i;
+        p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
 
         if( !strcmp( p_parser->psz_object_name, "main" ) )
             continue;
 
-        module_config_t *p_config = p_parser->p_config;
-        if( p_config ) do
+        for ( i = 0; i < p_parser->confsize; i++ )
         {
+            module_config_t *p_config = p_parser->p_config + i;
             NSString *o_modulelongname, *o_modulename;
             NSNumber *o_moduleenabled = nil;
+
             /* Hack: required subcategory is stored in i_min */
             if( p_config->i_type == CONFIG_SUBCATEGORY &&
                 p_config->value.i == _p_item->min.i )
@@ -2100,7 +2088,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
                     arrayWithObjects: o_modulename, o_modulelongname,
                     o_moduleenabled, nil]];
             }
-        } while( p_item < p_end && p_config++ );
+        }
     }
     vlc_list_release( p_list );