filechooserwidget: Move file name to column view

And remove it from the tree view. Next commits will look a lot like
this, until all columns are moved.
This commit is contained in:
Georges Basile Stavracas Neto 2022-10-07 18:11:06 -03:00 committed by Matthias Clasen
parent 6c84958b9f
commit b96317b872
3 changed files with 45 additions and 14 deletions

View File

@ -275,7 +275,6 @@ struct _GtkFileChooserWidget
GFile *renamed_file;
GtkTreeViewColumn *list_name_column;
GtkCellRenderer *list_name_renderer;
GtkCellRenderer *list_pixbuf_renderer;
GtkTreeViewColumn *list_time_column;
GtkCellRenderer *list_date_renderer;
@ -7146,12 +7145,6 @@ update_cell_renderer_attributes (GtkFileChooserWidget *impl)
"gicon", MODEL_COL_ICON,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
gtk_tree_view_column_set_attributes (impl->list_name_column,
impl->list_name_renderer,
"text", MODEL_COL_NAME,
"ellipsize", MODEL_COL_ELLIPSIZE,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
gtk_tree_view_column_set_attributes (impl->list_size_column,
impl->list_size_renderer,
@ -7774,7 +7767,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, search_spinner);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_name_column);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_pixbuf_renderer);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_name_renderer);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_time_column);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_date_renderer);
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_time_renderer);

View File

@ -967,6 +967,7 @@ enum {
PROP_0,
PROP_FILE,
PROP_FILE_INFO,
PROP_NAME,
N_PROPS,
};
@ -990,6 +991,10 @@ _gtk_file_system_item_get_property (GObject *object,
g_value_set_object (value, self->node->info);
break;
case PROP_NAME:
g_value_set_string (value, g_file_info_get_display_name (self->node->info));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -1012,6 +1017,10 @@ _gtk_file_system_item_class_init (GtkFileSystemItemClass *klass)
G_TYPE_FILE_INFO,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
item_properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, "",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, item_properties);
}

View File

@ -141,6 +141,42 @@
<property name="vexpand">1</property>
<child>
<object class="GtkColumnView" id="browse_files_column_view">
<child>
<object class="GtkColumnViewColumn" id="column_view_name_column">
<property name="title" translatable="yes">Name</property>
<property name="expand">1</property>
<property name="resizable">1</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="GtkBox">
<child>
<object class="GtkInscription">
<property name="hexpand">1</property>
<property name="xalign">0</property>
<property name="min-chars">10</property>
<binding name="text">
<lookup type="GtkFileSystemItem" name="name">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
@ -203,12 +239,6 @@
<property name="xpad">6</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="list_name_renderer">
<property name="width-chars">10</property>
<property name="ellipsize">3</property>
</object>
</child>
</object>
</child>
<child>