screen: Fix workspace removal

I accidentally broke this in commit a119ea9. The code was considerably
more complicated than it needs to be, so let's replace it with a
g_list_find and nothing more.
This commit is contained in:
Jasper St. Pierre 2014-08-16 14:49:18 -04:00
parent e0c92befd5
commit 32cf4afb04

View File

@ -1073,19 +1073,16 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
guint32 timestamp) guint32 timestamp)
{ {
GList *l; GList *l;
GList *next;
MetaWorkspace *neighbour = NULL; MetaWorkspace *neighbour = NULL;
GList *next = NULL;
int index; int index;
gboolean active_index_changed; gboolean active_index_changed;
int new_num; int new_num;
for (l = screen->workspaces; l != NULL; l = next) l = g_list_find (screen->workspaces, workspace);
{ if (!l)
MetaWorkspace *w = l->data; return;
if (w == workspace)
{
if (l->next)
next = l->next; next = l->next;
if (l->prev) if (l->prev)
@ -1098,13 +1095,6 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
return; return;
} }
break;
}
}
if (!neighbour)
return;
meta_workspace_relocate_windows (workspace, neighbour); meta_workspace_relocate_windows (workspace, neighbour);
if (workspace == screen->active_workspace) if (workspace == screen->active_workspace)