-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmPartitions.class
174 lines (126 loc) · 3.72 KB
/
frmPartitions.class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
' Gambas class file
' ### PARTITIONING MODE FORM ###
PUBLIC tnum AS Integer[]
PUBLIC ttime AS Date
PUBLIC SUB Form_Show()
' set button focus:
frmMain.btnMain3.SetFocus
' set some background colours:
TextLabel1.BackColor = Global.HTMLBG
lblSubTitle.BackColor = Global.LogoBG
Panel1.BackColor = Global.LogoBG
END
PUBLIC SUB Form_Resize()
' Resize the html message:
TextLabel1.Width = ScrollView1.ClientWidth
TextLabel1.Adjust
END
PUBLIC SUB btnFullDisk_Click() 'Full disk:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
frmMain.btnMain3.Enabled = FALSE 'Disable "Partitions".
frmMain.btnMain4.Enabled = TRUE 'Enable "Packages".
frmMain.btnMain4_Click 'Advance to "Packages".
' Unflag button execution:
Global.flagBUTTExec = FALSE
END
PUBLIC SUB btnFreeSpace_Click() 'Free space:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
frmMain.btnMain3.Enabled = FALSE 'Disable "Partitions".
frmMain.btnMain4.Enabled = TRUE 'Enable "Packages".
frmMain.btnMain4_Click 'Advance to "Packages".
' Unflag button execution:
Global.flagBUTTExec = FALSE
END
PUBLIC SUB btnGParted_Click() 'GParted:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
IF User.Name <> "root" THEN
message.Warning("You need to be root to run GParted...", "Exit")
ELSE
Global.tproc = SHELL "gparted"
ttime = Now
REPEAT
'tnum = desktop.Find("/dev/hda - GParted")
tnum = desktop.Find("GParted")
WAIT 0.1
IF DateDiff(ttime, Now, gb.Second) > 25 THEN
message.Error("Error executing GParted, could be due to low memory.")
BREAK
ENDIF
UNTIL tnum.Count > 0
IF tnum.Count > 0 THEN
frmPartitioner.Reparent(frmMain.pnlContainer, 0, 0)
frmPartitioner.Embedder1.Embed(tnum[0])
ME.Hide
frmPartitioner.Show
frmPartitioner.Embedder1.Raise
ENDIF
ENDIF
IF Global.DebugMode = TRUE THEN
Utils.DrivePartInfo
frmPartSelect.ShowModal
ENDIF
' Unflag button execution:
Global.flagBUTTExec = FALSE
END
PUBLIC SUB btnCfdisk_Click() 'cfdisk:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
IF User.Name <> "root" THEN
message.Warning("You need to be root to run cfdisk...", "Exit")
ELSE
utils.BUTTdisable
' Global.tproc = SHELL "xterm -e cfdisk"
' Global.tproc = EXEC ["xterm", "-e", "cfdisk"]
Global.tproc = EXEC ["aterm", "+tr", "+sb", "-fg", "black", "-bg", "white", "-e", "cfdisk"]
ttime = Now
REPEAT
tnum = desktop.Find("cfdisk")
WAIT 0.1
IF DateDiff(ttime, Now, gb.Second) > 10 THEN
message.Error("Error executing cfdisk, could be due to low memory.")
frmPartitions.Show
utils.BUTTrest
BREAK
ENDIF
UNTIL tnum.Count > 0
IF tnum.Count > 0 THEN
frmPartitioner.Reparent(frmMain.pnlContainer, 0, 0)
frmPartitioner.Embedder1.Embed(tnum[0])
ME.Hide
frmPartitioner.Show
frmPartitioner.Embedder1.SetFocus
ENDIF
ENDIF
' Unflag button execution:
Global.flagBUTTExec = FALSE
END
PUBLIC SUB btnPreset_Click() 'Preset strategies:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
' do some stuff...
' Unflag button execution:
Global.flagBUTTExec = FALSE
END
PUBLIC SUB btnNoPart_Click() 'No partitioning:
' Check for button execution:
IF Global.flagBUTTExec = TRUE THEN RETURN
' Flag button execution:
Global.flagBUTTExec = TRUE
' Mountpoint selection:
frmPartSelect.ShowModal
' Unflag button execution:
Global.flagBUTTExec = FALSE
END