image_viewer: Fix image view tab icon lost (#17063)
Closes #16989 Release Notes: - N/A
This commit is contained in:
parent
64fa7a5234
commit
804d1997f2
2 changed files with 13 additions and 1 deletions
|
@ -16,6 +16,8 @@ doctest = false
|
|||
anyhow.workspace = true
|
||||
db.workspace = true
|
||||
gpui.workspace = true
|
||||
file_icons.workspace = true
|
||||
ui.workspace = true
|
||||
settings.workspace = true
|
||||
workspace.workspace = true
|
||||
project.workspace = true
|
||||
|
|
|
@ -7,11 +7,13 @@ use gpui::{
|
|||
use persistence::IMAGE_VIEWER;
|
||||
use ui::prelude::*;
|
||||
|
||||
use file_icons::FileIcons;
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
use settings::Settings;
|
||||
use std::{ffi::OsStr, path::PathBuf};
|
||||
use workspace::{
|
||||
item::{Item, ProjectItem, SerializableItem, TabContentParams},
|
||||
ItemId, Pane, Workspace, WorkspaceId,
|
||||
ItemId, ItemSettings, Pane, Workspace, WorkspaceId,
|
||||
};
|
||||
|
||||
const IMAGE_VIEWER_KIND: &str = "ImageView";
|
||||
|
@ -85,6 +87,14 @@ impl Item for ImageView {
|
|||
.into_any_element()
|
||||
}
|
||||
|
||||
fn tab_icon(&self, cx: &WindowContext) -> Option<Icon> {
|
||||
ItemSettings::get_global(cx)
|
||||
.file_icons
|
||||
.then(|| FileIcons::get_icon(self.path.as_path(), cx))
|
||||
.flatten()
|
||||
.map(|icon| Icon::from_path(icon))
|
||||
}
|
||||
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
_workspace_id: Option<WorkspaceId>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue