Merge branch 'app-private-recent-list' into 'gtk-3-24'
FileChooserWidget: Don't show recent items with private hint set See merge request GNOME/gtk!172
This commit is contained in:
		@ -7460,6 +7460,23 @@ recent_idle_cleanup (gpointer data)
 | 
				
			|||||||
  g_free (load_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
 | 
					/* Populates the file system model with the GtkRecentInfo* items
 | 
				
			||||||
 * in the provided list; frees the items
 | 
					 * in the provided list; frees the items
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -7481,6 +7498,9 @@ populate_model_with_recent_items (GtkFileChooserWidget *impl,
 | 
				
			|||||||
      GtkRecentInfo *info = l->data;
 | 
					      GtkRecentInfo *info = l->data;
 | 
				
			||||||
      GFile *file;
 | 
					      GFile *file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (recent_item_is_private (info))
 | 
				
			||||||
 | 
					        continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
 | 
					      file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
 | 
				
			||||||
      _gtk_file_system_model_add_and_query_file (priv->recent_model,
 | 
					      _gtk_file_system_model_add_and_query_file (priv->recent_model,
 | 
				
			||||||
                                                 file,
 | 
					                                                 file,
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user