<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkCheckButton" id="mediaexport-enabled-checkbutton">
- <property name="label" translatable="yes">_Media Export</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="uris-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
+ <object class="GtkLabel" id="media-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Media</property>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>
using Gee;
public class Rygel.MediaExportPrefSection : PreferencesSection {
- const string ENABLED_CHECK = "-enabled-checkbutton";
const string NAME = "MediaExport";
const string URIS_KEY = "uris";
const string URIS_LABEL = URIS_KEY + "-label";
const string REMOVE_BUTTON = "remove-button";
const string CLEAR_BUTTON = "clear-button";
- private CheckButton enabled_check;
private ArrayList<Widget> widgets; // All widgets in this section
private TreeView treeview;
this.widgets = new ArrayList<Widget> ();
- this.enabled_check = (CheckButton) builder.get_object (name.down () +
- ENABLED_CHECK);
- assert (this.enabled_check != null);
-
- try {
- this.enabled_check.active = config.get_enabled (name);
- } catch (GLib.Error err) {
- this.enabled_check.active = false;
- }
-
- this.enabled_check.toggled.connect (this.on_enabled_check_toggled);
-
this.treeview = (TreeView) builder.get_object (URIS_TEXTVIEW);
assert (this.treeview != null);
this.liststore = (ListStore) builder.get_object (URIS_LISTSTORE);
button = (Button) builder.get_object (CLEAR_BUTTON);
button.clicked.connect (this.on_clear_button_clicked);
this.widgets.add (button);
-
- var label = (Label) builder.get_object (URIS_LABEL);
- assert (label != null);
- this.widgets.add (label);
-
- // Initialize the sensitivity of all widgets
- this.reset_widgets_sensitivity ();
}
public override void save () {
- this.config.set_bool (this.name,
- UserConfig.ENABLED_KEY,
- this.enabled_check.active);
-
TreeIter iter;
var uri_list = new ArrayList<string> ();
this.config.set_string_list (this.name, URIS_KEY, uri_list);
}
- private void reset_widgets_sensitivity () {
- this.title_entry.sensitive = this.enabled_check.active;
-
- foreach (var widget in this.widgets) {
- widget.sensitive = enabled_check.active;
- }
- }
-
- private void on_enabled_check_toggled (ToggleButton enabled_check) {
- this.reset_widgets_sensitivity ();
- }
-
private void on_add_button_clicked (Button button) {
if (this.dialog.run () == ResponseType.OK) {
TreeIter iter;