[gnumeric] ssdiff: fix checking of input messages also.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ssdiff: fix checking of input messages also.
- Date: Fri, 17 Mar 2017 16:48:06 +0000 (UTC)
commit 8751d33409b223c8d3f2a023ed6e103639bf30b1
Author: Morten Welinder <terra gnome org>
Date: Fri Mar 17 12:47:43 2017 -0400
ssdiff: fix checking of input messages also.
NEWS | 2 +-
src/input-msg.c | 14 ++++++++++++++
src/input-msg.h | 3 +++
src/mstyle.c | 7 ++++++-
src/ssdiff.c | 2 --
5 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9fd9032..72559ce 100644
--- a/NEWS
+++ b/NEWS
@@ -16,7 +16,7 @@ Morten:
* Hyperlinks improvements. [#706671]
* Plug leaks.
* Fix issues with sheet-local names.
- * ssdiff improvements with hyperlinks and validations.
+ * ssdiff improvements with hyperlinks, input messages, and validations.
--------------------------------------------------------------------------
Gnumeric 1.12.33
diff --git a/src/input-msg.c b/src/input-msg.c
index 18d660b..493baa3 100644
--- a/src/input-msg.c
+++ b/src/input-msg.c
@@ -92,6 +92,20 @@ gnm_input_msg_new (char const *msg, char const *title)
return res;
}
+gboolean
+gnm_input_msg_equal (GnmInputMsg const *a,
+ GnmInputMsg const *b)
+{
+ g_return_val_if_fail (GNM_IS_INPUT_MSG (a), FALSE);
+ g_return_val_if_fail (GNM_IS_INPUT_MSG (b), FALSE);
+
+ return (g_strcmp0 (a->title ? a->title->str : NULL,
+ b->title ? b->title->str : NULL) == 0 &&
+ g_strcmp0 (a->msg ? a->msg->str : NULL,
+ b->msg ? b->msg->str : NULL) == 0);
+}
+
+
char const *
gnm_input_msg_get_msg (GnmInputMsg const *imsg)
{
diff --git a/src/input-msg.h b/src/input-msg.h
index 919bd97..4bbba44 100644
--- a/src/input-msg.h
+++ b/src/input-msg.h
@@ -16,6 +16,9 @@ GnmInputMsg *gnm_input_msg_new (char const *msg, char const *title);
char const *gnm_input_msg_get_msg (GnmInputMsg const *msg);
char const *gnm_input_msg_get_title (GnmInputMsg const *msg);
+gboolean gnm_input_msg_equal (GnmInputMsg const *a,
+ GnmInputMsg const *b);
+
G_END_DECLS
#endif /* _GNM_INPUT_MSG_H_ */
diff --git a/src/mstyle.c b/src/mstyle.c
index 2b93442..a60c8de 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -16,6 +16,7 @@
#include "sheet-style.h"
#include "style-conditions.h"
#include "hlink.h"
+#include "input-msg.h"
#include "application.h"
#include "parse-util.h"
#include "expr.h"
@@ -540,11 +541,13 @@ gnm_style_find_conflicts (GnmStyle *accum, GnmStyle const *overlay,
return conflicts;
}
+#define GNM_INPUT_MSG_EQUAL3(a,b,r) (gnm_input_msg_equal (a,b))
+
#define RELAX_CHECK(op_,field_,checker_) do { \
if (diffs & (1u << (op_)) && \
elem_is_set (a, (op_)) && \
elem_is_set (b, (op_)) && \
- (checker_) (a->field_, b->field_, relax_sheet)) \
+ checker_ (a->field_, b->field_, relax_sheet)) \
diffs &= ~(1u << (op_)); \
} while (0)
@@ -576,6 +579,7 @@ gnm_style_find_differences (GnmStyle const *a, GnmStyle const *b,
if (relax_sheet) {
RELAX_CHECK (MSTYLE_HLINK, hlink, gnm_hlink_equal);
RELAX_CHECK (MSTYLE_VALIDATION, validation, gnm_validation_equal);
+ RELAX_CHECK (MSTYLE_INPUT_MSG, input_msg, GNM_INPUT_MSG_EQUAL3);
// FIXME: Conditions
}
@@ -584,6 +588,7 @@ gnm_style_find_differences (GnmStyle const *a, GnmStyle const *b,
}
#undef RELAX_CHECK
+#undef GNM_INPUT_MSG_EQUAL3
static inline void
gnm_style_clear_pango (GnmStyle *style)
diff --git a/src/ssdiff.c b/src/ssdiff.c
index f8094a1..d17a7bd 100644
--- a/src/ssdiff.c
+++ b/src/ssdiff.c
@@ -674,7 +674,6 @@ xml_style_changed (GnmDiffState *state, GnmRange const *r,
DO_STRINGS ("Title", cb_validation_title, ov, nv);
DO_INTS ("AllowBlank", cb_validation_allow_blank, ov, nv);
DO_INTS ("UseDropdown", cb_validation_use_dropdown, ov, nv);
- gsf_xml_out_add_cstr_unchecked (state->xml, NULL, "<!-- Difference might be spurious
-->");
gsf_xml_out_end_element (state->xml); /* </Validation> */
break;
}
@@ -686,7 +685,6 @@ xml_style_changed (GnmDiffState *state, GnmRange const *r,
gsf_xml_out_start_element (state->xml, "InputMessage");
DO_STRINGS ("Message", gnm_input_msg_get_msg, om, nm);
DO_STRINGS ("Title", gnm_input_msg_get_title, om, nm);
- gsf_xml_out_add_cstr_unchecked (state->xml, NULL, "<!-- Difference might be spurious
-->");
gsf_xml_out_end_element (state->xml); /* </InputMessage> */
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]