[gnome-calendar/gbsneto/gtk4: 33/37] event-popover: Port to GTK4




commit 71b0271e1e8dfed84b0005a86943c7dd4c365d5b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 26 13:14:18 2022 -0300

    event-popover: Port to GTK4

 src/gui/gcal-event-popover.c  | 13 +++----------
 src/gui/gcal-event-popover.ui | 35 +++++++++++++++--------------------
 src/theme/Adwaita.css         |  4 ++--
 3 files changed, 20 insertions(+), 32 deletions(-)
---
diff --git a/src/gui/gcal-event-popover.c b/src/gui/gcal-event-popover.c
index 2403f725..e6dc1006 100644
--- a/src/gui/gcal-event-popover.c
+++ b/src/gui/gcal-event-popover.c
@@ -26,7 +26,6 @@
 #include "gcal-utils.h"
 
 #include <glib/gi18n.h>
-#include <handy.h>
 
 struct _GcalEventPopover
 {
@@ -416,7 +415,7 @@ add_meeting (GcalEventPopover *self,
 
   row = gcal_meeting_row_new (url);
   g_signal_connect (row, "join-meeting", G_CALLBACK (on_join_meeting_cb), self);
-  gtk_container_add (GTK_CONTAINER (self->meetings_listbox), row);
+  gtk_list_box_append (self->meetings_listbox, row);
 
   gtk_widget_show (GTK_WIDGET (self->meetings_listbox));
 }
@@ -510,18 +509,12 @@ on_join_meeting_cb (GcalMeetingRow   *meeting_row,
                     const gchar      *url,
                     GcalEventPopover *self)
 {
-  g_autoptr (GError) error = NULL;
   GtkWindow *window;
 
-  window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
+  window = GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (self)));
   g_assert (window != NULL);
 
-  gtk_show_uri_on_window (window, url, GDK_CURRENT_TIME, &error);
-  if (error)
-    {
-      g_warning ("Error opening URL: %s", error->message);
-      return;
-    }
+  gtk_show_uri (window, url, GDK_CURRENT_TIME);
 
   /* For some reason, gtk_popover_popdown() crashes when called here */
   gtk_widget_hide (GTK_WIDGET (self));
diff --git a/src/gui/gcal-event-popover.ui b/src/gui/gcal-event-popover.ui
index 3f366e28..f2aca597 100644
--- a/src/gui/gcal-event-popover.ui
+++ b/src/gui/gcal-event-popover.ui
@@ -8,46 +8,44 @@
 
     <child>
       <object class="GtkBox">
-        <property name="visible">True</property>
+        <property name="spacing">6</property>
         <property name="orientation">vertical</property>
 
         <child>
           <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="spacing">0</property>
+            <property name="spacing">6</property>
             <property name="orientation">vertical</property>
 
             <!-- Title -->
             <child>
               <object class="GtkLabel" id="summary_label">
-                <property name="visible">True</property>
-                <property name="margin">12</property>
+                <property name="margin-top">12</property>
+                <property name="margin-bottom">12</property>
+                <property name="margin-start">12</property>
+                <property name="margin-end">12</property>
                 <property name="ellipsize">end</property>
                 <property name="width-chars">30</property>
                 <property name="max-width-chars">40</property>
-                <attributes>
-                  <attribute name="weight" value="bold" />
-                </attributes>
+                <style>
+                  <class name="heading" />
+                </style>
               </object>
             </child>
 
             <!-- Date & Time -->
             <child>
               <object class="GtkLabel" id="date_time_label">
-                <property name="visible">True</property>
                 <property name="ellipsize">end</property>
               </object>
             </child>
 
             <child>
               <object class="GtkSeparator">
-                <property name="visible">True</property>
               </object>
             </child>
 
             <child>
               <object class="GtkScrolledWindow">
-                <property name="visible">True</property>
                 <property name="hscrollbar-policy">never</property>
                 <property name="propagate-natural-width">True</property>
                 <property name="propagate-natural-height">True</property>
@@ -55,8 +53,10 @@
 
                 <child>
                   <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="margin">12</property>
+                    <property name="margin-top">12</property>
+                    <property name="margin-bottom">12</property>
+                    <property name="margin-start">12</property>
+                    <property name="margin-end">12</property>
                     <property name="spacing">12</property>
                     <property name="orientation">vertical</property>
 
@@ -64,8 +64,8 @@
                     <!-- Placeholder -->
                     <child>
                       <object class="GtkLabel" id="placeholder_label">
-                        <property name="visible">True</property>
-                        <property name="expand">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
                         <property name="valign">center</property>
                         <property name="label" translatable="yes">No event information</property>
                         <attributes>
@@ -99,7 +99,6 @@
 
                         <child>
                           <object class="GtkLabel">
-                            <property name="visible">True</property>
                             <property name="xalign">0.0</property>
                             <property name="label" translatable="yes">Location</property>
                             <attributes>
@@ -110,13 +109,11 @@
 
                         <child>
                           <object class="GtkSeparator">
-                            <property name="visible">True</property>
                           </object>
                         </child>
 
                         <child>
                           <object class="GtkLabel" id="location_label">
-                            <property name="visible">True</property>
                             <property name="selectable">True</property>
                             <property name="xalign">0.0</property>
                           </object>
@@ -155,8 +152,6 @@
         <!-- Edit button -->
         <child>
           <object class="GtkButton" id="edit_button">
-            <property name="visible">True</property>
-            <property name="can-default">True</property>
             <property name="label" translatable="yes">Edit…</property>
             <signal name="clicked" handler="on_edit_button_clicked_cb" object="GcalEventPopover" 
swapped="no" />
           </object>
diff --git a/src/theme/Adwaita.css b/src/theme/Adwaita.css
index d31670d2..431c0378 100644
--- a/src/theme/Adwaita.css
+++ b/src/theme/Adwaita.css
@@ -230,11 +230,11 @@ event.color-light:backdrop {
 
 /* Event Popover */
 popover.event-popover,
-popover.event-popover > box {
+popover.event-popover > contents {
   padding: 0;
 }
 
-popover.event-popover > box > button {
+popover.event-popover > contents > box > button {
   border-left-width: 0;
   border-right-width: 0;
   border-bottom-width: 0;


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