diff --git a/glade/configure-dialog.glade b/glade/configure-dialog.glade index a8272cb..e8a4a84 100644 --- a/glade/configure-dialog.glade +++ b/glade/configure-dialog.glade @@ -1,449 +1,702 @@ - - - + + + - - 0 - SGPEMv2 Preferences - True - GTK_WIN_POS_CENTER_ON_PARENT - 500 - 300 - gtk-preferences - GDK_WINDOW_TYPE_HINT_DIALOG - - - True - - - True - True - False - - - True - 5 - 5 - - - True - 0,000000 - 0,000000 - GTK_SHADOW_NONE - - - True - 6 - 0,000000 - 0,000000 - 12 - - - True - True - GTK_SHADOW_IN - - - True - True - - - - - - - - - True - 0,000000 - 0,000000 - <b>Loaded Plugins</b> - True - - - label_item - - - - - - - True - 0,000000 - 0,000000 - GTK_SHADOW_NONE - - - True - 6 - 0,000000 - 0,000000 - 12 - - - True - 10 - - - True - True - GTK_SHADOW_IN - - - True - True - - - - - - - True - 4 - GTK_BUTTONBOX_START - - - True - True - True - gtk-add - True - - - - - True - False - True - True - gtk-remove - True - - - 1 - - - - - False - False - 3 - GTK_PACK_END - 1 - - - - - - - - - True - 0,000000 - 0,000000 - <b>Additional Plugin Directories</b> - True - - - label_item - - - - - 1 - - - - - False - - - - - True - 0,000000 - 0,000000 - Plugins - - - tab - False - False - - - - - True - 5 - 5 - - - True - 0,000000 - 0,000000 - GTK_SHADOW_NONE - - - True - 6 - 0,000000 - 0,000000 - 12 - - - True - True - GTK_SHADOW_IN - - - True - True - - - - - - - - - True - 0,000000 - 0,000000 - <b>Loaded Policies</b> - True - - - label_item - - - - - - - True - 0,000000 - 0,000000 - GTK_SHADOW_NONE - - - True - 6 - 0,000000 - 0,000000 - 12 - - - True - 10 - - - True - True - GTK_SHADOW_IN - - - True - True - - - - - - - True - 4 - GTK_BUTTONBOX_START - - - True - True - True - gtk-add - True - - - - - True - False - True - True - gtk-remove - True - - - 1 - - - - - False - False - 3 - GTK_PACK_END - 1 - - - - - - - - - True - 0,000000 - 0,000000 - <b>Additional Policies Directories</b> - True - - - label_item - - - - - 1 - - - - - 1 - False - - - - - True - 0,000000 - 0,000000 - Policies - - - tab - 1 - False - False - - - - - True - - - True - 5 - 0,000000 - 0,000000 - GTK_SHADOW_NONE - - - True - 0,000000 - 0,000000 - 12 - - - True - - - True - 0,000000 - 0,000000 - Simulation step speed (milliseconds) - - - False - - - - - True - True - 1000,000000 0,000000 9999,000000 100,000000 500,000000 500,000000 - 2 - True - True - GTK_UPDATE_IF_VALID - - - False - 1 - - - - - - - - - True - 0,000000 - 0,000000 - <b>Simulation speed</b> - True - - - label_item - - - - - False - False - - - - - 2 - False - - - - - True - 0,000000 - 0,000000 - Speed - - - tab - 2 - False - False - - - - - 2 - - - - - True - GTK_BUTTONBOX_END - - - True - True - True - True - gtk-close - True - -7 - - - - - False - GTK_PACK_END - - - - - + + + 0 + SGPEMv2 Preferences + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + 500 + 300 + True + False + gtk-preferences + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + True + False + GTK_POS_TOP + False + False + + + + 5 + True + False + 5 + + + + True + 0 + 0 + GTK_SHADOW_NONE + + + + 6 + True + 0 + 0 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + + + + + + True + <b>Loaded Plugins</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + 0 + 0 + GTK_SHADOW_NONE + + + + 6 + True + 0 + 0 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 10 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_START + 4 + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + True + False + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + True + + + + + 3 + False + False + GTK_PACK_END + + + + + + + + + + True + <b>Additional Plugin Directories</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + False + True + + + + + + True + Plugins + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + 5 + True + False + 5 + + + + True + 0 + 0 + GTK_SHADOW_NONE + + + + 6 + True + 0 + 0 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + + + + + + True + <b>Loaded Policies</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + 0 + 0 + GTK_SHADOW_NONE + + + + 6 + True + 0 + 0 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 10 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_START + 4 + + + + True + True + True + gtk-add + True + GTK_RELIEF_NORMAL + True + + + + + + True + False + True + True + gtk-remove + True + GTK_RELIEF_NORMAL + True + + + + + 3 + False + False + GTK_PACK_END + + + + + + + + + + True + <b>Additional Policies Directories</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + False + True + + + + + + True + Policies + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + False + 0 + + + + 5 + True + 0 + 0 + GTK_SHADOW_NONE + + + + True + 0 + 0 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 0 + + + + True + Simulation step speed (milliseconds) + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + False + + + + + + True + True + 2 + 0 + True + GTK_UPDATE_IF_VALID + True + False + 1000 0 9999 100 500 0 + + + 0 + True + False + + + + + + + + + + True + <b>Simulation speed</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + False + False + + + + + False + True + + + + + + True + Speed + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + True + True + + + + + + diff --git a/src/backend/global_preferences.cc b/src/backend/global_preferences.cc index 20b275f..d2f7597 100644 --- a/src/backend/global_preferences.cc +++ b/src/backend/global_preferences.cc @@ -24,6 +24,7 @@ #include "string_utils.hh" #include + // Do not include in header file: #include "singleton.tcc" using namespace sgpem; @@ -238,7 +239,7 @@ GlobalPreferences::key_file_read(KeyFile& kf) { std::ostringstream ostr; ostr << "policies-dir-" << i; - Glib::ustring key(ostr.str()); + Glib::ustring key(ostr.str().c_str()); val = kf.search_value(key); if (val) { @@ -276,14 +277,14 @@ GlobalPreferences::key_file_write(KeyFile& kf) std::ostringstream ostr; n++; ostr << "modules-dir-" << n; // << std::ends; - Glib::ustring key(ostr.str()); + Glib::ustring key(ostr.str().c_str()); kf.insert_key_value(key, (*iter)); ++iter; } Glib::ustring key("modules-dir-number"); std::ostringstream ostr; ostr << n << std::ends; - Glib::ustring value(ostr.str()); + Glib::ustring value(ostr.str().c_str()); kf.insert_key_value(key, value); } // add policies directories @@ -299,14 +300,14 @@ GlobalPreferences::key_file_write(KeyFile& kf) std::ostringstream ostr; n++; ostr << "policies-dir-" << n; // << std::ends; - Glib::ustring key(ostr.str()); + Glib::ustring key(ostr.str().c_str()); kf.insert_key_value(key, (*iter)); ++iter; } Glib::ustring key("policies-dir-number"); std::ostringstream ostr; ostr << n << std::ends; - Glib::ustring value(ostr.str()); + Glib::ustring value(ostr.str().c_str()); kf.insert_key_value(key, value); } } diff --git a/src/graphical_preferences_editor.cc b/src/graphical_preferences_editor.cc index 376ad86..217a03e 100644 --- a/src/graphical_preferences_editor.cc +++ b/src/graphical_preferences_editor.cc @@ -133,6 +133,7 @@ void PreferencesEditor::on_close() { preferences_dialog->hide(); + prefs.write_configrc(); } void diff --git a/src/parse_opts.cc b/src/parse_opts.cc index f54faa0..1166bde 100644 --- a/src/parse_opts.cc +++ b/src/parse_opts.cc @@ -101,6 +101,16 @@ parse_options(int argc, char** argv) Gtk::Main main_loop(argc, argv, context); GlobalPreferences& prefs = GlobalPreferences::get_instance(); + try + { + //prefs.load_configrc(); + + } + catch (std::exception e) + { + std::cout << std::endl + << _("Error while loading preferences") << std::endl; + } for (Glib::OptionGroup::vecustrings::const_iterator it = policies_dir_val.begin(); it != policies_dir_val.end(); ++it) diff --git a/src/resources_widget.cc b/src/resources_widget.cc index 02c473d..c69d2a8 100644 --- a/src/resources_widget.cc +++ b/src/resources_widget.cc @@ -298,7 +298,6 @@ ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr, << "" << " (" << (sr.get_length() - sr.get_remaining_time()) << "/" << sr.get_length() << ")"; - ++index; } oss << "";