[evolution/wip/webkit2] EHTMLEditorTableDialog - Fix the table width units handling



commit baf1cb79cca69e642da5fb95f6a8030b1b4e930e
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Jul 22 11:42:58 2016 +0200

    EHTMLEditorTableDialog - Fix the table width units handling
    
    When the units are changed to pixels we need to change the GtkSpinButton maximal
    range otherwise it will get stuck on 100.

 e-util/e-html-editor-table-dialog.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-html-editor-table-dialog.c b/e-util/e-html-editor-table-dialog.c
index be2505d..b437507 100644
--- a/e-util/e-html-editor-table-dialog.c
+++ b/e-util/e-html-editor-table-dialog.c
@@ -154,6 +154,22 @@ html_editor_table_dialog_set_width (EHTMLEditorTableDialog *dialog)
 }
 
 static void
+html_editor_table_dialog_width_units_changed (GtkWidget *widget,
+                                              EHTMLEditorTableDialog *dialog)
+{
+       if (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->width_units)) == 0) {
+               /* FIXME WK2 - is it even possible to remove the max limitation
+                * from the GtkSpinButton? If not 10000 will be hopefully enough, */
+               gtk_spin_button_set_range (
+                       GTK_SPIN_BUTTON (dialog->priv->width_edit), 0, 10000);
+       } else
+               gtk_spin_button_set_range (
+                       GTK_SPIN_BUTTON (dialog->priv->width_edit), 0, 100);
+
+       html_editor_table_dialog_set_width (dialog);
+}
+
+static void
 html_editor_table_dialog_get_width (EHTMLEditorTableDialog *dialog)
 {
        EHTMLEditor *editor;
@@ -576,9 +592,9 @@ e_html_editor_table_dialog_init (EHTMLEditorTableDialog *dialog)
        gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-px", "px");
        gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-percent", "%");
        gtk_grid_attach (grid, widget, 2, 0, 1, 1);
-       g_signal_connect_swapped (
+       g_signal_connect (
                widget, "changed",
-               G_CALLBACK (html_editor_table_dialog_set_width), dialog);
+               G_CALLBACK (html_editor_table_dialog_width_units_changed), dialog);
        dialog->priv->width_units = widget;
 
        /* Spacing */


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