[GB.DESKTOP]

* BUG: Load generic icons even in fast mode


git-svn-id: svn://localhost/gambas/trunk@5278 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Fabien Bodard 2012-11-01 22:22:44 +00:00
parent 3223450699
commit 5f455082e2
5 changed files with 88 additions and 53 deletions

View file

@ -135,30 +135,58 @@ Image
#DesktopMime
C
Weight
_$iWeight
v
i
Type
_$sType
v
s
Pattern
_$sPattern
v
s
Magic
_$aMagic
v
String[]
GenericIcon
_$sGenericIcon
v
s
IsSuffix
_$bIsSuffix
v
b
PreciseSearch
P
b
Weight
r
i
Type
r
s
Pattern
r
s
Magic
r
String[]
GenericIcon
r
s
IsSuffix
r
b
_compare
m
i

View file

@ -1,11 +1,12 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.3.90
Title=Desktop-neutral routines from Portland project
Startup=Main
Startup=Form11
Version=3.3.90
VersionFile=1
Component=gb.image
Component=gb.qt4
Component=gb.form
Component=gb.desktop
TabSize=2
Type=Component

View file

@ -7,12 +7,18 @@ Count=0
[DebugWindow/$cAtom]
Geometry=[0,0,260,210]
[DebugWindow/TypeToMInfo]
Geometry=[-2,-3,210,210]
[DebugWindow/_Desktop.GetWindowProperty("_NET_CURRENT_DESKTOP", _Desktop.RootWindow)]
Geometry=[-6,0,210,210]
[DebugWindow/_Desktop.GetWindowProperty(Atom["_NET_WM_STATE"], $iId)]
Geometry=[0,0,429,210]
[DebugWindow/hImage]
Geometry=[-2,-3,210,210]
[FCommit]
LastCommit="[GB.DESKTOP]\n* NEW: Desktop.Open() interprets \"~\" as the home directory."
@ -24,16 +30,20 @@ SearchComment=False
SearchString=True
[OpenFile]
File[1]=".src/Desktop.class:324.46"
File[1]=".src/Desktop.class:267.0"
File[2]=".src/DesktopWindow.class:280.2"
File[3]=".src/Main.module:0.0"
File[3]=".src/Main.module:143.0"
File[4]=".src/DesktopFile.class:276.2"
Active=5
File[5]=".src/DesktopMime.class:285.32"
Count=5
File[5]=".src/DesktopMime.class:66.20"
File[6]=".src/Tests/Form11.form"
File[7]=".src/Tests/Module1.module:5.16"
File[8]=".src/Tests/Form11.class:6.17"
Count=8
[Watches]
Count=0
Count=1
Watch[1]="CStr(Size) &/ \"mimetypes/\" & sMime"
[YWindows]
Count=0

View file

@ -4,7 +4,6 @@ Export
Class Stock
Static Private $aMimesSuffix As New DesktopMime[] ''Normal pattern for extentions
Static Private $aMimesPrefix As New DesktopMime[] ''Pattern for prefix
Static Private $aMimesSpecial As New DesktopMime[] ''Special Pattern
@ -45,7 +44,6 @@ End
'
' End
Public Sub GetIcon(Optional Size As Integer = 16) As Image
Dim sPath As String
@ -85,8 +83,6 @@ Public Function GetApplications() As DesktopFile[]
End
'****************** Static Functions ****************
Static Private Sub LoadMimeDatabase()
@ -156,21 +152,22 @@ Static Private Sub LoadMimeDatabase()
' Next
Close #hfile
If $bPreciseSearch Then
'Chargement du fichier Magic
If Exist(sPath &/ "mime/magic") Then
hFile = Open sPath &/ "mime/magic" For Read
While Not Eof(hFile)
Line Input #hFile, s
If s Begins "[" Then
Try hMInfo = TypeToMInfo[Split(Mid(s, 2, Len(s) - 2), ":")[1]]
Continue
Endif
If IsNull(hMInfo) Then Continue
hMInfo._$aMagic.Add(s)
Wend
Close #hfile
If $bPreciseSearch Then
'Chargement du fichier Magic
If Exist(sPath &/ "mime/magic") Then
hFile = Open sPath &/ "mime/magic" For Read
While Not Eof(hFile)
Line Input #hFile, s
If s Begins "[" Then
Try hMInfo = TypeToMInfo[Split(Mid(s, 2, Len(s) - 2), ":")[1]]
Continue
Endif
If IsNull(hMInfo) Then Continue
hMInfo._$aMagic.Add(s)
Wend
Close #hfile
Endif
Endif
'Chargement des Icones Génériques
@ -180,20 +177,19 @@ If $bPreciseSearch Then
While Not Eof(hFile)
Line Input #hFile, s
ars = Split(s, ":")
Try TypeToMInfo[ars[0]].GenericIcon = ars[1]
Try TypeToMInfo[ars[0]]._$sGenericIcon = ars[1]
Wend
Close #hfile
Endif
Endif
Next
If $aMimesSuffix.Count = 0 Then
Error "Warning: Mime Database not found."
Endif
Catch
Refresh
Error "Warning: Error on reading mime database"
Refresh
Error "Warning: Error on reading mime database"
End
Static Private Function FindByExt(sFile As String) As DesktopMime[]
@ -359,49 +355,49 @@ Static Public Sub Exist(Type As String) As Boolean
End
Private Function Weight_Read() As Integer
Return _$iWeight
End
Private Function Type_Read() As String
Return _$sType
End
Private Function Pattern_Read() As String
Return _$sPattern
End
Private Function Magic_Read() As String[]
Return _$aMagic
End
Private Function GenericIcon_Read() As String
Return _$sGenericIcon
End
Private Function IsSuffix_Read() As Boolean
Return _$bIsSuffix
End
Static Private Function PreciseSearch_Read() As Boolean
Return $bPreciseSearch
End
Static Private Sub PreciseSearch_Write(Value As Boolean)
$bPreciseSearch = Value
End

View file

@ -6,7 +6,7 @@ Public Sub Form_Open()
Dim s As String
'Dim hDesktop As New DesktopFile
Dim sPath As String = User.home
Dim sPath As String = User.home &/ "Documents/SCEA"
Dim hFilemime As DesktopMime
Dim sKey As String
'ColumnView1.Columns.Count = 2