[totem] thumbnailer: Simplify getting the file's basename



commit 549ab7e18cefd7deb16f2a60063856420d89d6ba
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Apr 18 01:12:25 2013 +0200

    thumbnailer: Simplify getting the file's basename

 src/totem-video-thumbnailer.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c
index 38d4df0..a7ddeda 100644
--- a/src/totem-video-thumbnailer.c
+++ b/src/totem-video-thumbnailer.c
@@ -711,6 +711,7 @@ create_gallery (ThumbApp *app)
        gint screenshot_width = 0, screenshot_height = 0, x_padding = 0, y_padding = 0;
        gfloat scale = 1.0;
        gchar *header_text, *duration_text, *filename;
+       GFile *file;
 
        /* Calculate how many screenshots we're going to take */
        stream_length = app->duration;
@@ -827,15 +828,9 @@ create_gallery (ThumbApp *app)
 
        /* Build the header information */
        duration_text = totem_time_to_string (stream_length, FALSE, FALSE);
-       filename = NULL;
-       if (strstr (app->input, "://")) {
-               char *local;
-               local = g_filename_from_uri (app->input, NULL, NULL);
-               filename = g_path_get_basename (local);
-               g_free (local);
-       }
-       if (filename == NULL)
-               filename = g_path_get_basename (app->input);
+       file = g_file_new_for_commandline_arg (app->input);
+       filename = g_file_get_basename (file);
+       g_object_unref (file);
 
        /* Translators: The first string is "Filename" (as translated); the second is an actual filename.
                        The third string is "Resolution" (as translated); the fourth and fifth are screenshot 
height and width, respectively.


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