~lewisgoddard/unitysettings/trunk

« back to all changes in this revision

Viewing changes to MDash.module

  • Committer: Lewis Goddard
  • Date: 2012-03-20 17:09:37 UTC
  • Revision ID: lewisgoddard@eustasy.co.uk-20120320170937-wqpf7jom5f71es14
Beta Release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
' Gambas module file
 
2
PUBLIC SUB start()
 
3
  DisableControls()
 
4
  Combo_insert()
 
5
  readSettings()
 
6
  SetLabel()
 
7
  SetPictureBox()
 
8
END
 
9
 
 
10
 
 
11
PUBLIC SUB DisableControls()
 
12
IF Main.Usession = "3D" THEN 
 
13
  SELECT CASE Main.Uversion
 
14
    CASE "11.04"
 
15
      FMain.sliderhome3.Enabled = FALSE
 
16
      FMain.sliderhome3.ToolTip = FMain.TextLabel25.Text
 
17
      FMain.pichome3.Enabled = FALSE
 
18
      FMain.TextLabel28.Foreground = &H00B0B0B0&
 
19
      
 
20
      FMain.sliderhome4.Enabled = FALSE
 
21
      FMain.sliderhome4.ToolTip = FMain.TextLabel25.Text
 
22
      FMain.pichome4.Enabled = FALSE
 
23
      FMain.TextLabel31.Foreground = &H00B0B0B0&
 
24
      
 
25
      FMain.ComboBox3.Enabled = FALSE
 
26
      FMain.ComboBox3.ToolTip = FMain.TextLabel25.Text
 
27
      FMain.TextLabel30.Foreground = &H00B0B0B0&
 
28
      
 
29
    CASE "11.10"
 
30
      FMain.sliderhome3.Enabled = FALSE
 
31
      FMain.sliderhome3.ToolTip = FMain.TextLabel25.Text
 
32
      FMain.pichome3.Enabled = FALSE
 
33
      FMain.TextLabel28.Foreground = &H00B0B0B0&
 
34
      
 
35
      FMain.sliderhome4.Enabled = FALSE
 
36
      FMain.sliderhome4.ToolTip = FMain.TextLabel25.Text
 
37
      FMain.pichome4.Enabled = FALSE
 
38
      FMain.TextLabel31.Foreground = &H00B0B0B0&
 
39
      
 
40
    CASE "12.04"
 
41
      
 
42
  END SELECT 
 
43
ELSE 
 
44
  FMain.ComboBox3.Enabled = FALSE
 
45
  FMain.ComboBox3.ToolTip = FMain.TextLabel25.Text
 
46
  FMain.TextLabel30.Foreground = &H00B0B0B0&
 
47
  
 
48
  FMain.sliderhome3.Enabled = FALSE
 
49
  FMain.sliderhome3.ToolTip = FMain.TextLabel25.Text
 
50
  FMain.pichome3.Enabled = FALSE
 
51
  FMain.TextLabel28.Foreground = &H00B0B0B0&
 
52
      
 
53
  FMain.sliderhome4.Enabled = FALSE
 
54
  FMain.sliderhome4.ToolTip = FMain.TextLabel25.Text
 
55
  FMain.pichome4.Enabled = FALSE
 
56
  FMain.TextLabel31.Foreground = &H00B0B0B0&
 
57
  
 
58
  IF Main.Uversion <> "12.04" THEN 
 
59
    FMain.ComboBox4.Enabled = FALSE
 
60
    FMain.ComboBox4.ToolTip = FMain.TextLabel25.Text
 
61
    FMain.TextLabel29.Foreground = &H00B0B0B0&
 
62
  ENDIF 
 
63
ENDIF 
 
64
END
 
65
 
 
66
 
 
67
PUBLIC SUB Combo_insert()
 
68
  'Blur
 
69
  FMain.ComboBox3.Add(("OFF"))
 
70
  FMain.ComboBox3.Add(("ON"))
 
71
  FMain.ComboBox3.Add(("Smart"))
 
72
  
 
73
  'Dash Size
 
74
IF Main.Usession = "3D" THEN 
 
75
  FMain.ComboBox4.Add("Automatic")
 
76
  FMain.ComboBox4.Add("Desktop")
 
77
  FMain.ComboBox4.Add("Netbook")
 
78
ELSE 
 
79
  FMain.ComboBox4.Add("Automatic")
 
80
  FMain.ComboBox4.Add("Full screen")
 
81
ENDIF 
 
82
END 
 
