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

Simplify the application appicon creation

This patch removes all the appicon stuff from the application creation
to the appicon creation. Now, the application only calls one function
(create_appicon_for_application()) and this function do all the work.

The function do the same code than the code before this patch, but the
only change is that the "if" test to check if the appicon was found in
the docks now is negated, removing the return and doing the appicon_save
inside the function.

Finally, the old makeAppIconFor is now create_appicon_for_application().
This commit is contained in:
Rodolfo García Peñas (kix)
2013-01-22 21:18:15 +01:00
committed by Carlos R. Mafra
parent 97d7c32184
commit 70c9208e40
3 changed files with 19 additions and 24 deletions

View File

@@ -71,6 +71,7 @@ static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char
static WAppIcon *wAppIconCreate(WWindow * leader_win);
static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon);
static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon);
static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window);
/* This function is used if the application is a .app. It checks if it has an icon in it
* like for example /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
@@ -143,19 +144,24 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
return aicon;
}
void makeAppIconFor(WApplication *wapp)
void create_appicon_for_application(WApplication *wapp, WWindow *wwin)
{
/* If app_icon, work is done, return */
if (wapp->app_icon)
return;
/* Try to create an icon from the dock or clip */
create_appicon_from_dock(wwin, wapp, wapp->main_window);
/* Create the icon */
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
wIconUpdate(wapp->app_icon->icon, NULL);
/* If app_icon was not found, create it */
if (!wapp->app_icon) {
/* Create the icon */
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
wIconUpdate(wapp->app_icon->icon, NULL);
/* Now, paint the icon */
if (!WFLAGP(wapp->main_window_desc, no_appicon))
paint_app_icon(wapp);
/* Now, paint the icon */
if (!WFLAGP(wapp->main_window_desc, no_appicon))
paint_app_icon(wapp);
}
/* Save the app_icon in a file */
save_appicon(wapp->app_icon, False);
}
void unpaint_app_icon(WApplication *wapp)
@@ -958,7 +964,7 @@ static WAppIcon *findDockIconFor(WDock *dock, Window main_window)
return aicon;
}
void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window)
static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window)
{
WScreen *scr = wwin->screen_ptr;
wapp->app_icon = NULL;