summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-06-10 19:55:58 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-06-11 16:14:47 -0400
commit8c670b3b5d1c1d6f5a52cdc6702d0c11b37560c0 (patch)
tree57779c4467e4e8659606dc8b13a063d9cc6b56e9
parent5dddec4dd900e333eb7ceb2126fb79ea16985214 (diff)
downloadgtk+-8c670b3b5d1c1d6f5a52cdc6702d0c11b37560c0.tar.gz
testcolumnview: Add recent file support
Use testcolumnview --recent to see recent files.
-rw-r--r--gtk/gtkbookmarklist.c3
-rw-r--r--tests/testcolumnview.c32
2 files changed, 31 insertions, 4 deletions
diff --git a/gtk/gtkbookmarklist.c b/gtk/gtkbookmarklist.c
index d342bf1f07..5f81147933 100644
--- a/gtk/gtkbookmarklist.c
+++ b/gtk/gtkbookmarklist.c
@@ -34,6 +34,9 @@
* #GtkBookmarkList is a list model that wraps GBookmarkFile.
* It presents a #GListModel and fills it asynchronously with the #GFileInfos
* returned from that function.
+ *
+ * The #GFileInfos in the list have some attributes in the recent namespace
+ * added: recent::private (boolean) and recent:applications (stringv).
*/
enum {
diff --git a/tests/testcolumnview.c b/tests/testcolumnview.c
index 0b6e8a749e..6b0b3cbad9 100644
--- a/tests/testcolumnview.c
+++ b/tests/testcolumnview.c
@@ -62,6 +62,16 @@ create_list_model_for_directory (gpointer file)
return G_LIST_MODEL (create_directory_list (file));
}
+static GListModel *
+create_recent_files_list (void)
+{
+ GtkBookmarkList *dir;
+
+ dir = gtk_bookmark_list_new (NULL, "*");
+
+ return G_LIST_MODEL (dir);
+}
+
#if 0
typedef struct _RowData RowData;
struct _RowData
@@ -557,6 +567,7 @@ struct {
{ "owner (real)", G_FILE_ATTRIBUTE_OWNER_USER_REAL, SIMPLE_STRING_FACTORY (G_FILE_ATTRIBUTE_OWNER_USER_REAL, "string") },
{ "group", G_FILE_ATTRIBUTE_OWNER_GROUP, SIMPLE_STRING_FACTORY (G_FILE_ATTRIBUTE_OWNER_GROUP, "string") },
{ "Preview icon", G_FILE_ATTRIBUTE_PREVIEW_ICON, ICON_FACTORY (G_FILE_ATTRIBUTE_PREVIEW_ICON) },
+ { "Private", "recent::private", BOOLEAN_FACTORY ("recent::private") },
};
#if 0
@@ -717,17 +728,30 @@ main (int argc, char *argv[])
g_object_unref (builder);
if (argc > 1)
- root = g_file_new_for_commandline_arg (argv[1]);
+ {
+ if (g_strcmp0 (argv[1], "--recent") == 0)
+ {
+ dirmodel = create_recent_files_list ();
+ }
+ else
+ {
+ root = g_file_new_for_commandline_arg (argv[1]);
+ dirmodel = create_list_model_for_directory (root);
+ g_object_unref (root);
+ }
+ }
else
- root = g_file_new_for_path (g_get_current_dir ());
- dirmodel = create_list_model_for_directory (root);
+ {
+ root = g_file_new_for_path (g_get_current_dir ());
+ dirmodel = create_list_model_for_directory (root);
+ g_object_unref (root);
+ }
tree = gtk_tree_list_model_new (FALSE,
dirmodel,
TRUE,
create_list_model_for_file_info,
NULL, NULL);
g_object_unref (dirmodel);
- g_object_unref (root);
sorter = gtk_tree_list_row_sorter_new (g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (view))));
sort = gtk_sort_list_model_new (G_LIST_MODEL (tree), sorter);