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 #ifdef HAVE_GLADEMM
00050 /** Constructor.
00051  * @param cobject pointer to base object type
00052  * @param ref_xml Glade XML file
00053  */
00054 ConfigRemoveDialog::ConfigRemoveDialog( BaseObjectType* cobject,
00055                                         const Glib::RefPtr<Gnome::Glade::Xml>& ref_xml )
00056   : Gtk::Dialog(cobject)
00057 {
00058   ref_xml->get_widget("lblPath", m_lbl_path);
00059   ref_xml->get_widget("chbIsDefaultRemove", m_chb_is_default);
00060 }
00061 #endif
00062 
00063 /** Destructor. */
00064 ConfigRemoveDialog::~ConfigRemoveDialog()
00065 {
00066 }
00067 
00068 /** Initialize the dialog.
00069  * @param path the config path that was selected for deletion.
00070  * @param is_default true if only the default config value is set
00071  */
00072 void
00073 ConfigRemoveDialog::init(const Glib::ustring& path, bool is_default)
00074 {
00075   set_title("Remove config entry");
00076   Glib::ustring text = "Really remove <b>" + path + "</b>?";
00077   m_lbl_path->set_markup(text);
00078   m_chb_is_default->set_active(is_default);
00079 }
00080 
00081 /** Get the remove default flag of the entry to be deleted
00082  * @return if true delete also the default config value
00083  */
00084 bool
00085 ConfigRemoveDialog::get_remove_default() const
00086 {
00087   return m_chb_is_default->get_active();
00088 }