On 21/06/12 18:29, Carlos R. Mafra wrote:

> 
> Function names are important and should not do more than their
> names imply. In this case, create_appicon_from_dock() should only
> try to get an icon from the dock (or clip).
> 
> If the icon is not there, do not try to make an icon from scratch.
> You were told to create it from the dock!
> 
> Signed-off-by: Carlos R. Mafra <[email protected]>
> ---
>  src/appicon.c     |    4 ----
>  src/application.c |   16 +++++++++-------
>  2 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/src/appicon.c b/src/appicon.c
> index 6cc2bca..6827c2f 100644
> --- a/src/appicon.c
> +++ b/src/appicon.c
> @@ -955,8 +955,6 @@ static WAppIcon *findDockIconFor(WDock *dock, Window 
> main_window)
>  void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window 
> main_window)
>  {
>       WScreen *scr = wwin->screen_ptr;
> -
> -     /* Create the application icon */
>       wapp->app_icon = NULL;
>  
>       if (scr->last_dock)
> @@ -990,7 +988,5 @@ void create_appicon_from_dock(WWindow *wwin, WApplication 
> *wapp, Window main_win
>  
>               wAppIconPaint(wapp->app_icon);
>               wAppIconSave(wapp->app_icon);
> -     } else {
> -             makeAppIconFor(wapp);
>       }
>  }
> diff --git a/src/application.c b/src/application.c
> index f0122f0..f08f435 100644
> --- a/src/application.c
> +++ b/src/application.c
> @@ -132,22 +132,24 @@ WApplication *wApplicationCreate(WWindow * wwin)
>  #ifdef USER_MENU
>       if (!wapp->menu)
>               wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
> -#endif       /* USER_MENU */
> +#endif
>  
> -     /*
> -      * Set application wide attributes from the leader.
> -      */
> +     /* Set application wide attributes from the leader */
>       wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
>       wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
>  
>       /* application descriptor */
>       XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
>  
> -     /* Create the application icon using the icon from docks
> -      * If not found in docks, create a new icon
> -      * using the function wAppIconCreate() */
> +     /* First try to create an icon from the dock or clip */
>       create_appicon_from_dock(wwin, wapp, main_window);
>  
> +     /*
> +      * In case it was not found in the dock, make it from scratch.
> +      * Note: makeAppIconFor() returns early if wapp->app_icon exists
> +      */
> +     makeAppIconFor(wapp);
> +
>       /* Save the app_icon in a file */
>       save_app_icon(wapp);
>  


Great patch. More clear, better.

+1


-- 
To unsubscribe, send mail to [email protected].

Reply via email to