[gtk/gbsneto/filechooser-column-view: 9/74] filechooserwidget: Move file name to column view
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gbsneto/filechooser-column-view: 9/74] filechooserwidget: Move file name to column view
- Date: Fri, 21 Oct 2022 02:40:31 +0000 (UTC)
commit b96317b872288c4f4926634f13590b8973c60049
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Oct 7 18:11:06 2022 -0300
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.
gtk/gtkfilechooserwidget.c | 8 --------
gtk/gtkfilesystemmodel.c | 9 +++++++++
gtk/ui/gtkfilechooserwidget.ui | 42 ++++++++++++++++++++++++++++++++++++------
3 files changed, 45 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 296858b544..7714f2b7b9 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -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);
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 309cbd0267..35325cb83f 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -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);
}
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 379bdbdae3..4e0090f9f7 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]