18
18
class LLabel : Gtk.Label
20
public LLabel (string label)
22
this.set_halign (Gtk.Align.START);
25
public LLabel.indent (string label)
28
this.margin_left = 10;
30
public LLabel.markup (string label)
33
this.use_markup = true;
35
public LLabel.right (string label)
37
this.set_halign (Gtk.Align.END);
40
public LLabel.right_with_markup (string label)
42
this.set_halign (Gtk.Align.END);
43
this.use_markup = true;
20
public LLabel (string label)
22
this.set_halign (Gtk.Align.START);
25
public LLabel.indent (string label)
28
this.margin_left = 10;
30
public LLabel.markup (string label)
33
this.use_markup = true;
35
public LLabel.right (string label)
37
this.set_halign (Gtk.Align.END);
40
public LLabel.right_with_markup (string label)
42
this.set_halign (Gtk.Align.END);
43
this.use_markup = true;
48
48
public class GalaPlug : Pantheon.Switchboard.Plug
54
var notebook = new Granite.Widgets.StaticNotebook (false);
58
var dock_grid = new Gtk.Grid ();
60
var icon_size_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
62
Gtk.Scale icon_size_range = null;
63
var icon_size = new Gtk.SpinButton.with_range (32, 96, 1);
64
icon_size.set_value (PlankSettings.get_default ().icon_size);
65
icon_size.value_changed.connect (() => {
66
PlankSettings.get_default ().icon_size = (int)icon_size.get_value ();
67
icon_size_range.set_value (icon_size.get_value ());
69
icon_size.halign = Gtk.Align.START;
71
icon_size_range = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 32, 96, 1);
72
icon_size_range.set_value (PlankSettings.get_default ().icon_size);
73
icon_size_range.button_release_event.connect (() => {icon_size.value = icon_size_range.get_value (); return false;});
74
icon_size_range.draw_value = false;
76
icon_size_box.pack_start (icon_size_range, true);
77
icon_size_box.pack_start (icon_size, false);
79
var hide_mode = new Gtk.ComboBoxText ();
80
hide_mode.append ("0", _("Don't hide"));
81
hide_mode.append ("1", _("Intelligent hide"));
82
hide_mode.append ("2", _("Auto hide"));
83
hide_mode.append ("3", _("Hide on maximize"));
84
hide_mode.active_id = PlankSettings.get_default ().hide_mode.to_string ();
85
hide_mode.changed.connect (() => PlankSettings.get_default ().hide_mode = int.parse (hide_mode.active_id));
86
hide_mode.halign = Gtk.Align.START;
87
hide_mode.width_request = 164;
89
var monitor = new Gtk.ComboBoxText ();
91
for (i=0;i<Gdk.Screen.get_default ().get_n_monitors ();i ++)
92
monitor.append ((i+1).to_string (), _("Monitor")+" "+(i+1).to_string ());
93
monitor.active_id = (PlankSettings.get_default ().monitor+1).to_string ();
94
monitor.changed.connect (() => PlankSettings.get_default ().monitor = int.parse (monitor.active_id));
95
monitor.halign = Gtk.Align.START;
96
monitor.width_request = 164;
98
dock_grid.column_homogeneous = true;
99
dock_grid.column_spacing = 12;
100
dock_grid.row_spacing = 6;
101
dock_grid.margin = 64;
102
dock_grid.margin_top = 24;
104
dock_grid.attach (new LLabel.right (_("Icon Size:")), 0, 0, 1, 1);
105
dock_grid.attach (icon_size_box, 1, 0, 1, 1);
106
dock_grid.attach (new LLabel.right (_("Hide Mode:")), 0, 1, 1, 1);
107
dock_grid.attach (hide_mode, 1, 1, 1, 1);
109
dock_grid.attach (new LLabel.right (_("Monitor")+":"), 0, 2, 1, 1);
110
dock_grid.attach (monitor, 1, 2, 1, 1);
113
notebook.append_page (dock_grid, new Gtk.Label (_("Dock")));
116
var wallpaper = new Wallpaper (this);
117
notebook.append_page (wallpaper, new Gtk.Label (_("Wallpaper")));
120
var hotc_grid = new Gtk.Grid ();
121
hotc_grid.column_spacing = 12;
122
hotc_grid.margin = 32;
123
hotc_grid.margin_top = 50;
125
var expl = new LLabel (_("When the cursor enters the corner of the display:"));
126
expl.margin_bottom = 10;
128
var topleft = create_hotcorner ();
129
topleft.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-topleft").to_string ();
130
topleft.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-topleft", int.parse (topleft.active_id)));
131
topleft.valign = Gtk.Align.START;
132
var topright = create_hotcorner ();
133
topright.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-topright").to_string ();
134
topright.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-topright", int.parse (topright.active_id)));
135
topright.valign = Gtk.Align.START;
136
var bottomleft = create_hotcorner ();
137
bottomleft.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-bottomleft").to_string ();
138
bottomleft.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-bottomleft", int.parse (bottomleft.active_id)));
139
bottomleft.valign = Gtk.Align.END;
140
var bottomright = create_hotcorner ();
141
bottomright.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-bottomright").to_string ();
142
bottomright.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-bottomright", int.parse (bottomright.active_id)));
143
bottomright.valign = Gtk.Align.END;
145
var icon = new Gtk.Image.from_file (Constants.PKGDATADIR + "/hotcornerdisplay.png");
146
var custom_command = new Gtk.Entry ();
147
custom_command.text = BehaviorSettings.get_default ().hotcorner_custom_command;
148
custom_command.changed.connect (() => BehaviorSettings.get_default ().hotcorner_custom_command = custom_command.text );
150
var cc_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
151
cc_box.margin_top = 24;
152
cc_box.pack_start (new LLabel (_("Custom Command:")), false);
153
cc_box.pack_start (custom_command, false);
155
hotc_grid.attach (expl, 0, 0, 3, 1);
156
hotc_grid.attach (icon, 1, 1, 1, 3);
157
hotc_grid.attach (topleft, 0, 1, 1, 1);
158
hotc_grid.attach (topright, 2, 1, 1, 1);
159
hotc_grid.attach (bottomleft, 0, 3, 1, 1);
160
hotc_grid.attach (bottomright, 2, 3, 1, 1);
161
hotc_grid.attach (cc_box, 0, 4, 2, 1);
163
notebook.append_page (hotc_grid, new Gtk.Label (_("Hot Corners")));
168
notebook.page_changed.connect ((page) => {
169
if (page == 1 && !wallpaper.finished) {
170
switchboard_controller.progress_bar_set_visible (true);
172
switchboard_controller.progress_bar_set_visible (false);
177
Gtk.ComboBoxText create_hotcorner ()
179
var box = new Gtk.ComboBoxText ();
180
box.append ("0", _("Do Nothing"));
181
box.append ("1", _("Show Workspace View"));
182
box.append ("2", _("Maximize Current Window"));
183
box.append ("3", _("Minimize Current Window"));
184
box.append ("4", _("Open Launcher"));
185
box.append ("6", _("Expose All Windows"));
186
box.append ("5", _("Execute Custom Command"));
192
public static int main (string[] args)
196
var plug = new GalaPlug ();
197
plug.register ("Effects");
54
var notebook = new Granite.Widgets.StaticNotebook (false);
55
notebook.set_margin_top (12);
58
var wallpaper = new Wallpaper (this);
59
notebook.append_page (wallpaper, new Gtk.Label (_("Wallpaper")));
60
switchboard_controller.progress_bar_set_visible (true);
63
var dock_grid = new Gtk.Grid ();
64
dock_grid.set_column_spacing (12);
65
dock_grid.set_row_spacing (6);
66
dock_grid.margin = 12;
68
var icon_size_range = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 32, 96, 1);
69
var icon_size = new Gtk.SpinButton.with_range (32, 96, 1);
70
icon_size.set_value (PlankSettings.get_default ().icon_size);
71
icon_size.value_changed.connect (() => {
72
PlankSettings.get_default ().icon_size = (int)icon_size.get_value ();
73
icon_size_range.set_value (icon_size.get_value ());
75
icon_size.halign = Gtk.Align.START;
77
icon_size_range.set_value (PlankSettings.get_default ().icon_size);
78
icon_size_range.button_release_event.connect (() => {icon_size.value = icon_size_range.get_value (); return false;});
79
icon_size_range.draw_value = false;
80
icon_size_range.set_hexpand (true);
82
var hide_mode = new Gtk.ComboBoxText ();
83
hide_mode.append ("0", _("Don't hide"));
84
hide_mode.append ("1", _("Intelligent hide"));
85
hide_mode.append ("2", _("Auto hide"));
86
hide_mode.append ("3", _("Hide on maximize"));
87
hide_mode.active_id = PlankSettings.get_default ().hide_mode.to_string ();
88
hide_mode.changed.connect (() => PlankSettings.get_default ().hide_mode = int.parse (hide_mode.active_id));
89
hide_mode.halign = Gtk.Align.START;
90
hide_mode.width_request = 164;
92
var monitor = new Gtk.ComboBoxText ();
94
for (i = 0; i < Gdk.Screen.get_default ().get_n_monitors () ; i ++) {
95
monitor.append ( (i+1).to_string (), _("Monitor %d").printf (i+1) );
97
monitor.active_id = ( PlankSettings.get_default ().monitor +1 ).to_string ();
98
monitor.changed.connect (() => PlankSettings.get_default ().monitor = int.parse (monitor.active_id));
99
monitor.halign = Gtk.Align.START;
100
monitor.width_request = 164;
102
dock_grid.attach (new LLabel.right (_("Icon Size:")), 0, 0, 2, 1);
103
dock_grid.attach (icon_size_range,2, 0, 1, 1);
104
dock_grid.attach (icon_size, 3, 0, 1, 1);
105
dock_grid.attach (new LLabel.right (_("Hide Mode:")), 0, 1, 2, 1);
106
dock_grid.attach (hide_mode, 2, 1, 2, 1);
108
dock_grid.attach (new LLabel.right (_("Monitor:")), 0, 2, 2, 1);
109
dock_grid.attach (monitor, 2, 2, 2, 1);
112
var fake_label = new Gtk.Label ("");
113
fake_label.set_hexpand (true);
114
dock_grid.attach (fake_label, 0, 0, 1, 1);
116
notebook.append_page (dock_grid, new Gtk.Label (_("Dock")));
119
var hotc_grid = new Gtk.Grid ();
120
hotc_grid.column_spacing = 12;
121
hotc_grid.margin = 32;
122
hotc_grid.margin_top = 50;
124
var expl = new LLabel (_("When the cursor enters the corner of the display:"));
125
expl.margin_bottom = 10;
126
expl.set_hexpand (true);
128
var topleft = create_hotcorner ();
129
topleft.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-topleft").to_string ();
130
topleft.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-topleft", int.parse (topleft.active_id)));
131
topleft.valign = Gtk.Align.START;
132
var topright = create_hotcorner ();
133
topright.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-topright").to_string ();
134
topright.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-topright", int.parse (topright.active_id)));
135
topright.valign = Gtk.Align.START;
136
var bottomleft = create_hotcorner ();
137
bottomleft.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-bottomleft").to_string ();
138
bottomleft.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-bottomleft", int.parse (bottomleft.active_id)));
139
bottomleft.valign = Gtk.Align.END;
140
var bottomright = create_hotcorner ();
141
bottomright.active_id = BehaviorSettings.get_default ().schema.get_enum ("hotcorner-bottomright").to_string ();
142
bottomright.changed.connect (() => BehaviorSettings.get_default ().schema.set_enum ("hotcorner-bottomright", int.parse (bottomright.active_id)));
143
bottomright.valign = Gtk.Align.END;
145
var icon = new Gtk.Image.from_file (Constants.PKGDATADIR + "/hotcornerdisplay.png");
146
var custom_command = new Gtk.Entry ();
147
custom_command.text = BehaviorSettings.get_default ().hotcorner_custom_command;
148
custom_command.changed.connect (() => BehaviorSettings.get_default ().hotcorner_custom_command = custom_command.text );
150
var cc_grid = new Gtk.Grid ();
151
cc_grid.set_column_spacing (12);
152
cc_grid.set_margin_top (6);
153
cc_grid.attach (new LLabel (_("Custom Command:")), 0, 0, 1, 1);
154
cc_grid.attach (custom_command, 1, 0, 1, 1);
157
hotc_grid.attach (expl, 0, 0, 3, 1);
158
hotc_grid.attach (icon, 1, 1, 1, 3);
159
hotc_grid.attach (topleft, 0, 1, 1, 1);
160
hotc_grid.attach (topright, 2, 1, 1, 1);
161
hotc_grid.attach (bottomleft, 0, 3, 1, 1);
162
hotc_grid.attach (bottomright, 2, 3, 1, 1);
163
hotc_grid.attach (cc_grid, 0, 4, 2, 1);
165
notebook.append_page (hotc_grid, new Gtk.Label (_("Hot Corners")));
170
notebook.page_changed.connect ((page) => {
171
if (page == 0 && !wallpaper.finished) {
172
switchboard_controller.progress_bar_set_visible (true);
174
switchboard_controller.progress_bar_set_visible (false);
179
Gtk.ComboBoxText create_hotcorner ()
181
var box = new Gtk.ComboBoxText ();
182
box.append ("0", _("Do Nothing"));
183
box.append ("1", _("Show Workspace View"));
184
box.append ("2", _("Maximize Current Window"));
185
box.append ("3", _("Minimize Current Window"));
186
box.append ("4", _("Open Launcher"));
187
box.append ("6", _("Expose All Windows"));
188
box.append ("5", _("Execute Custom Command"));
194
public static int main (string[] args) {
198
var plug = new GalaPlug ();
199
plug.register ("Effects");
206
public static void translations () {
207
string desktop_name = _("Desktop");