[nautilus/wip/apoos-maximus/gsoc2020: 22/27] properties-window: set Contents title lable's valign property




commit 0c7ef6c297756dceeab023ede0e0458ea9df8c80
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date:   Tue Jul 14 01:05:14 2020 +0530

    properties-window: set Contents title lable's valign property
    
    When the Contents field displays a multi line message
    the Contents label needs to be aligned to the first line.
    Traditional implementation achieved this by conditionally
    appending a newline character, however now that valign
    property could be used to achieve the same, by setting it
    to "Start"

 src/nautilus-properties-window.c               | 20 --------------------
 src/resources/ui/nautilus-properties-window.ui |  1 +
 2 files changed, 1 insertion(+), 20 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index d2559364b..2bda6e2a2 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2110,7 +2110,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *window)
     guint total_count;
     guint unreadable_directory_count;
     goffset total_size;
-    gboolean used_two_lines;
     NautilusFile *file;
     GList *l;
     guint file_unreadable;
@@ -2172,7 +2171,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *window)
     }
 
     text = NULL;
-    used_two_lines = FALSE;
 
     if (total_count == 0)
     {
@@ -2209,7 +2207,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *window)
                                 _("(some contents unreadable)"),
                                 NULL);
             g_free (temp);
-            used_two_lines = TRUE;
         }
     }
 
@@ -2217,23 +2214,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *window)
                         text);
     g_free (text);
 
-    /* Also set the title field here, with a trailing carriage return &
-     * space if the value field has two lines. This is a hack to get the
-     * "Contents:" title to line up with the first line of the
-     * 2-line value. Maybe there's a better way to do this, but I
-     * couldn't think of one.
-     */
-    text = g_strdup (_("Contents:"));
-    if (used_two_lines)
-    {
-        temp = text;
-        text = g_strconcat (temp, "\n ", NULL);
-        g_free (temp);
-    }
-    gtk_label_set_text (GTK_LABEL (window->contents_title_label),
-                        text);
-    g_free (text);
-
     if (!deep_count_active)
     {
         window->deep_count_finished = TRUE;
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index f4425caa6..67d8c4a92 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -175,6 +175,7 @@
                         <child>
                           <object class="GtkLabel" id="contents_title_label">
                             <property name="can_focus">False</property>
+                            <property name="valign">start</property>
                             <property name="label" translatable="yes">Contents:</property>
                             <property name="xalign">0</property>
                           </object>


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