PK
ZR# = schemas/org.gnome.shell.extensions.lunar-calendar.gschema.xmlUT 3h`ux d
true
false
true
false
false
true
'white'
'none'
PK
\RF schemas/gschemas.compiledUT 37h`ux d GVariant X ( UAP X ) H L org.gnome.shell.extensions.lunar-calendar (
d v _ v L a" v }~ v 6 > 6 v @ E v E v P U - U
v h m , m v x »G v jieri-color white (s)gen-zhi (b) ba-zi (b).path /org/gnome/shell/extensions/lunar-calendar/ sshow-date (b)jieri (b)show-calendar (b)zti-dx none e xx-small x-small small none (s(yau))show-time (b) PK
ZR͠% % extension.jsUT 3h`ux d
const { Clutter, GObject, Gdk, LunarDate, GnomeDesktop, St } = imports.gi;
const Main = imports.ui.main;
const Calendar = imports.ui.calendar;
const MessageList = imports.ui.messageList;
const Lang = imports.lang;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
const Gettext_lunarDate = imports.gettext.domain('lunar-date');
const _ld = Gettext_lunarDate.gettext;
const diZhi = "Zǐ, Chǒu, Yín, Mǎo, Chén, Sì, Wǔ, Wèi, Shēn, Yǒu, Xū, Hài"
.split(", ").map(function(_){ return _ld(_); });
const jieri_str = LunarDate.DATE_MAJOR_VERSION >= 3 || LunarDate.DATE_MAJOR_VERSION == 2 && LunarDate.DATE_MINOR_VERSION >= 9 ? "%(holiday)" : "%(jieri)";
let replacementFunc = [], ld = new LunarDate.Date, settingsChanged = [], localSettings = {};
let settings;
ld.setDate = function (date) {
this.set_solar_date(date.getFullYear(), (1+date.getMonth()), date.getDate(), date.getHours());
};
ld.setDateNoon = function (date) {
this.set_solar_date(date.getFullYear(), (1+date.getMonth()), date.getDate(), 12);
};
ld.getShi = function () {
return diZhi[~~((+this.strftime("%(hour)")+1)/2)%12];
};
function init() {
}
function _make_new_with_args (my_class, args) {
return new (Function.prototype.bind.apply(my_class,
[null].concat(Array.prototype.slice.call(args))))();
}
function _getLunarClockDisplay() {
let show_date = settings.get_boolean('show-date');
return ((show_date ? "\u2001" + ld.strftime("%(YUE)月%(RI)日") : "") +
(settings.get_boolean('show-time') ? ld.getShi() + (show_date ? "时" : "") : ""));
}
// avoid replacing WallClock with a custom Object inheriting from
// GObject due to bgo#734071
var LunarCalendarMessage = GObject.registerClass(
class LunarCalendarMessage extends MessageList.Message {
canClear() { return false; }
canClose() { return false; }
_sync() {
super._sync();
this._closeButton.visible = this.canClear();
}
});
var LunarCalendarSection = GObject.registerClass(
class LunarCalendarSection extends MessageList.MessageListSection {
_init() {
super._init('Lunar Calendar');
this._title = new St.Button({ style_class: 'events-section-title',
label: '',
x_align: Clutter.ActorAlign.START,
can_focus: true });
this.insert_child_below(this._title, null);
}
get allowed() {
return true;
}
_reloadEvents() {
this._reloading = true;
this._list.destroy_all_children();
let jr = settings.get_boolean('jieri') ? ld.strftime(jieri_str) : "";
if (jr != "")
this.addMessage(new LunarCalendarMessage("节日", ld.get_jieri("\n")), false);
if (settings.get_boolean('ba-zi'))
this.addMessage(new LunarCalendarMessage("八字", ld.strftime("%(Y8)年%(M8)月%(D8)日")), false);
if (settings.get_boolean('gen-zhi'))
this.addMessage(new LunarCalendarMessage("干支", ld.strftime("%(Y60)年%(M60)月%(D60)日")), false);
this._reloading = false;
this._sync();
}
setDate(date) {
// 3.38
if (super.setDate) {
super.setDate(date);
}
ld.setDateNoon(date);
let cny = ld.strftime("%(shengxiao)");
this._title.label = ld.strftime("%(NIAN)年%(YUE)月%(RI)日");
this._reloadEvents();
}
_shouldShow() { return true; }
_sync() {
if (this._reloading)
return;
super._sync();
}
});
function enable() {
settings = Convenience.getSettings();
settings.connect('changed', function() {
for (x in settingsChanged) {
settingsChanged[x]();
}
});
let dm = Main.panel.statusArea.dateMenu;
let cal = dm._calendar;
let ml = dm._messageList;
let cny_now;
replacementFunc.calendarUpdater = cal._update;
replacementFunc.originalMonthHeader = cal._headerFormat;
// gnome 3.12
replacementFunc.calendarRebuilder = cal._rebuildCalendar;
let rebuild_in_progress = false;
let update_in_progress = false;
let fixupHeader = _("%A %B %e, %Y").match(/%Y[^%]+%/);
if (fixupHeader)
cal._headerFormat = cal._headerFormat.replace(/%Y.%/, fixupHeader);
let _toHex = function (number) {
let t = (number * 65535).toString(16);
while (t.length < 4) t = '0' + t;
return t;
};
settingsChanged.updateLocal = function () {
let color = new Gdk.RGBA;
color.parse('white');
color.parse(settings.get_string('jieri-color'));
localSettings.jieri_color = "#" + _toHex(color.red) + _toHex(color.green) + _toHex(color.blue);
};
settingsChanged.updateLocal();
let updateDate = function () {
ld.setDate(new Date());
cny_now = ld.strftime("%(shengxiao)");
// gnome 3.16
ml._lunarCalendarSection.cny_now = cny_now;
let date_label = dm._date._dateLabel;
date_label.text = date_label.text + (date_label.text.match(/[.,]/) ? ", " : "\u2001") + cny_now;
};
dm._clock.run_dispose();
// gnome 3.14.1
replacementFunc.openMenuId = dm.menu.connect('open-state-changed', function(menu, isOpen) {
if (isOpen)
updateDate();
});
dm._clock = new GnomeDesktop.WallClock();
let _clockUpdater = function () {
ld.setDate(new Date());
dm._clockDisplay.text = dm._clock.clock + _getLunarClockDisplay();
};
dm._clock.connect('notify::clock', Lang.bind(dm, _clockUpdater));
_clockUpdater();
settingsChanged.refreshClock = _clockUpdater;
let lunarButton = function (orig_button, iter_date, oargs) {
let fat_button = false;
if (+oargs[0].label == +iter_date.getDate().toString()) {
iter_date._lunar_iter_found = true;
ld.setDateNoon(iter_date);
let yd = settings.get_boolean('show-calendar') ? ld.strftime("%(ri)") : "";
let jr = settings.get_boolean('jieri') ? ld.strftime(jieri_str) : "";
let dx = settings.get_string('zti-dx');
fat_button = yd != "";
let l = oargs[0].label;
//if (yd != "") l = " " + l + " ";
if (jr != "") l = "" + l + "";
if (yd != "") l += "\n" +
ld.strftime(yd == "1" ? "%(YUE)月" : "%(RI)") +
"";
if (dx != "none") l = "" + l + "";
oargs[0].label = l;
}
let new_button = _make_new_with_args(orig_button, oargs);
return new_button;
};
let updateYear = function (that) {
ld.setDateNoon(that._selectedDate);
let cny = ld.strftime("%(shengxiao)");
if (cny != cny_now)
that._monthLabel.text = that._monthLabel.text + " / " + cny;
};
// gnome 3.12
cal._rebuildCalendar = function () {
if (rebuild_in_progress) {
// gnome 3.36
log("lunarcal: stopped nested calendar._rebuildCalendar");
return;
}
rebuild_in_progress = true;
let orig_button = St.Button;
let orig_date = Date;
let iter_date = new orig_date();
Date = function () {
let new_date = _make_new_with_args(orig_date, arguments);
if (!iter_date._lunar_iter_found &&
arguments.length > 0 && arguments[0] instanceof orig_date) {
iter_date = new_date;
}
return new_date;
};
St.Button = function () {
return lunarButton(orig_button, iter_date, arguments);
};
replacementFunc.calendarRebuilder.apply(this, arguments);
St.Button = orig_button;
Date = orig_date;
let cal_style_class = cal.style_class.split(' ')
.filter(function(e){ return e.length && e != 'lunar-calendar'; });
if (settings.get_boolean('show-calendar'))
cal_style_class.push('lunar-calendar');
cal.style_class = cal_style_class.join(' ');
rebuild_in_progress = false;
};
cal._update = function () {
if (update_in_progress) {
// gnome 3.36
log("lunarcal: stopped nested calendar._update");
return;
}
update_in_progress = true;
replacementFunc.calendarUpdater.apply(this, arguments);
updateYear(this);
if (ml._lunarCalendarSection && this._selectedDate) {
// 3.38
ml._lunarCalendarSection.setDate(this._selectedDate);
}
update_in_progress = false;
};
settingsChanged.rebuildCal = function () {
cal._rebuildCalendar();
// 3.38
if (ml._lunarCalendarSection && cal._selectedDate) {
cal._update();
}
};
settingsChanged.rebuildCal();
// gnome 3.16
ml._lunarCalendarSection = new LunarCalendarSection();
ml._addSection(ml._lunarCalendarSection);
ml._sectionList.set_child_at_index(ml._lunarCalendarSection, 3);
ml._lunarCalendarSection._sync();
ml._sync();
}
function disable() {
let dm = Main.panel.statusArea.dateMenu;
let restore_style = dm._calendar.style_class.split(' ')
.filter(function(e){ return e.length && e != 'lunar-calendar'; })
.join(' ');
dm._calendar.style_class = restore_style;
dm._calendar._update = replacementFunc.calendarUpdater;
dm._calendar._headerFormat = replacementFunc.originalMonthHeader;
dm._calendar._rebuildCalendar = replacementFunc.calendarRebuilder;
// gnome 3.36
dm._messageList._lunarCalendarSection.run_dispose();
delete dm._messageList._lunarCalendarSection;
dm._clock.run_dispose();
dm._clock = new GnomeDesktop.WallClock();
// gnome 3.14.1
dm.menu.disconnect(replacementFunc.openMenuId);
dm._clock.bind_property('clock', dm._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE);
settingsChanged.rebuildCal();
settingsChanged = [];
settings.run_dispose();
settings = null;
delete replacementFunc.calendarUpdater;
delete replacementFunc.originalMonthHeader;
delete replacementFunc.calendarRebuilder;
delete replacementFunc.openMenuId;
}
PK
ZRy|5 convenience.jsUT 3h`ux d
const Gio = imports.gi.Gio;
const ExtensionUtils = imports.misc.extensionUtils;
function getSettings() {
let extension = ExtensionUtils.getCurrentExtension();
return new Gio.Settings({
settings_schema: Gio.SettingsSchemaSource.new_from_directory(
extension.dir.get_child('schemas').get_path(),
Gio.SettingsSchemaSource.get_default(),
false)
.lookup(extension.metadata['settings-schema'], false)
});
}
PK
ZR stylesheet.cssUT 3h`ux d .lunar-calendar .calendar-day-with-events {
background-size: cover;
box-shadow: 0px -1px rgba(238, 238, 236, 0.3) inset;
}
PK
ZR( prefs.uiUT 4h`ux d
PK
N[R۩ prefs.jsUT 4h`ux d
const Lang = imports.lang;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
let settings, openWinsCounter;
function init() {
}
function buildPrefsWidget() {
let ui = Gtk.Builder.new_from_file(Me.dir.get_path() + "/prefs.ui");
let win = ui.get_object('content-table');
if (!settings) {
settings = Convenience.getSettings();
openWinsCounter = 0;
}
else {
openWinsCounter = openWinsCounter + 1;
}
settings.bind('show-date', ui.get_object('show-date'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('show-time', ui.get_object('show-time'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('show-calendar', ui.get_object('show-calendar'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('ba-zi', ui.get_object('ba-zi'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('gen-zhi', ui.get_object('gen-zhi'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('jieri', ui.get_object('jieri'), 'active', Gio.SettingsBindFlags.DEFAULT);
// using on the calendar day buttons does not work anymore :-(
let zti_inhibitor = false;
for (let i = 1; i <= 4; ++i) {
let cl = i;
ui.get_object('zti-' + i).connect('toggled', function(object) {
if (zti_inhibitor) { return; }
zti_inhibitor = true;
for (let j = 1; j <= 4; ++j) {
ui.get_object('zti-' + j).set_active(j <= cl);
}
settings.set_enum('zti-dx', cl);
zti_inhibitor = false;
});
}
let fontsizeFromSetting = function() {
ui.get_object('zti-' + settings.get_enum('zti-dx')).toggled();
};
settings.connect('changed::zti-dx', fontsizeFromSetting);
fontsizeFromSetting();
win.connect('destroy', function () {
if (!openWinsCounter) {
settings.run_dispose();
settings = null;
}
else {
openWinsCounter = openWinsCounter - 1;
}
});
return win;
}
PK @VcxU
metadata.json{
"_generated": "Generated by SweetTooth, do not edit",
"creator": "Nei",
"description": "Display Chinese Lunar Calendar in panel\n\n\u26a0\u26a0\u26a0 dependency: typelib-1_0-LunarDate-3_0 / gir1.2-lunardate-3.0",
"name": "Lunar Calendar \u519c\u5386",
"settings-schema": "org.gnome.shell.extensions.lunar-calendar",
"shell-version": [
"40",
"41"
],
"url": "",
"uuid": "lunarcal@ailin.nemui",
"version": 27
}PK
ZR# = schemas/org.gnome.shell.extensions.lunar-calendar.gschema.xmlUT 3h`ux d PK
\RF k schemas/gschemas.compiledUT 37h`ux d PK
ZR͠% % extension.jsUT 3h`ux d PK
ZRy|5 - convenience.jsUT 3h`ux d PK
ZR / stylesheet.cssUT 3h`ux d PK
ZR( I0 prefs.uiUT 4h`ux d PK
N[R۩ J prefs.jsUT 4h`ux d PK @VcxU
R metadata.jsonPK T