[gnumeric] Format Dialog: apply "ok" to set General right away for inconsistent style.



commit e6cb1171dccc7824574ea7219bac647c00f07b65
Author: Morten Welinder <terra gnome org>
Date:   Fri Jul 3 17:10:42 2020 -0400

    Format Dialog: apply "ok" to set General right away for inconsistent style.
    
    Fixes #503.

 NEWS                             | 1 +
 src/dialogs/ChangeLog            | 6 ++++++
 src/dialogs/dialog-cell-format.c | 9 +++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index b661f0100..8e0b0e955 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Morten:
        * Fix 2038 problem on quit.
        * Improve tests.
        * Improve dependency tracking for implicit intersection. [#501]
+       * Fix format dialog issue.  [#503]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.47
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 1057c7e7a..a6b201a55 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,9 @@
+2020-07-03  Morten Welinder  <terra gnome org>
+
+       * dialog-cell-format.c (fmt_dialog_impl): When we have
+       inconsistent format for the selection on entry, allow "ok" to set
+       general right away.  Fixes #503.
+
 2020-05-09  Morten Welinder <terra gnome org>
 
        * Release 1.12.47
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 65afd67a0..779d5aa16 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -2477,6 +2477,11 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno, gint pages)
                                gtk_widget_hide (widget);
                }
 
+       // If we have conflicts then allow setting General right away
+       if (state->conflicts & (1 << MSTYLE_FORMAT))
+               cb_number_format_changed (NULL,
+                                         go_format_as_XL (go_format_general ()),
+                                         state);
 
        gnm_restore_window_geometry (GTK_WINDOW (state->dialog),
                                          CELL_FORMAT_KEY);
@@ -2499,7 +2504,7 @@ cb_check_cell_format (GnmCellIter const *iter, gpointer user)
                gnm_style_set_format (state->style, fmt);
                return NULL;
        } else {
-               state->conflicts |= MSTYLE_FORMAT;
+               state->conflicts |= (1 << MSTYLE_FORMAT);
                return VALUE_TERMINATE;
        }
 }
@@ -2538,7 +2543,7 @@ fmt_dialog_selection_type (SheetView *sv,
        state->conflicts = sheet_style_find_conflicts (state->sheet, &r,
                &(state->style), state->borders);
 
-       if ((state->conflicts & MSTYLE_FORMAT) == 0 &&
+       if ((state->conflicts & (1 << MSTYLE_FORMAT)) == 0 &&
            go_format_is_general (gnm_style_get_format (state->style))) {
                sheet_foreach_cell_in_range (state->sheet,
                                             CELL_ITER_IGNORE_BLANK,


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