shell-app: ensure there's always a muxer when setting actions on it

It's not guaranteed that the application DBus proxy appears before
we receive the first focus event from the toplevel window.
Ensure that the first method to access the action muxer creates it if
hasn't been created yet.
This commit is contained in:
Cosimo Cecchi 2011-12-21 16:32:18 +01:00
parent b47b82ed42
commit 7b9c9b2f7d

View File

@ -577,6 +577,9 @@ shell_app_update_window_actions (ShellApp *app, MetaWindow *window)
g_object_set_data_full (G_OBJECT (window), "actions", actions, g_object_unref); g_object_set_data_full (G_OBJECT (window), "actions", actions, g_object_unref);
} }
if (!app->running_state->muxer)
app->running_state->muxer = g_action_muxer_new ();
g_action_muxer_insert (app->running_state->muxer, "win", actions); g_action_muxer_insert (app->running_state->muxer, "win", actions);
g_object_notify (G_OBJECT (app), "action-group"); g_object_notify (G_OBJECT (app), "action-group");
} }
@ -1092,7 +1095,10 @@ on_dbus_proxy_gotten (GObject *initable,
g_dbus_proxy_get_connection (state->app_proxy), g_dbus_proxy_get_connection (state->app_proxy),
g_dbus_proxy_get_name (state->app_proxy), g_dbus_proxy_get_name (state->app_proxy),
g_dbus_proxy_get_object_path (state->app_proxy)); g_dbus_proxy_get_object_path (state->app_proxy));
state->muxer = g_action_muxer_new ();
if (!state->muxer)
state->muxer = g_action_muxer_new ();
g_action_muxer_insert (state->muxer, "app", state->remote_actions); g_action_muxer_insert (state->muxer, "app", state->remote_actions);
g_strfreev (g_action_group_list_actions (state->remote_actions)); g_strfreev (g_action_group_list_actions (state->remote_actions));