Skip to content

Commit

Permalink
Fix: applets not updating when closing background window
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfin authored and flexiondotorg committed Jun 30, 2019
1 parent 64bfd81 commit 6c04935
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
12 changes: 11 additions & 1 deletion window-buttons-applet/window-buttons-applet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace WindowButtonsApplet{
this.change_layout();
this.change_theme();
this.change_spacing();
this.change_behaviour();

this.marco_gsettings.changed["theme"].connect(this.change_theme);
this.gsettings.changed["spacing"].connect(this.change_spacing);
Expand Down Expand Up @@ -206,6 +207,15 @@ namespace WindowButtonsApplet{
this.set_spacing(spacing);
}

public void change_behaviour(){
string behaviour = gsettings.get_string("behaviour");

Wnck.Screen.get_default().window_closed.disconnect( reload );

if(behaviour == "topmost-maximized")
Wnck.Screen.get_default().window_closed.connect( reload );
}

private Wnck.Window get_current_window(){
Wnck.Window* win = null;
string behaviour = gsettings.get_string("behaviour");
Expand Down Expand Up @@ -284,7 +294,7 @@ namespace WindowButtonsApplet{
widget_container.gsettings.changed["buttons-layout"].connect(widget_container.change_layout);
widget_container.gsettings.changed["spacing"].connect( (key) => { widget_container.change_size(applet.get_size()); } );
widget_container.gsettings.changed["padding"].connect( (key) => { widget_container.change_size(applet.get_size()); } );
widget_container.gsettings.changed["behaviour"].connect( (key) => { widget_container.reload(); } );
widget_container.gsettings.changed["behaviour"].connect( () => { widget_container.change_behaviour(); widget_container.reload(); } );
applet.setup_menu(menu,action_group);

settings.delete_event.connect( (event) => { settings.hide() ; return true ; } );
Expand Down
12 changes: 11 additions & 1 deletion window-menu-applet/window-menu-applet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ namespace WindowMenuApplet{

}

public void change_behaviour(){
string behaviour = gsettings.get_string("behaviour");

Wnck.Screen.get_default().window_closed.disconnect( reload );

if(behaviour == "topmost-maximized")
Wnck.Screen.get_default().window_closed.connect( reload );
}

private Wnck.Window get_current_window(){
Wnck.Window* win = null;
string behaviour = gsettings.get_string("behaviour");
Expand Down Expand Up @@ -102,6 +111,7 @@ namespace WindowMenuApplet{

button = new WindowMenuButton();

change_behaviour();
change_orient(applet);

Gtk.Builder builder = new Gtk.Builder();
Expand Down Expand Up @@ -133,7 +143,7 @@ namespace WindowMenuApplet{
menu += """<menuitem name="About" action="about" />""";

gsettings.bind("behaviour",builder.get_object("behaviour"),"active_id",SettingsBindFlags.DEFAULT);
gsettings.changed["behaviour"].connect( (key) => { reload(); } );
gsettings.changed["behaviour"].connect( () => { change_behaviour(); reload(); } );

applet.add(button);
applet.setup_menu(menu,action_group);
Expand Down
12 changes: 11 additions & 1 deletion window-title-applet/window-title-applet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ namespace WindowTitleApplet{
}
}

public void change_behaviour(){
string behaviour = gsettings.get_string("behaviour");

Wnck.Screen.get_default().window_closed.disconnect( reload );

if(behaviour == "topmost-maximized")
Wnck.Screen.get_default().window_closed.connect( reload );
}

private Wnck.Window get_current_window(){
Wnck.Window* win = null;
string behaviour = gsettings.get_string("behaviour");
Expand Down Expand Up @@ -98,6 +107,7 @@ namespace WindowTitleApplet{
title = new Gtk.Label("");
title.ellipsize = Pango.EllipsizeMode.END;

change_behaviour();
reload();

//title.set_label(Wnck.Screen.get_default().get_active_window().get_name());
Expand Down Expand Up @@ -131,7 +141,7 @@ namespace WindowTitleApplet{
menu += """<menuitem name="About" action="about" />""";

gsettings.bind("behaviour",builder.get_object("behaviour"),"active_id",SettingsBindFlags.DEFAULT);
gsettings.changed["behaviour"].connect( (key) => { reload(); } );
gsettings.changed["behaviour"].connect( () => { change_behaviour(); reload(); } );

applet.set_flags(MatePanel.AppletFlags.EXPAND_MINOR | MatePanel.AppletFlags.EXPAND_MAJOR);

Expand Down

0 comments on commit 6c04935

Please sign in to comment.