diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml
index 8753b078ba..d274e67024 100644
--- a/demos/gtk-demo/demo.gresource.xml
+++ b/demos/gtk-demo/demo.gresource.xml
@@ -127,6 +127,7 @@
listview_filebrowser.ui
+ listview_filebrowser.css
listview_minesweeper.ui
diff --git a/demos/gtk-demo/listview_filebrowser.c b/demos/gtk-demo/listview_filebrowser.c
index 8483ec35ff..7dcf3e3d3f 100644
--- a/demos/gtk-demo/listview_filebrowser.c
+++ b/demos/gtk-demo/listview_filebrowser.c
@@ -18,6 +18,7 @@ struct _FileBrowserView
GtkListItemFactory *factory;
char *icon_name;
+ char *title;
GtkOrientation orientation;
};
@@ -25,6 +26,7 @@ enum {
PROP_0,
PROP_FACTORY,
PROP_ICON_NAME,
+ PROP_TITLE,
PROP_ORIENTATION,
N_PROPS
@@ -54,6 +56,10 @@ file_browser_view_get_property (GObject *object,
g_value_set_string (value, self->icon_name);
break;
+ case PROP_TITLE:
+ g_value_set_string (value, self->title);
+ break;
+
case PROP_ORIENTATION:
g_value_set_enum (value, self->orientation);
break;
@@ -83,6 +89,11 @@ file_browser_view_set_property (GObject *object,
self->icon_name = g_value_dup_string (value);
break;
+ case PROP_TITLE:
+ g_free (self->title);
+ self->title = g_value_dup_string (value);
+ break;
+
case PROP_ORIENTATION:
self->orientation = g_value_get_enum (value);
break;
@@ -100,6 +111,7 @@ file_browser_view_finalize (GObject *object)
g_object_unref (self->factory);
g_free (self->icon_name);
+ g_free (self->title);
G_OBJECT_CLASS (file_browser_view_parent_class)->dispose (object);
}
@@ -125,6 +137,12 @@ file_browser_view_class_init (FileBrowserViewClass *klass)
"icon to display for selecting this view",
NULL,
G_PARAM_READWRITE);
+ properties[PROP_TITLE] =
+ g_param_spec_string ("title",
+ "title",
+ "title to display for selecting this view",
+ NULL,
+ G_PARAM_READWRITE);
properties[PROP_ORIENTATION] =
g_param_spec_enum ("orientation",
"orientation",
@@ -224,6 +242,14 @@ do_listview_filebrowser (GtkWidget *do_widget)
GtkDirectoryList *dirlist;
GFile *file;
char *cwd;
+ GtkCssProvider *provider;
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_resource (provider, "/listview_filebrowser/listview_filebrowser.css");
+ gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ 800);
+ g_object_unref (provider);
builder = gtk_builder_new_from_resource ("/listview_filebrowser/listview_filebrowser.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
diff --git a/demos/gtk-demo/listview_filebrowser.css b/demos/gtk-demo/listview_filebrowser.css
new file mode 100644
index 0000000000..c27fadf57f
--- /dev/null
+++ b/demos/gtk-demo/listview_filebrowser.css
@@ -0,0 +1,11 @@
+list.viewswitcher {
+ border: 1px solid gray;
+}
+
+list.viewswitcher > row {
+ padding: 5px;
+}
+
+list.viewswitcher row:selected {
+ background: gray;
+}
diff --git a/demos/gtk-demo/listview_filebrowser.ui b/demos/gtk-demo/listview_filebrowser.ui
index 126c1baa02..7d5d4ce5cd 100644
--- a/demos/gtk-demo/listview_filebrowser.ui
+++ b/demos/gtk-demo/listview_filebrowser.ui
@@ -39,12 +39,14 @@
view-list-symbolic
+ List
horizontal