~wasta-linux/wasta-core-wily/master

« back to all changes in this revision

Viewing changes to install-files/extensions/gnomenu@panacier.gmail.com/prefs.js

  • Committer: Rik Shaw
  • Date: 2015-11-01 13:28:40 UTC
  • Revision ID: git-v1:59c62c9b2e4f4f1cf62db1f5dc1cf630feb99933
initial 15.10 commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ========================================================================================================
 
2
 * prefs.js - preferences
 
3
 * ========================================================================================================
 
4
 */
 
5
 
 
6
const Gio = imports.gi.Gio;
 
7
const GLib = imports.gi.GLib;
 
8
const GObject = imports.gi.GObject;
 
9
const Gtk = imports.gi.Gtk;
 
10
const Lang = imports.lang;
 
11
 
 
12
const ExtensionUtils = imports.misc.extensionUtils;
 
13
const Me = ExtensionUtils.getCurrentExtension();
 
14
const Convenience = Me.imports.convenience;
 
15
 
 
16
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
 
17
const _ = Gettext.gettext;
 
18
 
 
19
 
 
20
const GnoMenuPreferencesWidget = new GObject.Class({
 
21
    Name: 'GnoMenu.GnoMenuPreferencesWidget',
 
22
    GTypeName: 'GnoMenuPreferencesWidget',
 
23
    Extends: Gtk.Box,
 
24
 
 
25
    _init: function(params) {
 
26
        this.parent(params);
 
27
        this.settings = Convenience.getSettings('org.gnome.shell.extensions.gnomenu');
 
28
 
 
29
        let frame = new Gtk.Box({
 
30
            orientation: Gtk.Orientation.VERTICAL
 
31
        });
 
32
 
 
33
        /* PANEL SETTINGS */
 
34
 
 
35
        let panelSettings = new Gtk.Box({
 
36
            orientation: Gtk.Orientation.VERTICAL,
 
37
            margin_bottom: 10
 
38
        });
 
39
 
 
40
        let panelSettingsTitle = new Gtk.Label({
 
41
            label: _("<b>Panel Settings</b>"),
 
42
            use_markup: true,
 
43
            xalign: 0,
 
44
            margin_top: 5,
 
45
            margin_bottom: 5
 
46
        });
 
47
 
 
48
 
 
49
        let disableHotCornerBox = new Gtk.Box({
 
50
            spacing: 20,
 
51
            orientation: Gtk.Orientation.HORIZONTAL,
 
52
            homogeneous: false,
 
53
            margin_left: 20,
 
54
            margin_top: 5,
 
55
            margin_bottom: 5,
 
56
            margin_right: 10
 
57
        });
 
58
        let disableHotCornerLabel = new Gtk.Label({
 
59
            label: _("Disable activities hot corner"),
 
60
            use_markup: true,
 
61
            xalign: 0,
 
62
            hexpand: true
 
63
        });
 
64
        let disableHotCornerSwitch = new Gtk.Switch ({
 
65
            halign: Gtk.Align.END
 
66
        });
 
67
        disableHotCornerSwitch.set_active(this.settings.get_boolean('disable-activities-hotcorner'));
 
68
        disableHotCornerSwitch.connect("notify::active", Lang.bind(this, function(check) {
 
69
            this.settings.set_boolean('disable-activities-hotcorner', check.get_active());
 
70
        }));
 
71
 
 
72
        disableHotCornerBox.add(disableHotCornerLabel);
 
73
        disableHotCornerBox.add(disableHotCornerSwitch);
 
74
 
 
75
 
 
76
        let hidePanelViewBox = new Gtk.Box({
 
77
            spacing: 20,
 
78
            orientation: Gtk.Orientation.HORIZONTAL,
 
79
            homogeneous: false,
 
80
            margin_left: 20,
 
81
            margin_top: 5,
 
82
            margin_bottom: 5,
 
83
            margin_right: 10
 
84
        });
 
85
        let hidePanelViewLabel = new Gtk.Label({
 
86
            label: _("Remove View button from panel"),
 
87
            use_markup: true,
 
88
            xalign: 0,
 
89
            hexpand: true
 
90
        });
 
91
        let hidePanelViewSwitch = new Gtk.Switch ({
 
92
            halign: Gtk.Align.END
 
93
        });
 
94
        hidePanelViewSwitch.set_active(this.settings.get_boolean('hide-panel-view'));
 
95
        hidePanelViewSwitch.connect("notify::active", Lang.bind(this, function(check) {
 
96
            this.settings.set_boolean('hide-panel-view', check.get_active());
 
97
        }));
 
98
 
 
99
        hidePanelViewBox.add(hidePanelViewLabel);
 
100
        hidePanelViewBox.add(hidePanelViewSwitch);
 
101
 
 
102
        let panelViewBox = new Gtk.Box({
 
103
            orientation: Gtk.Orientation.VERTICAL
 
104
        });
 
105
 
 
106
        let customViewLabelBox = new Gtk.Box({
 
107
            spacing: 20,
 
108
            orientation: Gtk.Orientation.HORIZONTAL,
 
109
            homogeneous: false,
 
110
            margin_left: 20,
 
111
            margin_top: 0,
 
112
            margin_bottom: 5,
 
113
            margin_right: 10
 
114
        });
 
115
        
 
116
        let customViewLabel = new Gtk.Label({
 
117
            label: _("Label for View button"),
 
118
            margin_left: 40,
 
119
            hexpand: true,
 
120
            halign: Gtk.Align.START
 
121
        });
 
122
 
 
123
        let customViewLabelEntry = new Gtk.Entry({
 
124
            halign: Gtk.Align.END
 
125
        });
 
126
        customViewLabelEntry.set_width_chars(15);
 
127
        customViewLabelEntry.set_text(this.settings.get_strv('panel-view-label-text')[0]);
 
128
        customViewLabelEntry.connect('changed', Lang.bind(this, function(entry) {
 
129
            let iconName = entry.get_text();
 
130
            this.settings.set_strv('panel-view-label-text', [iconName]);
 
131
        }));
 
132
 
 
133
        customViewLabelBox.add(customViewLabel);
 
134
        customViewLabelBox.add(customViewLabelEntry);
 
135
 
 
136
        let customViewIconBox = new Gtk.Box({
 
137
            spacing: 20,
 
138
            orientation: Gtk.Orientation.HORIZONTAL,
 
139
            homogeneous: false,
 
140
            margin_left: 20,
 
141
            margin_top: 0,
 
142
            margin_bottom: 5,
 
143
            margin_right: 10
 
144
        });
 
145
        let customViewIcon = new Gtk.CheckButton({
 
146
            label: _("Use icon with View button"),
 
147
            margin_left: 40,
 
148
            hexpand: true,
 
149
            halign: Gtk.Align.START
 
150
        });
 
151
        customViewIcon.set_active(this.settings.get_boolean('use-panel-view-icon'));
 
152
        customViewIcon.connect('toggled', Lang.bind(this, function(check) {
 
153
            this.settings.set_boolean('use-panel-view-icon', check.get_active());
 
154
        }));
 
155
 
 
156
        let customViewIconEntry = new Gtk.Entry({
 
157
            halign: Gtk.Align.END
 
158
        });
 
159
        customViewIconEntry.set_width_chars(15);
 
160
        customViewIconEntry.set_text(this.settings.get_strv('panel-view-icon-name')[0]);
 
161
        customViewIconEntry.connect('changed', Lang.bind(this, function(entry) {
 
162
            let iconName = entry.get_text();
 
163
            this.settings.set_strv('panel-view-icon-name', [iconName]);
 
164
        }));
 
165
 
 
166
        this.settings.bind('use-panel-view-icon', customViewIconEntry, 'sensitive', Gio.SettingsBindFlags.DEFAULT);
 
167
        customViewIconBox.add(customViewIcon);
 
168
        customViewIconBox.add(customViewIconEntry);
 
169
 
 
170
        this.settings.bind('hide-panel-view', panelViewBox, 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN);
 
171
        panelViewBox.add(customViewLabelBox);
 
172
        panelViewBox.add(customViewIconBox);
 
173
 
 
174
 
 
175
        let hidePanelAppsBox = new Gtk.Box({
 
176
            spacing: 20,
 
177
            orientation: Gtk.Orientation.HORIZONTAL,
 
178
            homogeneous: false,
 
179
            margin_left: 20,
 
180
            margin_top: 5,
 
181
            margin_bottom: 5,
 
182
            margin_right: 10
 
183
        });
 
184
        let hidePanelAppsLabel = new Gtk.Label({
 
185
            label: _("Remove Apps button from panel"),
 
186
            use_markup: true,
 
187
            xalign: 0,
 
188
            hexpand: true
 
189
        });
 
190
        let hidePanelAppsSwitch = new Gtk.Switch ({
 
191
            halign: Gtk.Align.END
 
192
        });
 
193
        hidePanelAppsSwitch.set_active(this.settings.get_boolean('hide-panel-apps'));
 
194
        hidePanelAppsSwitch.connect("notify::active", Lang.bind(this, function(check) {
 
195
            this.settings.set_boolean('hide-panel-apps', check.get_active());
 
196
        }));
 
197
 
 
198
        hidePanelAppsBox.add(hidePanelAppsLabel);
 
199
        hidePanelAppsBox.add(hidePanelAppsSwitch);
 
200
 
 
201
        let panelAppsBox = new Gtk.Box({
 
202
            orientation: Gtk.Orientation.VERTICAL
 
203
        });
 
204
 
 
205
        let customAppsLabelBox = new Gtk.Box({
 
206
            spacing: 20,
 
207
            orientation: Gtk.Orientation.HORIZONTAL,
 
208
            homogeneous: false,
 
209
            margin_left: 20,
 
210
            margin_top: 0,
 
211
            margin_bottom: 5,
 
212
            margin_right: 10
 
213
        });
 
214
        
 
215
        let customAppsLabel = new Gtk.Label({
 
216
            label: _("Label for Apps button"),
 
217
            margin_left: 40,
 
218
            hexpand: true,
 
219
            halign: Gtk.Align.START
 
220
        });
 
221
 
 
222
        let customAppsLabelEntry = new Gtk.Entry({
 
223
            halign: Gtk.Align.END
 
224
        });
 
225
        customAppsLabelEntry.set_width_chars(15);
 
226
        customAppsLabelEntry.set_text(this.settings.get_strv('panel-apps-label-text')[0]);
 
227
        customAppsLabelEntry.connect('changed', Lang.bind(this, function(entry) {
 
228
            let iconName = entry.get_text();
 
229
            this.settings.set_strv('panel-apps-label-text', [iconName]);
 
230
        }));
 
231
 
 
232
        customAppsLabelBox.add(customAppsLabel);
 
233
        customAppsLabelBox.add(customAppsLabelEntry);
 
234
 
 
235
 
 
236
        let customAppsIconBox = new Gtk.Box({
 
237
            spacing: 20,
 
238
            orientation: Gtk.Orientation.HORIZONTAL,
 
239
            homogeneous: false,
 
240
            margin_left: 20,
 
241
            margin_top: 0,
 
242
            margin_bottom: 5,
 
243
            margin_right: 10
 
244
        });
 
245
        let customAppsIcon = new Gtk.CheckButton({
 
246
            label: _("Use icon with Apps button"),
 
247
            margin_left: 40,
 
248
            hexpand: true,
 
249
            halign: Gtk.Align.START
 
250
        });
 
251
        customAppsIcon.set_active(this.settings.get_boolean('use-panel-apps-icon'));
 
252
        customAppsIcon.connect('toggled', Lang.bind(this, function(check) {
 
253
            this.settings.set_boolean('use-panel-apps-icon', check.get_active());
 
254
        }));
 
255
 
 
256
        let customAppsIconEntry = new Gtk.Entry({
 
257
            halign: Gtk.Align.END
 
258
        });
 
259
        customAppsIconEntry.set_width_chars(15);
 
260
        customAppsIconEntry.set_text(this.settings.get_strv('panel-apps-icon-name')[0]);
 
261
        customAppsIconEntry.connect('changed', Lang.bind(this, function(entry) {
 
262
            let iconName = entry.get_text();
 
263
            this.settings.set_strv('panel-apps-icon-name', [iconName]);
 
264
        }));
 
265
 
 
266
        this.settings.bind('use-panel-apps-icon', customAppsIconEntry, 'sensitive', Gio.SettingsBindFlags.DEFAULT);
 
267
        customAppsIconBox.add(customAppsIcon);
 
268
        customAppsIconBox.add(customAppsIconEntry);
 
269
 
 
270
 
 
271
        this.settings.bind('hide-panel-apps', panelAppsBox, 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN);
 
272
        panelAppsBox.add(customAppsLabelBox);
 
273
        panelAppsBox.add(customAppsIconBox);
 
274
 
 
275
 
 
276
        let hidePanelMenuBox = new Gtk.Box({
 
277
            spacing: 20,
 
278
            orientation: Gtk.Orientation.HORIZONTAL,
 
279
            homogeneous: false,
 
280
            margin_left: 20,
 
281
            margin_top: 5,
 
282
            margin_bottom: 5,
 
283
            margin_right: 10
 
284
        });
 
285
        let hidePanelMenuLabel = new Gtk.Label({
 
286
            label: _("Remove Menu button from panel"),
 
287
            use_markup: true,
 
288
            xalign: 0,
 
289
            hexpand: true
 
290
        });
 
291
        let hidePanelMenuSwitch = new Gtk.Switch ({
 
292
            halign: Gtk.Align.END
 
293
        });
 
294
        hidePanelMenuSwitch.set_active(this.settings.get_boolean('hide-panel-menu'));
 
295
        hidePanelMenuSwitch.connect("notify::active", Lang.bind(this, function(check) {
 
296
            this.settings.set_boolean('hide-panel-menu', check.get_active());
 
297
        }));
 
298
 
 
299
        hidePanelMenuBox.add(hidePanelMenuLabel);
 
300
        hidePanelMenuBox.add(hidePanelMenuSwitch);
 
301
 
 
302
        let customMenuLabelBox = new Gtk.Box({
 
303
            spacing: 20,
 
304
            orientation: Gtk.Orientation.HORIZONTAL,
 
305
            homogeneous: false,
 
306
            margin_left: 20,
 
307
            margin_top: 0,
 
308
            margin_bottom: 5,
 
309
            margin_right: 10
 
310
        });
 
311
 
 
312
        let customMenuLabel = new Gtk.Label({
 
313
            label: _("Label for Menu button"),
 
314
            margin_left: 40,
 
315
            hexpand: true,
 
316
            halign: Gtk.Align.START
 
317
        });
 
318
 
 
319
        let customMenuLabelEntry = new Gtk.Entry({
 
320
            halign: Gtk.Align.END
 
321
        });
 
322
        customMenuLabelEntry.set_width_chars(15);
 
323
        customMenuLabelEntry.set_text(this.settings.get_strv('panel-menu-label-text')[0]);
 
324
        customMenuLabelEntry.connect('changed', Lang.bind(this, function(entry) {
 
325
            let iconName = entry.get_text();
 
326
            this.settings.set_strv('panel-menu-label-text', [iconName]);
 
327
        }));
 
328
 
 
329
        customMenuLabelBox.add(customMenuLabel);
 
330
        customMenuLabelBox.add(customMenuLabelEntry);
 
331
 
 
332
        let customMenuIconBox = new Gtk.Box({
 
333
            spacing: 20,
 
334
            orientation: Gtk.Orientation.HORIZONTAL,
 
335
            homogeneous: false,
 
336
            margin_left: 20,
 
337
            margin_top: 0,
 
338
            margin_bottom: 5,
 
339
            margin_right: 10
 
340
        });
 
341
        let customMenuIcon = new Gtk.CheckButton({
 
342
            label: _("Use icon with Menu button"),
 
343
            margin_left: 40,
 
344
            hexpand: true,
 
345
            halign: Gtk.Align.START
 
346
        });
 
347
        customMenuIcon.set_active(this.settings.get_boolean('use-panel-menu-icon'));
 
348
        customMenuIcon.connect('toggled', Lang.bind(this, function(check) {
 
349
            this.settings.set_boolean('use-panel-menu-icon', check.get_active());
 
350
        }));
 
351
 
 
352
        let customMenuIconEntry = new Gtk.Entry({
 
353
            halign: Gtk.Align.END
 
354
        });
 
355
        customMenuIconEntry.set_width_chars(15);
 
356
        customMenuIconEntry.set_text(this.settings.get_strv('panel-menu-icon-name')[0]);
 
357
        customMenuIconEntry.connect('changed', Lang.bind(this, function(entry) {
 
358
            let iconName = entry.get_text();
 
359
            this.settings.set_strv('panel-menu-icon-name', [iconName]);
 
360
        }));
 
361
 
 
362
        this.settings.bind('use-panel-menu-icon', customMenuIconEntry, 'sensitive', Gio.SettingsBindFlags.DEFAULT);
 
363
        customMenuIconBox.add(customMenuIcon);
 
364
        customMenuIconBox.add(customMenuIconEntry);
 
365
 
 
366
        let panelMenuBox = new Gtk.Box({
 
367
            orientation: Gtk.Orientation.VERTICAL
 
368
        });
 
369
 
 
370
        let disableMenuHotSpotBox = new Gtk.Box({
 
371
            spacing: 20,
 
372
            orientation: Gtk.Orientation.HORIZONTAL,
 
373
            homogeneous: false,
 
374
            margin_left: 20,
 
375
            margin_top: 0,
 
376
            margin_bottom: 5,
 
377
            margin_right: 10
 
378
        });
 
379
        let disableMenuHotSpot = new Gtk.CheckButton({
 
380
            label: _("Disable Menu button hot spot"),
 
381
            margin_left: 40
 
382
        });
 
383
        disableMenuHotSpot.set_active(this.settings.get_boolean('disable-panel-menu-hotspot'));
 
384
        disableMenuHotSpot.connect('toggled', Lang.bind(this, function(check) {
 
385
            this.settings.set_boolean('disable-panel-menu-hotspot', check.get_active());
 
386
        }));
 
387
 
 
388
        disableMenuHotSpotBox.add(disableMenuHotSpot);
 
389
 
 
390
        let disableMenuKeyboardAccelBox = new Gtk.Box({
 
391
            spacing: 20,
 
392
            orientation: Gtk.Orientation.HORIZONTAL,
 
393
            homogeneous: false,
 
394
            margin_left: 20,
 
395
            margin_top: 0,
 
396
            margin_bottom: 5,
 
397
            margin_right: 10
 
398
        });
 
399
        let disableMenuKeyboardAccel = new Gtk.CheckButton({
 
400
            label: _("Disable Menu button shortcut key"),
 
401
            margin_left: 40,
 
402
            hexpand: true
 
403
        });
 
404
        disableMenuKeyboardAccel.set_active(this.settings.get_boolean('disable-panel-menu-keyboard'));
 
405
        disableMenuKeyboardAccel.connect('toggled', Lang.bind(this, function(check) {
 
406
            this.settings.set_boolean('disable-panel-menu-keyboard', check.get_active());
 
407
        }));
 
408
 
 
409
        let keyboardAccelEntry = new Gtk.Entry({
 
410
            halign: Gtk.Align.END
 
411
        });
 
412
        keyboardAccelEntry.set_width_chars(15);
 
413
        keyboardAccelEntry.set_text(this.settings.get_strv('panel-menu-keyboard-accelerator')[0]);
 
414
        keyboardAccelEntry.connect('changed', Lang.bind(this, function(entry) {
 
415
            let [key, mods] = Gtk.accelerator_parse(entry.get_text());
 
416
            if(Gtk.accelerator_valid(key, mods)) {
 
417
                keyboardAccelEntry["secondary-icon-name"] = null;
 
418
                keyboardAccelEntry["secondary-icon-tooltip-text"] = null;
 
419
                let shortcut = Gtk.accelerator_name(key, mods);
 
420
                this.settings.set_strv('panel-menu-keyboard-accelerator', [shortcut]);
 
421
            } else {
 
422
                keyboardAccelEntry["secondary-icon-name"] = "dialog-warning-symbolic";
 
423
                keyboardAccelEntry["secondary-icon-tooltip-text"] = _("Invalid accelerator. Try F12, <Super>space, <Ctrl><Alt><Shift>a, etc.");
 
424
            }
 
425
        }));
 
426
 
 
427
        this.settings.bind('disable-panel-menu-keyboard', keyboardAccelEntry, 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN);
 
428
        disableMenuKeyboardAccelBox.add(disableMenuKeyboardAccel);
 
429
        disableMenuKeyboardAccelBox.add(keyboardAccelEntry);
 
430
 
 
431
 
 
432
        this.settings.bind('hide-panel-menu', panelMenuBox, 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN);
 
433
        panelMenuBox.add(customMenuLabelBox);
 
434
        panelMenuBox.add(customMenuIconBox);
 
435
        panelMenuBox.add(disableMenuHotSpotBox);
 
436
        panelMenuBox.add(disableMenuKeyboardAccelBox);
 
437
 
 
438
 
 
439
        panelSettings.add(panelSettingsTitle);
 
440
        panelSettings.add(disableHotCornerBox);
 
441
        panelSettings.add(hidePanelViewBox);
 
442
        panelSettings.add(panelViewBox);
 
443
        panelSettings.add(hidePanelAppsBox);
 
444
        panelSettings.add(panelAppsBox);
 
445
        panelSettings.add(hidePanelMenuBox);
 
446
        panelSettings.add(panelMenuBox);
 
447
 
 
448
 
 
449
        /* MENU SETTINGS */
 
450
 
 
451
        let appsSettings = new Gtk.Box({
 
452
            orientation: Gtk.Orientation.VERTICAL,
 
453
            margin_bottom: 50
 
454
        });
 
455
 
 
456
        let appsSettingsTitle = new Gtk.Label({
 
457
            label: _("<b>Menu Settings</b>"),
 
458
            use_markup: true,
 
459
            xalign: 0,
 
460
            margin_top: 5,
 
461
            margin_bottom: 5
 
462
        });
 
463
 
 
464
        let hideFavoritesBox = new Gtk.Box({
 
465
            spacing: 20,
 
466
            orientation: Gtk.Orientation.HORIZONTAL,
 
467
            homogeneous: false,
 
468
            margin_left: 20,
 
469
            margin_top: 5,
 
470
            margin_bottom: 5,
 
471
            margin_right: 10
 
472
        });
 
473
        let hideFavoritesLabel = new Gtk.Label({
 
474
            label: _("Hide Shortcuts Panel"),
 
475
            use_markup: true,
 
476
            xalign: 0,
 
477
            hexpand: true
 
478
        });
 
479
        let hideFavoritesSwitch = new Gtk.Switch ({
 
480
            halign: Gtk.Align.END
 
481
        });
 
482
        hideFavoritesSwitch.set_active(this.settings.get_boolean('hide-shortcuts'));
 
483
        hideFavoritesSwitch.connect("notify::active", Lang.bind(this, function(check) {
 
484
            this.settings.set_boolean('hide-shortcuts', check.get_active());
 
485
        }));
 
486
 
 
487
        hideFavoritesBox.add(hideFavoritesLabel);
 
488
        hideFavoritesBox.add(hideFavoritesSwitch);
 
489
 
 
490
        let menuLayoutBox = new Gtk.Box({
 
491
            spacing: 20,
 
492
            orientation: Gtk.Orientation.HORIZONTAL,
 
493
            homogeneous: false,
 
494
            margin_left: 20,
 
495
            margin_top: 5,
 
496
            margin_bottom: 5,
 
497
            margin_right: 10
 
498
        });
 
499
        let menuLayoutLabel = new Gtk.Label({label: _("Menu layout size"), hexpand:true, xalign:0});
 
500
        let menuLayoutCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
501
            menuLayoutCombo.set_size_request(120, -1);
 
502
            menuLayoutCombo.append_text(_('Large'));
 
503
            menuLayoutCombo.append_text(_('Medium'));
 
504
            menuLayoutCombo.append_text(_('Small'));
 
505
            menuLayoutCombo.set_active(this.settings.get_enum('menu-layout'));
 
506
            menuLayoutCombo.connect('changed', Lang.bind (this, function(widget) {
 
507
                    this.settings.set_enum('menu-layout', widget.get_active());
 
508
                    let selected = widget.get_active();
 
509
                    if (selected == 2) {
 
510
                        favoritesIconSizeCombo.set_active(iconSizes.indexOf(24));
 
511
                        appsListIconSizeCombo.set_active(iconSizes.indexOf(16));
 
512
                        appsGridIconSizeCombo.set_active(iconSizes.indexOf(32));
 
513
                    } else if (selected == 1) {
 
514
                        favoritesIconSizeCombo.set_active(iconSizes.indexOf(32));
 
515
                        appsListIconSizeCombo.set_active(iconSizes.indexOf(24));
 
516
                        appsGridIconSizeCombo.set_active(iconSizes.indexOf(48));
 
517
                    } else {
 
518
                        favoritesIconSizeCombo.set_active(iconSizes.indexOf(48));
 
519
                        appsListIconSizeCombo.set_active(iconSizes.indexOf(32));
 
520
                        appsGridIconSizeCombo.set_active(iconSizes.indexOf(64));
 
521
                    }
 
522
            }));
 
523
 
 
524
        menuLayoutBox.add(menuLayoutLabel);
 
525
        menuLayoutBox.add(menuLayoutCombo);
 
526
 
 
527
        let shortcutAppsDisplayBox = new Gtk.Box({
 
528
            spacing: 20,
 
529
            orientation: Gtk.Orientation.HORIZONTAL,
 
530
            homogeneous: false,
 
531
            margin_left: 20,
 
532
            margin_top: 5,
 
533
            margin_bottom: 5,
 
534
            margin_right: 10
 
535
        });
 
536
        let shortcutAppsDisplayLabel = new Gtk.Label({label: _("Icons to display on Shortcuts Panel"), 
 
537
                                                        hexpand:true, xalign:0});
 
538
        let shortcutAppsDisplayCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
539
            shortcutAppsDisplayCombo.set_size_request(120, -1);
 
540
            shortcutAppsDisplayCombo.append_text(_('Favorites'));
 
541
            shortcutAppsDisplayCombo.append_text(_('Places'));
 
542
            shortcutAppsDisplayCombo.set_active(this.settings.get_enum('shortcuts-display'));
 
543
            shortcutAppsDisplayCombo.connect('changed', Lang.bind (this, function(widget) {
 
544
                    this.settings.set_enum('shortcuts-display', widget.get_active());
 
545
            }));
 
546
 
 
547
        shortcutAppsDisplayBox.add(shortcutAppsDisplayLabel);
 
548
        shortcutAppsDisplayBox.add(shortcutAppsDisplayCombo);
 
549
 
 
550
        let startupAppsDisplayBox = new Gtk.Box({
 
551
            spacing: 20,
 
552
            orientation: Gtk.Orientation.HORIZONTAL,
 
553
            homogeneous: false,
 
554
            margin_left: 20,
 
555
            margin_top: 5,
 
556
            margin_bottom: 5,
 
557
            margin_right: 10
 
558
        });
 
559
        let startupAppsDisplayLabel = new Gtk.Label({label: _("Applications to display at startup"), 
 
560
                                                        hexpand:true, xalign:0});
 
561
        let startupAppsDisplayCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
562
            startupAppsDisplayCombo.set_size_request(120, -1);
 
563
            startupAppsDisplayCombo.append_text(_('All'));
 
564
            startupAppsDisplayCombo.append_text(_('Frequent'));
 
565
            startupAppsDisplayCombo.set_active(this.settings.get_enum('startup-apps-display'));
 
566
            startupAppsDisplayCombo.connect('changed', Lang.bind (this, function(widget) {
 
567
                    this.settings.set_enum('startup-apps-display', widget.get_active());
 
568
            }));
 
569
 
 
570
        startupAppsDisplayBox.add(startupAppsDisplayLabel);
 
571
        startupAppsDisplayBox.add(startupAppsDisplayCombo);
 
572
 
 
573
        let startupViewModeBox = new Gtk.Box({
 
574
            spacing: 20,
 
575
            orientation: Gtk.Orientation.HORIZONTAL,
 
576
            homogeneous: false,
 
577
            margin_left: 20,
 
578
            margin_top: 5,
 
579
            margin_bottom: 5,
 
580
            margin_right: 10
 
581
        });
 
582
        let startupViewModeLabel = new Gtk.Label({label: _("Default view mode for applications"), 
 
583
                                                    hexpand:true, xalign:0});
 
584
        let startupViewModeCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
585
            startupViewModeCombo.set_size_request(120, -1);
 
586
            startupViewModeCombo.append_text(_('List'));
 
587
            startupViewModeCombo.append_text(_('Grid'));
 
588
            startupViewModeCombo.set_active(this.settings.get_enum('startup-view-mode'));
 
589
            startupViewModeCombo.connect('changed', Lang.bind (this, function(widget) {
 
590
                    this.settings.set_enum('startup-view-mode', widget.get_active());
 
591
            }));
 
592
 
 
593
        startupViewModeBox.add(startupViewModeLabel);
 
594
        startupViewModeBox.add(startupViewModeCombo);
 
595
 
 
596
        let categorySelectMethodBox = new Gtk.Box({
 
597
            spacing: 20,
 
598
            orientation: Gtk.Orientation.HORIZONTAL,
 
599
            homogeneous: false,
 
600
            margin_left: 20,
 
601
            margin_top: 5,
 
602
            margin_bottom: 5,
 
603
            margin_right: 10
 
604
        });
 
605
        let categorySelectMethodLabel = new Gtk.Label({label: _("Category selection method"), hexpand:true, xalign:0});
 
606
        let categorySelectMethodCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
607
            categorySelectMethodCombo.set_size_request(120, -1);
 
608
            categorySelectMethodCombo.append_text(_('Hover'));
 
609
            categorySelectMethodCombo.append_text(_('Click'));
 
610
            categorySelectMethodCombo.set_active(this.settings.get_enum('category-selection-method'));
 
611
            categorySelectMethodCombo.connect('changed', Lang.bind (this, function(widget) {
 
612
                    this.settings.set_enum('category-selection-method', widget.get_active());
 
613
            }));
 
614
 
 
615
        categorySelectMethodBox.add(categorySelectMethodLabel);
 
616
        categorySelectMethodBox.add(categorySelectMethodCombo);
 
617
 
 
618
 
 
619
        let iconSizes = [16, 22, 24, 32, 48, 64];
 
620
 
 
621
        let favoritesIconSizeBox = new Gtk.Box({
 
622
            spacing: 20,
 
623
            orientation: Gtk.Orientation.HORIZONTAL,
 
624
            homogeneous: false,
 
625
            margin_left: 20,
 
626
            margin_top: 5,
 
627
            margin_bottom: 5,
 
628
            margin_right: 10
 
629
        });
 
630
        let favoritesIconSizeLabel = new Gtk.Label({label: _("Size of Shortcuts Panel icons"), hexpand:true, xalign:0});
 
631
        let favoritesIconSizeCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
632
            favoritesIconSizeCombo.set_size_request(120, -1);
 
633
            favoritesIconSizeCombo.append_text('16');
 
634
            favoritesIconSizeCombo.append_text('22');
 
635
            favoritesIconSizeCombo.append_text('24');
 
636
            favoritesIconSizeCombo.append_text('32');
 
637
            favoritesIconSizeCombo.append_text('48');
 
638
            favoritesIconSizeCombo.append_text('64');
 
639
            favoritesIconSizeCombo.set_active(iconSizes.indexOf(this.settings.get_int('shortcuts-icon-size')));
 
640
            favoritesIconSizeCombo.connect('changed', Lang.bind (this, function(widget) {
 
641
                    this.settings.set_int('shortcuts-icon-size', iconSizes[widget.get_active()]);
 
642
            }));
 
643
 
 
644
        favoritesIconSizeBox.add(favoritesIconSizeLabel);
 
645
        favoritesIconSizeBox.add(favoritesIconSizeCombo);
 
646
 
 
647
        let appsListIconSizeBox = new Gtk.Box({
 
648
            spacing: 20,
 
649
            orientation: Gtk.Orientation.HORIZONTAL,
 
650
            homogeneous: false,
 
651
            margin_left: 20,
 
652
            margin_top: 5,
 
653
            margin_bottom: 5,
 
654
            margin_right: 10
 
655
        });
 
656
        let appsListIconSizeLabel = new Gtk.Label({label: _("Size of Application List icons"), hexpand:true, xalign:0});
 
657
        let appsListIconSizeCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
658
            appsListIconSizeCombo.set_size_request(120, -1);
 
659
            appsListIconSizeCombo.append_text('16');
 
660
            appsListIconSizeCombo.append_text('22');
 
661
            appsListIconSizeCombo.append_text('24');
 
662
            appsListIconSizeCombo.append_text('32');
 
663
            appsListIconSizeCombo.append_text('48');
 
664
            appsListIconSizeCombo.append_text('64');
 
665
            appsListIconSizeCombo.set_active(iconSizes.indexOf(this.settings.get_int('apps-list-icon-size')));
 
666
            appsListIconSizeCombo.connect('changed', Lang.bind (this, function(widget) {
 
667
                    this.settings.set_int('apps-list-icon-size', iconSizes[widget.get_active()]);
 
668
            }));
 
669
 
 
670
        appsListIconSizeBox.add(appsListIconSizeLabel);
 
671
        appsListIconSizeBox.add(appsListIconSizeCombo);
 
672
 
 
673
        let appsGridIconSizeBox = new Gtk.Box({
 
674
            spacing: 20,
 
675
            orientation: Gtk.Orientation.HORIZONTAL,
 
676
            homogeneous: false,
 
677
            margin_left: 20,
 
678
            margin_top: 5,
 
679
            margin_bottom: 5,
 
680
            margin_right: 10
 
681
        });
 
682
        let appsGridIconSizeLabel = new Gtk.Label({label: _("Size of Application Grid icons"), hexpand:true, xalign:0});
 
683
        let appsGridIconSizeCombo = new Gtk.ComboBoxText({halign:Gtk.Align.END});
 
684
            appsGridIconSizeCombo.set_size_request(120, -1);
 
685
            appsGridIconSizeCombo.append_text('16');
 
686
            appsGridIconSizeCombo.append_text('22');
 
687
            appsGridIconSizeCombo.append_text('24');
 
688
            appsGridIconSizeCombo.append_text('32');
 
689
            appsGridIconSizeCombo.append_text('48');
 
690
            appsGridIconSizeCombo.append_text('64');
 
691
            appsGridIconSizeCombo.set_active(iconSizes.indexOf(this.settings.get_int('apps-grid-icon-size')));
 
692
            appsGridIconSizeCombo.connect('changed', Lang.bind (this, function(widget) {
 
693
                    this.settings.set_int('apps-grid-icon-size', iconSizes[widget.get_active()]);
 
694
            }));
 
695
 
 
696
        appsGridIconSizeBox.add(appsGridIconSizeLabel);
 
697
        appsGridIconSizeBox.add(appsGridIconSizeCombo);
 
698
 
 
699
        appsSettings.add(appsSettingsTitle);
 
700
        appsSettings.add(hideFavoritesBox);
 
701
        appsSettings.add(menuLayoutBox);
 
702
        appsSettings.add(shortcutAppsDisplayBox);
 
703
        appsSettings.add(startupAppsDisplayBox);
 
704
        appsSettings.add(startupViewModeBox);
 
705
        appsSettings.add(categorySelectMethodBox);
 
706
        appsSettings.add(favoritesIconSizeBox);
 
707
        appsSettings.add(appsListIconSizeBox);
 
708
        appsSettings.add(appsGridIconSizeBox);
 
709
 
 
710
 
 
711
        frame.add(panelSettings);
 
712
        frame.add(appsSettings);
 
713
 
 
714
 
 
715
        //this.add(frame);
 
716
 
 
717
        let scrollWindow = new Gtk.ScrolledWindow({
 
718
            'hscrollbar-policy': Gtk.PolicyType.AUTOMATIC,
 
719
            'vscrollbar-policy': Gtk.PolicyType.AUTOMATIC,
 
720
            'hexpand': true, 'vexpand': true
 
721
        });
 
722
        scrollWindow.add_with_viewport(frame);
 
723
 
 
724
        this.add(scrollWindow);
 
725
 
 
726
    }
 
727
});
 
728
 
 
729
function init() {
 
730
    Convenience.initTranslations();
 
731
}
 
732
 
 
733
function buildPrefsWidget() {
 
734
    let widget = new GnoMenuPreferencesWidget({
 
735
        orientation: Gtk.Orientation.VERTICAL,
 
736
        spacing: 5,
 
737
        border_width: 5
 
738
    });
 
739
    widget.show_all();
 
740
 
 
741
    return widget;
 
742
}
 
743
 
 
744