Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tray icons don't disappear anymore when changing enabled applets/movi…

…ng applets (will need a few improvements) (issue #410)
  • Loading branch information...
commit f7058b2da7767f1e7aaa34dc8d6cf98f2341e91f 1 parent fa1e6b3
@glebihan glebihan authored
View
8 files/usr/share/cinnamon/applets/systray@cinnamon.org/applet.js
@@ -16,6 +16,7 @@ MyApplet.prototype = {
try {
Main.statusIconDispatcher.connect('status-icon-added', Lang.bind(this, this._onTrayIconAdded));
Main.statusIconDispatcher.connect('status-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
+ Main.statusIconDispatcher.connect('before-redisplay', Lang.bind(this, this._onBeforeRedisplay));
}
catch (e) {
global.logError(e);
@@ -26,6 +27,13 @@ MyApplet.prototype = {
},
+ _onBeforeRedisplay: function() {
+ let children = this.actor.get_children();
+ for (var i = 0; i < children.length; i++) {
+ children[i].destroy();
+ }
+ },
+
_onTrayIconAdded: function(o, icon, role) {
try {
let hiddenIcons = ["network", "power", "keyboard", "gnome-settings-daemon", "volume", "bluetooth", "battery", "a11y"];
View
2  js/ui/appletManager.js
@@ -92,6 +92,8 @@ function onEnabledAppletsChanged() {
catch(e) {
global.logError('Failed to refresh list of applets ' + e);
}
+
+ Main.statusIconDispatcher.redisplay();
}
function loadApplets() {
View
6 js/ui/statusIconDispatcher.js
@@ -38,6 +38,12 @@ StatusIconDispatcher.prototype = {
// http://bugzilla.gnome.org/show_bug.cgi=id=621382
Util.killall('indicator-application-service');
},
+
+ redisplay: function() {
+ this.emit('before-redisplay');
+ this._traymanager.redisplay();
+ this.emit('after-redisplay');
+ },
start: function(themeWidget) {
this._traymanager.manage_stage(global.stage, themeWidget);
View
19 src/cinnamon-tray-manager.c
@@ -345,6 +345,25 @@ na_tray_icon_added (NaTrayManager *na_manager, GtkWidget *socket,
}
static void
+cinnamon_tray_manager_child_redisplay (gpointer socket_pointer, gpointer child_pointer, gpointer user_data)
+{
+ CinnamonTrayManager *manager = user_data;
+ GtkWidget *socket = socket_pointer;
+ CinnamonTrayManagerChild *child = child_pointer;
+
+ g_return_if_fail(child != NULL);
+ g_return_if_fail(GTK_IS_WIDGET(child->window));
+
+ gtk_widget_unrealize(child->window);
+ gtk_widget_realize(child->window);
+}
+
+void cinnamon_tray_manager_redisplay (CinnamonTrayManager *manager)
+{
+ g_hash_table_foreach(manager->priv->icons, cinnamon_tray_manager_child_redisplay, manager);
+}
+
+static void
na_tray_icon_removed (NaTrayManager *na_manager, GtkWidget *socket,
gpointer user_data)
{
View
1  src/cinnamon-tray-manager.h
@@ -44,6 +44,7 @@ CinnamonTrayManager *cinnamon_tray_manager_new (void);
void cinnamon_tray_manager_manage_stage (CinnamonTrayManager *manager,
ClutterStage *stage,
StWidget *theme_widget);
+void cinnamon_tray_manager_redisplay (CinnamonTrayManager *manager);
G_END_DECLS
Please sign in to comment.
Something went wrong with that request. Please try again.