mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
filechooserwidget: Finish port to GtkColumnViewCell
Some missing updates from f5dea9a3c2
This commit is contained in:
parent
d00b78d283
commit
ccae75022b
@ -23,22 +23,21 @@
|
|||||||
|
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkbinlayout.h"
|
#include "gtkbinlayout.h"
|
||||||
|
#include "gtkcolumnviewcell.h"
|
||||||
#include "gtkdragsource.h"
|
#include "gtkdragsource.h"
|
||||||
#include "gtkgestureclick.h"
|
#include "gtkgestureclick.h"
|
||||||
#include "gtkgesturelongpress.h"
|
#include "gtkgesturelongpress.h"
|
||||||
#include "gtkicontheme.h"
|
#include "gtkicontheme.h"
|
||||||
#include "gtklistitem.h"
|
|
||||||
#include "gtkselectionmodel.h"
|
#include "gtkselectionmodel.h"
|
||||||
#include "gtkfilechooserutils.h"
|
#include "gtkfilechooserutils.h"
|
||||||
#include "gtkfilechooserwidgetprivate.h"
|
#include "gtkfilechooserwidgetprivate.h"
|
||||||
#include "gtklistitem.h"
|
|
||||||
|
|
||||||
struct _GtkFileChooserCell
|
struct _GtkFileChooserCell
|
||||||
{
|
{
|
||||||
GtkWidget parent_instance;
|
GtkWidget parent_instance;
|
||||||
|
|
||||||
GFileInfo *item;
|
GFileInfo *item;
|
||||||
GtkListItem *list_item;
|
GtkColumnViewCell *list_item;
|
||||||
|
|
||||||
gboolean show_time;
|
gboolean show_time;
|
||||||
};
|
};
|
||||||
@ -79,7 +78,7 @@ popup_menu (GtkFileChooserCell *self,
|
|||||||
|
|
||||||
if (self->list_item)
|
if (self->list_item)
|
||||||
gtk_widget_activate_action (widget, "item.popup-file-list-menu",
|
gtk_widget_activate_action (widget, "item.popup-file-list-menu",
|
||||||
"(udd)", gtk_list_item_get_position (self->list_item), p.x, p.y);
|
"(udd)", gtk_column_view_cell_get_position (self->list_item), p.x, p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -125,7 +124,7 @@ drag_prepare_cb (GtkDragSource *source,
|
|||||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (GTK_WIDGET (self),
|
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (GTK_WIDGET (self),
|
||||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||||
|
|
||||||
if (self->list_item && !gtk_list_item_get_selected (self->list_item))
|
if (self->list_item && !gtk_column_view_cell_get_selected (self->list_item))
|
||||||
{
|
{
|
||||||
gtk_widget_activate_action (GTK_WIDGET (self), "listitem.select", "(bb)", FALSE, FALSE);
|
gtk_widget_activate_action (GTK_WIDGET (self), "listitem.select", "(bb)", FALSE, FALSE);
|
||||||
}
|
}
|
||||||
@ -205,13 +204,6 @@ get_selectable (GtkFileChooserCell *self)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
update_list_item (GtkFileChooserCell *self)
|
|
||||||
{
|
|
||||||
if (self->list_item)
|
|
||||||
gtk_list_item_set_selectable (self->list_item, get_selectable (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_chooser_cell_set_property (GObject *object,
|
gtk_file_chooser_cell_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -230,7 +222,6 @@ gtk_file_chooser_cell_set_property (GObject *object,
|
|||||||
else
|
else
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (self), "dim-label");
|
gtk_widget_add_css_class (GTK_WIDGET (self), "dim-label");
|
||||||
|
|
||||||
update_list_item (self);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SHOW_TIME:
|
case PROP_SHOW_TIME:
|
||||||
@ -239,8 +230,6 @@ gtk_file_chooser_cell_set_property (GObject *object,
|
|||||||
|
|
||||||
case PROP_LIST_ITEM:
|
case PROP_LIST_ITEM:
|
||||||
self->list_item = g_value_get_object (value);
|
self->list_item = g_value_get_object (value);
|
||||||
|
|
||||||
update_list_item (self);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtkdropdown.h"
|
#include "gtkdropdown.h"
|
||||||
#include "gtkcolumnview.h"
|
#include "gtkcolumnview.h"
|
||||||
|
#include "gtkcolumnviewcell.h"
|
||||||
#include "gtkcolumnviewcolumn.h"
|
#include "gtkcolumnviewcolumn.h"
|
||||||
#include "gtkcolumnviewrow.h"
|
#include "gtkcolumnviewrow.h"
|
||||||
#include "gtkcssnumbervalueprivate.h"
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
@ -44,7 +45,6 @@
|
|||||||
#include "gtkgesturelongpress.h"
|
#include "gtkgesturelongpress.h"
|
||||||
#include "gtkgrid.h"
|
#include "gtkgrid.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtklistitem.h"
|
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkalertdialog.h"
|
#include "gtkalertdialog.h"
|
||||||
#include "gtkmountoperation.h"
|
#include "gtkmountoperation.h"
|
||||||
@ -1946,8 +1946,8 @@ files_list_restrict_key_presses (GtkEventControllerKey *controller,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_file_date (GtkListItem *item,
|
column_view_get_file_date (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
GtkFileChooserWidget *impl;
|
GtkFileChooserWidget *impl;
|
||||||
glong time;
|
glong time;
|
||||||
@ -1955,7 +1955,7 @@ column_view_get_file_date (GtkListItem *item,
|
|||||||
if (!info)
|
if (!info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_list_item_get_child (item),
|
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||||
if (!impl)
|
if (!impl)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1972,8 +1972,8 @@ column_view_get_file_date (GtkListItem *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_file_display_name (GtkListItem *item,
|
column_view_get_file_display_name (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
if (info)
|
if (info)
|
||||||
return g_strdup (g_file_info_get_display_name (info));
|
return g_strdup (g_file_info_get_display_name (info));
|
||||||
@ -1982,8 +1982,8 @@ column_view_get_file_display_name (GtkListItem *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_file_time (GtkListItem *item,
|
column_view_get_file_time (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
GtkFileChooserWidget *impl;
|
GtkFileChooserWidget *impl;
|
||||||
glong time;
|
glong time;
|
||||||
@ -1991,7 +1991,7 @@ column_view_get_file_time (GtkListItem *item,
|
|||||||
if (!info)
|
if (!info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_list_item_get_child (item),
|
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||||
if (!impl)
|
if (!impl)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2008,8 +2008,8 @@ column_view_get_file_time (GtkListItem *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_file_type (GtkListItem *item,
|
column_view_get_file_type (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
GtkFileChooserWidget *impl;
|
GtkFileChooserWidget *impl;
|
||||||
|
|
||||||
@ -2097,12 +2097,12 @@ file_chooser_get_location (GtkFileChooserWidget *impl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_location (GtkListItem *list_item,
|
column_view_get_location (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
GtkFileChooserWidget *impl;
|
GtkFileChooserWidget *impl;
|
||||||
|
|
||||||
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_list_item_get_child (list_item),
|
impl = GTK_FILE_CHOOSER_WIDGET (gtk_widget_get_ancestor (gtk_column_view_cell_get_child (cell),
|
||||||
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
GTK_TYPE_FILE_CHOOSER_WIDGET));
|
||||||
if (!impl)
|
if (!impl)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2111,8 +2111,8 @@ column_view_get_location (GtkListItem *list_item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_size (GtkListItem *item,
|
column_view_get_size (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
if (info && !_gtk_file_info_consider_as_directory (info))
|
if (info && !_gtk_file_info_consider_as_directory (info))
|
||||||
return g_format_size (g_file_info_get_size (info));
|
return g_format_size (g_file_info_get_size (info));
|
||||||
@ -2121,8 +2121,8 @@ column_view_get_size (GtkListItem *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
column_view_get_tooltip_text (GtkListItem *list_item,
|
column_view_get_tooltip_text (GtkColumnViewCell *cell,
|
||||||
GFileInfo *info)
|
GFileInfo *info)
|
||||||
{
|
{
|
||||||
GFile *file;
|
GFile *file;
|
||||||
|
|
||||||
|
@ -330,25 +330,25 @@
|
|||||||
<property name="bytes"><![CDATA[
|
<property name="bytes"><![CDATA[
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<template class="GtkListItem">
|
<template class="GtkColumnViewCell">
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkFileChooserCell">
|
<object class="GtkFileChooserCell">
|
||||||
<binding name="item">
|
<binding name="item">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
<property name="list-item">GtkListItem</property>
|
<property name="list-item">GtkColumnViewCell</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<binding name="label">
|
<binding name="label">
|
||||||
<closure type="gchararray" function="column_view_get_file_type">
|
<closure type="gchararray" function="column_view_get_file_type">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</closure>
|
</closure>
|
||||||
</binding>
|
</binding>
|
||||||
<binding name="tooltip-text">
|
<binding name="tooltip-text">
|
||||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</closure>
|
</closure>
|
||||||
</binding>
|
</binding>
|
||||||
</object>
|
</object>
|
||||||
@ -680,19 +680,19 @@
|
|||||||
<property name="bytes"><![CDATA[
|
<property name="bytes"><![CDATA[
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<template class="GtkListItem">
|
<template class="GtkColumnViewCell">
|
||||||
<property name="child">
|
<property name="child">
|
||||||
<object class="GtkFileChooserCell">
|
<object class="GtkFileChooserCell">
|
||||||
<binding name="item">
|
<binding name="item">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
<property name="list-item">GtkListItem</property>
|
<property name="list-item">GtkColumnViewCell</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<binding name="tooltip-text">
|
<binding name="tooltip-text">
|
||||||
<closure type="gchararray" function="column_view_get_tooltip_text">
|
<closure type="gchararray" function="column_view_get_tooltip_text">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</closure>
|
</closure>
|
||||||
</binding>
|
</binding>
|
||||||
<child>
|
<child>
|
||||||
@ -701,7 +701,7 @@
|
|||||||
<property name="margin-start">6</property>
|
<property name="margin-start">6</property>
|
||||||
<property name="margin-end">6</property>
|
<property name="margin-end">6</property>
|
||||||
<binding name="file-info">
|
<binding name="file-info">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@ -717,7 +717,7 @@
|
|||||||
</attributes>
|
</attributes>
|
||||||
<binding name="label">
|
<binding name="label">
|
||||||
<closure type="gchararray" function="column_view_get_file_display_name">
|
<closure type="gchararray" function="column_view_get_file_display_name">
|
||||||
<lookup name="item">GtkListItem</lookup>
|
<lookup name="item">GtkColumnViewCell</lookup>
|
||||||
</closure>
|
</closure>
|
||||||
</binding>
|
</binding>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user