gtkfilechooser: dim cut file icons
This commit is contained in:
parent
073b38a0f5
commit
badfe1295a
1 changed files with 48 additions and 0 deletions
|
|
@ -5081,6 +5081,48 @@ file_clipboard_cut_files_clear (GtkFileChooserDefault *impl)
|
|||
file_clipboard_queue_draw_current_view (impl);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
file_clipboard_file_is_cut (GtkFileChooserDefault *impl,
|
||||
GFile *file)
|
||||
{
|
||||
return (impl->file_clipboard_cut_files &&
|
||||
file &&
|
||||
g_hash_table_lookup (impl->file_clipboard_cut_files, file) != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
file_clipboard_icon_cell_data_func (GtkCellLayout *cell_layout,
|
||||
GtkCellRenderer *renderer,
|
||||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkFileChooserDefault *impl = data;
|
||||
GFile *file = NULL;
|
||||
gboolean is_sensitive = TRUE;
|
||||
gboolean is_cut;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
MODEL_COL_FILE, &file,
|
||||
MODEL_COL_IS_SENSITIVE, &is_sensitive,
|
||||
-1);
|
||||
|
||||
is_cut = file_clipboard_file_is_cut (impl, file);
|
||||
|
||||
/*
|
||||
* Match common file-manager feedback for cut files: dim only the icon.
|
||||
* The row remains selectable and activatable; text, size and mtime stay
|
||||
* normally readable. Hidden-file dimming can be added here later as a
|
||||
* separate visual state.
|
||||
*/
|
||||
g_object_set (renderer,
|
||||
"sensitive", is_sensitive && !is_cut,
|
||||
NULL);
|
||||
|
||||
if (file)
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
file_clipboard_data_free (struct file_clipboard_data *data)
|
||||
{
|
||||
|
|
@ -8101,6 +8143,7 @@ create_browse_files_icon_view (GtkFileChooserDefault *impl)
|
|||
impl->list_icon_renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
g_object_set (G_OBJECT (impl->list_icon_renderer),
|
||||
"ypad", 3u,
|
||||
"follow-state", TRUE,
|
||||
NULL);
|
||||
|
||||
set_icon_cell_renderer_fixed_size (impl, GTK_CELL_RENDERER (impl->list_icon_renderer),
|
||||
|
|
@ -8118,6 +8161,11 @@ create_browse_files_icon_view (GtkFileChooserDefault *impl)
|
|||
"wrap-mode", PANGO_WRAP_WORD_CHAR,
|
||||
"yalign", 0.0f,
|
||||
NULL);
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (impl->browse_files_icon_view),
|
||||
impl->list_icon_renderer,
|
||||
file_clipboard_icon_cell_data_func,
|
||||
impl,
|
||||
NULL);
|
||||
update_icon_view_cell_layout (impl);
|
||||
|
||||
g_signal_connect (impl->list_name_renderer, "edited",
|
||||
|
|
|
|||
Loading…
Reference in a new issue