[gnome-todo] omni-area: Use GtdTextWidthLayout



commit 53a8064d8b573b7b6bbe6202c9f33108c98c57f3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat May 2 00:23:00 2020 -0300

    omni-area: Use GtdTextWidthLayout

 src/gtd-omni-area.c  |  5 ++--
 src/gtd-omni-area.ui | 75 ++++++++++++++++++++++++++++++----------------------
 2 files changed, 46 insertions(+), 34 deletions(-)
---
diff --git a/src/gtd-omni-area.c b/src/gtd-omni-area.c
index a461e95..deed59e 100644
--- a/src/gtd-omni-area.c
+++ b/src/gtd-omni-area.c
@@ -24,6 +24,7 @@
 
 #include "gtd-debug.h"
 #include "gtd-omni-area-addin.h"
+#include "gtd-text-width-layout.h"
 
 #include <libpeas/peas.h>
 
@@ -142,6 +143,8 @@ gtd_omni_area_class_init (GtdOmniAreaClass *klass)
 
   widget_class->destroy = gtd_omni_area_destroy;
 
+  g_type_ensure (GTD_TYPE_TEXT_WIDTH_LAYOUT);
+
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/todo/ui/gtd-omni-area.ui");
 
   gtk_widget_class_bind_template_child (widget_class, GtdOmniArea, main_stack);
@@ -196,8 +199,6 @@ gtd_omni_area_push_message (GtdOmniArea *self,
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
 
   label = gtk_label_new (text);
-  gtk_label_set_width_chars (GTK_LABEL (label), 35);
-  gtk_label_set_max_width_chars (GTK_LABEL (label), 35);
   gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
   gtk_label_set_xalign (GTK_LABEL (label), 0.0);
   gtk_container_add (GTK_CONTAINER (box), label);
diff --git a/src/gtd-omni-area.ui b/src/gtd-omni-area.ui
index 9d10da7..dd521a0 100644
--- a/src/gtd-omni-area.ui
+++ b/src/gtd-omni-area.ui
@@ -12,51 +12,62 @@
         </child>
 
         <child type="center">
-          <object class="GtkBox">
-            <property name="css-name">entry</property>
-
+          <object class="GtkFrame">
+            <property name="css-name"></property>
+            <property name="layout-manager">
+              <object class="GtdTextWidthLayout">
+                <property name="width-chars">25</property>
+                <property name="max-width-chars">40</property>
+              </object>
+            </property>
 
             <child>
-              <object class="GtkStack" id="main_stack">
-                <property name="margin-start">6</property>
-                <property name="margin-end">6</property>
-                <property name="hhomogeneous">true</property>
-                <property name="transition-type">slide-up-down</property>
-                <property name="transition-duration">500</property>
+              <object class="GtkBox">
+                <property name="hexpand">true</property>
+                <property name="css-name">entry</property>
 
                 <child>
-                  <object class="GtkStackPage">
-                    <property name="name">placeholder</property>
-                    <property name="child">
-                      <object class="GtkLabel">
-                        <property name="label" translatable="yes">To Do</property>
-                        <property name="xalign">0.0</property>
-                        <property name="width-chars">35</property>
-                        <property name="max-width-chars">35</property>
+                  <object class="GtkStack" id="main_stack">
+                    <property name="margin-start">6</property>
+                    <property name="margin-end">6</property>
+                    <property name="hhomogeneous">true</property>
+                    <property name="transition-type">slide-up-down</property>
+                    <property name="transition-duration">500</property>
+
+                    <child>
+                      <object class="GtkStackPage">
+                        <property name="name">placeholder</property>
+                        <property name="child">
+                          <object class="GtkLabel">
+                            <property name="label" translatable="yes">To Do</property>
+                            <property name="xalign">0.0</property>
+                          </object>
+                        </property>
                       </object>
-                    </property>
-                  </object>
-                </child>
+                    </child>
 
-                <child>
-                  <object class="GtkStackPage">
-                    <property name="name">messages</property>
-                    <property name="child">
-                      <object class="GtkStack" id="status_stack">
-                        <property name="margin-start">6</property>
-                        <property name="margin-end">6</property>
-                        <property name="hhomogeneous">true</property>
-                        <property name="transition-type">slide-up-down</property>
-                        <property name="transition-duration">500</property>
+                    <child>
+                      <object class="GtkStackPage">
+                        <property name="name">messages</property>
+                        <property name="child">
+                          <object class="GtkStack" id="status_stack">
+                            <property name="margin-start">6</property>
+                            <property name="margin-end">6</property>
+                            <property name="hhomogeneous">true</property>
+                            <property name="transition-type">slide-up-down</property>
+                            <property name="transition-duration">500</property>
+                          </object>
+                        </property>
                       </object>
-                    </property>
+                    </child>
+
                   </object>
                 </child>
 
+
               </object>
             </child>
 
-
           </object>
         </child>
 


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