filechooser: Use gtk_recent_info_is_local() for filtering
authorBarnabás Pőcze <pobrn@protonmail.com>
Wed, 8 Mar 2023 19:04:41 +0000 (20:04 +0100)
committerBarnabás Pőcze <pobrn@protonmail.com>
Wed, 8 Mar 2023 19:04:41 +0000 (20:04 +0100)
There is already a function for determining if URI
has the "file" scheme, so use that.

gtk/gtkfilechooserwidget.c

index baecc10aaaa2a4b784838365dbedd8afad18bd6d..f2c76d56ee8b8fa206875826d739ed10b91dd1f8 100644 (file)
@@ -641,11 +641,10 @@ _gtk_file_chooser_extract_recent_folders (GList *infos)
       GFile *parent;
       GFile *file;
 
-      uri = gtk_recent_info_get_uri (info);
-
-      if (!g_str_has_prefix (uri, "file://"))
+      if (!gtk_recent_info_is_local (info))
         continue;
 
+      uri = gtk_recent_info_get_uri (info);
       file = g_file_new_for_uri (uri);
       parent = g_file_get_parent (file);
       g_object_unref (file);
@@ -5996,8 +5995,7 @@ recent_start_loading (GtkFileChooserWidget *impl)
           GtkRecentInfo *info = l->data;
           GFile *file;
 
-          const char *uri = gtk_recent_info_get_uri (info);
-          if (!g_str_has_prefix (uri, "file://"))
+          if (!gtk_recent_info_is_local (info))
             continue;
 
           if (gtk_recent_info_get_private_hint (info) &&