config_edit_dialog.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <tools/config_editor/config_edit_dialog.h>
00024 #include <gui_utils/utils.h>
00025
00026 using namespace fawkes;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 ConfigEditDialog::ConfigEditDialog( BaseObjectType* cobject,
00059 const Glib::RefPtr<Gnome::Glade::Xml>& ref_xml )
00060 : Gtk::Dialog(cobject)
00061 {
00062 m_ent_value = dynamic_cast<Gtk::Entry*>( get_widget(ref_xml, "entValueEdit") );
00063 m_cob_bool_value = dynamic_cast<Gtk::ComboBox*>( get_widget(ref_xml, "cmbBoolEdit") );
00064 m_type_pages = dynamic_cast<Gtk::Notebook*>( get_widget(ref_xml, "nbkTypesEdit") );
00065 m_chb_is_default = dynamic_cast<Gtk::CheckButton*>( get_widget(ref_xml, "chbIsDefaultEdit") );
00066 }
00067
00068
00069
00070
00071
00072
00073 void
00074 ConfigEditDialog::init( const Glib::ustring& path, const Glib::ustring& type,
00075 const Glib::ustring& value )
00076 {
00077 is_bool = (type == "bool");
00078 set_title(path);
00079 m_ent_value->set_text(value);
00080 m_cob_bool_value->set_active(value == "TRUE" ? 0 : 1);
00081 m_type_pages->set_current_page(!is_bool ? 0 : 1);
00082 m_chb_is_default->set_active(false);
00083 }
00084
00085
00086 ConfigEditDialog::~ConfigEditDialog()
00087 {
00088 }
00089
00090
00091
00092
00093 Glib::ustring
00094 ConfigEditDialog::get_value() const
00095 {
00096 if (!is_bool) return m_ent_value->get_text();
00097 else
00098 {
00099 Gtk::TreeIter iter = m_cob_bool_value->get_active();
00100 Gtk::TreeRow row = *iter;
00101 Glib::ustring type;
00102
00103 row.get_value(0, type);
00104
00105 return type;
00106 }
00107 }
00108
00109
00110
00111
00112 bool
00113 ConfigEditDialog::get_is_default() const
00114 {
00115 return m_chb_is_default->get_active();
00116 }