Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class CinnamonSystrayApplet extends Applet.Applet {
}

on_applet_removed_from_panel() {
if (this._scaleUpdateId > 0) {
Mainloop.source_remove(this._scaleUpdateId);
this._scaleUpdateId = 0;
}

this._signalManager.disconnectAllSignals();

this._clearIcons();
Expand Down Expand Up @@ -93,6 +98,11 @@ class CinnamonSystrayApplet extends Applet.Applet {

_clearIcons() {
this.button_box.get_children().forEach((button) => {
if (button._showTimeoutId > 0) {
GLib.source_remove(button._showTimeoutId);
button._showTimeoutId = 0;
}

// button.set_size(-1, -1);
button.remove_actor(button.child);
button.destroy();
Expand Down Expand Up @@ -156,7 +166,9 @@ class CinnamonSystrayApplet extends Applet.Applet {

icon.visible = false;
icon.opacity = 0;
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => {
button._showTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => {
button._showTimeoutId = 0;

if (icon.is_finalized()) {
button.destroy();
return GLib.SOURCE_REMOVE;
Expand Down Expand Up @@ -213,6 +225,15 @@ class CinnamonSystrayApplet extends Applet.Applet {
_onTrayIconRemoved(o, icon) {
const parent = icon.get_parent();

if (parent == null) {
return;
}

if (parent._showTimeoutId > 0) {
GLib.source_remove(parent._showTimeoutId);
parent._showTimeoutId = 0;
}

parent.remove_actor(icon);
parent.destroy()
}
Expand Down
13 changes: 12 additions & 1 deletion src/cinnamon-tray-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ void
cinnamon_tray_manager_set_orientation (CinnamonTrayManager *manager,
ClutterOrientation orientation)
{
if (manager->priv->na_manager == NULL)
return;

if (orientation == CLUTTER_ORIENTATION_HORIZONTAL)
{
na_tray_manager_set_orientation (manager->priv->na_manager, GTK_ORIENTATION_HORIZONTAL);
Expand All @@ -400,7 +403,12 @@ cinnamon_tray_manager_child_redisplay (gpointer socket_pointer, gpointer child_p

g_return_if_fail(child != NULL);

if (child->actor && CLUTTER_IS_ACTOR(child->actor)) {
/* No actor means the plug never arrived. Leave the child alone so the
* pending plug-added handler can still create its icon. */
if (child->actor == NULL)
return;

if (CLUTTER_IS_ACTOR(child->actor)) {
clutter_actor_destroy(child->actor);
g_clear_object (&child->actor);
}
Expand All @@ -410,5 +418,8 @@ cinnamon_tray_manager_child_redisplay (gpointer socket_pointer, gpointer child_p

void cinnamon_tray_manager_redisplay (CinnamonTrayManager *manager)
{
if (manager->priv->icons == NULL)
return;

g_hash_table_foreach(manager->priv->icons, cinnamon_tray_manager_child_redisplay, manager);
}
Loading