This file is indexed.

/usr/share/gnome-shell/extensions/multi-monitors-add-on@spin83/mmcalendar.js is in gnome-shell-extension-multi-monitors 0.00~git20171014.1.df5d6e4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
/*
Copyright (C) 2014  spin83

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, visit https://www.gnu.org/licenses/.
*/

const Lang = imports.lang;

const St = imports.gi.St;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Shell = imports.gi.Shell;
const Clutter = imports.gi.Clutter;
const GnomeDesktop = imports.gi.GnomeDesktop;
const GObject = imports.gi.GObject;

const Config = imports.misc.config;

const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const MessageList = imports.ui.messageList;
const DateMenu = imports.ui.dateMenu;
const Calendar = imports.ui.calendar;

const ExtensionUtils = imports.misc.extensionUtils;
const MultiMonitors = ExtensionUtils.getCurrentExtension();
const Convenience = MultiMonitors.imports.convenience;

const Gettext_gtk30 = imports.gettext.domain('gtk30');
const gtk30_ = Gettext_gtk30.gettext;

const MultiMonitorsCalendar = new Lang.Class({
	Name: 'MultiMonitorsCalendar',
    Extends: Calendar.Calendar,
    
    _init: function() {
    	this._currentVersion = Config.PACKAGE_VERSION.split('.');
        this._weekStart = Shell.util_get_week_start();
        if (this._currentVersion[0]==3 && this._currentVersion[1]>20) {
        	this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
        }
        else {
        	this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.calendar' });
        }
        
        this._showWeekdateKeyId = this._settings.connect('changed::' + Calendar.SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange));
        this._useWeekdate = this._settings.get_boolean(Calendar.SHOW_WEEKDATE_KEY);

        // Find the ordering for month/year in the calendar heading
        this._headerFormatWithoutYear = '%B';
        switch (gtk30_('calendar:MY')) {
        case 'calendar:MY':
            this._headerFormat = '%B %Y';
            break;
        case 'calendar:YM':
            this._headerFormat = '%Y %B';
            break;
        default:
            log('Translation of "calendar:MY" in GTK+ is not correct');
            this._headerFormat = '%B %Y';
            break;
        }

        // Start off with the current date
        this._selectedDate = new Date();

        this._shouldDateGrabFocus = false;

        this.actor = new St.Widget({ style_class: 'calendar',
                                     layout_manager: new Clutter.TableLayout(),
                                     reactive: true });

        this.actor.connect('scroll-event',
                           Lang.bind(this, this._onScroll));
        
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));

        this._buildHeader ();
    },
    
    _onDestroy: function(actor) {
    	this._settings.disconnect(this._showWeekdateKeyId);
    }
});

const MultiMonitorsEventsSection = new Lang.Class({
    Name: 'MultiMonitorsEventsSection',
    Extends: MessageList.MessageListSection,

    _init: function() {
    	this._currentVersion = Config.PACKAGE_VERSION.split('.');
        this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
        this._reloadEventsId = this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
        this._eventSource = new Calendar.EmptyEventSource();

        if (this._currentVersion[0]==3 && this._currentVersion[1]>22) {
        	this.parent();

            this._title = new St.Button({ style_class: 'events-section-title',
                                          label: '',
                                          x_align: St.Align.START,
                                          can_focus: true });
            this.actor.insert_child_below(this._title, null);

            this._title.connect('clicked', Lang.bind(this, this._onTitleClicked));
            this._title.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
        }
        else {
        	this.parent('');
        }

        this._defaultAppSystem = Shell.AppSystem.get_default(); 
        this._appInstalledChangedId = this._defaultAppSystem.connect('installed-changed',
                                              Lang.bind(this, this._appInstalledChanged));
        
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
        this._appInstalledChanged();
    },
    
    _onDestroy: function(actor) {
    	this._desktopSettings.disconnect(this._reloadEventsId);
    	this._defaultAppSystem.disconnect(this._appInstalledChangedId);
    },

    _ignoreEvent: Calendar.EventsSection.prototype._ignoreEvent,
    setEventSource: Calendar.EventsSection.prototype.setEventSource,

    get allowed() {
        return Main.sessionMode.showCalendarEvents;
    },

    _updateTitle: Calendar.EventsSection.prototype._updateTitle,
    _reloadEvents: Calendar.EventsSection.prototype._reloadEvents,
    _appInstalledChanged: Calendar.EventsSection.prototype._appInstalledChanged,
    _getCalendarApp: Calendar.EventsSection.prototype._getCalendarApp,
    _onTitleClicked: Calendar.EventsSection.prototype._onTitleClicked,
    setDate: Calendar.EventsSection.prototype.setDate,
    _shouldShow: Calendar.EventsSection.prototype._shouldShow,
    _sync: Calendar.EventsSection.prototype._sync
});

