window: Listen for pref changes

The workspaces-only-on-primary preference changes how windows are
displayed, so listen for pref changes and update the visibility
accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=664853
This commit is contained in:
Florian Müllner 2011-11-26 01:52:24 +01:00
parent a88365df9b
commit 497f9be61e

View File

@ -179,6 +179,20 @@ enum
static guint window_signals[LAST_SIGNAL] = { 0 }; static guint window_signals[LAST_SIGNAL] = { 0 };
static void
prefs_changed_callback (MetaPreference pref,
gpointer data)
{
MetaWindow *window = data;
if (pref != META_PREF_WORKSPACES_ONLY_ON_PRIMARY)
return;
meta_window_update_on_all_workspaces (window);
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
}
static void static void
meta_window_finalize (GObject *object) meta_window_finalize (GObject *object)
{ {
@ -195,6 +209,8 @@ meta_window_finalize (GObject *object)
meta_icon_cache_free (&window->icon_cache); meta_icon_cache_free (&window->icon_cache);
meta_prefs_remove_listener (prefs_changed_callback, window);
g_free (window->sm_client_id); g_free (window->sm_client_id);
g_free (window->wm_client_machine); g_free (window->wm_client_machine);
g_free (window->startup_id); g_free (window->startup_id);
@ -475,6 +491,7 @@ meta_window_class_init (MetaWindowClass *klass)
static void static void
meta_window_init (MetaWindow *self) meta_window_init (MetaWindow *self)
{ {
meta_prefs_add_listener (prefs_changed_callback, self);
} }
#ifdef WITH_VERBOSE_MODE #ifdef WITH_VERBOSE_MODE