[evolution/wip/webkit2] Bug 764428 - Empty state text in Contacts view is not properly centered



commit 2e6268373501dc652c84c05c15284d0ebb5a545c
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 1 14:07:37 2016 +0200

    Bug 764428 - Empty state text in Contacts view is not properly centered

 e-util/e-reflow.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/e-util/e-reflow.c b/e-util/e-reflow.c
index ec4cd81..3f3d22f 100644
--- a/e-util/e-reflow.c
+++ b/e-util/e-reflow.c
@@ -560,13 +560,8 @@ set_empty (EReflow *reflow)
                        if (reflow->empty_message) {
                                gnome_canvas_item_set (
                                        reflow->empty_text,
-                                       "width", reflow->minimum_width,
                                        "text", reflow->empty_message,
                                        NULL);
-                               e_canvas_item_move_absolute (
-                                       reflow->empty_text,
-                                       reflow->minimum_width / 2,
-                                       0);
                        } else {
                                g_object_run_dispose (G_OBJECT (reflow->empty_text));
                                reflow->empty_text = NULL;
@@ -576,18 +571,24 @@ set_empty (EReflow *reflow)
                                reflow->empty_text = gnome_canvas_item_new (
                                        GNOME_CANVAS_GROUP (reflow),
                                        e_text_get_type (),
-                                       "width", reflow->minimum_width,
                                        "clip", TRUE,
                                        "use_ellipsis", TRUE,
-                                       "justification", GTK_JUSTIFY_CENTER,
+                                       "justification", GTK_JUSTIFY_LEFT,
                                        "text", reflow->empty_message,
                                        NULL);
-                               e_canvas_item_move_absolute (
-                                       reflow->empty_text,
-                                       reflow->minimum_width / 2,
-                                       0);
                        }
                }
+
+               if (reflow->empty_text) {
+                       gdouble text_width = -1.0;
+
+                       g_object_get (reflow->empty_text, "text_width", &text_width, NULL);
+
+                       e_canvas_item_move_absolute (
+                               reflow->empty_text,
+                               (MAX (reflow->width - text_width, 0) + E_REFLOW_BORDER_WIDTH) / 2,
+                               0);
+               }
        } else {
                if (reflow->empty_text) {
                        g_object_run_dispose (G_OBJECT (reflow->empty_text));
@@ -1497,6 +1498,14 @@ e_reflow_reflow (GnomeCanvasItem *item,
        reflow->width = running_width + reflow->column_width + E_REFLOW_BORDER_WIDTH;
        if (reflow->width < reflow->minimum_width)
                reflow->width = reflow->minimum_width;
+       if (reflow->empty_text) {
+               gdouble text_width = -1.0;
+
+               g_object_get (reflow->empty_text, "text_width", &text_width, NULL);
+
+               if (text_width + (E_REFLOW_BORDER_WIDTH * 2) > reflow->width)
+                       reflow->width = text_width + (E_REFLOW_BORDER_WIDTH * 2);
+       }
        if (old_width != reflow->width)
                e_canvas_item_request_parent_reflow (item);
 }


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