From: Daniel Déchelotte <[email protected]>
---
src/dock.c | 47 +++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/src/dock.c b/src/dock.c
index a73e8c5..f9090ce 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -441,14 +441,35 @@ static void omnipresentCallback(WMenu *menu, WMenuEntry
*entry)
}
}
+static void removeIcons(WMArray *icons, WDock *dock)
+{
+ WAppIcon *aicon;
+ int keepit;
+ WMArrayIterator it;
+
+ WM_ITERATE_ARRAY(icons, aicon, it) {
+ keepit = aicon->running && wApplicationOf(aicon->main_window);
+ wDockDetach(dock, aicon);
+ if (keepit) {
+ /* XXX: can: aicon->icon == NULL ? */
+ PlaceIcon(dock->screen_ptr, &aicon->x_pos,
&aicon->y_pos,
+ wGetHeadForWindow(aicon->icon->owner));
+ XMoveWindow(dpy, aicon->icon->core->window,
aicon->x_pos, aicon->y_pos);
+ if (!dock->mapped || dock->collapsed)
+ XMapWindow(dpy, aicon->icon->core->window);
+ }
+ }
+ WMFreeArray(icons);
+
+ if (wPreferences.auto_arrange_icons)
+ wArrangeIcons(dock->screen_ptr, True);
+}
+
static void removeIconsCallback(WMenu *menu, WMenuEntry *entry)
{
WAppIcon *clickedIcon = (WAppIcon *) entry->clientdata;
WDock *dock;
- WAppIcon *aicon;
WMArray *selectedIcons;
- int keepit;
- WMArrayIterator it;
assert(clickedIcon != NULL);
@@ -457,7 +478,8 @@ static void removeIconsCallback(WMenu *menu, WMenuEntry
*entry)
selectedIcons = getSelected(dock);
if (WMGetArrayItemCount(selectedIcons)) {
- if (wMessageDialog(dock->screen_ptr, _("Workspace Clip"),
+ if (wMessageDialog(dock->screen_ptr,
+ dock->type == WM_CLIP ? _("Workspace Clip")
: _("Drawer"),
_("All selected icons will be removed!"),
_("OK"), _("Cancel"), NULL) != WAPRDefault) {
WMFreeArray(selectedIcons);
@@ -471,22 +493,7 @@ static void removeIconsCallback(WMenu *menu, WMenuEntry
*entry)
WMAddToArray(selectedIcons, clickedIcon);
}
- WM_ITERATE_ARRAY(selectedIcons, aicon, it) {
- keepit = aicon->running && wApplicationOf(aicon->main_window);
- wDockDetach(dock, aicon);
- if (keepit) {
- /* XXX: can: aicon->icon == NULL ? */
- PlaceIcon(dock->screen_ptr, &aicon->x_pos,
&aicon->y_pos,
- wGetHeadForWindow(aicon->icon->owner));
- XMoveWindow(dpy, aicon->icon->core->window,
aicon->x_pos, aicon->y_pos);
- if (!dock->mapped || dock->collapsed)
- XMapWindow(dpy, aicon->icon->core->window);
- }
- }
- WMFreeArray(selectedIcons);
-
- if (wPreferences.auto_arrange_icons)
- wArrangeIcons(dock->screen_ptr, True);
+ removeIcons(selectedIcons, dock);
}
static void keepIconsCallback(WMenu *menu, WMenuEntry *entry)
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].