Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Desktop directory to file dialogs #4632

Merged
merged 3 commits into from May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions dialog/file.go
Expand Up @@ -860,6 +860,7 @@ func getFavoriteIcons() map[string]fyne.Resource {
if runtime.GOOS == "darwin" {
return map[string]fyne.Resource{
"Documents": theme.DocumentIcon(),
"Desktop": theme.DesktopIcon(),
"Downloads": theme.DownloadIcon(),
"Music": theme.MediaMusicIcon(),
"Pictures": theme.MediaPhotoIcon(),
Expand All @@ -869,6 +870,7 @@ func getFavoriteIcons() map[string]fyne.Resource {

return map[string]fyne.Resource{
"Documents": theme.DocumentIcon(),
"Desktop": theme.DesktopIcon(),
"Downloads": theme.DownloadIcon(),
"Music": theme.MediaMusicIcon(),
"Pictures": theme.MediaPhotoIcon(),
Expand All @@ -878,6 +880,7 @@ func getFavoriteIcons() map[string]fyne.Resource {

func getFavoriteOrder() []string {
order := []string{
"Desktop",
"Documents",
"Downloads",
"Music",
Expand Down
1 change: 1 addition & 0 deletions dialog/file_xdg.go
Expand Up @@ -45,6 +45,7 @@ func getFavoriteLocations() (map[string]fyne.ListableURI, error) {

favoriteNames := getFavoriteOrder()
arguments := map[string]string{
"Desktop": "DESKTOP",
"Documents": "DOCUMENTS",
"Downloads": "DOWNLOAD",
"Music": "MUSIC",
Expand Down
1 change: 1 addition & 0 deletions test/markup_renderer.go
Expand Up @@ -437,6 +437,7 @@ func knownResource(rsc fyne.Resource) string {
theme.ContentRemoveIcon(): "contentRemoveIcon",
theme.ContentUndoIcon(): "contentUndoIcon",
theme.DeleteIcon(): "deleteIcon",
theme.DesktopIcon(): "desktopIcon",
theme.DocumentCreateIcon(): "documentCreateIcon",
theme.DocumentIcon(): "documentIcon",
theme.DocumentPrintIcon(): "documentPrintIcon",
Expand Down
5 changes: 5 additions & 0 deletions theme/bundled-icons.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions theme/gen.go
Expand Up @@ -187,6 +187,7 @@ func main() {

bundleIcon("download", f)
bundleIcon("computer", f)
bundleIcon("desktop", f)
bundleIcon("storage", f)
bundleIcon("upload", f)

Expand Down
11 changes: 11 additions & 0 deletions theme/icons.go
Expand Up @@ -446,6 +446,11 @@ const (
// Since: 2.0
IconNameComputer fyne.ThemeIconName = "computer"

// IconNameDesktop is the name of theme lookup for desktop icon.
//
// Since: 2.5
IconNameDesktop fyne.ThemeIconName = "desktop"

// IconNameAccount is the name of theme lookup for account icon.
//
// Since: 2.1
Expand Down Expand Up @@ -590,6 +595,7 @@ var (

IconNameDownload: NewThemedResource(downloadIconRes),
IconNameComputer: NewThemedResource(computerIconRes),
IconNameDesktop: NewThemedResource(desktopIconRes),
IconNameStorage: NewThemedResource(storageIconRes),
IconNameUpload: NewThemedResource(uploadIconRes),

Expand Down Expand Up @@ -1254,6 +1260,11 @@ func ComputerIcon() fyne.Resource {
return safeIconLookup(IconNameComputer)
}

// DesktopIcon returns a resource containing the standard desktop icon for the current theme
func DesktopIcon() fyne.Resource {
return safeIconLookup(IconNameDesktop)
}

// DownloadIcon returns a resource containing the standard download icon for the current theme
func DownloadIcon() fyne.Resource {
return safeIconLookup(IconNameDownload)
Expand Down
1 change: 1 addition & 0 deletions theme/icons/desktop.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.