1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

Unify save_appicon() and wAppIconSave()

Having two similarly named functions for doing the same thing is confusing.
In order to account for the extra check done by the late wAppIconSave(),
add an argument "dock".

Now there's only save_appicon().

And as pointed out by Rodolfo kix García, the save_appicon_core() function
can be removed too.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Carlos R. Mafra
2012-06-21 15:16:20 +01:00
parent 4700e5f0b2
commit a1e80f5411
4 changed files with 15 additions and 31 deletions

View File

@@ -397,30 +397,25 @@ void wAppIconPaint(WAppIcon * aicon)
0, 0, wPreferences.icon_size, wPreferences.icon_size);
}
/* Internal application to save the application icon */
static void save_app_icon_core(WAppIcon *aicon)
/* Save the application icon, if it's a dockapp then use it with dock = True */
void save_appicon(WAppIcon *aicon, Bool dock)
{
char *path;
if (!aicon)
return;
if (dock && (!aicon->docked || aicon->attracted))
return;
path = wIconStore(aicon->icon);
if (!path)
return;
wApplicationSaveIconPathFor(path, aicon->wm_instance, aicon->wm_class);
wfree(path);
}
/* Save the application icon */
/* This function is used when the icon doesn't have window, like dock or clip */
void wAppIconSave(WAppIcon *aicon)
{
if (!aicon->docked || aicon->attracted)
return;
save_app_icon_core(aicon);
}
#define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
/* main_window may not have the full command line; try to find one which does */
@@ -930,16 +925,6 @@ static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char
UpdateDomainFile(WDWindowAttributes);
}
/* Save the application icon */
/* This function is used by normal windows */
void save_app_icon(WApplication *wapp)
{
if (!wapp->app_icon)
return;
save_app_icon_core(wapp->app_icon);
}
static WAppIcon *findDockIconFor(WDock *dock, Window main_window)
{
WAppIcon *aicon = NULL;
@@ -987,6 +972,6 @@ void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_win
wapp->app_icon->icon->icon_win = mainw->wm_hints->icon_window;
wAppIconPaint(wapp->app_icon);
wAppIconSave(wapp->app_icon);
save_appicon(wapp->app_icon, True);
}
}

View File

@@ -78,7 +78,6 @@ void wAppIconPaint(WAppIcon *aicon);
void wAppIconMove(WAppIcon *aicon, int x, int y);
void makeAppIconFor(WApplication * wapp);
void removeAppIconFor(WApplication * wapp);
void save_app_icon(WApplication *wapp);
void save_appicon(WAppIcon *aicon, Bool dock);
void paint_app_icon(WApplication *wapp);
void wAppIconSave(WAppIcon *aicon);
#endif

View File

@@ -151,7 +151,7 @@ WApplication *wApplicationCreate(WWindow * wwin)
makeAppIconFor(wapp);
/* Save the app_icon in a file */
save_app_icon(wapp);
save_appicon(wapp->app_icon, False);
return wapp;
}

View File

@@ -548,7 +548,7 @@ static void keepIconsCallback(WMenu *menu, WMenuEntry *entry)
wAppIconPaint(aicon);
}
}
wAppIconSave(aicon);
save_appicon(aicon, True);
}
WMFreeArray(selectedIcons);
}
@@ -1173,7 +1173,7 @@ static void dockIconPaint(WAppIcon *btn)
wClipIconPaint(btn);
else {
wAppIconPaint(btn);
wAppIconSave(btn);
save_appicon(btn, True);
}
}
@@ -1961,7 +1961,7 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y)
MoveInStackListUnder(dock->icon_array[index - 1]->icon->core, icon->icon->core);
wAppIconMove(icon, icon->x_pos, icon->y_pos);
wAppIconPaint(icon);
wAppIconSave(icon);
save_appicon(icon, True);
if (wPreferences.auto_arrange_icons)
wArrangeIcons(dock->screen_ptr, True);
@@ -2089,7 +2089,7 @@ static Bool moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x,
icon->icon->shadowed = 0;
icon->icon->force_paint = 1;
}
wAppIconSave(icon);
save_appicon(icon, True);
}
if (src->auto_collapse || src->auto_raise_lower)