Instead of PluginPref implementations overriding a handler, they just
provide a list of all widgets.
private ListStore liststore;
private FileChooserDialog dialog;
private ListStore liststore;
private FileChooserDialog dialog;
- private ArrayList<Button> buttons;
-
public MediaExportPrefSection (Builder builder,
UserConfig config) {
base (builder, config, NAME);
public MediaExportPrefSection (Builder builder,
UserConfig config) {
base (builder, config, NAME);
+ this.widgets.add (this.treeview);
try {
var uris = config.get_string_list (this.name, URIS_KEY);
try {
var uris = config.get_string_list (this.name, URIS_KEY);
this.dialog.set_current_folder (Environment.get_home_dir ());
this.dialog.show_hidden = false;
this.dialog.set_current_folder (Environment.get_home_dir ());
this.dialog.show_hidden = false;
- this.buttons = new ArrayList<Button> ();
-
var button = (Button) builder.get_object (ADD_BUTTON);
button.clicked += this.on_add_button_clicked;
var button = (Button) builder.get_object (ADD_BUTTON);
button.clicked += this.on_add_button_clicked;
- this.buttons.add (button);
+ this.widgets.add (button);
button = (Button) builder.get_object (REMOVE_BUTTON);
button.clicked += this.on_remove_button_clicked;
button = (Button) builder.get_object (REMOVE_BUTTON);
button.clicked += this.on_remove_button_clicked;
- this.buttons.add (button);
+ this.widgets.add (button);
button = (Button) builder.get_object (CLEAR_BUTTON);
button.clicked += this.on_clear_button_clicked;
button = (Button) builder.get_object (CLEAR_BUTTON);
button.clicked += this.on_clear_button_clicked;
- this.buttons.add (button);
+ this.widgets.add (button);
}
public override void save () {
}
public override void save () {
this.config.set_string_list (this.name, URIS_KEY, uri_list);
}
this.config.set_string_list (this.name, URIS_KEY, uri_list);
}
- protected override void on_enabled_check_toggled (
- CheckButton enabled_check) {
- base.on_enabled_check_toggled (enabled_check);
-
- this.treeview.sensitive = enabled_check.active;
- foreach (var button in this.buttons) {
- button.sensitive = enabled_check.active;
- }
- }
-
private void on_add_button_clicked (Button button) {
if (this.dialog.run () == ResponseType.OK) {
TreeIter iter;
private void on_add_button_clicked (Button button) {
if (this.dialog.run () == ResponseType.OK) {
TreeIter iter;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using Gtk;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using Gtk;
public class Rygel.PluginPrefSection : PreferencesSection {
const string ENABLED_CHECK = "-enabled-checkbutton";
public class Rygel.PluginPrefSection : PreferencesSection {
const string ENABLED_CHECK = "-enabled-checkbutton";
private CheckButton enabled_check;
private Entry title_entry;
private CheckButton enabled_check;
private Entry title_entry;
+ protected ArrayList<Widget> widgets; // All widgets in this section
+
public PluginPrefSection (Builder builder,
UserConfig config,
string name) {
base (config, name);
public PluginPrefSection (Builder builder,
UserConfig config,
string name) {
base (config, name);
+ this.widgets = new ArrayList<Widget> ();
+
this.enabled_check = (CheckButton) builder.get_object (name.down () +
ENABLED_CHECK);
assert (this.enabled_check != null);
this.enabled_check = (CheckButton) builder.get_object (name.down () +
ENABLED_CHECK);
assert (this.enabled_check != null);
this.config.set_string (this.name, UserConfig.TITLE_KEY, title);
}
this.config.set_string (this.name, UserConfig.TITLE_KEY, title);
}
- protected virtual void on_enabled_check_toggled (
- CheckButton enabled_check) {
+ protected void on_enabled_check_toggled (CheckButton enabled_check) {
this.title_entry.sensitive = enabled_check.active;
this.title_entry.sensitive = enabled_check.active;
+
+ foreach (var widget in this.widgets) {
+ widget.sensitive = enabled_check.active;
+ }
this.pictures_check = (CheckButton) builder.get_object (PICTURES_CHECK);
assert (this.pictures_check != null);
this.pictures_check = (CheckButton) builder.get_object (PICTURES_CHECK);
assert (this.pictures_check != null);
+ this.widgets.add (this.videos_check);
+ this.widgets.add (this.music_check);
+ this.widgets.add (this.pictures_check);
+
this.videos_check.active = true;
this.music_check.active = true;
this.pictures_check.active = true;
this.videos_check.active = true;
this.music_check.active = true;
this.pictures_check.active = true;
config.set_bool (this.name, MUSIC_KEY, this.music_check.active);
config.set_bool (this.name, PICTURES_KEY, this.pictures_check.active);
}
config.set_bool (this.name, MUSIC_KEY, this.music_check.active);
config.set_bool (this.name, PICTURES_KEY, this.pictures_check.active);
}
-
- protected override void on_enabled_check_toggled (
- CheckButton enabled_check) {
- base.on_enabled_check_toggled (enabled_check);
-
- this.videos_check.sensitive = enabled_check.active;
- this.music_check.sensitive = enabled_check.active;
- this.pictures_check.sensitive = enabled_check.active;
- }