Fixed some autostart issues #178

This commit is contained in:
Michael J. Seiferling
2019-03-09 09:20:37 -06:00
parent 7ca0a50411
commit 7fa0c66ca1
4 changed files with 54 additions and 23 deletions
+23 -3
View File
@@ -1186,8 +1186,9 @@ Public Class frmMain
'Verify the "Start with Windows" setting 'Verify the "Start with Windows" setting
If oSettings.StartWithWindows Then If oSettings.StartWithWindows Then
If mgrCommon.IsUnix Then If mgrCommon.IsUnix Then
If Not VerifyAutoStartLinux() Then Dim sVerifyError As String = String.Empty
UpdateLog(frmMain_ErrorLinuxAutoStartMissing, False, ToolTipIcon.Info) If Not VerifyAutoStartLinux(sVerifyError) Then
UpdateLog(sVerifyError, False, ToolTipIcon.Info)
End If End If
Else Else
If Not VerifyStartWithWindows() Then If Not VerifyStartWithWindows() Then
@@ -1746,10 +1747,12 @@ Public Class frmMain
End If End If
End Sub End Sub
Private Function VerifyAutoStartLinux() As Boolean Private Function VerifyAutoStartLinux(ByRef sErrorMessage As String) As Boolean
Dim oProcess As Process Dim oProcess As Process
Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/" Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/"
'Check if the app is still properly installed
If File.Exists("/usr/share/applications/gbm.desktop") Then
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
Return True Return True
Else Else
@@ -1769,6 +1772,23 @@ Public Class frmMain
Catch ex As Exception Catch ex As Exception
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation) mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
End Try End Try
sErrorMessage = frmMain_ErrorLinuxAutoStartMissing
Return False
End If
Else
'If the app is no longer properly installed, disable autostart and the setting.
Try
oSettings.StartWithWindows = False
oSettings.SaveSettings()
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
File.Delete(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop")
End If
Catch ex As Exception
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
End Try
sErrorMessage = frmMain_ErrorLinuxAutoStartLinkMissing
Return False Return False
End If End If
End Function End Function
+1 -2
View File
@@ -357,9 +357,8 @@ Public Class frmSettings
chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck
If mgrCommon.IsUnix Then If mgrCommon.IsUnix Then
'Only enable these options on Linux if GBM was installed with an official method 'Only enable this option on Linux if GBM was installed with an official method
If Not File.Exists("/usr/share/applications/gbm.desktop") Then If Not File.Exists("/usr/share/applications/gbm.desktop") Then
chkStartMinimized.Enabled = False
chkAutoStart.Enabled = False chkAutoStart.Enabled = False
End If End If
End If End If
+10 -1
View File
@@ -3309,6 +3309,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Looks up a localized string similar to GBM is set to start automatically, but the desktop link is missing. Automatic start has been disabled, please re-install GBM using a package manager..
'''</summary>
Friend ReadOnly Property frmMain_ErrorLinuxAutoStartLinkMissing() As String
Get
Return ResourceManager.GetString("frmMain_ErrorLinuxAutoStartLinkMissing", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.. ''' Looks up a localized string similar to GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created..
'''</summary> '''</summary>
@@ -4867,7 +4876,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to An error occured while creating the autostart link:[BR][BR][PARAM]. ''' Looks up a localized string similar to An error occured while configuring autostart:[BR][BR][PARAM].
'''</summary> '''</summary>
Friend ReadOnly Property frmSettings_ErrorLinuxAutoStart() As String Friend ReadOnly Property frmSettings_ErrorLinuxAutoStart() As String
Get Get
+4 -1
View File
@@ -2345,7 +2345,7 @@
<value>GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.</value> <value>GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.</value>
</data> </data>
<data name="frmSettings_ErrorLinuxAutoStart" xml:space="preserve"> <data name="frmSettings_ErrorLinuxAutoStart" xml:space="preserve">
<value>An error occured while creating the autostart link:[BR][BR][PARAM]</value> <value>An error occured while configuring autostart:[BR][BR][PARAM]</value>
</data> </data>
<data name="mgrBackup_ErrorRegBackupElevation" xml:space="preserve"> <data name="mgrBackup_ErrorRegBackupElevation" xml:space="preserve">
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to perform this backup.</value> <value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to perform this backup.</value>
@@ -2368,4 +2368,7 @@
<data name="mgrRestore_ErrorRegBackupElevation" xml:space="preserve"> <data name="mgrRestore_ErrorRegBackupElevation" xml:space="preserve">
<value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to restore this backup.</value> <value>[PARAM] stores saved games in the Windows registry, accessing the registry requires elevated permissions. Please restart GBM as Administrator to restore this backup.</value>
</data> </data>
<data name="frmMain_ErrorLinuxAutoStartLinkMissing" xml:space="preserve">
<value>GBM is set to start automatically, but the desktop link is missing. Automatic start has been disabled, please re-install GBM using a package manager.</value>
</data>
</root> </root>