[gnome-photos/gnome-3-30] device-item, local-item: Convert to UTF-8 before displaying the path



commit bca40631ce58ba164859010cbdb1ed8b82891d66
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Sep 11 07:49:03 2018 +0200

    device-item, local-item: Convert to UTF-8 before displaying the path
    
    Silences the following WARNING:
      Pango-WARNING **: Invalid UTF-8 string passed to
        pango_layout_set_text()
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/114

 src/photos-device-item.c | 4 +++-
 src/photos-local-item.c  | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-device-item.c b/src/photos-device-item.c
index 64129c88..7d775617 100644
--- a/src/photos-device-item.c
+++ b/src/photos-device-item.c
@@ -319,6 +319,7 @@ photos_device_item_get_source_widget (PhotosBaseItem *item)
   GtkWidget *source_widget;
   const gchar *uri;
   g_autofree gchar *source_path = NULL;
+  g_autofree gchar *source_path_display_name = NULL;
   g_autofree gchar *source_uri = NULL;
 
   g_return_val_if_fail (!photos_base_item_is_collection (item), NULL);
@@ -327,9 +328,10 @@ photos_device_item_get_source_widget (PhotosBaseItem *item)
   file = g_file_new_for_uri (uri);
   source_link = g_file_get_parent (file);
   source_path = g_file_get_path (source_link);
+  source_path_display_name = g_filename_display_name (source_path);
   source_uri = g_file_get_uri (source_link);
 
-  source_widget = gtk_link_button_new_with_label (source_uri, source_path);
+  source_widget = gtk_link_button_new_with_label (source_uri, source_path_display_name);
   gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
   g_signal_connect_object (source_widget,
                            "activate-link",
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 042e9349..a337bad1 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -1,7 +1,7 @@
 /*
  * Photos - access, organize and share your photos on GNOME
  * Copyright © 2014 Pranav Kant
- * Copyright © 2012 – 2017 Red Hat, Inc.
+ * Copyright © 2012 – 2018 Red Hat, Inc.
  * Copyright © 2016 Umang Jain
  *
  * This program is free software: you can redistribute it and/or modify
@@ -246,15 +246,17 @@ photos_local_item_get_source_widget (PhotosBaseItem *item)
       GtkWidget *label;
       const gchar *uri;
       g_autofree gchar *source_path = NULL;
+      g_autofree gchar *source_path_display_name = NULL;
       g_autofree gchar *source_uri = NULL;
 
       uri = photos_base_item_get_uri (item);
       file = g_file_new_for_uri (uri);
       source_link = g_file_get_parent (file);
       source_path = g_file_get_path (source_link);
+      source_path_display_name = g_filename_display_name (source_path);
       source_uri = g_file_get_uri (source_link);
 
-      source_widget = gtk_link_button_new_with_label (source_uri, source_path);
+      source_widget = gtk_link_button_new_with_label (source_uri, source_path_display_name);
       gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
       g_signal_connect_object (source_widget,
                                "activate-link",


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