Resolves #178
This commit is contained in:
+45
-1
@@ -53,6 +53,7 @@ Public Class frmMain
|
|||||||
WithEvents tmScanTimer As New Timer
|
WithEvents tmScanTimer As New Timer
|
||||||
WithEvents tmRestoreCheck As New System.Timers.Timer
|
WithEvents tmRestoreCheck As New System.Timers.Timer
|
||||||
WithEvents tmFileWatcherQueue As New System.Timers.Timer
|
WithEvents tmFileWatcherQueue As New System.Timers.Timer
|
||||||
|
WithEvents tmMinimizeTimer As New System.Timers.Timer
|
||||||
|
|
||||||
Public WithEvents oProcess As New mgrProcessDetection
|
Public WithEvents oProcess As New mgrProcessDetection
|
||||||
Public WithEvents oBackup As New mgrBackup
|
Public WithEvents oBackup As New mgrBackup
|
||||||
@@ -1180,10 +1181,16 @@ 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 Not VerifyAutoStartLinux() Then
|
||||||
|
UpdateLog(frmMain_ErrorLinuxAutoStartMissing, False, ToolTipIcon.Info)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
If Not VerifyStartWithWindows() Then
|
If Not VerifyStartWithWindows() Then
|
||||||
UpdateLog(frmMain_ErrorAppLocationChanged, False, ToolTipIcon.Info)
|
UpdateLog(frmMain_ErrorAppLocationChanged, False, ToolTipIcon.Info)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'Check for any custom 7z utility and display a warning if it's missing
|
'Check for any custom 7z utility and display a warning if it's missing
|
||||||
If oSettings.Custom7zLocation <> String.Empty Then
|
If oSettings.Custom7zLocation <> String.Empty Then
|
||||||
@@ -1735,6 +1742,33 @@ Public Class frmMain
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function VerifyAutoStartLinux() As Boolean
|
||||||
|
Dim oProcess As Process
|
||||||
|
Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/"
|
||||||
|
|
||||||
|
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
'Create the autostart folder if it doesn't exist yet
|
||||||
|
If Not Directory.Exists(sAutoStartFolder) Then
|
||||||
|
Directory.CreateDirectory(sAutoStartFolder)
|
||||||
|
End If
|
||||||
|
'Create link
|
||||||
|
Try
|
||||||
|
oProcess = New Process
|
||||||
|
oProcess.StartInfo.FileName = "/bin/ln"
|
||||||
|
oProcess.StartInfo.Arguments = "-s /usr/share/applications/gbm.desktop " & sAutoStartFolder
|
||||||
|
oProcess.StartInfo.UseShellExecute = False
|
||||||
|
oProcess.StartInfo.RedirectStandardOutput = True
|
||||||
|
oProcess.StartInfo.CreateNoWindow = True
|
||||||
|
oProcess.Start()
|
||||||
|
Catch ex As Exception
|
||||||
|
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
|
||||||
|
End Try
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function VerifyStartWithWindows() As Boolean
|
Private Function VerifyStartWithWindows() As Boolean
|
||||||
Dim oKey As Microsoft.Win32.RegistryKey
|
Dim oKey As Microsoft.Win32.RegistryKey
|
||||||
Dim sAppName As String = Application.ProductName
|
Dim sAppName As String = Application.ProductName
|
||||||
@@ -1944,6 +1978,10 @@ Public Class frmMain
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub HandleMinimizeTimer() Handles tmMinimizeTimer.Elapsed
|
||||||
|
Me.WindowState = FormWindowState.Minimized
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Elapsed
|
Private Sub AutoRestoreEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmRestoreCheck.Elapsed
|
||||||
If eCurrentStatus <> eStatus.Paused Then
|
If eCurrentStatus <> eStatus.Paused Then
|
||||||
AutoRestoreCheck()
|
AutoRestoreCheck()
|
||||||
@@ -2133,12 +2171,18 @@ Public Class frmMain
|
|||||||
'Unix Handler
|
'Unix Handler
|
||||||
If mgrCommon.IsUnix Then
|
If mgrCommon.IsUnix Then
|
||||||
Me.MinimizeBox = True
|
Me.MinimizeBox = True
|
||||||
|
If oSettings.StartToTray Then
|
||||||
|
'Window Managers and/or Mono will not trigger a minimize in the Load or Shown event. We need to delay it.
|
||||||
|
tmMinimizeTimer.AutoReset = False
|
||||||
|
tmMinimizeTimer.Interval = 1000
|
||||||
|
tmMinimizeTimer.Start()
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Me.gMonTray.Visible = True
|
Me.gMonTray.Visible = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
If mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
|
If mgrCommon.ShowMessage(frmMain_ErrorInitFailure, ex.Message & vbCrLf & ex.StackTrace, MsgBoxStyle.YesNo) = MsgBoxResult.No Then
|
||||||
bInitFail = True
|
bInitFail = True
|
||||||
End If
|
End If
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
@@ -16,6 +16,35 @@ Public Class frmSettings
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Sub HandleLinuxAutoStart(ByVal bToggle As Boolean)
|
||||||
|
Dim oProcess As Process
|
||||||
|
Dim sAutoStartFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) & Path.DirectorySeparatorChar & ".config/autostart/"
|
||||||
|
|
||||||
|
If bToggle Then
|
||||||
|
'Create the autostart folder if it doesn't exist yet
|
||||||
|
If Not Directory.Exists(sAutoStartFolder) Then
|
||||||
|
Directory.CreateDirectory(sAutoStartFolder)
|
||||||
|
End If
|
||||||
|
'Create link
|
||||||
|
Try
|
||||||
|
oProcess = New Process
|
||||||
|
oProcess.StartInfo.FileName = "/bin/ln"
|
||||||
|
oProcess.StartInfo.Arguments = "-s /usr/share/applications/gbm.desktop " & sAutoStartFolder
|
||||||
|
oProcess.StartInfo.UseShellExecute = False
|
||||||
|
oProcess.StartInfo.RedirectStandardOutput = True
|
||||||
|
oProcess.StartInfo.CreateNoWindow = True
|
||||||
|
oProcess.Start()
|
||||||
|
Catch ex As Exception
|
||||||
|
mgrCommon.ShowMessage(frmSettings_ErrorLinuxAutoStart, ex.Message, MsgBoxStyle.Exclamation)
|
||||||
|
End Try
|
||||||
|
Else
|
||||||
|
'Delete link
|
||||||
|
If File.Exists(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop") Then
|
||||||
|
File.Delete(sAutoStartFolder & Path.DirectorySeparatorChar & "gbm.desktop")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub HandleRegistryUpdate(ByVal bToggle As Boolean)
|
Private Sub HandleRegistryUpdate(ByVal bToggle As Boolean)
|
||||||
Dim oKey As Microsoft.Win32.RegistryKey
|
Dim oKey As Microsoft.Win32.RegistryKey
|
||||||
Dim sAppName As String = Application.ProductName
|
Dim sAppName As String = Application.ProductName
|
||||||
@@ -35,14 +64,18 @@ Public Class frmSettings
|
|||||||
Private Function ValidateSettings() As Boolean
|
Private Function ValidateSettings() As Boolean
|
||||||
|
|
||||||
'Show Start with Windows warning if running as admin
|
'Show Start with Windows warning if running as admin
|
||||||
If chkAutoStart.Checked And mgrCommon.IsElevated Then
|
If Not mgrCommon.IsUnix And chkAutoStart.Checked And mgrCommon.IsElevated Then
|
||||||
mgrCommon.ShowMessage(frmSettings_WarningAdminStart, MsgBoxStyle.Exclamation)
|
mgrCommon.ShowMessage(frmSettings_WarningAdminStart, MsgBoxStyle.Exclamation)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Only modify registry key when the value changed
|
'Only modify when the value changed
|
||||||
If chkAutoStart.Checked <> oSettings.StartWithWindows Then
|
If chkAutoStart.Checked <> oSettings.StartWithWindows Then
|
||||||
|
If mgrCommon.IsUnix Then
|
||||||
|
HandleLinuxAutoStart(chkAutoStart.Checked)
|
||||||
|
Else
|
||||||
HandleRegistryUpdate(chkAutoStart.Checked)
|
HandleRegistryUpdate(chkAutoStart.Checked)
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
oSettings.StartWithWindows = chkAutoStart.Checked
|
oSettings.StartWithWindows = chkAutoStart.Checked
|
||||||
|
|
||||||
oSettings.MonitorOnStartup = chkMonitorOnStartup.Checked
|
oSettings.MonitorOnStartup = chkMonitorOnStartup.Checked
|
||||||
@@ -201,12 +234,6 @@ Public Class frmSettings
|
|||||||
txt7zLocation.Text = oSettings.Custom7zLocation
|
txt7zLocation.Text = oSettings.Custom7zLocation
|
||||||
eCurrentSyncFields = oSettings.SyncFields
|
eCurrentSyncFields = oSettings.SyncFields
|
||||||
|
|
||||||
'Unix Handler
|
|
||||||
If mgrCommon.IsUnix Then
|
|
||||||
chkStartMinimized.Checked = False
|
|
||||||
chkAutoStart.Checked = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
'Retrieve 7z Info
|
'Retrieve 7z Info
|
||||||
GetUtilityInfo(oSettings.Custom7zLocation)
|
GetUtilityInfo(oSettings.Custom7zLocation)
|
||||||
|
|
||||||
@@ -329,11 +356,13 @@ Public Class frmSettings
|
|||||||
chkShowResolvedPaths.Text = frmSettings_chkShowResolvedPaths
|
chkShowResolvedPaths.Text = frmSettings_chkShowResolvedPaths
|
||||||
chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck
|
chkDisableDiskSpaceCheck.Text = frmSettings_chkDisableDiskSpaceCheck
|
||||||
|
|
||||||
'Unix Handler
|
|
||||||
If mgrCommon.IsUnix Then
|
If mgrCommon.IsUnix Then
|
||||||
|
'Only enable these options on Linux if GBM was installed with an official method
|
||||||
|
If Not File.Exists("/usr/share/applications/gbm.desktop") Then
|
||||||
chkStartMinimized.Enabled = False
|
chkStartMinimized.Enabled = False
|
||||||
chkAutoStart.Enabled = False
|
chkAutoStart.Enabled = False
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'Handle Panels
|
'Handle Panels
|
||||||
pnlGeneral.Visible = False
|
pnlGeneral.Visible = False
|
||||||
|
|||||||
Generated
+18
@@ -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 autostart link is missing. The autostart link has been re-created..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmMain_ErrorLinuxAutoStartMissing() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmMain_ErrorLinuxAutoStartMissing", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to The command [PARAM] requires more parameters..
|
''' Looks up a localized string similar to The command [PARAM] requires more parameters..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -4857,6 +4866,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to An error occured while creating the autostart link:[BR][BR][PARAM].
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSettings_ErrorLinuxAutoStart() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSettings_ErrorLinuxAutoStart", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to The custom 7-Zip location [PARAM] does not exist..
|
''' Looks up a localized string similar to The custom 7-Zip location [PARAM] does not exist..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -2341,4 +2341,10 @@
|
|||||||
<data name="frmSettings_chkDisableDiskSpaceCheck" xml:space="preserve">
|
<data name="frmSettings_chkDisableDiskSpaceCheck" xml:space="preserve">
|
||||||
<value>Disable disk space check prior to backup</value>
|
<value>Disable disk space check prior to backup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="frmMain_ErrorLinuxAutoStartMissing" xml:space="preserve">
|
||||||
|
<value>GBM is set to start automatically, but the autostart link is missing. The autostart link has been re-created.</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSettings_ErrorLinuxAutoStart" xml:space="preserve">
|
||||||
|
<value>An error occured while creating the autostart link:[BR][BR][PARAM]</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user