Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
config_remove_dialog.cpp
1 
2 /***************************************************************************
3  * config_remove_dialog.cpp - Remove config entries
4  *
5  * Created: Thu Sep 25 18:53:13 2008
6  * Copyright 2008 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <tools/config_editor/config_remove_dialog.h>
24 
25 /** @class ConfigRemoveDialog "config_remove_dialog.h"
26  * Dialog to remove a config entry
27  *
28  * @author Daniel Beck
29  */
30 
31 /** @var ConfigRemoveDialog::m_lbl_path
32  * A Gtk::Label that presents the path to be deleted.
33  */
34 
35 /** @var ConfigRemoveDialog::m_chb_is_default
36  * The Gtk::CheckButton to set the remove default flag
37  */
38 
39 /** Constructor.
40  * @param lbl_path label of path to delete
41  * @param chb_is_default checkbutton for default value deletion
42  */
43 ConfigRemoveDialog::ConfigRemoveDialog(Gtk::Label *lbl_path, Gtk::CheckButton *chb_is_default)
44 {
45  m_lbl_path = lbl_path;
46  m_chb_is_default = chb_is_default;
47 }
48 
49 /** Constructor.
50  * @param cobject pointer to base object type
51  * @param builder Gtk builder
52  */
54  const Glib::RefPtr<Gtk::Builder> &builder)
55  : Gtk::Dialog(cobject)
56 {
57  builder->get_widget("lblPath", m_lbl_path);
58  builder->get_widget("chbIsDefaultRemove", m_chb_is_default);
59 }
60 
61 /** Destructor. */
63 {
64 }
65 
66 /** Initialize the dialog.
67  * @param path the config path that was selected for deletion.
68  * @param is_default true if only the default config value is set
69  */
70 void
71 ConfigRemoveDialog::init(const Glib::ustring& path, bool is_default)
72 {
73  set_title("Remove config entry");
74  Glib::ustring text = "Really remove <b>" + path + "</b>?";
75  m_lbl_path->set_markup(text);
76  m_chb_is_default->set_active(is_default);
77 }
78 
79 /** Get the remove default flag of the entry to be deleted
80  * @return if true delete also the default config value
81  */
82 bool
84 {
85  return m_chb_is_default->get_active();
86 }