windowmenu: Avoid applying previous settings to new window (#20)

There is only one menu made that is shared across all windows. Setting
always_on_top.active caused the activate (and toggled as well) signal
to execute, causing the current window to get the results of the previous
window.
This commit is contained in:
Felipe Escoto 2017-07-16 11:40:08 -05:00 committed by Rico Tzschichholz
parent c7c88db340
commit 7664aee55d

View File

@ -25,13 +25,22 @@ namespace Gala
*/
public class WindowMenu : Gtk.Menu
{
ulong always_on_top_handler_id;
ulong on_visible_workspace_handler_id;
public Meta.Window current_window {
get {
return _current_window;
}
set {
SignalHandler.block (always_on_top, always_on_top_handler_id);
SignalHandler.block (on_visible_workspace, on_visible_workspace_handler_id);
_current_window = value;
update_window ();
SignalHandler.unblock (always_on_top, always_on_top_handler_id);
SignalHandler.unblock (on_visible_workspace, on_visible_workspace_handler_id);
}
}
@ -83,7 +92,7 @@ namespace Gala
append (resize);
always_on_top = new Gtk.CheckMenuItem.with_label (_("Always on Top"));
always_on_top.activate.connect (() => {
always_on_top_handler_id = always_on_top.activate.connect (() => {
if (current_window.is_above ())
current_window.unmake_above ();
else
@ -92,7 +101,7 @@ namespace Gala
append (always_on_top);
on_visible_workspace = new Gtk.CheckMenuItem.with_label (_("Always on Visible Workspace"));
on_visible_workspace.activate.connect (() => {
on_visible_workspace_handler_id = on_visible_workspace.activate.connect (() => {
if (current_window.on_all_workspaces)
current_window.unstick ();
else