const MultiMonitorsNotificationSection = new Lang.Class({
    Name: 'MultiMonitorsNotificationSection',
    Extends: MessageList.MessageListSection,

    _init: function() {
    	this._currentVersion = Config.PACKAGE_VERSION.split('.');
    	
    	if (this._currentVersion[0]==3 && this._currentVersion[1]>22) {
    		this.parent();
    	}
    	else {
    		this.parent(_("Notifications"));
    	}
        this._sources = new Map();
        this._nUrgent = 0;

        this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
        Main.messageTray.getSources().forEach(Lang.bind(this, function(source) {
            this._sourceAdded(Main.messageTray, source);
        }));

        this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
    },
    
    _onDestroy: function(actor) {
    	Main.messageTray.disconnect(this._sourceAddedId);
    	let source, obj;
    	for ([source, obj] of this._sources.entries()) {
    		this._onSourceDestroy(source, obj);
    	}
    },

    get allowed() {
        return Main.sessionMode.hasNotifications &&
               !Main.sessionMode.isGreeter;
    },

    _createTimeLabel: Calendar.NotificationSection.prototype._createTimeLabel,
    _sourceAdded: Calendar.NotificationSection.prototype._sourceAdded,
    _onNotificationAdded: Calendar.NotificationSection.prototype._onNotificationAdded,
    _onSourceDestroy: Calendar.NotificationSection.prototype._onSourceDestroy,
    _onMapped: Calendar.NotificationSection.prototype._onMapped
});

const MultiMonitorsCalendarMessageList = new Lang.Class({
    Name: 'MultiMonitorsCalendarMessageList',
    Extends: Calendar.CalendarMessageList,
    
    _init: function() {
    	this._currentVersion = Config.PACKAGE_VERSION.split('.');
    	
        this.actor = new St.Widget({ style_class: 'message-list',
                                     layout_manager: new Clutter.BinLayout(),
                                     x_expand: true, y_expand: true });

        this._placeholder = new Calendar.Placeholder();
        this.actor.add_actor(this._placeholder.actor);

        this._scrollView = new St.ScrollView({ style_class: 'vfade',
                                               overlay_scrollbars: true,
                                               x_expand: true, y_expand: true,
                                               x_fill: true, y_fill: true });
        this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
        
        if (this._currentVersion[0]==3 && this._currentVersion[1]>22) {
	        let box = new St.BoxLayout({ vertical: true,
	                                     x_expand: true, y_expand: true });
	        this.actor.add_actor(box);

	        box.add_actor(this._scrollView);
	
	        this._clearButton = new St.Button({ style_class: 'message-list-clear-button button',
	                                            label: _("Clear All"),
	                                            can_focus: true });
	        this._clearButton.set_x_align(Clutter.ActorAlign.END);
	        this._clearButton.connect('clicked', () => {
	            let sections = [...this._sections.keys()];
	            sections.forEach((s) => { s.clear(); });
	        });
	        box.add_actor(this._clearButton);
    	}
        else {
        	this.actor.add_actor(this._scrollView);
        }
        this._sectionList = new St.BoxLayout({ style_class: 'message-list-sections',
                                               vertical: true,
                                               y_expand: true,
                                               y_align: Clutter.ActorAlign.START });
        this._scrollView.add_actor(this._sectionList);
        this._sections = new Map();

//        this._mediaSection = new Mpris.MediaSection();
//        this._addSection(this._mediaSection);

        this._notificationSection = new MultiMonitorsNotificationSection();
        this._addSection(this._notificationSection);
        this._eventsSection = new MultiMonitorsEventsSection();
        this._addSection(this._eventsSection);

        this._sessionModeUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sync));
        
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
    },
    
    _onDestroy: function(actor) {
    	Main.sessionMode.disconnect(this._sessionModeUpdatedId);
    }
});

