[gnumeric] Show less pages in the cell format dialog



commit 00de508eaf491b365c7b7e085df3c63cc5ed5704
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Aug 2 01:00:46 2013 -0600

    Show less pages in the cell format dialog
    
    2013-08-02  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * src/sheet-control-gui.c (context_menu_handler): add argument to
        dialog_cell_format call
        * src/wbc-gtk-actions.c (cb_format_cells): add argument to
        dialog_cell_format call
        (cb_data_validate): ditto
    
    2013-08-02  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * dialog-cell-format.c (dialog_cell_format): add pages argument
        (fmt_dialog_impl): add pages argument, calculate default
        value for the argument
        (dialog_cell_format_select_style): move code from here to fmt_dialog_impl
        * dialogs.h (dialog_cell_format): add argument

 ChangeLog                        |    8 ++++++++
 src/dialogs/ChangeLog            |    8 ++++++++
 src/dialogs/dialog-cell-format.c |   31 +++++++++++++++++++------------
 src/dialogs/dialogs.h            |    3 ++-
 src/sheet-control-gui.c          |    2 +-
 src/wbc-gtk-actions.c            |    5 +++--
 6 files changed, 41 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5559592..c971df5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-08-02  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * src/sheet-control-gui.c (context_menu_handler): add argument to
+       dialog_cell_format call
+       * src/wbc-gtk-actions.c (cb_format_cells): add argument to
+       dialog_cell_format call
+       (cb_data_validate): ditto
+
 2013-07-30  Morten Welinder  <terra gnome org>
 
        * src/xml-sax-read.c (xml_sax_style_border): Make sure we have a
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 8e56e73..40350c5 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,11 @@
+2013-08-02  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * dialog-cell-format.c (dialog_cell_format): add pages argument
+       (fmt_dialog_impl): add pages argument, calculate default
+       value for the argument
+       (dialog_cell_format_select_style): move code from here to fmt_dialog_impl
+       * dialogs.h (dialog_cell_format): add argument
+
 2013-07-21  Morten Welinder  <terra gnome org>
 
        * dialog-cell-format-cond.c (c_fmt_dialog_init_editor_page): Don't
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 68589ed..d8d7277 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -2178,7 +2178,7 @@ set_initial_focus (FormatState *s)
 }
 
 static void
-fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
+fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno, gint pages)
 {
        static struct {
                char const *const name;
@@ -2440,6 +2440,15 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
        g_signal_connect (G_OBJECT (dialog), "destroy",
                          G_CALLBACK (cb_dialog_destroy), NULL);
 
+       if (pages > 0)
+               for (i = 0; i <= FD_LAST; i++) {
+                       GtkWidget *widget = gtk_notebook_get_nth_page
+                               (state->notebook, i);
+                       if (widget != NULL && !((1<<i) & pages))
+                               gtk_widget_hide (widget);
+               }
+
+
        gnumeric_restore_window_geometry (GTK_WINDOW (state->dialog),
                                          CELL_FORMAT_KEY);
 }
@@ -2549,7 +2558,7 @@ dialog_cell_format_init (WBCGtk *wbcg)
 }
 
 void
-dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
+dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno, gint pages)
 {
        FormatState  *state;
 
@@ -2564,7 +2573,13 @@ dialog_cell_format (WBCGtk *wbcg, FormatDialogPosition_t pageno)
        state->style_selector.w = NULL;
        state->style_selector.closure = NULL;
 
-       fmt_dialog_impl (state, pageno);
+       if (pages == 0) {
+               int i;
+               for (i = FD_NUMBER; i <= FD_PROTECTION; i++)
+                       pages |= (1 << i); 
+       }
+
+       fmt_dialog_impl (state, pageno, pages);
 
        wbc_gtk_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
        go_gtk_nonmodal_dialog (wbcg_toplevel (state->wbcg),
@@ -2589,7 +2604,6 @@ dialog_cell_format_select_style (WBCGtk *wbcg, gint pages,
                                 GnmStyle *style, gpointer closure)
 {
        FormatState  *state;
-       gint i;
 
        g_return_val_if_fail (wbcg != NULL, NULL);
        state = dialog_cell_format_init (wbcg);
@@ -2606,14 +2620,7 @@ dialog_cell_format_select_style (WBCGtk *wbcg, gint pages,
                state->conflicts = 0;
        }
 
-       fmt_dialog_impl (state, FD_BACKGROUND);
-
-       for (i = 0; i <= FD_LAST; i++) {
-               GtkWidget *widget = gtk_notebook_get_nth_page
-                       (state->notebook, i);
-               if (widget != NULL && !((1<<i) & pages))
-                       gtk_widget_hide (widget);
-       }
+       fmt_dialog_impl (state, FD_BACKGROUND, pages);
 
        gtk_widget_hide (state->apply_button);
 
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index eaee736..2533c15 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -22,7 +22,8 @@ void   dialog_formula_guru    (WBCGtk *wbcg, GnmFunc *func);
 void    dialog_plugin_manager  (WBCGtk *wbcg);
 void    dialog_goto_cell       (WBCGtk *wbcg);
 void    dialog_cell_format     (WBCGtk *wbcg,
-                                FormatDialogPosition_t pageno);
+                                FormatDialogPosition_t pageno,
+                                int pages);
 GtkDialog *dialog_cell_format_select_style (WBCGtk *wbcg,
                                            gint pages, GtkWindow *w,
                                            GnmStyle *style,
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index b48a31b..341dae9 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -1954,7 +1954,7 @@ context_menu_handler (GnumericPopupMenuElement const *element,
                cmd_selection_clear (wbc, CLEAR_VALUES);
                break;
        case CONTEXT_FORMAT_CELL :
-               dialog_cell_format (wbcg, FD_CURRENT);
+               dialog_cell_format (wbcg, FD_CURRENT, 0);
                break;
        case CONTEXT_FORMAT_CELL_COND :
                dialog_cell_format_cond (wbcg);
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index ea301b2..e26e48c 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -929,7 +929,7 @@ static GNM_ACTION_DEF (cb_sheet_name)
 
 static GNM_ACTION_DEF (cb_sheet_order)         { dialog_sheet_order (wbcg); }
 static GNM_ACTION_DEF (cb_sheet_resize)                { dialog_sheet_resize (wbcg); }
-static GNM_ACTION_DEF (cb_format_cells)                { dialog_cell_format (wbcg, FD_CURRENT); }
+static GNM_ACTION_DEF (cb_format_cells)                { dialog_cell_format (wbcg, FD_CURRENT, 0); }
 static GNM_ACTION_DEF (cb_format_cells_cond)    { dialog_cell_format_cond (wbcg); }
 static GNM_ACTION_DEF (cb_autoformat)          { dialog_autoformat (wbcg); }
 static GNM_ACTION_DEF (cb_workbook_attr)       { dialog_workbook_attr (wbcg); }
@@ -986,7 +986,8 @@ static GNM_ACTION_DEF (cb_data_import_other)        { gui_file_open
 static GNM_ACTION_DEF (cb_auto_filter)          { cmd_autofilter_add_remove (WORKBOOK_CONTROL (wbcg)); }
 static GNM_ACTION_DEF (cb_show_all)            { filter_show_all (WORKBOOK_CONTROL (wbcg)); }
 static GNM_ACTION_DEF (cb_data_filter)         { dialog_advanced_filter (wbcg); }
-static GNM_ACTION_DEF (cb_data_validate)       { dialog_cell_format (wbcg, FD_VALIDATION); }
+static GNM_ACTION_DEF (cb_data_validate)       { dialog_cell_format (wbcg, FD_VALIDATION, 
+                                                                     (1 << FD_VALIDATION) | (1 << 
FD_INPUT_MSG)); }
 static GNM_ACTION_DEF (cb_data_text_to_columns) { stf_text_to_columns (WORKBOOK_CONTROL (wbcg), 
GO_CMD_CONTEXT (wbcg)); }
 static GNM_ACTION_DEF (cb_data_consolidate)    { dialog_consolidate (wbcg); }
 static GNM_ACTION_DEF (cb_data_table)          { dialog_data_table (wbcg); }


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