[gnome-calendar/wip/flb/weather-forecast: 132/135] month-cell: Display temperatures



commit 67f3a2057ed1946242f499fd8206c74f3008bf66
Author: Florian Brosch <flo brosch gmail com>
Date:   Sun Oct 29 16:38:00 2017 +0100

    month-cell: Display temperatures

 data/ui/month-cell.ui       | 14 ++++++++++++++
 src/views/gcal-month-cell.c |  9 +++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/month-cell.ui b/data/ui/month-cell.ui
index 3ad9f325..89904a41 100644
--- a/data/ui/month-cell.ui
+++ b/data/ui/month-cell.ui
@@ -28,13 +28,27 @@
                 </style>
               </object>
             </child>
+
+            <!-- Weather forecast -->
             <child>
               <object class="GtkImage" id="weather_icon">
                 <property name="can-focus">False</property>
                 <property name="visible">True</property>
                 <property name="pixel_size">16</property>
+                <property name="margin-start">12</property>
+                <style>
+                  <class name="dim-label" />
+                </style>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkLabel" id="temp_label">
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
                 <style>
                   <class name="dim-label" />
+                  <class name="temp-label" />
                 </style>
               </object>
             </child>
diff --git a/src/views/gcal-month-cell.c b/src/views/gcal-month-cell.c
index 8e476152..f6541991 100644
--- a/src/views/gcal-month-cell.c
+++ b/src/views/gcal-month-cell.c
@@ -34,6 +34,7 @@ struct _GcalMonthCell
   GtkLabel           *day_label;
   GtkWidget          *header_box;
   GtkImage           *weather_icon;
+  GtkLabel           *temp_label;
 
   GtkWidget          *overflow_button;
   GtkWidget          *overflow_label;
@@ -429,6 +430,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_button);
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_label);
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overlay);
+  gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, temp_label);
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, weather_icon);
 
   gtk_widget_class_bind_template_callback (widget_class, enter_notify_event_cb);
@@ -508,16 +510,19 @@ gcal_month_cell_set_weather (GcalMonthCell   *self,
   if (info == NULL)
     {
       gtk_image_clear (self->weather_icon);
+      gtk_label_set_text (self->temp_label, "");
     }
   else
     {
       const gchar* icon_name; /* unowned */
+      const gchar* temp_str;  /* unwoned */
 
       icon_name = gcal_weather_info_get_icon_name (info);
+      temp_str = gcal_weather_info_get_temperature (info);
+
       gtk_image_set_from_icon_name (self->weather_icon, icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
+      gtk_label_set_text (self->temp_label, temp_str);
     }
-
-  gtk_widget_show (GTK_WIDGET (self->weather_icon));
 }
 
 gboolean


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