diff options
author | Steve Zesch <[email protected]> | 2012-01-09 22:14:20 -0500 |
---|---|---|
committer | Steve Zesch <[email protected]> | 2012-01-09 22:14:20 -0500 |
commit | e554754f5681592f0f7b1d41e0943a89470f3796 (patch) | |
tree | 223db9350604b352a18d6b6f6ed330600afafeef /capplets/appearance/mate-wp-info.c | |
parent | 035a4e3cfa5782aaa4967cf923a1364eba3b056b (diff) | |
parent | b9c28ef703e934e8dc137686984f04c7b0d2d010 (diff) | |
download | mate-control-center-e554754f5681592f0f7b1d41e0943a89470f3796.tar.bz2 mate-control-center-e554754f5681592f0f7b1d41e0943a89470f3796.tar.xz |
Merge branch 'master' of https://github.com/mate-desktop/mate-control-center
Diffstat (limited to 'capplets/appearance/mate-wp-info.c')
-rw-r--r-- | capplets/appearance/mate-wp-info.c | 124 |
1 files changed, 67 insertions, 57 deletions
diff --git a/capplets/appearance/mate-wp-info.c b/capplets/appearance/mate-wp-info.c index 5c799eab..58145fd0 100644 --- a/capplets/appearance/mate-wp-info.c +++ b/capplets/appearance/mate-wp-info.c @@ -24,64 +24,74 @@ #include <gio/gio.h> #include "mate-wp-info.h" -MateWPInfo * mate_wp_info_new (const gchar * uri, - MateDesktopThumbnailFactory * thumbs) { - MateWPInfo *wp; - GFile *file; - GFileInfo *info; - - file = g_file_new_for_commandline_arg (uri); - - info = g_file_query_info (file, - G_FILE_ATTRIBUTE_STANDARD_NAME "," - G_FILE_ATTRIBUTE_STANDARD_SIZE "," - G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," - G_FILE_ATTRIBUTE_TIME_MODIFIED, - G_FILE_QUERY_INFO_NONE, - NULL, NULL); - g_object_unref (file); - - if (info == NULL || g_file_info_get_content_type (info) == NULL) { - if (!strcmp (uri, "(none)")) { - wp = g_new0 (MateWPInfo, 1); - - wp->mime_type = g_strdup ("image/x-no-data"); - wp->uri = g_strdup (uri); - wp->name = g_strdup (_("No Desktop Background")); - wp->size = 0; - } else { - wp = NULL; - } - } else { - wp = g_new0 (MateWPInfo, 1); - - wp->uri = g_strdup (uri); - - wp->name = g_strdup (g_file_info_get_name (info)); - if (g_file_info_get_content_type (info) != NULL) - wp->mime_type = g_strdup (g_file_info_get_content_type (info)); - wp->size = g_file_info_get_size (info); - wp->mtime = g_file_info_get_attribute_uint64 (info, - G_FILE_ATTRIBUTE_TIME_MODIFIED); - - wp->thumburi = mate_desktop_thumbnail_factory_lookup (thumbs, - uri, - wp->mtime); - } - - if (info != NULL) - g_object_unref (info); - - return wp; +MateWPInfo* mate_wp_info_new(const char* uri, MateDesktopThumbnailFactory* thumbs) +{ + MateWPInfo* wp; + + GFile* file = g_file_new_for_commandline_arg(uri); + + GFileInfo* info = g_file_query_info(file, + G_FILE_ATTRIBUTE_STANDARD_NAME "," + G_FILE_ATTRIBUTE_STANDARD_SIZE "," + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," + G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + + g_object_unref(file); + + if (info == NULL || g_file_info_get_content_type (info) == NULL) + { + if (!strcmp (uri, "(none)")) + { + wp = g_new0(MateWPInfo, 1); + + wp->mime_type = g_strdup("image/x-no-data"); + wp->uri = g_strdup(uri); + wp->name = g_strdup(_("No Desktop Background")); + wp->size = 0; + } + else + { + wp = NULL; + } + } + else + { + wp = g_new0 (MateWPInfo, 1); + + wp->uri = g_strdup(uri); + + wp->name = g_strdup(g_file_info_get_name(info)); + + if (g_file_info_get_content_type(info) != NULL) + { + wp->mime_type = g_strdup(g_file_info_get_content_type(info)); + } + + wp->size = g_file_info_get_size(info); + wp->mtime = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + + wp->thumburi = mate_desktop_thumbnail_factory_lookup(thumbs, uri, wp->mtime); + } + + if (info != NULL) + { + g_object_unref(info); + } + + return wp; } -void mate_wp_info_free (MateWPInfo * info) { - if (info == NULL) { - return; - } +void mate_wp_info_free(MateWPInfo* info) +{ + if (info == NULL) + { + return; + } - g_free (info->uri); - g_free (info->thumburi); - g_free (info->name); - g_free (info->mime_type); + g_free(info->uri); + g_free(info->thumburi); + g_free(info->name); + g_free(info->mime_type); } |