summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
authorrbuj <[email protected]>2022-07-28 18:21:22 +0200
committerLuke from DC <[email protected]>2022-08-20 20:29:54 +0000
commitd33085ff3b6a088a512b243382d20f1f0adc0957 (patch)
treea7f044166cc8247801f7b2e515209f89a29a9e57 /libmate-desktop
parentec93c117bf6dd3bc8f465012902dbd7aad38d6a7 (diff)
downloadmate-desktop-d33085ff3b6a088a512b243382d20f1f0adc0957.tar.bz2
mate-desktop-d33085ff3b6a088a512b243382d20f1f0adc0957.tar.xz
mate-bg: time_t mtime -> gint64 mtime
The timestamp is retrieved with g_file_info_get_attribute_uint64 in get_mtime (const char *filename)
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-bg.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index e60f013..0f617fa 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -100,7 +100,7 @@ struct _MateBG {
/* Cached information, only access through cache accessor functions */
SlideShow* slideshow;
- time_t file_mtime;
+ gint64 file_mtime;
GdkPixbuf* pixbuf_cache;
int timeout_id;
@@ -168,7 +168,7 @@ static GdkPixbuf *get_pixbuf_for_size (MateBG *bg,
static void clear_cache (MateBG *bg);
static gboolean is_different (MateBG *bg,
const char *filename);
-static time_t get_mtime (const char *filename);
+static gint64 get_mtime (const char *filename);
static GdkPixbuf *create_img_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
@@ -680,16 +680,10 @@ static gboolean
cache_file_is_valid (const char *filename,
const char *cache_filename)
{
- time_t mtime;
- time_t cache_mtime;
-
if (!g_file_test (cache_filename, G_FILE_TEST_IS_REGULAR))
return FALSE;
- mtime = get_mtime (filename);
- cache_mtime = get_mtime (cache_filename);
-
- return (mtime < cache_mtime);
+ return (get_mtime (filename) < get_mtime (cache_filename));
}
static void
@@ -2095,14 +2089,12 @@ ensure_timeout (MateBG *bg,
}
}
-static time_t
+static gint64
get_mtime (const char *filename)
{
GFile *file;
GFileInfo *info;
- time_t mtime;
-
- mtime = (time_t)-1;
+ gint64 mtime = (gint64)-1;
if (filename) {
file = g_file_new_for_path (filename);
@@ -2430,9 +2422,7 @@ is_different (MateBG *bg,
return FALSE;
}
else {
- time_t mtime = get_mtime (filename);
-
- if (mtime != bg->file_mtime)
+ if (get_mtime (filename) != bg->file_mtime)
return TRUE;
if (strcmp (filename, bg->filename) != 0)
@@ -3094,13 +3084,12 @@ create_thumbnail_for_filename (MateDesktopThumbnailFactory *factory,
const char *filename)
{
char *thumb;
- time_t mtime;
+ gint64 mtime;
GdkPixbuf *orig, *result = NULL;
char *uri;
mtime = get_mtime (filename);
-
- if (mtime == (time_t)-1)
+ if (mtime == (gint64)-1)
return NULL;
uri = g_filename_to_uri (filename, NULL, NULL);