/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="service">
        /// The <see cref="StreamrecorderService"/> that is being configured
        /// </param>
        /// <param name="previous_output_folder">
        /// A <see cref="System.String"/> containing the previously configured output directory
        /// </param>
        /// <param name="previous_encoder">
        /// A <see cref="System.String"/> containing the previously configured encoder
        /// </param>
        /// <param name="is_importing_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled
        /// </param>
        /// <param name="is_splitting_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled
        /// </param>
        public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled)
        {
            streamrecorder_service = service;

            preferences_image.Yalign = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;
            preferences_image.Show ();
            header_label.Text = String.Format (AddinManager.CurrentLocalizer.GetString ("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>");
            header_label.UseMarkup = true;
            header_label.Wrap = true;
            header_label.Yalign = 0f;
            header_label.Xalign = 0f;
            description_label.Text = AddinManager.CurrentLocalizer.GetString ("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n");
            description_label.Yalign = 0f;
            description_label.Xalign = 0f;
            choose_folder_label.Text = AddinManager.CurrentLocalizer.GetString ("Output folder:");
            choose_encoder_label.Text = AddinManager.CurrentLocalizer.GetString ("Encoder:");
            output_folder.Text = previous_output_folder;
            choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString ("_Browse");
            choose_output_folder_button.Image = new Image ("gtk-directory", IconSize.Button);
            choose_output_folder_button.ShowAll ();
            cancel_button.Label = AddinManager.CurrentLocalizer.GetString ("_Cancel");
            cancel_button.Image = new Image ("gtk-cancel", IconSize.Button);
            save_button.Label = AddinManager.CurrentLocalizer.GetString ("_Save");
            save_button.Image = new Image ("gtk-save", IconSize.Button);
            enable_import_ripped_songs.Label = AddinManager.CurrentLocalizer.GetString ("Import files to media library");
            enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get ().Equals ("True") ? true : false;
            enable_automatic_splitting.Label = AddinManager.CurrentLocalizer.GetString ("Enable automatic files splitting by Metadata");
            enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get ().Equals ("True") ? true : false;

            encoderbox.Clear ();
            CellRendererText cell = new CellRendererText ();
            encoderbox.PackStart (cell, false);
            encoderbox.AddAttribute (cell, "text", 0);
            ListStore store = new ListStore (typeof(string));
            encoderbox.Model = store;

            int row = -1;
            int chosen_row = -1;
            foreach (string encoder in streamrecorder_service.GetEncoders ()) {
                row++;
                store.AppendValues (encoder);
                if (encoder.Equals (previous_encoder)) {
                    chosen_row = row;
                    Hyena.Log.DebugFormat ("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row);
                }
            }

            if (chosen_row > -1) {
                Gtk.TreeIter iter;
                encoderbox.Model.IterNthChild (out iter, chosen_row);
                encoderbox.SetActiveIter (iter);
            } else {
                Gtk.TreeIter iter;
                encoderbox.Model.GetIterFirst (out iter);
                encoderbox.SetActiveIter (iter);
            }

            HBox main_container = new HBox ();
            VBox action_container = new VBox ();

            main_container.Spacing = 12;
            main_container.BorderWidth = 6;

            action_container.PackStart (header_label, true, true, 0);
            action_container.PackStart (description_label, true, true, 0);
            VBox choosing_labels = new VBox ();
            choosing_labels.PackStart (choose_folder_label, true, true, 5);
            choosing_labels.PackStart (choose_encoder_label, true, true, 5);
            HBox folder_choosing = new HBox ();
            folder_choosing.PackStart (output_folder, true, true, 5);
            folder_choosing.PackStart (choose_output_folder_button, true, true, 0);
            VBox box_choosing = new VBox ();
            box_choosing.PackStart (folder_choosing, true, true, 0);
            box_choosing.PackStart (encoderbox, true, true, 5);
            HBox all_choosing = new HBox ();
            all_choosing.PackStart (choosing_labels, true, true, 0);
            all_choosing.PackStart (box_choosing, true, true, 0);

            action_container.PackStart (all_choosing, true, true, 5);
            action_container.PackStart (enable_automatic_splitting, true, true, 5);
            action_container.PackStart (enable_import_ripped_songs, true, true, 5);

            main_container.PackStart (preferences_image, true, true, 5);
            main_container.PackEnd (action_container, true, true, 5);
            this.VBox.PackStart (main_container, true, true, 5);

            AddActionWidget (cancel_button, 0);
            AddActionWidget (save_button, 0);

            choose_output_folder_button.Clicked += new EventHandler (OnChooseOutputFolderButtonClicked);
            cancel_button.Clicked += new EventHandler (OnCancelButtonClicked);
            save_button.Clicked += new EventHandler (OnSaveButtonClicked);

            Title = "Streamrecorder configuration";
            IconName = "gtk-preferences";
            Resizable = false;
            BorderWidth = 6;
            HasSeparator = false;
            this.VBox.Spacing = 12;

            ShowAll ();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="service">
        /// The <see cref="StreamrecorderService"/> that is being configured
        /// </param>
        /// <param name="previous_output_folder">
        /// A <see cref="System.String"/> containing the previously configured output directory
        /// </param>
        /// <param name="previous_encoder">
        /// A <see cref="System.String"/> containing the previously configured encoder
        /// </param>
        /// <param name="is_importing_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled
        /// </param>
        /// <param name="is_splitting_enabled">
        /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled
        /// </param>
        public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled)
        {
            streamrecorder_service = service;
            encoderbox.IdColumn    = 0;

            preferences_image.Yalign   = 0f;
            preferences_image.IconName = "gtk-preferences";
            preferences_image.IconSize = (int)IconSize.Dialog;
            preferences_image.Show();
            header_label.Text                 = String.Format(AddinManager.CurrentLocalizer.GetString("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>");
            header_label.UseMarkup            = true;
            header_label.Wrap                 = true;
            header_label.Yalign               = 0f;
            header_label.Xalign               = 0f;
            description_label.Text            = AddinManager.CurrentLocalizer.GetString("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n");
            description_label.Yalign          = 0f;
            description_label.Xalign          = 0f;
            choose_folder_label.Text          = AddinManager.CurrentLocalizer.GetString("Output folder:");
            choose_encoder_label.Text         = AddinManager.CurrentLocalizer.GetString("Encoder:");
            output_folder.Text                = previous_output_folder;
            choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString("_Browse");
            choose_output_folder_button.Image = new Image("gtk-directory", IconSize.Button);
            choose_output_folder_button.ShowAll();
            cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel");
            cancel_button.Image = new Image("gtk-cancel", IconSize.Button);
            save_button.Label   = AddinManager.CurrentLocalizer.GetString("_Save");
            save_button.Image   = new Image("gtk-save", IconSize.Button);
            enable_import_ripped_songs.Label  = AddinManager.CurrentLocalizer.GetString("Import files to media library");
            enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get().Equals("True") ? true : false;
            enable_automatic_splitting.Label  = AddinManager.CurrentLocalizer.GetString("Enable automatic files splitting by Metadata");
            enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get().Equals("True") ? true : false;

            encoderbox.Clear();
            CellRendererText cell = new CellRendererText();

            encoderbox.PackStart(cell, false);
            encoderbox.AddAttribute(cell, "text", 0);
            ListStore store = new ListStore(typeof(string));

            encoderbox.Model = store;

            int row        = -1;
            int chosen_row = -1;

            foreach (string encoder in streamrecorder_service.GetEncoders())
            {
                row++;
                store.AppendValues(encoder);
                if (encoder.Equals(previous_encoder))
                {
                    chosen_row = row;
                    Hyena.Log.DebugFormat("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row);
                }
            }

            if (chosen_row > -1)
            {
                Gtk.TreeIter iter;
                encoderbox.Model.IterNthChild(out iter, chosen_row);
                encoderbox.SetActiveIter(iter);
            }
            else
            {
                Gtk.TreeIter iter;
                encoderbox.Model.GetIterFirst(out iter);
                encoderbox.SetActiveIter(iter);
            }

            HBox main_container   = new HBox();
            VBox action_container = new VBox();

            main_container.Spacing     = 12;
            main_container.BorderWidth = 6;

            action_container.PackStart(header_label, true, true, 0);
            action_container.PackStart(description_label, true, true, 0);
            VBox choosing_labels = new VBox();

            choosing_labels.PackStart(choose_folder_label, true, true, 5);
            choosing_labels.PackStart(choose_encoder_label, true, true, 5);
            HBox folder_choosing = new HBox();

            folder_choosing.PackStart(output_folder, true, true, 5);
            folder_choosing.PackStart(choose_output_folder_button, true, true, 0);
            VBox box_choosing = new VBox();

            box_choosing.PackStart(folder_choosing, true, true, 0);
            box_choosing.PackStart(encoderbox, true, true, 5);
            HBox all_choosing = new HBox();

            all_choosing.PackStart(choosing_labels, true, true, 0);
            all_choosing.PackStart(box_choosing, true, true, 0);

            action_container.PackStart(all_choosing, true, true, 5);
            action_container.PackStart(enable_automatic_splitting, true, true, 5);
            action_container.PackStart(enable_import_ripped_songs, true, true, 5);

            main_container.PackStart(preferences_image, true, true, 5);
            main_container.PackEnd(action_container, true, true, 5);
            this.ContentArea.PackStart(main_container, true, true, 5);

            AddActionWidget(cancel_button, 0);
            AddActionWidget(save_button, 0);

            choose_output_folder_button.Clicked += new EventHandler(OnChooseOutputFolderButtonClicked);
            cancel_button.Clicked += new EventHandler(OnCancelButtonClicked);
            save_button.Clicked   += new EventHandler(OnSaveButtonClicked);

            Title       = "Streamrecorder configuration";
            IconName    = "gtk-preferences";
            Resizable   = false;
            BorderWidth = 6;
//            HasSeparator = false;
            this.ContentArea.Spacing = 12;

            ShowAll();
        }