diff --git a/PersianCalendar@oxygenws.com/Calendar.js b/PersianCalendar@oxygenws.com/Calendar.js index a29744e..88f493f 100644 --- a/PersianCalendar@oxygenws.com/Calendar.js +++ b/PersianCalendar@oxygenws.com/Calendar.js @@ -299,9 +299,9 @@ export class Calendar { if (is_same_month) { if (events[0]) { - styleClass += ' pcalendar-day-with-events '; + styleClass += ' calendar-day-with-events pcalendar-day-with-events '; } - style += `font-weight:600;`; + style += `font-weight:400;`; if (events[1]) { styleClass += ' calendar-weekend pcalendar-weekend '; @@ -429,14 +429,14 @@ export class Calendar { _getDateButton(date, dayOfWeek, calendar) { const button = new St.Button({ - label: this.format( + label: this._str.transDigits(this.format( this._settings.get_string(`${calendar}-display-format`), date.day, date.month, date.year, dayOfWeek, calendar, - ), + )), style_class: 'calendar-day-base pcalendar-date-label', x_align: Clutter.ActorAlign.CENTER, x_expand: true, diff --git a/PersianCalendar@oxygenws.com/extension.js b/PersianCalendar@oxygenws.com/extension.js index 5b7d16d..68656b9 100644 --- a/PersianCalendar@oxygenws.com/extension.js +++ b/PersianCalendar@oxygenws.com/extension.js @@ -68,7 +68,7 @@ const PersianCalendar = GObject.registerClass( this.label.set_style('color:'); } })); - + /// this.event_hooks.push(this._settings.connect('changed::widget-format', () => this._updateDate(true, true))); @@ -114,51 +114,17 @@ const PersianCalendar = GObject.registerClass( // this._settings.connect('changed::font', this._onFontChangeForCalendar.bind(this)); // this._settings.connect('changed::custom-font', this._onFontChangeForCalendar.bind(this)); // ////////////////////////////// - - this._generateConverterPart(); + + this._genConverterPart(); // action buttons - const actionButtons = new PopupMenu.PopupBaseMenuItem({ + this._actionButtonsPart = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, }); - this.menu.addMenuItem(actionButtons); - - // Add preferences button - let icon = new St.Icon({ - icon_name: 'emblem-system-symbolic', - style_class: 'popup-menu-icon calendar-popup-menu-icon', - }); - - const preferencesIcon = new St.Button({ - child: icon, - style_class: 'button system-menu-action calendar-preferences-button', - reactive: true, - can_focus: true, - x_align: Clutter.ActorAlign.CENTER, - x_expand: true, - }); - preferencesIcon.connect('clicked', () => { - this._openPreferences(); - }); - actionButtons.actor.add_child(preferencesIcon); - - // Add Nowruz button - icon = new St.Icon({ - icon_name: 'emblem-favorite-symbolic', - style_class: 'popup-menu-icon calendar-popup-menu-icon', - }); - - const nowruzIcon = new St.Button({ - child: icon, - style_class: 'button system-menu-action calendar-preferences-button', - reactive: true, - can_focus: true, - x_align: Clutter.ActorAlign.CENTER, - x_expand: true, - }); - nowruzIcon.connect('clicked', this._showNowruzNotification.bind(this)); - actionButtons.actor.add_child(nowruzIcon); + this.menu.addMenuItem(this._actionButtonsPart); + this._genActionButtonsPart(); + this.event_hooks.push(Main.sessionMode.connect('updated', () => this._genActionButtonsPart())); this.menu.connect('open-state-changed', (isOpen) => { if (isOpen) { @@ -171,6 +137,47 @@ const PersianCalendar = GObject.registerClass( this.show(); } + _genActionButtonsPart() { + this._actionButtonsPart.remove_all_children(); + if (!Main.sessionMode.isLocked) { + // Add preferences button + let icon = new St.Icon({ + icon_name: 'emblem-system-symbolic', + style_class: 'popup-menu-icon calendar-popup-menu-icon', + }); + + const preferencesIcon = new St.Button({ + child: icon, + style_class: 'button system-menu-action calendar-preferences-button', + reactive: true, + can_focus: true, + x_align: Clutter.ActorAlign.CENTER, + x_expand: true, + }); + preferencesIcon.connect('clicked', () => { + this._openPreferences(); + }); + this._actionButtonsPart.actor.add_child(preferencesIcon); + + // Add Nowruz button + icon = new St.Icon({ + icon_name: 'emblem-favorite-symbolic', + style_class: 'popup-menu-icon calendar-popup-menu-icon', + }); + + const nowruzIcon = new St.Button({ + child: icon, + style_class: 'button system-menu-action calendar-preferences-button', + reactive: true, + can_focus: true, + x_align: Clutter.ActorAlign.CENTER, + x_expand: true, + }); + nowruzIcon.connect('clicked', this._showNowruzNotification.bind(this)); + this._actionButtonsPart.actor.add_child(nowruzIcon); + } + } + _onFontChangeForIcon() { // const font_desc = Pango.FontDescription.from_string(this._settings.get_string('font')); // font_desc = Pango.FontDescription.from_string(font_desc.get_family()); @@ -214,8 +221,10 @@ const PersianCalendar = GObject.registerClass( // is holiday? if (events[1]) { this.label.add_style_class_name('pcalendar-tray-holiday'); + this.label.add_style_class_name('pcalendar-tray-holiday-light-dark'); } else { this.label.remove_style_class_name('pcalendar-tray-holiday'); + this.label.remove_style_class_name('pcalendar-tray-holiday-light-dark'); } this.label.set_text( @@ -246,7 +255,7 @@ const PersianCalendar = GObject.registerClass( return true; } - _generateConverterPart() { + _genConverterPart() { // Add date conversion button const converterMenu = new PopupMenu.PopupSubMenuMenuItem(this._gettext.__('Date conversion')); converterMenu.actor.add_style_class_name('pcalendar-font'); @@ -480,20 +489,20 @@ const PersianCalendar = GObject.registerClass( month_delta, ).format(month_delta, day_delta, pdate.year + 1); } - this.nowruz_notify(this._str.transDigits(nowruz)); + this._nowruzNotify(this._str.transDigits(nowruz)); } else if (day_delta !== 0) { nowruz = this._gettext.n__( '%d day left to Nowruz %d', '%d days left to Nowruz %d', day_delta, ).format(day_delta, pdate.year + 1); - this.nowruz_notify(this._str.transDigits(nowruz)); + this._nowruzNotify(this._str.transDigits(nowruz)); } else { - this.nowruz_notify(this._gettext.__('Happy New Year')); + this._nowruzNotify(this._gettext.__('Happy New Year')); } } - nowruz_notify(title) { + _nowruzNotify(title) { this.notify(title, undefined, 'emblem-favorite-symbolic'); } diff --git a/PersianCalendar@oxygenws.com/locale/fa_IR/LC_MESSAGES/persian-calendar.po b/PersianCalendar@oxygenws.com/locale/fa_IR/LC_MESSAGES/persian-calendar.po index 949bebe..7523bbc 100644 --- a/PersianCalendar@oxygenws.com/locale/fa_IR/LC_MESSAGES/persian-calendar.po +++ b/PersianCalendar@oxygenws.com/locale/fa_IR/LC_MESSAGES/persian-calendar.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-04 10:03+0200\n" +"POT-Creation-Date: 2024-06-14 12:56+0200\n" "PO-Revision-Date: 2022-04-02 12:52+0430\n" "Last-Translator: eshagh \n" "Language-Team: \n" @@ -433,56 +433,56 @@ msgid "Zihajje" msgstr "ذیحجه" #. Add date conversion button -#: PersianCalendar@oxygenws.com/extension.js:251 +#: PersianCalendar@oxygenws.com/extension.js:260 msgid "Date conversion" msgstr "تبدیل تاریخ" -#: PersianCalendar@oxygenws.com/extension.js:272 +#: PersianCalendar@oxygenws.com/extension.js:281 msgid "from Persian" msgstr "از هـ.خورشیدی" -#: PersianCalendar@oxygenws.com/extension.js:284 +#: PersianCalendar@oxygenws.com/extension.js:293 msgid "from Gregorian" msgstr "از میلادی" -#: PersianCalendar@oxygenws.com/extension.js:296 +#: PersianCalendar@oxygenws.com/extension.js:305 msgid "from Hijri" msgstr "از هـ.قمری" -#: PersianCalendar@oxygenws.com/extension.js:319 +#: PersianCalendar@oxygenws.com/extension.js:328 msgid "year" msgstr "سال" -#: PersianCalendar@oxygenws.com/extension.js:328 +#: PersianCalendar@oxygenws.com/extension.js:337 msgid "month" msgstr "ماه" -#: PersianCalendar@oxygenws.com/extension.js:337 +#: PersianCalendar@oxygenws.com/extension.js:346 msgid "day" msgstr "روز" -#: PersianCalendar@oxygenws.com/extension.js:472 +#: PersianCalendar@oxygenws.com/extension.js:481 #, javascript-format msgid "%d month and 1 day left to Nowruz %d" msgid_plural "%d months and 1 day left to Nowruz %d" msgstr[0] "%d ماه و ۱ روز مانده به نوروز %d" msgstr[1] "%d ماه و ۱ روز مانده به نوروز %d" -#: PersianCalendar@oxygenws.com/extension.js:478 +#: PersianCalendar@oxygenws.com/extension.js:487 #, javascript-format msgid "%d month and %d days left to Nowruz %d" msgid_plural "%d months and %d days left to Nowruz %d" msgstr[0] "%d ماه و %d روز مانده به نوروز %d" msgstr[1] "%d ماه و %d روز مانده به نوروز %d" -#: PersianCalendar@oxygenws.com/extension.js:486 +#: PersianCalendar@oxygenws.com/extension.js:495 #, javascript-format msgid "%d day left to Nowruz %d" msgid_plural "%d days left to Nowruz %d" msgstr[0] "%d روز مانده به نوروز %d" msgstr[1] "%d روز مانده به نوروز %d" -#: PersianCalendar@oxygenws.com/extension.js:492 +#: PersianCalendar@oxygenws.com/extension.js:501 msgid "Happy New Year" msgstr "سال نو مبارک" diff --git a/PersianCalendar@oxygenws.com/locale/persian-calendar.pot b/PersianCalendar@oxygenws.com/locale/persian-calendar.pot index 4bab833..8d11fe0 100644 --- a/PersianCalendar@oxygenws.com/locale/persian-calendar.pot +++ b/PersianCalendar@oxygenws.com/locale/persian-calendar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-04 12:10+0200\n" +"POT-Creation-Date: 2024-06-14 13:02+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -433,56 +433,56 @@ msgid "Zihajje" msgstr "" #. Add date conversion button -#: PersianCalendar@oxygenws.com/extension.js:251 +#: PersianCalendar@oxygenws.com/extension.js:260 msgid "Date conversion" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:272 +#: PersianCalendar@oxygenws.com/extension.js:281 msgid "from Persian" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:284 +#: PersianCalendar@oxygenws.com/extension.js:293 msgid "from Gregorian" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:296 +#: PersianCalendar@oxygenws.com/extension.js:305 msgid "from Hijri" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:319 +#: PersianCalendar@oxygenws.com/extension.js:328 msgid "year" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:328 +#: PersianCalendar@oxygenws.com/extension.js:337 msgid "month" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:337 +#: PersianCalendar@oxygenws.com/extension.js:346 msgid "day" msgstr "" -#: PersianCalendar@oxygenws.com/extension.js:472 +#: PersianCalendar@oxygenws.com/extension.js:481 #, javascript-format msgid "%d month and 1 day left to Nowruz %d" msgid_plural "%d months and 1 day left to Nowruz %d" msgstr[0] "" msgstr[1] "" -#: PersianCalendar@oxygenws.com/extension.js:478 +#: PersianCalendar@oxygenws.com/extension.js:487 #, javascript-format msgid "%d month and %d days left to Nowruz %d" msgid_plural "%d months and %d days left to Nowruz %d" msgstr[0] "" msgstr[1] "" -#: PersianCalendar@oxygenws.com/extension.js:486 +#: PersianCalendar@oxygenws.com/extension.js:495 #, javascript-format msgid "%d day left to Nowruz %d" msgid_plural "%d days left to Nowruz %d" msgstr[0] "" msgstr[1] "" -#: PersianCalendar@oxygenws.com/extension.js:492 +#: PersianCalendar@oxygenws.com/extension.js:501 msgid "Happy New Year" msgstr "" diff --git a/PersianCalendar@oxygenws.com/metadata.json b/PersianCalendar@oxygenws.com/metadata.json index 6674cf4..f5f1caf 100644 --- a/PersianCalendar@oxygenws.com/metadata.json +++ b/PersianCalendar@oxygenws.com/metadata.json @@ -9,5 +9,10 @@ ], "url": "https://github.com/omid/Persian-Calendar-for-Gnome-Shell", "uuid": "PersianCalendar@oxygenws.com", - "version": 112 + "session-modes": [ + "user", + "unlock-dialog", + "gdm" + ], + "version": 113 } diff --git a/PersianCalendar@oxygenws.com/stylesheet-light.css b/PersianCalendar@oxygenws.com/stylesheet-light.css new file mode 100644 index 0000000..1116084 --- /dev/null +++ b/PersianCalendar@oxygenws.com/stylesheet-light.css @@ -0,0 +1,3 @@ +.pcalendar-tray-holiday-light-dark { + background-image: url("resource:///org/gnome/shell/theme/calendar-today-light.svg"); +} diff --git a/PersianCalendar@oxygenws.com/stylesheet.css b/PersianCalendar@oxygenws.com/stylesheet.css index 218e0b4..d89b022 100644 --- a/PersianCalendar@oxygenws.com/stylesheet.css +++ b/PersianCalendar@oxygenws.com/stylesheet.css @@ -7,8 +7,12 @@ font-weight: 500; } +.pcalendar-tray-holiday-light-dark { + background-image: url("resource:///org/gnome/shell/theme/calendar-today.svg"); +} + .pcalendar-tray-holiday { - text-decoration: underline; + background-size: contain; font-weight: 900; }