[calls/wip/cdavis/history-libhandy-widgets: 3/4] calls-record-row: Use HdyActionRow




commit e3085daf5452ebd9efc9c15fdbd46e16865efdc7
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Dec 4 17:23:52 2021 -0800

    calls-record-row: Use HdyActionRow
    
    Gives us consistent spacing and margins.

 src/calls-call-record-row.c |  6 ++---
 src/ui/call-record-row.ui   | 62 ++++++++++-----------------------------------
 2 files changed, 16 insertions(+), 52 deletions(-)
---
diff --git a/src/calls-call-record-row.c b/src/calls-call-record-row.c
index b835f3d5..a04c5cc2 100644
--- a/src/calls-call-record-row.c
+++ b/src/calls-call-record-row.c
@@ -43,7 +43,7 @@ struct _CallsCallRecordRow
 
   GtkWidget *avatar;
   GtkImage *type;
-  GtkLabel *target;
+  HdyActionRow *action_row;
   GtkLabel *time;
   GtkButton *button;
   GtkPopover *popover;
@@ -343,7 +343,7 @@ setup_contact (CallsCallRecordRow *self)
   self->contact = calls_contacts_provider_lookup_phone_number (contacts_provider, target);
 
   g_object_bind_property (self->contact, "name",
-                          self->target, "label",
+                          self->action_row, "title",
                           G_BINDING_SYNC_CREATE);
 
   g_object_bind_property (self->contact, "has-individual",
@@ -526,7 +526,7 @@ calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/call-record-row.ui");
   gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, avatar);
   gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, type);
-  gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, target);
+  gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, action_row);
   gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, time);
   gtk_widget_class_bind_template_child (widget_class, CallsCallRecordRow, button);
 
diff --git a/src/ui/call-record-row.ui b/src/ui/call-record-row.ui
index 5c98c6f1..b478cd23 100644
--- a/src/ui/call-record-row.ui
+++ b/src/ui/call-record-row.ui
@@ -8,56 +8,40 @@
     <property name="activatable">False</property>
     <property name="selectable">False</property>
     <child>
+      <!-- When porting to GTK4 we can get rid of the EventBox and make the whole row an ActionRow -->
       <object class="GtkEventBox" id="event_box">
         <property name="visible">True</property>
         <child>
-          <object class="GtkBox">
+          <object class="HdyActionRow" id="action_row">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <child>
+            <child type="prefix">
               <object class="HdyAvatar" id="avatar">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
-                <property name="margin_top">8</property>
-                <property name="margin_bottom">8</property>
+                <property name="margin-top">12</property>
+                <property name="margin-bottom">12</property>
                 <property name="size">48</property>
-                <property name="text" bind-source="target" bind-property="label" 
bind-flags="sync-create"></property>
+                <property name="text" bind-source="action_row" bind-property="title" 
bind-flags="sync-create"/>
                 <property name="show-initials">True</property>
               </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
             </child>
-            <child>
+            <child type="prefix">
               <object class="GtkImage" id="type">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
               </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="target">
+              <object class="GtkLabel" id="time">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">10</property>
-                <property name="ellipsize">middle</property>
+                <property name="justify">right</property>
+                <style>
+                  <class name="dim-label"/>
+                  <class name="caption"/>
+                </style>
               </object>
-              <packing>
-                <property name="position">2</property>
-              </packing>
             </child>
             <child>
               <object class="GtkButton" id="button">
                 <property name="visible">True</property>
-                <property name="margin_left">12</property>
-                <property name="margin_right">8</property>
-                <property name="margin_top">8</property>
-                <property name="margin_bottom">8</property>
-                <property name="halign">center</property>
                 <property name="valign">center</property>
                 <property name="action-name">app.dial</property>
                 <style>
@@ -75,26 +59,6 @@
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="pack_type">end</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="time">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_left">8</property>
-                <property name="justify">right</property>
-                <style>
-                  <class name="dim-label"/>
-                  <class name="caption"/>
-                </style>
-              </object>
-              <packing>
-                <property name="pack_type">end</property>
-                <property name="position">4</property>
-              </packing>
             </child>
           </object>
         </child>


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