[recipes: 1/2] Fix deprecation warnings for use of GTimeVal



commit 64ad62346876fb79987e96ecb9b9eaf5d1790647
Author: Matthew Leeds <mwl458 gmail com>
Date:   Sun Mar 22 22:29:56 2020 +0000

    Fix deprecation warnings for use of GTimeVal
    
    Only 18 years left until this would have been an issue

 data/recipes.db                 |  2 +-
 meson.build                     |  6 +++---
 src/gr-cooking-view.c           |  2 +-
 src/gr-edit-page.c              |  2 +-
 src/gr-image-viewer.c           |  2 +-
 src/gr-image.c                  | 15 ++++++---------
 src/gr-ingredients-viewer-row.c |  2 +-
 src/gr-recipe-store.c           | 15 ++++++---------
 8 files changed, 20 insertions(+), 26 deletions(-)
---
diff --git a/data/recipes.db b/data/recipes.db
index 64dddd1..89dd8ec 100644
--- a/data/recipes.db
+++ b/data/recipes.db
@@ -31,7 +31,7 @@ Season=
 Category=Sauce
 PrepTime=Less than 15 minutes
 CookTime=
-Ingredients=1          Cucumber        Ingredients\n2  Cloves  Garlic Minced   Ingredients\n¼  cup     Extra 
Virgin Olive Oil  Ingredients\n18 oz      Strained Greek yogurt   Ingredients\n2  tbsp    Red wine vinegar    
    Ingredients\n1  pinch   Salt and pepper Ingredients\n
+Ingredients=1          Cucumber        Ingredients\n2  Cloves  Garlic Minced   Ingredients\n¼  cup     Extra 
Virgin Olive Oil  Ingredients\n18 oz      Strained Greek yogurt   Ingredients\n2  tbsp    Red wine vinegar    
    Ingredients\n1  pinch   Salt and pepper Ingredients
 Instructions=To prepare this traditional Greek tzatziki sauce recipe, remove the skin and the seeds of the 
cucumber and grate it into a large bowl. Season with salt and pepper and leave aside for 10 minutes.\n\n    
Wrap the grated cucumber in a towel and squeeze, in order to get rid of the excess water.\n\n    Assemble the 
tzatziki sauce. In a bowl, add the cucumber, the minced garlic and olive oil, the yogurt, 1-2 tbsps of red 
wine vinegar, a pinch of salt and blend, until the ingredients are combined. Store the tzatziki sauce in the 
fridge and always serve cold. (Alternatively, if you have a blender, pour in the olive oil and garlic and 
blend until combined. Then mix with the rest of the ingredients using a spoon. This will help the garlic to 
mix better with the rest of the ingredients).\n\n    Prepare this traditional tzatziki sauce for your friends 
and family and serve as a delicious dip with some warm pita breads aside, or as a sauce for Greek-style 
souvlaki. Enjoy!
 Notes=
 Serves=4
diff --git a/meson.build b/meson.build
index 3b461c4..1286312 100644
--- a/meson.build
+++ b/meson.build
@@ -81,9 +81,9 @@ if get_option('canberra') != 'no'
 endif
 
 deps = [ dependency('gtk+-3.0', version : '>=3.22'),
-         dependency('glib-2.0'),
-         dependency('gio-2.0'),
-         dependency('gio-unix-2.0'),
+         dependency('glib-2.0', version : '>= 2.61.2'),
+         dependency('gio-2.0', version : '>= 2.61.2'),
+         dependency('gio-unix-2.0', version : '>= 2.61.2'),
          dependency('gmodule-export-2.0'),
          dependency('libsoup-2.4'),
          dependency('goa-1.0'),
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index ed1ca6b..709a1b6 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -663,7 +663,7 @@ gr_cooking_view_stop (GrCookingView *view,
                 container_remove_all (GTK_CONTAINER (view->timer_box));
 
         g_clear_pointer (&view->instructions, g_free);
-        g_clear_pointer (&view->images, g_array_unref);
+        g_clear_pointer (&view->images, g_ptr_array_unref);
         g_ptr_array_set_size (view->steps, 0);
 
         if (stop_timers) {
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index 856680a..a025623 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -946,7 +946,7 @@ get_units_model (GrEditPage *page)
                                                    -1);
         }
 
-        return g_object_ref (store);
+        return GTK_TREE_MODEL (g_object_ref (store));
 }
 
 static gboolean
