Merge branch 'wip/corey/file-chooser-signal' into 'main'
Port filechooserwidget to GtkSignalListItemFactory See merge request GNOME/gtk!5858
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkgesturelongpress.h"
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkselectionmodel.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
@@ -39,11 +38,6 @@ struct _GtkFileChooserCell
|
||||
|
||||
GFileInfo *item;
|
||||
GtkColumnViewCell *list_item;
|
||||
|
||||
gboolean date_column;
|
||||
guint type_format;
|
||||
|
||||
gboolean show_time;
|
||||
};
|
||||
|
||||
struct _GtkFileChooserCellClass
|
||||
@@ -55,21 +49,13 @@ G_DEFINE_TYPE (GtkFileChooserCell, gtk_file_chooser_cell, GTK_TYPE_WIDGET)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_DATE_COLUMN = 1,
|
||||
PROP_POSITION,
|
||||
PROP_POSITION = 1,
|
||||
PROP_ITEM,
|
||||
PROP_SHOW_TIME,
|
||||
PROP_LIST_ITEM,
|
||||
};
|
||||
|
||||
#define ICON_SIZE 16
|
||||
|
||||
guint
|
||||
gtk_file_chooser_cell_get_type_format (GtkFileChooserCell *self)
|
||||
{
|
||||
return self->type_format;
|
||||
}
|
||||
|
||||
static void
|
||||
popup_menu (GtkFileChooserCell *self,
|
||||
double x,
|
||||
@@ -161,45 +147,11 @@ drag_prepare_cb (GtkDragSource *source,
|
||||
return provider;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_cell_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserCell *self = GTK_FILE_CHOOSER_CELL (widget);
|
||||
GtkFileChooserWidget *impl;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (GTK_WIDGET (self),
|
||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||
|
||||
g_object_bind_property (impl, "show-time", self, "show-time", G_BINDING_SYNC_CREATE);
|
||||
|
||||
if (self->date_column)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
char *text;
|
||||
|
||||
box = gtk_widget_get_first_child (GTK_WIDGET (self));
|
||||
label = gtk_widget_get_first_child (box);
|
||||
text = gtk_file_chooser_widget_get_file_date (self->list_item, self->item);
|
||||
gtk_label_set_text (GTK_LABEL (label), text);
|
||||
g_free (text);
|
||||
label = gtk_widget_get_last_child (box);
|
||||
text = gtk_file_chooser_widget_get_file_time (self->list_item, self->item);
|
||||
gtk_label_set_text (GTK_LABEL (label), text);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_cell_init (GtkFileChooserCell *self)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
GtkDragSource *drag_source;
|
||||
GSettings *settings;
|
||||
|
||||
settings = _gtk_file_chooser_get_settings_for_widget (GTK_WIDGET (self));
|
||||
|
||||
self->type_format = g_settings_get_enum (settings, SETTINGS_KEY_TYPE_FORMAT);
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
@@ -213,8 +165,6 @@ gtk_file_chooser_cell_init (GtkFileChooserCell *self)
|
||||
drag_source = gtk_drag_source_new ();
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source));
|
||||
g_signal_connect (drag_source, "prepare", G_CALLBACK (drag_prepare_cb), self);
|
||||
|
||||
g_signal_connect (self, "realize", G_CALLBACK (gtk_file_chooser_cell_realize), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -247,10 +197,6 @@ gtk_file_chooser_cell_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DATE_COLUMN:
|
||||
self->date_column = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_ITEM:
|
||||
self->item = g_value_get_object (value);
|
||||
|
||||
@@ -261,10 +207,6 @@ gtk_file_chooser_cell_set_property (GObject *object,
|
||||
|
||||
break;
|
||||
|
||||
case PROP_SHOW_TIME:
|
||||
self->show_time = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_LIST_ITEM:
|
||||
self->list_item = g_value_get_object (value);
|
||||
break;
|
||||
@@ -285,18 +227,10 @@ gtk_file_chooser_cell_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DATE_COLUMN:
|
||||
g_value_set_boolean (value, self->date_column);
|
||||
break;
|
||||
|
||||
case PROP_ITEM:
|
||||
g_value_set_object (value, self->item);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_TIME:
|
||||
g_value_set_boolean (value, self->show_time);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -314,22 +248,11 @@ gtk_file_chooser_cell_class_init (GtkFileChooserCellClass *klass)
|
||||
object_class->set_property = gtk_file_chooser_cell_set_property;
|
||||
object_class->get_property = gtk_file_chooser_cell_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_DATE_COLUMN,
|
||||
g_param_spec_boolean ("date-column", NULL, NULL,
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ITEM,
|
||||
g_param_spec_object ("item", NULL, NULL,
|
||||
G_TYPE_FILE_INFO,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SHOW_TIME,
|
||||
g_param_spec_boolean ("show-time", NULL, NULL,
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LIST_ITEM,
|
||||
g_param_spec_object ("list-item", NULL, NULL,
|
||||
GTK_TYPE_LIST_ITEM,
|
||||
|
||||
@@ -31,7 +31,5 @@ G_DECLARE_FINAL_TYPE (GtkFileChooserCell, gtk_file_chooser_cell, GTK, FILE_CHOOS
|
||||
|
||||
GtkFileChooserCell * gtk_file_chooser_cell_new (void);
|
||||
|
||||
guint gtk_file_chooser_cell_get_type_format (GtkFileChooserCell *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkgesturelongpress.h"
|
||||
#include "gtkgrid.h"
|
||||
#include "gtkinscription.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkalertdialog.h"
|
||||
@@ -70,6 +71,7 @@
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtkrevealer.h"
|
||||
#include "gtksignallistitemfactory.h"
|
||||
#include "gtkspinner.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkdebug.h"
|
||||
@@ -505,8 +507,8 @@ static void set_model_filter (GtkFileChooserWidget *impl,
|
||||
static void switch_to_home_dir (GtkFileChooserWidget *impl);
|
||||
static void set_show_hidden (GtkFileChooserWidget *impl,
|
||||
gboolean show_hidden);
|
||||
static char * get_type_information (TypeFormat type_format,
|
||||
GFileInfo *info);
|
||||
static char * get_type_information (GtkFileChooserWidget *impl,
|
||||
GFileInfo *info);
|
||||
static char * my_g_format_date_for_display (GtkFileChooserWidget *impl,
|
||||
glong secs);
|
||||
static char * my_g_format_time_for_display (GtkFileChooserWidget *impl,
|
||||
@@ -1945,21 +1947,15 @@ files_list_restrict_key_presses (GtkEventControllerKey *controller,
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
char *
|
||||
gtk_file_chooser_widget_get_file_date (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
static char *
|
||||
get_file_date (GtkFileChooserWidget *impl,
|
||||
GFileInfo *info)
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
glong time;
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||
if (!impl)
|
||||
return NULL;
|
||||
|
||||
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||
time = (glong) g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
|
||||
else
|
||||
@@ -1981,21 +1977,15 @@ column_view_get_file_display_name (GtkColumnViewCell *cell,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
gtk_file_chooser_widget_get_file_time (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
static char *
|
||||
get_file_time (GtkFileChooserWidget *impl,
|
||||
GFileInfo *info)
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
glong time;
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||
if (!impl)
|
||||
return NULL;
|
||||
|
||||
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||
time = (glong) g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
|
||||
else
|
||||
@@ -2007,23 +1997,6 @@ gtk_file_chooser_widget_get_file_time (GtkColumnViewCell *cell,
|
||||
return my_g_format_time_for_display (impl, time);
|
||||
}
|
||||
|
||||
static char *
|
||||
column_view_get_file_type (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
{
|
||||
GtkFileChooserCell *child;
|
||||
|
||||
if (!info || _gtk_file_info_consider_as_directory (info))
|
||||
return NULL;
|
||||
|
||||
child = GTK_FILE_CHOOSER_CELL (gtk_column_view_cell_get_child (cell));
|
||||
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
||||
return get_type_information (gtk_file_chooser_cell_get_type_format (child), info);
|
||||
}
|
||||
|
||||
static void
|
||||
column_view_row_bind (GtkListItemFactory *factory,
|
||||
GtkColumnViewRow *row,
|
||||
@@ -2097,22 +2070,7 @@ file_chooser_get_location (GtkFileChooserWidget *impl,
|
||||
}
|
||||
|
||||
static char *
|
||||
column_view_get_location (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||
if (!impl)
|
||||
return NULL;
|
||||
|
||||
return file_chooser_get_location (impl, info);
|
||||
}
|
||||
|
||||
static char *
|
||||
column_view_get_size (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
column_view_get_size (GFileInfo *info)
|
||||
{
|
||||
if (info && !_gtk_file_info_consider_as_directory (info))
|
||||
return g_format_size (g_file_info_get_size (info));
|
||||
@@ -2121,8 +2079,8 @@ column_view_get_size (GtkColumnViewCell *cell,
|
||||
}
|
||||
|
||||
static char *
|
||||
column_view_get_tooltip_text (GtkColumnViewCell *cell,
|
||||
GFileInfo *info)
|
||||
column_view_get_tooltip_text (GtkListItem *cell,
|
||||
GFileInfo *info)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
@@ -3284,6 +3242,7 @@ settings_save (GtkFileChooserWidget *impl)
|
||||
g_settings_set_int (settings, SETTINGS_KEY_SIDEBAR_WIDTH,
|
||||
gtk_paned_get_position (GTK_PANED (impl->browse_widgets_hpaned)));
|
||||
g_settings_set_enum (settings, SETTINGS_KEY_DATE_FORMAT, impl->show_time ? DATE_FORMAT_WITH_TIME : DATE_FORMAT_REGULAR);
|
||||
g_settings_set_enum (settings, SETTINGS_KEY_TYPE_FORMAT, impl->type_format);
|
||||
g_settings_set_enum (settings, SETTINGS_KEY_VIEW_TYPE, impl->view_type);
|
||||
|
||||
/* Now apply the settings */
|
||||
@@ -3946,8 +3905,8 @@ get_category_from_content_type (const char *content_type)
|
||||
}
|
||||
|
||||
static char *
|
||||
get_type_information (TypeFormat type_format,
|
||||
GFileInfo *info)
|
||||
get_type_information (GtkFileChooserWidget *impl,
|
||||
GFileInfo *info)
|
||||
{
|
||||
const char *content_type;
|
||||
char *mime_type;
|
||||
@@ -3959,7 +3918,7 @@ get_type_information (TypeFormat type_format,
|
||||
if (!content_type)
|
||||
goto end;
|
||||
|
||||
switch (type_format)
|
||||
switch (impl->type_format)
|
||||
{
|
||||
case TYPE_FORMAT_MIME:
|
||||
mime_type = g_content_type_get_mime_type (content_type);
|
||||
@@ -6808,12 +6767,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_path_bar_size_group);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_path_bar);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_toggle_view_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, column_view_name_column);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, column_view_location_column);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, column_view_size_column);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, column_view_time_column);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, filter_combo_hbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, column_view_type_column);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, filter_combo);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, extra_align);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, extra_and_filters);
|
||||
@@ -6848,9 +6802,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
gtk_widget_class_bind_template_callback (widget_class, rename_file_rename_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, rename_file_end);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_get_file_display_name);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_get_file_type);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_get_location);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_get_size);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_get_tooltip_text);
|
||||
gtk_widget_class_bind_template_callback (widget_class, column_view_row_bind);
|
||||
|
||||
@@ -7082,8 +7033,8 @@ type_sort_func (gconstpointer a,
|
||||
GtkOrdering result;
|
||||
|
||||
/* FIXME: use sortkeys for these */
|
||||
key_a = get_type_information (impl->type_format, (GFileInfo *)a);
|
||||
key_b = get_type_information (impl->type_format, (GFileInfo *)b);
|
||||
key_a = get_type_information (impl, (GFileInfo *)a);
|
||||
key_b = get_type_information (impl, (GFileInfo *)b);
|
||||
|
||||
result = g_strcmp0 (key_a, key_b);
|
||||
|
||||
@@ -7306,6 +7257,170 @@ file_chooser_widget_long_pressed (GtkEventController *controller,
|
||||
popup_menu (widget, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_cell_common (GtkColumnViewCell *column_cell,
|
||||
GtkWidget *child,
|
||||
GFileInfo *info)
|
||||
{
|
||||
char *tooltip;
|
||||
GtkFileChooserCell *cell = gtk_file_chooser_cell_new ();
|
||||
|
||||
g_object_set (cell, "list-item", column_cell, "item", info, NULL);
|
||||
gtk_widget_insert_before (child, GTK_WIDGET (cell), NULL);
|
||||
tooltip = column_view_get_tooltip_text (NULL, info);
|
||||
gtk_widget_set_tooltip_text (child, tooltip);
|
||||
gtk_column_view_cell_set_child (column_cell, GTK_WIDGET (cell));
|
||||
|
||||
g_free (tooltip);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_name_cell (GtkFileChooserWidget *impl,
|
||||
GtkColumnViewCell *column_cell)
|
||||
{
|
||||
GtkFileThumbnail *thumbnail;
|
||||
GtkWidget *box;
|
||||
GtkWidget *inscription;
|
||||
GFileInfo *info = gtk_column_view_cell_get_item (column_cell);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
thumbnail = g_object_new (GTK_TYPE_FILE_THUMBNAIL, NULL);
|
||||
gtk_widget_set_margin_start (GTK_WIDGET (thumbnail), 6);
|
||||
gtk_widget_set_margin_end (GTK_WIDGET (thumbnail), 6);
|
||||
_gtk_file_thumbnail_set_info (thumbnail, info);
|
||||
|
||||
inscription = gtk_inscription_new (g_file_info_get_display_name (info));
|
||||
gtk_widget_set_hexpand (inscription, TRUE);
|
||||
gtk_inscription_set_min_chars (GTK_INSCRIPTION (inscription), 10);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), GTK_WIDGET (thumbnail));
|
||||
gtk_box_append (GTK_BOX (box), inscription);
|
||||
|
||||
bind_cell_common (column_cell, box, info);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
bind_location_cell (GtkFileChooserWidget *impl,
|
||||
GtkColumnViewCell *column_cell)
|
||||
{
|
||||
GtkWidget *inscription;
|
||||
char *text;
|
||||
GFileInfo *info = gtk_column_view_cell_get_item (column_cell);
|
||||
|
||||
text = file_chooser_get_location (impl, info);
|
||||
inscription = gtk_inscription_new (text);
|
||||
gtk_widget_set_hexpand (inscription, TRUE);
|
||||
gtk_inscription_set_xalign (GTK_INSCRIPTION (inscription), 0);
|
||||
gtk_inscription_set_min_chars (GTK_INSCRIPTION (inscription), 10);
|
||||
gtk_widget_set_margin_start (inscription, 6);
|
||||
gtk_widget_set_margin_end (inscription, 6);
|
||||
|
||||
bind_cell_common (column_cell, inscription, info);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_size_cell (GtkFileChooserWidget *impl,
|
||||
GtkColumnViewCell *column_cell)
|
||||
{
|
||||
GtkWidget *label;
|
||||
char *text;
|
||||
GFileInfo *info = gtk_column_view_cell_get_item (column_cell);
|
||||
|
||||
text = column_view_get_size (info);
|
||||
label = gtk_label_new (text);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
bind_cell_common (column_cell, label, info);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_time_cell (GtkFileChooserWidget *impl,
|
||||
GtkColumnViewCell *column_cell)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
char *text;
|
||||
GFileInfo *info = gtk_column_view_cell_get_item (column_cell);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
text = get_file_date (impl, info);
|
||||
label = gtk_label_new (text);
|
||||
g_free (text);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
text = get_file_time (impl, info);
|
||||
label = gtk_label_new (text);
|
||||
g_object_bind_property (impl, "show-time", label, "visible", G_BINDING_SYNC_CREATE);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
bind_cell_common (column_cell, box, info);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_type_cell (GtkFileChooserWidget *impl,
|
||||
GtkColumnViewCell *column_cell)
|
||||
{
|
||||
GtkWidget *label;
|
||||
char *display_name;
|
||||
GFileInfo *info = gtk_column_view_cell_get_item (column_cell);
|
||||
|
||||
if (_gtk_file_info_consider_as_directory (info))
|
||||
display_name = NULL;
|
||||
else
|
||||
display_name = get_type_information (impl, info);
|
||||
|
||||
label = gtk_label_new (display_name);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
bind_cell_common (column_cell, label, info);
|
||||
|
||||
g_free (display_name);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_columns (GtkColumnView *view,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkListItemFactory *factory;
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect_swapped (factory, "bind", G_CALLBACK (bind_name_cell), impl);
|
||||
impl->column_view_name_column = gtk_column_view_column_new (_("Name"), factory);
|
||||
gtk_column_view_column_set_expand (impl->column_view_name_column, TRUE);
|
||||
gtk_column_view_column_set_resizable (impl->column_view_name_column, TRUE);
|
||||
gtk_column_view_append_column (view, impl->column_view_name_column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect_swapped (factory, "bind", G_CALLBACK (bind_location_cell), impl);
|
||||
impl->column_view_location_column = gtk_column_view_column_new (_("Location"), factory);
|
||||
gtk_column_view_column_set_expand (impl->column_view_location_column, TRUE);
|
||||
gtk_column_view_column_set_resizable (impl->column_view_location_column, TRUE);
|
||||
gtk_column_view_column_set_visible (impl->column_view_location_column, FALSE);
|
||||
gtk_column_view_append_column (view, impl->column_view_location_column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect_swapped (factory, "bind", G_CALLBACK (bind_size_cell), impl);
|
||||
impl->column_view_size_column = gtk_column_view_column_new (_("Size"), factory);
|
||||
gtk_column_view_append_column (view, impl->column_view_size_column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect_swapped (factory, "bind", G_CALLBACK (bind_type_cell), impl);
|
||||
impl->column_view_type_column = gtk_column_view_column_new (_("Type"), factory);
|
||||
gtk_column_view_column_set_resizable (impl->column_view_type_column, TRUE);
|
||||
gtk_column_view_append_column (view, impl->column_view_type_column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect_swapped (factory, "bind", G_CALLBACK (bind_time_cell), impl);
|
||||
impl->column_view_time_column = gtk_column_view_column_new (_("Modified"), factory);
|
||||
gtk_column_view_append_column (view, impl->column_view_time_column);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
{
|
||||
@@ -7356,6 +7471,7 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
gtk_sort_list_model_set_model (impl->sort_model, G_LIST_MODEL (impl->filter_model));
|
||||
|
||||
gtk_column_view_set_model (GTK_COLUMN_VIEW (impl->browse_files_column_view), impl->selection_model);
|
||||
setup_columns (GTK_COLUMN_VIEW (impl->browse_files_column_view), impl);
|
||||
|
||||
g_object_set_data (G_OBJECT (impl->column_view_name_column), "column", GINT_TO_POINTER (0));
|
||||
g_object_set_data (G_OBJECT (impl->column_view_size_column), "column", GINT_TO_POINTER (1));
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include "deprecated/gtkfilechooserwidget.h"
|
||||
#include "gtkcolumnviewcell.h"
|
||||
#include "gtkselectionmodel.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -37,14 +36,6 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *chooser);
|
||||
void
|
||||
gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *chooser);
|
||||
|
||||
char *
|
||||
gtk_file_chooser_widget_get_file_date (GtkColumnViewCell *cell,
|
||||
GFileInfo *info);
|
||||
|
||||
char *
|
||||
gtk_file_chooser_widget_get_file_time (GtkColumnViewCell *cell,
|
||||
GFileInfo *info);
|
||||
|
||||
GSList *
|
||||
gtk_file_chooser_widget_get_selected_files (GtkFileChooserWidget *impl);
|
||||
|
||||
|
||||
@@ -176,238 +176,6 @@
|
||||
</property>
|
||||
<signal name="activate" handler="browse_files_view_row_activated_cb" swapped="no"/>
|
||||
<signal name="keynav-failed" handler="browse_files_view_keynav_failed_cb"/>
|
||||
<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="GtkColumnViewCell">
|
||||
<property name="child">
|
||||
<object class="GtkFileChooserCell">
|
||||
<binding name="item">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
<property name="list-item">GtkColumnViewCell</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<binding name="tooltip-text">
|
||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
<child>
|
||||
<object class="GtkFileThumbnail">
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<binding name="file-info">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInscription">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="min-chars">10</property>
|
||||
<binding name="text">
|
||||
<closure type="gchararray" function="column_view_get_file_display_name">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="column_view_location_column">
|
||||
<property name="title" translatable="yes">Location</property>
|
||||
<property name="resizable">1</property>
|
||||
<property name="visible">0</property>
|
||||
<property name="expand">1</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkColumnViewCell">
|
||||
<property name="child">
|
||||
<object class="GtkFileChooserCell">
|
||||
<binding name="item">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
<property name="list-item">GtkColumnViewCell</property>
|
||||
<child>
|
||||
<object class="GtkInscription">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="min-chars">10</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<binding name="text">
|
||||
<closure type="gchararray" function="column_view_get_location">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
<binding name="tooltip-text">
|
||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="column_view_size_column">
|
||||
<property name="title" translatable="yes">Size</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkColumnViewCell">
|
||||
<property name="child">
|
||||
<object class="GtkFileChooserCell">
|
||||
<binding name="item">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
<property name="list-item">GtkColumnViewCell</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<binding name="label">
|
||||
<closure type="gchararray" function="column_view_get_size">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
<binding name="tooltip-text">
|
||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="column_view_type_column">
|
||||
<property name="title" translatable="yes">Type</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="GtkColumnViewCell">
|
||||
<property name="child">
|
||||
<object class="GtkFileChooserCell">
|
||||
<binding name="item">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
<property name="list-item">GtkColumnViewCell</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<binding name="label">
|
||||
<closure type="gchararray" function="column_view_get_file_type">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
<binding name="tooltip-text">
|
||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="column_view_time_column">
|
||||
<property name="title" translatable="yes">Modified</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkColumnViewCell">
|
||||
<property name="child">
|
||||
<object class="GtkFileChooserCell" id="file_chooser_cell">
|
||||
<binding name="item">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</binding>
|
||||
<property name="list-item">GtkColumnViewCell</property>
|
||||
<property name="date-column">true</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">6</property>
|
||||
<binding name="tooltip-text">
|
||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||
<lookup name="item">GtkColumnViewCell</lookup>
|
||||
</closure>
|
||||
</binding>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible" bind-source="file_chooser_cell" bind-property="show-time" bind-flags="sync-create"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]></property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user