Fawkes API  Fawkes Development Version
config_remove_dialog.cpp
00001 
00002 /***************************************************************************
00003  *  config_remove_dialog.cpp - Remove config entries
00004  *
00005  *  Created: Thu Sep 25 18:53:13 2008
00006  *  Copyright  2008  Daniel Beck
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #include <tools/config_editor/config_remove_dialog.h>
00024 
00025 /** @class ConfigRemoveDialog "config_remove_dialog.h"
00026  * Dialog to remove a config entry
00027  *
00028  * @author Daniel Beck
00029  */
00030 
00031 /** @var ConfigRemoveDialog::m_lbl_path
00032  * A Gtk::Label that presents the path to be deleted.
00033  */
00034 
00035 /** @var ConfigRemoveDialog::m_chb_is_default
00036  * The Gtk::CheckButton to set the remove default flag
00037  */
00038 
00039 /** Constructor.
00040  * @param lbl_path label of path to delete
00041  * @param chb_is_default checkbutton for default value deletion
00042  */
00043 ConfigRemoveDialog::ConfigRemoveDialog(Gtk::Label *lbl_path, Gtk::CheckButton *chb_is_default)
00044 {
00045   m_lbl_path = lbl_path;
00046   m_chb_is_default = chb_is_default;
00047 }
00048 
00049 /** Constructor.
00050  * @param cobject pointer to base object type
00051  * @param builder Gtk builder
00052  */
00053 ConfigRemoveDialog::ConfigRemoveDialog(BaseObjectType* cobject,
00054                                        const Glib::RefPtr<Gtk::Builder> &builder)
00055   : Gtk::Dialog(cobject)
00056 {
00057   builder->get_widget("lblPath", m_lbl_path);
00058   builder->get_widget("chbIsDefaultRemove", m_chb_is_default);
00059 }
00060 
00061 /** Destructor. */
00062 ConfigRemoveDialog::~ConfigRemoveDialog()
00063 {
00064 }
00065 
00066 /** Initialize the dialog.
00067  * @param path the config path that was selected for deletion.
00068  * @param is_default true if only the default config value is set
00069  */
00070 void
00071 ConfigRemoveDialog::init(const Glib::ustring& path, bool is_default)
00072 {
00073   set_title("Remove config entry");
00074   Glib::ustring text = "Really remove <b>" + path + "</b>?";
00075   m_lbl_path->set_markup(text);
00076   m_chb_is_default->set_active(is_default);
00077 }
00078 
00079 /** Get the remove default flag of the entry to be deleted
00080  * @return if true delete also the default config value
00081  */
00082 bool
00083 ConfigRemoveDialog::get_remove_default() const
00084 {
00085   return m_chb_is_default->get_active();
00086 }