src/rygel/rygel-changelog.vala
src/ui/rygel-general-pref-section.vala
src/ui/rygel-media-export-pref-section.vala
-src/ui/rygel-plugin-pref-section.vala
src/ui/rygel-preferences-dialog.vala
src/ui/rygel-preferences-section.vala
src/ui/rygel-writable-user-config.vala
rygel-preferences-dialog.vala \
rygel-preferences-section.vala \
rygel-general-pref-section.vala \
- rygel-plugin-pref-section.vala \
rygel-media-export-pref-section.vala \
rygel-writable-user-config.vala
using Gtk;
using Gee;
-public class Rygel.MediaExportPrefSection : Rygel.PluginPrefSection {
+public class Rygel.MediaExportPrefSection : PreferencesSection {
+ const string ENABLED_CHECK = "-enabled-checkbutton";
+ const string TITLE_LABEL = "-title-label";
+ const string TITLE_ENTRY = "-title-entry";
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 Entry title_entry;
+
+ private ArrayList<Widget> widgets; // All widgets in this section
+
private TreeView treeview;
private ListStore liststore;
private FileChooserDialog dialog;
public MediaExportPrefSection (Builder builder,
WritableUserConfig config) {
- base (builder, config, 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.title_entry = (Entry) builder.get_object (name.down () +
+ TITLE_ENTRY);
+ assert (this.title_entry != null);
+ var title_label = (Label) builder.get_object (name.down () +
+ TITLE_LABEL);
+ assert (title_label != null);
+ this.widgets.add (title_label);
+
+ try {
+ this.enabled_check.active = config.get_enabled (name);
+ } catch (GLib.Error err) {
+ this.enabled_check.active = false;
+ }
+
+ string title;
+ try {
+ title = config.get_title (name);
+ } catch (GLib.Error err) {
+ title = name;
+ }
+
+ title = title.replace ("@REALNAME@", "%n");
+ title = title.replace ("@USERNAME@", "%u");
+ title = title.replace ("@HOSTNAME@", "%h");
+ this.title_entry.set_text (title);
+
+ this.enabled_check.toggled.connect (this.on_enabled_check_toggled);
this.treeview = (TreeView) builder.get_object (URIS_TEXTVIEW);
assert (this.treeview != null);
}
public override void save () {
- base.save ();
+ this.config.set_bool (this.name,
+ UserConfig.ENABLED_KEY,
+ this.enabled_check.active);
+
+ var title = this.title_entry.get_text ().replace ("%n", "@REALNAME@");
+ title = title.replace ("%u", "@USERNAME@");
+ title = title.replace ("%h", "@HOSTNAME@");
+ this.config.set_string (this.name, UserConfig.TITLE_KEY, title);
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;
+++ /dev/null
-/*
- * Copyright (C) 2009 Nokia Corporation.
- *
- * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
- * <zeeshan.ali@nokia.com>
- *
- * This file is part of Rygel.
- *
- * Rygel is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Rygel is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-using Gtk;
-using Gee;
-
-public class Rygel.PluginPrefSection : PreferencesSection {
- const string ENABLED_CHECK = "-enabled-checkbutton";
- const string TITLE_LABEL = "-title-label";
- const string TITLE_ENTRY = "-title-entry";
-
- private CheckButton enabled_check;
- private Entry title_entry;
-
- protected ArrayList<Widget> widgets; // All widgets in this section
-
- public PluginPrefSection (Builder builder,
- WritableUserConfig 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.title_entry = (Entry) builder.get_object (name.down () +
- TITLE_ENTRY);
- assert (this.title_entry != null);
- var title_label = (Label) builder.get_object (name.down () +
- TITLE_LABEL);
- assert (title_label != null);
- this.widgets.add (title_label);
-
- try {
- this.enabled_check.active = config.get_enabled (name);
- } catch (GLib.Error err) {
- this.enabled_check.active = false;
- }
-
- string title;
- try {
- title = config.get_title (name);
- } catch (GLib.Error err) {
- title = name;
- }
-
- title = title.replace ("@REALNAME@", "%n");
- title = title.replace ("@USERNAME@", "%u");
- title = title.replace ("@HOSTNAME@", "%h");
- this.title_entry.set_text (title);
-
- this.enabled_check.toggled.connect (this.on_enabled_check_toggled);
- }
-
- public override void save () {
- this.config.set_bool (this.name,
- UserConfig.ENABLED_KEY,
- this.enabled_check.active);
-
- var title = this.title_entry.get_text ().replace ("%n", "@REALNAME@");
- title = title.replace ("%u", "@USERNAME@");
- title = title.replace ("%h", "@HOSTNAME@");
- this.config.set_string (this.name, UserConfig.TITLE_KEY, title);
- }
-
- protected 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 ();
- }
-}