Skip to content

Commit 68c00e4

Browse files
authored
SpiceSpy v5.7.0: New refresh features (#8125)
1 parent bec04f2 commit 68c00e4

File tree

19 files changed

+430
-163
lines changed

19 files changed

+430
-163
lines changed

SpiceSpy@claudiux/files/SpiceSpy@claudiux/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v5.7.0~20251228
2+
* You can now interrupt a refresh.
3+
* You can request to change the icon color when refreshing. You can choose this color.
4+
* The menu should no longer close unexpectedly.
5+
16
### v5.6.2~20251125
27
* Highlights the number of new issues in the menu.
38

SpiceSpy@claudiux/files/SpiceSpy@claudiux/applet.js

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {
2121
const { HttpLib } = require("./lib/httpLib");
2222
const { to_string } = require("./lib/to-string");
2323
//mainloopTools:
24-
const { _sourceIds, timeout_add_seconds, timeout_add, setTimeout, clearTimeout, setInterval, clearInterval, source_exists, source_remove, remove_all_sources } = require("./lib/mainloopTools");
24+
const { timeout_add_seconds, setTimeout, clearTimeout, source_remove, remove_all_sources } = require("./lib/mainloopTools");
2525

2626
const UUID = "SpiceSpy@claudiux";
2727

@@ -340,6 +340,8 @@ class SpiceSpy extends Applet.TextIconApplet {
340340
this.jobsLoopId = null;
341341
this.issuesLoopId = null;
342342
this.is_looping = true;
343+
344+
this.iconColorLoopId = null;
343345

344346
this.settings = new Settings.AppletSettings(this, UUID, instance_id);
345347

@@ -352,6 +354,9 @@ class SpiceSpy extends Applet.TextIconApplet {
352354
this.update_interval = 0.5 * Math.round(this.settings.getValue("update-interval") / 30);
353355
this.settings.setValue("update-interval", -1);
354356
}
357+
this.settings.bind("update-interruptible", "updateIsInterruptible");
358+
this.settings.bind("coloredIcon", "coloredIcon");
359+
this.settings.bind("colorWhileRefreshing", "colorWhileRefreshing");
355360
this.settings.bind("standard-opacity", "standard_opacity");
356361
this.settings.bind("color-on-change", "color_on_change", () => { this.make_menu() });
357362
this.show_icon_in_menu = true;
@@ -369,6 +374,18 @@ class SpiceSpy extends Applet.TextIconApplet {
369374
this.settings.bind("spices_to_spy", "spices_to_spy");
370375
this.settings.bind("old_spices_to_spy", "old_spices_to_spy");
371376
} // End of get_user_settings
377+
378+
setIconColor() {
379+
if (!this.coloredIcon) {
380+
this.actor.style = null;
381+
return
382+
}
383+
if (this.commentsJobsList.length > 0 || this.issuesJobsList.length > 0) {
384+
this.actor.style = `color: ${this.colorWhileRefreshing};`
385+
} else {
386+
this.actor.style = null
387+
}
388+
} // End of setIconColor
372389

373390
update_interval_value() {
374391
const sec = Math.round(this.update_interval * 3600); // From hours to seconds.
@@ -449,7 +466,10 @@ class SpiceSpy extends Applet.TextIconApplet {
449466
this.settings.setValue("uuid-list", _uuid_list);
450467

451468
// Loop next tick (value 0) to ensure that this.actor is on stage:
452-
setTimeout(() => this.loop(), 0);
469+
let _to = setTimeout(() => {
470+
clearTimeout(_to);
471+
this.loop()
472+
}, 0);
453473
}
454474
} // End of _add_user_Spices
455475

@@ -570,7 +590,8 @@ class SpiceSpy extends Applet.TextIconApplet {
570590
if (this.spices_to_spy[type][uuid])
571591
this.spices_to_spy[type][uuid]["issues"] = issuesNumber;
572592
GLib.free(jsonFileContents);
573-
this.make_menu();
593+
if (!this.menu.isOpen)
594+
this.make_menu();
574595
} // End of do_issuesJob
575596

576597
do_issuesJob_OLD(type, spice, command) {
@@ -663,7 +684,10 @@ class SpiceSpy extends Applet.TextIconApplet {
663684
source_remove(id);
664685
}
665686
this.issuesLoopId = null;
666-
this.issuesLoopId = timeout_add_seconds(5, () => { this.issuesJobs_loop(); return (this.issuesJobsList.length > 0 && this.is_looping); });
687+
this.issuesLoopId = timeout_add_seconds(5, () => {
688+
this.issuesJobs_loop();
689+
return (this.issuesJobsList.length > 0 && this.is_looping);
690+
});
667691

668692
return this.is_looping;
669693
} // End of loop
@@ -790,18 +814,6 @@ class SpiceSpy extends Applet.TextIconApplet {
790814
}
791815
} // End of update_issues
792816

793-
update_issues_OLD() {
794-
const GET_ISSUES_SCRIPT = SCRIPTS_DIR+"/get-issues.sh"
795-
const interval = 5000; //ms = 5 seconds.
796-
for (let type of TYPES) {
797-
let spices = this.spices_to_spy[type];
798-
for (let spice of Object.keys(spices)) {
799-
let command = ""+GET_ISSUES_SCRIPT+" "+type+" "+spices[spice]['uuid'];
800-
this.issuesJobsList.push(type, spice, command);
801-
}
802-
}
803-
} // End of update_issues_OLD
804-
805817
make_menu() {
806818
var total_diff_score = 0;
807819
var total_diff_comments = 0;
@@ -915,7 +927,7 @@ class SpiceSpy extends Applet.TextIconApplet {
915927
}
916928

917929
if (this.issuesJobsList.length === 0) {
918-
let refresh = new PopupMenu.PopupIconMenuItem(_("Refresh"), "", St.IconType.SYMBOLIC);
930+
let refresh = new PopupMenu.PopupIconMenuItem(_("Refresh"), "view-refresh-symbolic", St.IconType.SYMBOLIC);
919931
refresh.connect("activate",
920932
() => {
921933
if (this.menu) this.menu.toggle(true);
@@ -926,12 +938,40 @@ class SpiceSpy extends Applet.TextIconApplet {
926938
);
927939
this.menu.addMenuItem(refresh);
928940
} else {
929-
let refresh_in_progress = new PopupMenu.PopupIconMenuItem(
930-
_("Refreshing in progress"),
931-
"view-refresh",
932-
St.IconType.SYMBOLIC,
933-
{ reactive: false }
941+
let refresh_in_progress;
942+
if (this.updateIsInterruptible) {
943+
refresh_in_progress = new PopupMenu.PopupIconMenuItem(
944+
_("Refreshing in progress - Click to stop"),
945+
"hand-open-symbolic",
946+
St.IconType.SYMBOLIC,
947+
{ reactive: true }
948+
);
949+
refresh_in_progress.connect("activate",
950+
() => {
951+
if (this.menu) this.menu.toggle(true);
952+
if (this.issuesLoopId != null) {
953+
source_remove(this.issuesLoopId);
954+
}
955+
this.issuesLoopId = null;
956+
this.issuesJobsList = [];
957+
958+
if (this.jobsLoopId != null) {
959+
source_remove(this.jobsLoopId);
960+
}
961+
this.jobsLoopId = null;
962+
this.commentsJobsList = [];
963+
//~ this.is_looping = true;
964+
//~ this.fistTime = false;
965+
}
934966
);
967+
} else {
968+
refresh_in_progress = new PopupMenu.PopupIconMenuItem(
969+
_("Refreshing in progress"),
970+
"hand-open-symbolic",
971+
St.IconType.SYMBOLIC,
972+
{ reactive: false }
973+
);
974+
}
935975
this.menu.addMenuItem(refresh_in_progress);
936976
}
937977

@@ -972,6 +1012,7 @@ class SpiceSpy extends Applet.TextIconApplet {
9721012

9731013
this.loopId = timeout_add_seconds(60, () => { this.loop() });
9741014
this.jobsLoopId = timeout_add_seconds(15, () => { this.commentsJobs_loop(); return this.is_looping; });
1015+
this.iconColorLoopId = timeout_add_seconds(1, () => { this.setIconColor(); return this.is_looping; });
9751016

9761017
this.update_issues_json();
9771018
this.updateUI();
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

SpiceSpy@claudiux/files/SpiceSpy@claudiux/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"uuid": "SpiceSpy@claudiux",
33
"name": "SpiceSpy",
44
"description": "Notifies you when there's a change to your favorite Spices on the website.",
5-
"version": "5.6.2",
5+
"version": "5.7.0",
66
"max-instances": 1,
77
"author": "claudiux"
88
}

SpiceSpy@claudiux/files/SpiceSpy@claudiux/po/SpiceSpy@claudiux.pot

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#, fuzzy
66
msgid ""
77
msgstr ""
8-
"Project-Id-Version: SpiceSpy@claudiux 5.5.0\n"
8+
"Project-Id-Version: SpiceSpy@claudiux 5.7.0\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-applets/"
1010
"issues\n"
11-
"POT-Creation-Date: 2025-09-25 23:34+0200\n"
11+
"POT-Creation-Date: 2025-12-28 16:21+0100\n"
1212
"PO-Revision-Date: \n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -17,47 +17,51 @@ msgstr ""
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

20-
#. applet.js:201
20+
#. applet.js:185
2121
msgid "score"
2222
msgstr ""
2323

24-
#. applet.js:213
24+
#. applet.js:197
2525
msgid "comments"
2626
msgstr ""
2727

28-
#. applet.js:225
28+
#. applet.js:209
2929
msgid "recent issues"
3030
msgstr ""
3131

32-
#. applet.js:237
32+
#. applet.js:222
3333
msgid "translations"
3434
msgstr ""
3535

36-
#. applet.js:312
36+
#. applet.js:297
3737
msgid "Reload icons"
3838
msgstr ""
3939

40-
#. applet.js:318
40+
#. applet.js:303
4141
msgid "Visit website"
4242
msgstr ""
4343

44-
#. applet.js:826
44+
#. applet.js:831
4545
msgid "Spices"
4646
msgstr ""
4747

48-
#. applet.js:915
48+
#. applet.js:919
4949
msgid "Mark all as read"
5050
msgstr ""
5151

52-
#. applet.js:926
52+
#. applet.js:930
5353
msgid "Refresh"
5454
msgstr ""
5555

56-
#. applet.js:938
56+
#. applet.js:944
57+
msgid "Refreshing in progress - Click to stop"
58+
msgstr ""
59+
60+
#. applet.js:969
5761
msgid "Refreshing in progress"
5862
msgstr ""
5963

60-
#. applet.js:949
64+
#. applet.js:981
6165
msgid "Configure..."
6266
msgstr ""
6367

@@ -95,6 +99,10 @@ msgstr ""
9599
msgid "hours"
96100
msgstr ""
97101

102+
#. settings-schema.json->update-interruptible->description
103+
msgid "The update can be interrupted by the user"
104+
msgstr ""
105+
98106
#. settings-schema.json->standard-opacity->description
99107
msgid "Opacity in absence of change"
100108
msgstr ""
@@ -216,6 +224,14 @@ msgstr ""
216224
msgid "Show only non-zero values in panel"
217225
msgstr ""
218226

227+
#. settings-schema.json->coloredIcon->description
228+
msgid "Change icon color while refreshing"
229+
msgstr ""
230+
231+
#. settings-schema.json->colorWhileRefreshing->description
232+
msgid "Icon color while refreshing"
233+
msgstr ""
234+
219235
#. settings-schema.json->author-list->columns->title
220236
msgid "GitHub user name"
221237
msgstr ""

0 commit comments

Comments
 (0)