Skip to content

Commit

Permalink
Fixed the Desktop button not being enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxer committed Dec 6, 2012
1 parent 5f73669 commit 07183e1
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 48 deletions.
Binary file modified GUI.gambas
Binary file not shown.
4 changes: 2 additions & 2 deletions GUI/.project
@@ -1,9 +1,9 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.3.4
# Compiled with Gambas 3.1.1
Title=Customizer
Startup=FMain
Icon=logo.png
Version=3.2.594
Version=3.2.595
Component=gb.image
Component=gb.gtk
Component=gb.form
Expand Down
5 changes: 3 additions & 2 deletions GUI/.settings
Expand Up @@ -12,10 +12,11 @@ SearchComment=False
SearchString=True

[OpenFile]
Active=1
File[1]=".src/FMain.form"
File[2]=".src/FGrub2.class:5.0"
Count=2
Active=3
File[3]=".src/Check.module:22.65"
Count=3

[Watches]
Count=0
Expand Down
84 changes: 42 additions & 42 deletions GUI/.src/Check.module
@@ -1,69 +1,69 @@
' Gambas module file

PUBLIC WorkDir AS String = Func.Get_Str("/opt/Customizer/settings.conf", "WORK_DIR=", "/home")
Public WorkDir As String = Func.Get_Str("/opt/Customizer/settings.conf", "WORK_DIR=", "/home")

PUBLIC SUB Conf_File()
Public Sub Conf_File()
Func.Event_Msg("Checking configuration file")
IF NOT Exist("/opt/Customizer/settings.conf") THEN
If Not Exist("/opt/Customizer/settings.conf") Then
Message.Warning("Configuration file doesn't exists, creating one with the default values")
Func.Event_Msg("[TRY] Restore configuration file")
File.Save("/opt/Customizer/settings.conf", "# Main settings\nWORK_DIR=/home\nMOUNT_DIR=/mnt\n\n# Preferences\nMESSAGES_COLORS=1\nFORCE_CHROOT=0\nAPT_HELPER=1\nRESOLUTION=800x600\nBOOT_FILES=0\nVRAM=256\nCOMPRESSION=xz\nLOCALES=C\n\n# Saved variables\nISO=\nDEB=\nHOOK=\nPIC=")

CATCH
Catch
Message.Error("Unable to create configuration file, check your permissions")
ENDIF
END
Endif
End


PUBLIC SUB X_session()
DIM Xsessions AS Variant
Public Sub X_session()
Dim Xsessions As Variant

Func.Event_Msg("Checking for X-sessions links")
Xsessions = 0
TRY Xsessions = Dir(WorkDir & "/FileSystem/usr/share/xsessions", gb.File).Count
Try Xsessions = Dir(WorkDir & "/FileSystem/usr/share/xsessions").Count

IF Xsessions >= 1 THEN
FMain.Desktop.Enabled = TRUE
ELSE
FMain.Desktop.Enabled = FALSE
ENDIF
END
If Xsessions >= 1 Then
FMain.Desktop.Enabled = True
Else
FMain.Desktop.Enabled = False
Endif
End

PUBLIC SUB Pkg_Manager()
Public Sub Pkg_Manager()
Func.Event_Msg("Checking for package-manager")
IF Exist(WorkDir & "/FileSystem/usr/sbin/synaptic") OR Exist(WorkDir & "/FileSystem/usr/bin/aptitude") THEN
FMain.Archive.Enabled = TRUE
ELSE
FMain.Archive.Enabled = FALSE
ENDIF
END
If Exist(WorkDir & "/FileSystem/usr/sbin/synaptic") Or Exist(WorkDir & "/FileSystem/usr/bin/aptitude") Then
FMain.Archive.Enabled = True
Else
FMain.Archive.Enabled = False
Endif
End

PUBLIC SUB ISO()
DIM Dist, Arch, Rel AS String
Public Sub ISO()
Dim Dist, Arch, Rel As String

Func.Event_Msg("Checking ISO image existence")
Dist = Func.Get_Str(WorkDir & "/FileSystem/etc/lsb-release", "DISTRIB_ID=", "Custom")
Rel = Func.Get_Str(WorkDir & "/FileSystem/etc/lsb-release", "DISTRIB_RELEASE=", "0.1")

SHELL "chroot '" & WorkDir & "/FileSystem' dpkg --print-architecture" TO Arch
Shell "chroot '" & WorkDir & "/FileSystem' dpkg --print-architecture" To Arch

IF Exist(WorkDir & "/" & Dist & "-" & Trim(Arch) & "-" & Rel & ".iso") THEN
FMain.QEMU.Enabled = TRUE
ENDIF
END
If Exist(WorkDir & "/" & Dist & "-" & Trim(Arch) & "-" & Rel & ".iso") Then
FMain.QEMU.Enabled = True
Endif
End

PUBLIC SUB Existence()
Public Sub Existence()
Func.Event_Msg("Checking essential directories and files")
IF Exist(WorkDir & "/FileSystem") AND Exist(WorkDir & "/ISO") THEN
IF NOT Exist(WorkDir & "/FileSystem/root") OR NOT Exist(WorkDir & "/FileSystem/etc") OR NOT Exist(WorkDir & "/FileSystem/usr") THEN
If Exist(WorkDir & "/FileSystem") And Exist(WorkDir & "/ISO") Then
If Not Exist(WorkDir & "/FileSystem/root") Or Not Exist(WorkDir & "/FileSystem/etc") Or Not Exist(WorkDir & "/FileSystem/usr") Then
Message.Error("Some important folder are missing which mait be result\nof unsuccessful cleaning or deleted by accident, clean and start\nall over again.")
FMain.Clean.Enabled = TRUE
ELSE
IF NOT Exist(WorkDir & "/FileSystem/etc/casper.conf") OR NOT Exist(WorkDir & "/FileSystem/etc/lsb-release") THEN
FMain.Clean.Enabled = True
Else
If Not Exist(WorkDir & "/FileSystem/etc/casper.conf") Or Not Exist(WorkDir & "/FileSystem/etc/lsb-release") Then
Message.Error(WorkDir & "/FileSystem/etc/casper.conf or " & WorkDir & "/FileSystem/etc/lsb-release\nare deleted but are very essential for setting up some configuration.\nCreate them using a text editor or clean and start all over again!")
Func.Disable_Stuff()
FMain.Clean.Enabled = TRUE
ELSE
FMain.Clean.Enabled = True
Else
'Enable some elements
Func.Enable_Stuff()

Expand All @@ -85,9 +85,9 @@ PUBLIC SUB Existence()

'Check if package manager is installed installed
Check.Pkg_Manager()
ENDIF
ENDIF
ELSE
Endif
Endif
Else
Func.Disable_Stuff()
ENDIF
END
Endif
End
4 changes: 2 additions & 2 deletions settings.conf
Expand Up @@ -22,7 +22,7 @@ COMPRESSION="xz"
LOCALES="C"

# Saved variables
ISO="/home/variable/Downloads/ubuntu-mini-remix-12.04-amd64.iso"
ISO=""
DEB=""
HOOK=""
PIC="/home/variable/Wallpapers/Archlinux_wallpaper___greyscle_by_platinummonkey.jpg"
PIC=""

0 comments on commit 07183e1

Please sign in to comment.