var MultiMonitorsDateMenuButton = new Lang.Class({
    Name: 'MultiMonitorsDateMenuButton',
    Extends: PanelMenu.Button,

    _init: function() {
    	this._currentVersion = Config.PACKAGE_VERSION.split('.');
    	let hbox;
    	let vbox;
    	
        let menuAlignment = 0.5;
        if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
            menuAlignment = 1.0 - menuAlignment;
        this.parent(menuAlignment);

        this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
//        this._indicator = new DateMenu.MessagesIndicator()

        let box = new St.BoxLayout();
//        box.add_actor(new DateMenu.IndicatorPad(this._indicator.actor));
        box.add_actor(this._clockDisplay);
//        box.add_actor(this._indicator.actor);

        this.actor.label_actor = this._clockDisplay;
        this.actor.add_actor(box);
        this.actor.add_style_class_name ('clock-display');
        
        let layout = new DateMenu.FreezableBinLayout();
        let bin = new St.Widget({ layout_manager: layout });
        
        if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
        	// For some minimal compatibility with PopupMenuItem
        	bin._delegate = this;
        }
        
        this.menu.box.add_child(bin);

        hbox = new St.BoxLayout({ name: 'calendarArea' });
        bin.add_actor(hbox);
        this._calendar = new MultiMonitorsCalendar();
        this._calendar.connect('selected-date-changed',
                               Lang.bind(this, function(calendar, date) {
                                   layout.frozen = !DateMenu._isToday(date);
                                   this._messageList.setDate(date);
                               }));

        this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
            // Whenever the menu is opened, select today
            if (isOpen) {
                let now = new Date();
                this._calendar.setDate(now);
                this._date.setDate(now);
                this._messageList.setDate(now);
            }
        }));

        // Fill up the first column
        this._messageList = new MultiMonitorsCalendarMessageList();
        hbox.add(this._messageList.actor, { expand: true, y_fill: false, y_align: St.Align.START });

        // Fill up the second column
        if (this._currentVersion[0]==3 && this._currentVersion[1]>22) {
	        let boxLayout = new DateMenu.CalendarColumnLayout(this._calendar.actor);
	        vbox = new St.Widget({ style_class: 'datemenu-calendar-column',
	                               layout_manager: boxLayout });
	        boxLayout.hookup_style(vbox);
        }
        else {
            vbox = new St.BoxLayout({ style_class: 'datemenu-calendar-column',
                vertical: true });
        }
        hbox.add(vbox);
        
        this._date = new DateMenu.TodayButton(this._calendar);
        vbox.add_actor(this._date.actor);

        vbox.add_actor(this._calendar.actor);

        this._clock = new GnomeDesktop.WallClock();
        this._clock.bind_property('clock', this._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE);
        if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
        	this._clockNotifyTimezoneId = this._clock.connect('notify::timezone', Lang.bind(this, this._updateTimeZone));
        }
        
        this._sessionModeUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
        
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
        
        this._sessionUpdated();
    },
    
    _onDestroy: function(actor) {
    	Main.sessionMode.disconnect(this._sessionModeUpdatedId);
        if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
        	this._clock.disconnect(this._clockNotifyTimezoneId);
        }
    },
    
    _getEventSource: function() {
        return new Calendar.DBusEventSource();
    },

    _setEventSource: function(eventSource) {
        if (this._eventSource)
            this._eventSource.destroy();

        this._calendar.setEventSource(eventSource);
        this._messageList.setEventSource(eventSource);

        this._eventSource = eventSource;
    },
    
    _updateTimeZone: DateMenu.DateMenuButton.prototype._updateTimeZone,

    _sessionUpdated: function() {
        let eventSource;
        let showEvents = Main.sessionMode.showCalendarEvents;
        if (showEvents) {
            eventSource = this._getEventSource();
        } else {
            eventSource = new Calendar.EmptyEventSource();
        }
        this._setEventSource(eventSource);

        // Displays are not actually expected to launch Settings when activated
        // but the corresponding app (clocks, weather); however we can consider
        // that display-specific settings, so re-use "allowSettings" here ...
//        this._displaysSection.visible = Main.sessionMode.allowSettings;
    }
    
});