[gnumeric] ConditionalStyle: Fix tracking problem when copying between sheets.



commit ce3586fc13c7272fcfabe50a778e51f7b2dd8598
Author: Morten Welinder <terra gnome org>
Date:   Tue Jan 19 20:18:32 2021 -0500

    ConditionalStyle: Fix tracking problem when copying between sheets.

 ChangeLog              | 5 +++++
 src/mstyle.c           | 6 ++++++
 src/sheet-conditions.c | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index cf644122e..8ab566404 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-19  Morten Welinder  <terra gnome org>
+
+       * src/mstyle.c (gnm_style_linked_sheet_changed): Make sure to tell
+       the GnmStyleConditions what is going on.  Fixes #547, item 3.
+
 2020-12-19  Morten Welinder  <terra gnome org>
 
        * src/sheet.c (sheet_range_unrender): New function.
diff --git a/src/mstyle.c b/src/mstyle.c
index 4c4c8ff27..ba9ff8750 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -991,7 +991,13 @@ gnm_style_linked_sheet_changed (GnmStyle *style)
        if (elem_is_set (style, MSTYLE_CONDITIONS) &&
            style->conditions &&
            gnm_style_conditions_get_sheet (style->conditions) != sheet) {
+               sheet_conditions_share_conditions_remove (style->conditions);
                GnmStyleConditions *new_c = gnm_style_conditions_dup_to (style->conditions, sheet);
+               GnmStyleConditions *new_sc = sheet_conditions_share_conditions_add (new_c);
+               if (new_sc) {
+                       g_object_unref (new_c);
+                       new_c = new_sc;
+               }
                gnm_style_set_conditions (style, new_c);
        }
 }
diff --git a/src/sheet-conditions.c b/src/sheet-conditions.c
index 72639ad22..c84b91ccf 100644
--- a/src/sheet-conditions.c
+++ b/src/sheet-conditions.c
@@ -246,7 +246,7 @@ sheet_conditions_share_conditions_remove (GnmStyleConditions *conds)
        else if (n == 1)
                g_hash_table_remove (cd->linked_conditions, conds);
        else
-               g_warning ("We're confused with sheet condition usage.");
+               g_warning ("We're confused with sheet condition usage (%d).", n);
 }
 
 // ----------------------------------------------------------------------------


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