diff --git a/src/gr-image-viewer.c b/src/gr-image-viewer.c
index 34355df..aeedeb2 100644
--- a/src/gr-image-viewer.c
+++ b/src/gr-image-viewer.c
@@ -127,7 +127,7 @@ gr_image_viewer_finalize (GObject *object)
         g_clear_pointer (&viewer->additions, g_ptr_array_unref);
         g_clear_pointer (&viewer->removals, g_ptr_array_unref);
 
-        g_clear_pointer (&viewer->images, g_array_unref);
+        g_clear_pointer (&viewer->images, g_ptr_array_unref);
         remove_hide_timeout (viewer);
         g_clear_object (&viewer->gesture);
 
diff --git a/src/gr-image.c b/src/gr-image.c
index 1f12815..4b1d084 100644
--- a/src/gr-image.c
+++ b/src/gr-image.c
@@ -235,17 +235,15 @@ should_try_load (const char *path)
                                   G_FILE_QUERY_INFO_NONE,
                                   NULL,
                                   NULL);
-        if (info) {
+        if (info &&
+            g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) {
                 goffset size;
-                GTimeVal tv;
                 g_autoptr(GDateTime) now = NULL;
                 g_autoptr(GDateTime) mtime = NULL;
 
                 size = g_file_info_get_size (info);
-                g_file_info_get_modification_time (info, &tv);
-
                 now = g_date_time_new_now_utc ();
-                mtime = g_date_time_new_from_timeval_utc (&tv);
+                mtime = g_file_info_get_modification_date_time (info);
 
                 if (size == 6) {
                         result = g_date_time_difference (now, mtime) > G_TIME_SPAN_DAY;
@@ -297,13 +295,12 @@ set_modified_request (SoupMessage *msg,
                                   G_FILE_QUERY_INFO_NONE,
                                   NULL,
                                   NULL);
-        if (info) {
-                GTimeVal tv;
+        if (info &&
+            g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) {
                 g_autoptr(GDateTime) mtime = NULL;
                 g_autofree char *mod_date = NULL;
 
-                g_file_info_get_modification_time (info, &tv);
-                mtime = g_date_time_new_from_timeval_utc (&tv);
+                mtime = g_file_info_get_modification_date_time (info);
                 mod_date = g_date_time_format (mtime, "%a, %d %b %Y %H:%M:%S %Z");
                 soup_message_headers_append (msg->request_headers, "If-Modified-Since", mod_date);
         }
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index 2723053..bea7376 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -764,7 +764,7 @@ get_units_model (GrIngredientsViewerRow *row)
                 }
         }
 
-        return g_object_ref (store);
+        return GTK_TREE_MODEL (g_object_ref (store));
 }
 
 static void
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index c7f4e84..3c6d7ca 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -991,15 +991,13 @@ should_try_load (const char *path)
                                   G_FILE_QUERY_INFO_NONE,
                                   NULL,
                                   NULL);
-        if (info) {
-                GTimeVal tv;
+        if (info &&
+            g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) {
                 g_autoptr(GDateTime) now = NULL;
                 g_autoptr(GDateTime) mtime = NULL;
 
-                g_file_info_get_modification_time (info, &tv);
-
                 now = g_date_time_new_now_utc ();
-                mtime = g_date_time_new_from_timeval_utc (&tv);
+                mtime = g_file_info_get_modification_date_time (info);
 
                 result = g_date_time_difference (now, mtime) > G_TIME_SPAN_DAY;
                 g_debug ("Cached file for %s is %s",
@@ -1016,7 +1014,6 @@ set_modified_request (SoupMessage *msg,
 {
         g_autoptr(GFile) file = NULL;
         g_autoptr(GFileInfo) info = NULL;
-        GTimeVal tv;
         g_autoptr(GDateTime) mtime = NULL;
         g_autofree char *mod_date = NULL;
 
@@ -1027,9 +1024,9 @@ set_modified_request (SoupMessage *msg,
                                   NULL,
                                   NULL);
 
-        if (info) {
-                g_file_info_get_modification_time (info, &tv);
-                mtime = g_date_time_new_from_timeval_utc (&tv);
+        if (info &&
+            g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED)) {
+                mtime = g_file_info_get_modification_date_time (info);
                 mod_date = g_date_time_format (mtime, "%a, %d %b %Y %H:%M:%S %Z");
                 soup_message_headers_append (msg->request_headers, "If-Modified-Since", mod_date);
         }


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