[vlc-commits] macosx/prefswidget: fix initilization
Felix Paul Kühne
git at videolan.org
Sat Jun 9 18:53:14 CEST 2018
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Jun 9 18:21:35 2018 +0200| [2378131a7c3351efe68f4a2cbeb582ad3a5c7815] | committer: Felix Paul Kühne
macosx/prefswidget: fix initilization
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2378131a7c3351efe68f4a2cbeb582ad3a5c7815
---
modules/gui/macosx/prefs_widgets.m | 54 ++++++++++++++++++++++----------------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index 1a9425c9ec..32f1912af8 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -406,8 +406,12 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
if (self != nil) {
_p_item = p_item;
- psz_name = p_item->psz_name;
- _type = p_item->i_type;
+ if (p_item) {
+ psz_name = p_item->psz_name;
+ _type = p_item->i_type;
+ } else {
+ psz_name = NULL;
+ }
[self setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin ];
}
return (self);
@@ -1940,6 +1944,12 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
- (id)initWithItem:(module_config_t *)p_item
withView:(NSView *)parentView
{
+ self = [super initWithFrame:CGRectZero item:p_item];
+ if (!self) {
+ return self;
+ }
+ self.viewType = CONFIG_ITEM_MODULE_LIST;
+
BOOL b_by_cat = p_item->i_type == CONFIG_ITEM_MODULE_LIST_CAT;
//Fill our array to know how may items we have...
@@ -2010,7 +2020,6 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
}
module_config_free(p_configlist);
-
} else if (module_provides(p_parser, p_item->psz_type)) {
NSString *o_modulelongname = toNSStr(module_get_name(p_parser, TRUE));
@@ -2079,30 +2088,29 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0;
- if (self = [super initWithFrame:mainFrame item:p_item]) {
- self.viewType = CONFIG_ITEM_MODULE_LIST;
+ self.frame = mainFrame;
- toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS(p_item->psz_longtext) toWidth: PREFS_WRAP];
+ toolTip = [[VLCStringUtility sharedInstance] wrapString: _NS(p_item->psz_longtext) toWidth: PREFS_WRAP];
- /* add the label */
- labelString = _NS((char *)p_item->psz_text);
- ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
- [self.label setAutoresizingMask:NSViewNotSizable ];
- [self addSubview: self.label];
+ /* add the label */
+ labelString = _NS((char *)p_item->psz_text);
+ ADD_LABEL(self.label, mainFrame, 0, -3, labelString, toolTip)
+ [self.label setAutoresizingMask:NSViewNotSizable ];
+ [self addSubview: self.label];
- /* build the textfield */
- if (p_item->value.psz)
- o_textfieldString = _NS(p_item->value.psz);
- else
- o_textfieldString = @"";
- ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
- mainFrame.size.height - 22, mainFrame.size.width -
- [self.label frame].size.width - 2, toolTip, o_textfieldString)
- [o_textfield setAutoresizingMask:NSViewWidthSizable ];
- [self addSubview: o_textfield];
+ /* build the textfield */
+ if (p_item->value.psz)
+ o_textfieldString = _NS(p_item->value.psz);
+ else
+ o_textfieldString = @"";
+ ADD_TEXTFIELD(o_textfield, mainFrame, [self.label frame].size.width + 2,
+ mainFrame.size.height - 22, mainFrame.size.width -
+ [self.label frame].size.width - 2, toolTip, o_textfieldString)
+ [o_textfield setAutoresizingMask:NSViewWidthSizable ];
+ [self addSubview: o_textfield];
+
+ [self addSubview: o_tableview];
- [self addSubview: o_tableview];
- }
return self;
}
More information about the vlc-commits
mailing list