diff options
author | Kai Willadsen <kai.willadsen@gmail.com> | 2018-08-28 20:14:16 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-08-28 16:15:45 -0400 |
commit | ba6c5ef2017ad957e914d6fa964a1dc1d566b2c2 (patch) | |
tree | dc03ee2e536fcb4f385659f0b38149952dbfe69a | |
parent | 6a8013735de3a0a6336d336cd0a0a739b021ecd2 (diff) | |
download | gtk+-ba6c5ef2017ad957e914d6fa964a1dc1d566b2c2.tar.gz |
FileChooserWidget: Don't show recent items with private hint set
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index a3c5361795..73a125dae5 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -7355,6 +7355,23 @@ recent_idle_cleanup (gpointer data) g_free (load_data); } +static gboolean +recent_item_is_private (GtkRecentInfo *info) +{ + gboolean is_private = FALSE; + + if (gtk_recent_info_get_private_hint (info)) + { + const gchar *app_name = g_get_application_name (); + gchar **recent_apps = gtk_recent_info_get_applications (info, NULL); + is_private = !g_strv_contains ((const char *const*) recent_apps, + app_name); + g_strfreev (recent_apps); + } + + return is_private; +} + /* Populates the file system model with the GtkRecentInfo* items * in the provided list; frees the items */ @@ -7376,6 +7393,9 @@ populate_model_with_recent_items (GtkFileChooserWidget *impl, GtkRecentInfo *info = l->data; GFile *file; + if (recent_item_is_private (info)) + continue; + file = g_file_new_for_uri (gtk_recent_info_get_uri (info)); _gtk_file_system_model_add_and_query_file (priv->recent_model, file, |