diff options
author | Laurent Napias <[email protected]> | 2019-06-29 12:02:22 +0200 |
---|---|---|
committer | ZenWalker <[email protected]> | 2019-07-03 20:46:07 +0200 |
commit | a0da3060df54a69f38b76dfd52c137700bdac96e (patch) | |
tree | 753a69f38cb643406219f4e8d6420dfb45ebd62b /libmate-desktop/mate-desktop-thumbnail.c | |
parent | fffd1db81fa1407ef933fa39aafb76bcdc6d86b2 (diff) | |
download | mate-desktop-a0da3060df54a69f38b76dfd52c137700bdac96e.tar.bz2 mate-desktop-a0da3060df54a69f38b76dfd52c137700bdac96e.tar.xz |
Remove trailing whitespaces
Diffstat (limited to 'libmate-desktop/mate-desktop-thumbnail.c')
-rw-r--r-- | libmate-desktop/mate-desktop-thumbnail.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c index 2d718e7..b874070 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -251,21 +251,21 @@ get_thumbnailers_dirs (void) } static void -size_prepared_cb (GdkPixbufLoader *loader, +size_prepared_cb (GdkPixbufLoader *loader, int width, int height, gpointer data) { SizePrepareContext *info = data; - + g_return_if_fail (width > 0 && height > 0); - + info->input_width = width; info->input_height = height; - + if (width < info->width && height < info->height) return; - - if (info->preserve_aspect_ratio && + + if (info->preserve_aspect_ratio && (info->width > 0 || info->height > 0)) { if (info->width < 0) { @@ -291,7 +291,7 @@ size_prepared_cb (GdkPixbufLoader *loader, if (info->height > 0) height = info->height; } - + gdk_pixbuf_loader_set_size (loader, width, height); } @@ -336,7 +336,7 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, guchar buffer[LOAD_BUFFER_SIZE]; gsize bytes_read; GdkPixbufLoader *loader = NULL; - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf; GdkPixbufAnimation *animation; GdkPixbufAnimationIter *iter; gboolean has_frame; @@ -467,7 +467,7 @@ mate_desktop_thumbnail_factory_finalize (GObject *object) { MateDesktopThumbnailFactory *factory; MateDesktopThumbnailFactoryPrivate *priv; - + factory = MATE_DESKTOP_THUMBNAIL_FACTORY (object); priv = factory->priv; @@ -773,13 +773,13 @@ static void mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory) { MateDesktopThumbnailFactoryPrivate *priv; - + factory->priv = mate_desktop_thumbnail_factory_get_instance_private (factory); priv = factory->priv; priv->size = MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL; - + priv->mime_types_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, @@ -811,7 +811,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (class); - + gobject_class->finalize = mate_desktop_thumbnail_factory_finalize; } @@ -822,7 +822,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla * Creates a new #MateDesktopThumbnailFactory. * * This function must be called on the main thread. - * + * * Return value: a new #MateDesktopThumbnailFactory * * Since: 2.2 @@ -831,11 +831,11 @@ MateDesktopThumbnailFactory * mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size) { MateDesktopThumbnailFactory *factory; - + factory = g_object_new (MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, NULL); - + factory->priv->size = size; - + return factory; } @@ -877,7 +877,7 @@ mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory, g_assert (digest_len == 16); file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - + path = g_build_filename (g_get_user_cache_dir (), "thumbnails", (priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", @@ -1060,7 +1060,7 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto (strstr (uri, "/.thumbnails/") != NULL || strstr (uri, "/.cache/thumbnails/") != NULL)) return FALSE; - + if (!mime_type) return FALSE; @@ -1080,13 +1080,13 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto uri, mtime); } - + return FALSE; } static char * expand_thumbnailing_script (const char *script, - const int size, + const int size, const char *inuri, const char *outfile) { @@ -1096,7 +1096,7 @@ expand_thumbnailing_script (const char *script, gboolean got_in; str = g_string_new (NULL); - + got_in = FALSE; last = script; while ((p = strchr (last, '%')) != NULL) @@ -1187,7 +1187,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * g_return_val_if_fail (mime_type != NULL, NULL); /* Doesn't access any volatile fields in factory, so it's threadsafe */ - + size = 128; if (factory->priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_LARGE) size = 256; @@ -1205,7 +1205,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * script = g_strdup (thumb->command); } g_mutex_unlock (&factory->priv->lock); - + if (script) { int fd; @@ -1246,7 +1246,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * "mate-original-height")); } } - + if (pixbuf == NULL) return NULL; @@ -1259,7 +1259,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); - + if (width > size || height > size) { const gchar *orig_width, *orig_height; @@ -1278,11 +1278,11 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * if (orig_height != NULL) { gdk_pixbuf_set_option (scaled, "tEXt::Thumb::Image::Height", orig_height); } - + g_object_unref (pixbuf); pixbuf = scaled; } - + if (original_width > 0) { g_snprintf (dimension, sizeof (dimension), "%i", original_width); gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Width", dimension); @@ -1324,7 +1324,7 @@ make_thumbnail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (image_dir); - + return res; } @@ -1368,7 +1368,7 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (fail_dir); g_free (app_dir); - + return res; } @@ -1376,9 +1376,9 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) /** * mate_desktop_thumbnail_factory_save_thumbnail: * @factory: a #MateDesktopThumbnailFactory - * @thumbnail: the thumbnail as a pixbuf + * @thumbnail: the thumbnail as a pixbuf * @uri: the uri of a file - * @original_mtime: the modification time of the original file + * @original_mtime: the modification time of the original file * * Saves @thumbnail at the right place. If the save fails a * failed thumbnail is written. @@ -1442,13 +1442,13 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", original_mtime); width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width"); height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height"); error = NULL; - if (width != NULL && height != NULL) + if (width != NULL && height != NULL) saved_ok = gdk_pixbuf_save (thumbnail, tmp_path, "png", &error, @@ -1466,7 +1466,7 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", NULL); - + if (saved_ok) { @@ -1548,12 +1548,12 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", mtime); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); saved_ok = gdk_pixbuf_save (pixbuf, tmp_path, - "png", NULL, + "png", NULL, "tEXt::Thumb::URI", uri, "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", @@ -1611,7 +1611,7 @@ mate_desktop_thumbnail_path_for_uri (const char *uri, md5 = mate_desktop_thumbnail_md5 (uri); file = g_strconcat (md5, ".png", NULL); g_free (md5); - + path = g_build_filename (g_get_user_cache_dir (), "thumbnails", (size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", @@ -1639,7 +1639,7 @@ mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf, const char *uri) { const char *thumb_uri; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; @@ -1667,19 +1667,19 @@ mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, { const char *thumb_uri, *thumb_mtime_str; time_t thumb_mtime; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; if (strcmp (uri, thumb_uri) != 0) return FALSE; - + thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); if (!thumb_mtime_str) return FALSE; thumb_mtime = atol (thumb_mtime_str); if (mtime != thumb_mtime) return FALSE; - + return TRUE; } |