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 #include <gui_utils/utils.h> 00025 00026 using namespace fawkes; 00027 00028 /** @class ConfigRemoveDialog tools/config_editor/config_remove_dialog.h 00029 * Dialog to remove a config entry 00030 * 00031 * @author Daniel Beck 00032 */ 00033 00034 /** @var ConfigRemoveDialog::m_lbl_path 00035 * A Gtk::Label that presents the path to be deleted. 00036 */ 00037 00038 /** @var ConfigRemoveDialog::m_chb_is_default 00039 * The Gtk::CheckButton to set the remove default flag 00040 */ 00041 00042 /** Constructor. 00043 * @param cobject pointer to base object type 00044 * @param ref_xml Glade XML file 00045 */ 00046 ConfigRemoveDialog::ConfigRemoveDialog( BaseObjectType* cobject, 00047 const Glib::RefPtr<Gnome::Glade::Xml>& ref_xml ) 00048 : Gtk::Dialog(cobject) 00049 { 00050 m_lbl_path = dynamic_cast<Gtk::Label*>( get_widget(ref_xml, "lblPath") ); 00051 m_chb_is_default = dynamic_cast<Gtk::CheckButton*>( get_widget(ref_xml, "chbIsDefaultRemove") ); 00052 } 00053 00054 /** Destructor. */ 00055 ConfigRemoveDialog::~ConfigRemoveDialog() 00056 { 00057 } 00058 00059 /** Initialize the dialog. 00060 * @param path the config path that was selected for deletion. 00061 * @param is_default true if only the default config value is set 00062 */ 00063 void 00064 ConfigRemoveDialog::init(const Glib::ustring& path, bool is_default) 00065 { 00066 set_title("Remove config entry"); 00067 Glib::ustring text = "Really remove <b>" + path + "</b>?"; 00068 m_lbl_path->set_markup(text); 00069 m_chb_is_default->set_active(is_default); 00070 } 00071 00072 /** Get the remove default flag of the entry to be deleted 00073 * @return if true delete also the default config value 00074 */ 00075 bool 00076 ConfigRemoveDialog::get_remove_default() const 00077 { 00078 return m_chb_is_default->get_active(); 00079 }

