[gtk/columnview-menu: 24/24] Add more columns to the settings demo
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/columnview-menu: 24/24] Add more columns to the settings demo
- Date: Mon, 1 Jun 2020 18:56:20 +0000 (UTC)
commit 77be8bff1f0acea2777ffd5c6c807c69367d3367
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 1 14:46:12 2020 -0400
Add more columns to the settings demo
Flesh out this demo more, so we can have a
non-trivial column editor here at some point.
demos/gtk-demo/listview_settings.c | 12 +++++++
demos/gtk-demo/listview_settings.ui | 70 +++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+)
---
diff --git a/demos/gtk-demo/listview_settings.c b/demos/gtk-demo/listview_settings.c
index 9ee30ea3c4..ac2ea3d3ae 100644
--- a/demos/gtk-demo/listview_settings.c
+++ b/demos/gtk-demo/listview_settings.c
@@ -302,6 +302,8 @@ do_listview_settings (GtkWidget *do_widget)
GtkColumnViewColumn *name_column;
GtkColumnViewColumn *type_column;
GtkColumnViewColumn *default_column;
+ GtkColumnViewColumn *summary_column;
+ GtkColumnViewColumn *description_column;
GtkSorter *sorter;
GActionGroup *actions;
GAction *action;
@@ -326,6 +328,8 @@ do_listview_settings (GtkWidget *do_widget)
columnview = GTK_WIDGET (gtk_builder_get_object (builder, "columnview"));
type_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "type_column"));
default_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "default_column"));
+ summary_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "summary_column"));
+ description_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "description_column"));
actions = G_ACTION_GROUP (g_simple_action_group_new ());
@@ -337,6 +341,14 @@ do_listview_settings (GtkWidget *do_widget)
g_action_map_add_action (G_ACTION_MAP (actions), action);
g_object_unref (action);
+ action = G_ACTION (g_property_action_new ("show-summary", summary_column, "visible"));
+ g_action_map_add_action (G_ACTION_MAP (actions), action);
+ g_object_unref (action);
+
+ action = G_ACTION (g_property_action_new ("show-description", description_column, "visible"));
+ g_action_map_add_action (G_ACTION_MAP (actions), action);
+ g_object_unref (action);
+
gtk_widget_insert_action_group (columnview, "columnview", actions);
g_object_unref (actions);
diff --git a/demos/gtk-demo/listview_settings.ui b/demos/gtk-demo/listview_settings.ui
index 96d2a22cfe..d567803140 100644
--- a/demos/gtk-demo/listview_settings.ui
+++ b/demos/gtk-demo/listview_settings.ui
@@ -176,6 +176,68 @@
</object>
</property>
</template>
+</interface>
+ ]]></property>
+ </object>
+ </property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkColumnViewColumn" id="summary_column">
+ <property name="title">Summary</property>
+ <property name="visible">0</property>
+ <property name="header-menu">header_menu</property>
+ <property name="factory">
+ <object class="GtkBuilderListItemFactory">
+ <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtkListItem">
+ <property name="child">
+ <object class="GtkLabel">
+ <property name="xalign">0</property>
+ <property name="wrap">1</property>
+ <property name="width-chars">50</property>
+ <property name="max-width-chars">50</property>
+ <binding name="label">
+ <lookup name="summary" type="SettingsKey">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </property>
+ </template>
+</interface>
+ ]]></property>
+ </object>
+ </property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkColumnViewColumn" id="description_column">
+ <property name="title">Description</property>
+ <property name="visible">0</property>
+ <property name="header-menu">header_menu</property>
+ <property name="factory">
+ <object class="GtkBuilderListItemFactory">
+ <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtkListItem">
+ <property name="child">
+ <object class="GtkLabel">
+ <property name="xalign">0</property>
+ <property name="wrap">1</property>
+ <property name="width-chars">50</property>
+ <property name="max-width-chars">50</property>
+ <binding name="label">
+ <lookup name="description" type="SettingsKey">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </property>
+ </template>
</interface>
]]></property>
</object>
@@ -201,6 +263,14 @@
<attribute name="label" translatable="yes">Default value</attribute>
<attribute name="action">columnview.show-default</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Summary</attribute>
+ <attribute name="action">columnview.show-summary</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Description</attribute>
+ <attribute name="action">columnview.show-description</attribute>
+ </item>
</section>
</menu>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]