Skip to content

Commit

Permalink
fix reloading the default layout after panel reset
Browse files Browse the repository at this point in the history
- do it in the idle handler
- wait until all toplevels are destroyed before reloading the layout
  • Loading branch information
monsta committed May 20, 2019
1 parent 5e2b2a8 commit 8dd8eaa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mate-panel/panel-profile.c
Expand Up @@ -1435,6 +1435,18 @@ panel_profile_delete_removed_ids (PanelGSettingsKeyType type,
g_slist_free (removed_ids);
}

static gboolean
load_default_layout_idle (gpointer unused) {
if (g_slist_length (panel_toplevel_list_toplevels ()) != 0) {
/* some toplevels are not destroyed yet, waiting */
return TRUE;
}

/* load the default layout and stop this handler */
panel_profile_ensure_toplevel_per_screen ();
return FALSE;
}

static void
panel_profile_toplevel_id_list_notify (GSettings *settings,
gchar *key,
Expand Down Expand Up @@ -1477,7 +1489,7 @@ panel_profile_toplevel_id_list_notify (GSettings *settings,

/* if there are no panels, reset layout to default */
if (g_slist_length (toplevel_ids) == 0)
panel_profile_ensure_toplevel_per_screen ();
g_idle_add (load_default_layout_idle, NULL);

g_slist_free (existing_toplevels);
g_slist_free (toplevel_ids);
Expand Down

0 comments on commit 8dd8eaa

Please sign in to comment.