[gnome-calendar/wip/flb/weather-forecast: 45/50] month-cell: Display temperatures



commit 8b7560b96ae3008ee9950a19ce5ffd235a6417ff
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 |   13 +++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/month-cell.ui b/data/ui/month-cell.ui
index 78e5e64..2ae203a 100644
--- a/data/ui/month-cell.ui
+++ b/data/ui/month-cell.ui
@@ -51,6 +51,20 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkLabel" id="temp_label">
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <style>
+                          <class name="temp-label" />
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkLabel" id="overflow_label">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
diff --git a/src/views/gcal-month-cell.c b/src/views/gcal-month-cell.c
index 68b8355..69fd68d 100644
--- a/src/views/gcal-month-cell.c
+++ b/src/views/gcal-month-cell.c
@@ -31,8 +31,9 @@ struct _GcalMonthCell
   GDateTime          *date;
   guint               n_overflow;
 
-  GtkLabel           *day_label; /* unowned */
-  GtkImage           *weather_icon;
+  GtkLabel           *day_label;    /* unowned */
+  GtkImage           *weather_icon; /* unowned */
+  GtkLabel           *temp_label;   /* unowned */
   GtkWidget          *overflow_button;
   GtkWidget          *overflow_label;
   GtkWidget          *overlay;
@@ -424,6 +425,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass)
 
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, day_label);
   gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, weather_icon);
+  gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, temp_label);
   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);
@@ -505,16 +507,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]