[nemiver/better-variable-format: 8/8] Avoid over reacting to pretty printing key changes



commit 0b7380b2ceee35df80059b919086f5e43692cca9
Author: Dodji Seketeli <dodji seketeli org>
Date:   Wed Mar 2 15:34:15 2011 +0100

    Avoid over reacting to pretty printing key changes
    
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::Priv::enable_pretty_printing): New member.
    	(DBGPerspective::on_conf_key_changed_signal): Don't react to a
    	change of the value of the pretty printing key if the new value
    	equals the old one.
    	(DBGPerspective::read_default_config): Set the value of the new
    	member DBGPerspective::Priv::enable_pretty_printing.  Also also a
    	couple of ";" around.

 src/persp/dbgperspective/nmv-dbg-perspective.cc |   25 +++++++++++++++++-----
 1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index e34ac8f..2333b6b 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -976,6 +976,7 @@ struct DBGPerspective::Priv {
     bool use_launch_terminal;
     int num_instr_to_disassemble;
     bool asm_style_pure;
+    bool enable_pretty_printing;
 #ifdef WITH_SOURCEVIEWMM2
     Glib::RefPtr<gtksourceview::SourceStyleScheme> editor_style;
 #endif // WITH_SOURCEVIEWMM2
@@ -1043,6 +1044,7 @@ struct DBGPerspective::Priv {
         use_launch_terminal (false),
         num_instr_to_disassemble (NUM_INSTR_TO_DISASSEMBLE),
         asm_style_pure (true),
+        enable_pretty_printing (true),
         mouse_in_source_editor_x (0),
         mouse_in_source_editor_y (0),
         in_show_var_value_at_pos_transaction (false),
@@ -2394,8 +2396,12 @@ DBGPerspective::on_conf_key_changed_signal (const UString &a_key,
     } else if (a_key == CONF_KEY_ASM_STYLE_PURE) {
         m_priv->asm_style_pure = boost::get<bool> (a_value);
     } else if (a_key == CONF_KEY_PRETTY_PRINTING) {
+        bool e = boost::get<bool> (a_value);
+        if (m_priv->enable_pretty_printing != e) {
+            m_priv->enable_pretty_printing = e;
         get_local_vars_inspector ()
             .visualize_local_variables_of_current_function ();
+        }
     }
 
     NEMIVER_CATCH
@@ -4921,9 +4927,11 @@ DBGPerspective::read_default_config ()
     if (m_priv->global_search_paths.empty ()) {
         UString dirs;
 
-        NEMIVER_TRY
+        NEMIVER_TRY;
+
         conf_mgr.get_key_value (CONF_KEY_NEMIVER_SOURCE_DIRS, dirs);
-        NEMIVER_CATCH_NOX
+
+        NEMIVER_CATCH_NOX;
 
         LOG_DD ("got source dirs '" << dirs << "' from conf mgr");
         if (!dirs.empty ()) {
@@ -4932,16 +4940,19 @@ DBGPerspective::read_default_config ()
                     << "' dir paths");
         }
 
-        NEMIVER_TRY
+        NEMIVER_TRY;
+
         conf_mgr.get_key_value (CONF_KEY_SHOW_DBG_ERROR_DIALOGS,
                                 m_priv->show_dbg_errors);
-        NEMIVER_CATCH_NOX
+        NEMIVER_CATCH_NOX;
 
         conf_mgr.value_changed_signal ().connect
             (sigc::mem_fun (*this,
                             &DBGPerspective::on_conf_key_changed_signal));
     }
-    NEMIVER_TRY
+
+    NEMIVER_TRY;
+
     conf_mgr.get_key_value (CONF_KEY_HIGHLIGHT_SOURCE_CODE,
                             m_priv->enable_syntax_highlight);
     conf_mgr.get_key_value (CONF_KEY_SHOW_SOURCE_LINE_NUMBERS,
@@ -4960,7 +4971,9 @@ DBGPerspective::read_default_config ()
                             m_priv->num_instr_to_disassemble);
     conf_mgr.get_key_value (CONF_KEY_ASM_STYLE_PURE,
                             m_priv->asm_style_pure);
-    NEMIVER_CATCH_NOX
+    conf_mgr.get_key_value (CONF_KEY_PRETTY_PRINTING,
+                            m_priv->enable_pretty_printing);
+    NEMIVER_CATCH_NOX;
 
 #ifdef WITH_SOURCEVIEWMM2
     UString style_id ("classic");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]