83
 
 
84
 
 
85
PUBLIC SUB readSettings()
 
86
  DIM tmpValue AS Variant
 
87
  DIM tmpShell AS String
 
88
  
 
89
  SELECT CASE Main.Uversion
 
90
    CASE "12.04"
 
91
      tmpValue = Main.GsettingsGet("com.canonical.Unity.ApplicationsLens", "display-available-apps") ' display-available-apps
 
92
      FMain.sliderhome3.X = 0
 
93
      IF Left$(tmpValue, Len(tmpValue) - 1) = "true" THEN FMain.sliderhome3.X = 36
 
94
      IF tmpValue = "true" THEN FMain.sliderhome3.X = 36
 
95
      
 
96
      tmpValue = Main.GsettingsGet("com.canonical.Unity.ApplicationsLens", "display-recent-apps") ' display-recent-apps
 
97
      FMain.sliderhome4.X = 0
 
98
      IF Left$(tmpValue, Len(tmpValue) - 1) = "true" THEN FMain.sliderhome4.X = 36
 
99
      IF tmpValue = "true" THEN FMain.sliderhome4.X = 36
 
100
      
 
101
  END SELECT 
 
102
  
 
103
      tmpValue = Main.GconfGet("/apps/compiz-1/plugins/unityshell/screen0/options/", "dash_blur_experimental") ' Blur
 
104
      FMain.ComboBox3.Index = tmpValue
 
105
      
 
106
      IF Main.Usession = "3D" THEN 
 
107
          tmpValue = Main.GsettingsGet("com.canonical.Unity", "form-factor") ' Dash size
 
108
          IF tmpValue = "'Automatic'\n" THEN FMain.ComboBox4.Index = 0
 
109
          IF tmpValue = "'Desktop'\n" THEN FMain.ComboBox4.Index = 1
 
110
          IF tmpValue = "'Netbook'\n" THEN FMain.ComboBox4.Index = 2
 
111
      ELSE 
 
112
          tmpValue = Main.GsettingsGet("com.canonical.Unity2d.Dash", "full-screen") ' Dash size
 
113
          tmpValue = Left$(tmpValue, Len(tmpValue) - 1)
 
114
          PRINT tmpValue
 
115
          IF tmpValue = "true" THEN FMain.ComboBox4.Index = 1
 
116
          IF tmpValue = "false" THEN FMain.ComboBox4.Index = 0
 
117
      ENDIF 
 
118
 
 
119
END
 
120
 
 
121
 
 
122
PUBLIC SUB SetLabel()  ' setup label
 
123
  
 
124
END
 
125
 
 
126
 
 
127
PUBLIC SUB SetPictureBox()
 
128
  IF FMain.sliderhome3.Enabled = FALSE THEN FMain.pichome3.Enabled = FALSE
 
129
  IF FMain.sliderhome4.Enabled = FALSE THEN FMain.pichome4.Enabled = FALSE
 
130
END
 
131
 
 
132
 
 
133
PUBLIC SUB defaultSettings()
 
134
  SELECT CASE Main.Uversion
 
135
    CASE "12.04"
 
136
      SHELL "gsettings reset com.canonical.Unity.ApplicationsLens display-available-apps" WAIT  ' display-available-apps
 
137
      SHELL "gsettings reset com.canonical.Unity.ApplicationsLens display-recent-apps" WAIT  ' display-recent-apps
 
138
      SHELL "gconftool --unset /apps/compiz-1/plugins/unityshell/screen0/options/dash_blur_experimental" WAIT ' Blur
 
139
      IF Main.Usession = "3D" THEN 
 
140
          SHELL "gsettings reset com.canonical.Unity form-factor" WAIT  ' Dash size 3D
 
141
      ELSE 
 
142
          SHELL "gsettings reset com.canonical.Unity2d.Dash full-screen" WAIT  ' Dash size 3D
 
143
      ENDIF 
 
144
      
 
145
    CASE "11.10"
 
146
      SHELL "gconftool --unset /apps/compiz-1/plugins/unityshell/screen0/options/dash_blur_experimental" WAIT ' Blur
 
147
      SHELL "gsettings set com.canonical.Unity form-factor 'Automatic'" WAIT  ' Dash size
 
148
      
 
149
    CASE "11.04"
 
150
      SHELL "gsettings set com.canonical.Unity form-factor 'Automatic'" WAIT  ' Dash size
 
151
      
 
152
  END SELECT 
 
153
  
 
154
readSettings()
 
155
END
 
156
 
 
157