public ProfileComboBoxConfigurable(MediaProfileManager manager, string configurationId, Box parent) { HBox editor = new HBox(); configuration_id = configurationId; combo = new ProfileComboBox(manager); combo.Show(); button = new ProfileConfigureButton(configurationId); button.ComboBox = combo; button.Show(); editor.Spacing = 5; editor.PackStart(combo, true, true, 0); editor.PackStart(button, false, false, 0); editor.Show(); ProfileConfiguration config = manager.GetActiveProfileConfiguration(configurationId); if (config != null) { Combo.SetActiveProfile(config.Profile); } description = new DescriptionLabel(delegate { var profile = Combo.ActiveProfile; return(profile != null ? profile.Description : ""); }); Combo.Changed += delegate { if (Combo.ActiveProfile != null) { Hyena.Log.DebugFormat("Setting active encoding profile: {0} (saved to {1})", Combo.ActiveProfile.Name, configurationId); ProfileConfiguration.SaveActiveProfile(Combo.ActiveProfile, configurationId); description.Update(); } }; Combo.StateChanged += delegate { if (Combo.State == StateType.Insensitive && description.Parent != null) { ((Container)parent ?? this).Remove(description); } else if (description.Parent == null) { description.PackInto(parent ?? this, parent != null); } }; Spacing = 5; PackStart(editor, true, true, 0); description.PackInto(parent ?? this, parent != null); }
public ProfileComboBoxConfigurable(MediaProfileManager manager, string configurationId, Box parent) { HBox editor = new HBox(); configuration_id = configurationId; combo = new ProfileComboBox(manager); combo.Show(); button = new ProfileConfigureButton(configurationId); button.ComboBox = combo; button.Show(); editor.Spacing = 5; editor.PackStart(combo, true, true, 0); editor.PackStart(button, false, false, 0); editor.Show(); ProfileConfiguration config = manager.GetActiveProfileConfiguration (configurationId); if (config != null) { Combo.SetActiveProfile(config.Profile); } description = new DescriptionLabel (delegate { var profile = Combo.ActiveProfile; return profile != null ? profile.Description : ""; }); Combo.Changed += delegate { if(Combo.ActiveProfile != null) { Hyena.Log.DebugFormat ("Setting active encoding profile: {0} (saved to {1})", Combo.ActiveProfile.Name, configurationId); ProfileConfiguration.SaveActiveProfile (Combo.ActiveProfile, configurationId); description.Update (); } }; Combo.StateChanged += delegate { if (Combo.State == StateType.Insensitive) { ((Container)parent ?? this).Remove (description); } else { description.PackInto (parent ?? this, parent != null); } }; Spacing = 5; PackStart (editor, true, true, 0); description.PackInto (parent ?? this, parent != null); }