[gnome-calendar/gbsneto/gtk4: 2/8] event-popover: Port to GTK4




commit e7cb4b65c4b0bea8cd6dc8d624d6ea0f0df4a0b7
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 | 65 ++++++++++++++++++++++++-------------------
 src/theme/Adwaita.css         | 15 +---------
 3 files changed, 41 insertions(+), 52 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..7d2f24a5 100644
--- a/src/gui/gcal-event-popover.ui
+++ b/src/gui/gcal-event-popover.ui
@@ -8,46 +8,46 @@
 
     <child>
       <object class="GtkBox">
-        <property name="visible">True</property>
+        <property name="spacing">12</property>
         <property name="orientation">vertical</property>
 
         <child>
           <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="spacing">0</property>
+            <property name="spacing">12</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-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="title-3" />
+                </style>
               </object>
             </child>
 
             <!-- Date & Time -->
             <child>
               <object class="GtkLabel" id="date_time_label">
-                <property name="visible">True</property>
                 <property name="ellipsize">end</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
               </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,18 +55,19 @@
 
                 <child>
                   <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="margin">12</property>
                     <property name="spacing">12</property>
                     <property name="orientation">vertical</property>
 
-
                     <!-- 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="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
                         <property name="label" translatable="yes">No event information</property>
                         <attributes>
                           <attribute name="style" value="italic" />
@@ -80,6 +81,10 @@
                     <!-- Description -->
                     <child>
                       <object class="GtkLabel" id="description_label">
+                        <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="use-markup">True</property>
                         <property name="selectable">True</property>
                         <property name="max-width-chars">50</property>
@@ -95,28 +100,30 @@
                     <!-- Location -->
                     <child>
                       <object class="GtkBox" id="location_box">
+                        <property name="spacing">6</property>
                         <property name="orientation">vertical</property>
 
                         <child>
                           <object class="GtkLabel">
-                            <property name="visible">True</property>
+                            <property name="margin-start">12</property>
+                            <property name="margin-end">12</property>
                             <property name="xalign">0.0</property>
                             <property name="label" translatable="yes">Location</property>
-                            <attributes>
-                              <attribute name="weight" value="bold" />
-                            </attributes>
+                            <style>
+                              <class name="heading" />
+                            </style>
                           </object>
                         </child>
 
                         <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="margin-start">12</property>
+                            <property name="margin-end">12</property>
                             <property name="selectable">True</property>
                             <property name="xalign">0.0</property>
                           </object>
@@ -137,16 +144,17 @@
 
         <!-- Meetings -->
         <child>
-          <object class="GtkSeparator">
-            <property name="visible" bind-source="meetings_listbox" bind-property="visible" 
bind-flags="default|sync-create" />
-          </object>
+          <object class="GtkSeparator" />
         </child>
 
         <child>
           <object class="GtkListBox" id="meetings_listbox">
+            <property name="visible">False</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
             <property name="selection-mode">none</property>
             <style>
-              <class name="background" />
+              <class name="calendar-list" />
             </style>
           </object>
         </child>
@@ -155,8 +163,9 @@
         <!-- Edit button -->
         <child>
           <object class="GtkButton" id="edit_button">
-            <property name="visible">True</property>
-            <property name="can-default">True</property>
+            <property name="margin-bottom">12</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</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 334ce01a..d91f03d9 100644
--- a/src/theme/Adwaita.css
+++ b/src/theme/Adwaita.css
@@ -156,23 +156,10 @@ event.color-light:backdrop {
 
 /* Event Popover */
 popover.event-popover,
-popover.event-popover > box {
+popover.event-popover > contents {
   padding: 0;
 }
 
-popover.event-popover > box > button {
-  border-left-width: 0;
-  border-right-width: 0;
-  border-bottom-width: 0;
-  border-top-left-radius: 0;
-  border-top-right-radius: 0;
-}
-
-popover.event-popover textview.view,
-popover.event-popover textview.view text {
-  background-color: transparent;
-}
-
 .search-viewport {
   background-color: @theme_base_color;
 }


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