shell/tray-manager: Allow to unmanage screen
Since support for legacy status icons is implemented by extensions nowadays, they need to undo the call to manage_screen() when they are disabled. Right now that means bypassing garbage collection with an explicit call to run_dispose() on the Shell.TrayManager. That works, but is rather ugly. An explicit unmanage_screen() method is a nicer option, and will be useful to us as well to deal with X11 going away (once Xwayland crashes don't bring down the entire session). https://gitlab.gnome.org/GNOME/gnome-shell/issues/2308
This commit is contained in:
parent
07bbcb1b48
commit
e6d4581959
@ -29,6 +29,7 @@ struct _ShellTrayManagerPrivate {
|
||||
ClutterColor bg_color;
|
||||
|
||||
GHashTable *icons;
|
||||
StWidget *theme_widget;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@ -228,6 +229,8 @@ void
|
||||
shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
StWidget *theme_widget)
|
||||
{
|
||||
g_set_weak_pointer (&manager->priv->theme_widget, theme_widget);
|
||||
|
||||
shell_tray_manager_ensure_resources (manager);
|
||||
|
||||
na_tray_manager_manage_screen (manager->priv->na_manager);
|
||||
@ -238,6 +241,20 @@ shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
shell_tray_manager_style_changed (theme_widget, manager);
|
||||
}
|
||||
|
||||
void
|
||||
shell_tray_manager_unmanage_screen (ShellTrayManager *manager)
|
||||
{
|
||||
if (manager->priv->theme_widget != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (manager->priv->theme_widget,
|
||||
G_CALLBACK (shell_tray_manager_style_changed),
|
||||
manager);
|
||||
}
|
||||
g_set_weak_pointer (&manager->priv->theme_widget, NULL);
|
||||
|
||||
shell_tray_manager_release_resources (manager);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_tray_manager_child_on_realize (GtkWidget *widget,
|
||||
ShellTrayManagerChild *child)
|
||||
|
@ -15,6 +15,7 @@ G_DECLARE_FINAL_TYPE (ShellTrayManager, shell_tray_manager,
|
||||
ShellTrayManager *shell_tray_manager_new (void);
|
||||
void shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
StWidget *theme_widget);
|
||||
void shell_tray_manager_unmanage_screen (ShellTrayManager *manager);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user