On Mon 24.Aug'09 at 0:17:27 +0200, Carlos R. Mafra wrote: > On Wed 26.Nov'08 at 16:27:19 +0100, Gilbert wrote: > > 07-WindowMaker-confirm_kill_show_app_name.diff > > [...] > > > > If anyone has a chance to have a look at these, please do. > > [...] > > With your patch applied the names are correct for all of them, > _but_ they also contain the whole set of options used to > start them. > > So now I get: > > "wmwifi -s will be forcibly closed..." > > instead of just: > > "wmwifi will be forcibly closed..." > > Can you take a look into it and parse out the options? > If you do I will happily apply it to my repo and use it :-)
I used the wtokensplit() function to remove the options and folded my patch into your original one. See below the result, do you agree with it? I tested here and it fixed the issue above, but I only needed to add wtokensplit() in src/dock.c and not in src/appicon.c. Now 'wmwifi -s' appears as "wmwifi" both if I kill it when docked (as I expected) but also when undocked (which was a surprise). Do you have any comments? Anybody? Regards, Carlos >From b8022b03e9e0c1d2989db0e032d9b1975b9c237a Mon Sep 17 00:00:00 2001 From: Gilbert Ashley <[email protected]> Date: Wed, 26 Nov 2008 16:27:19 +0100 Subject: [PATCH] Show app name in Kill Application dialog The "Kill Application" dialog window doesn't always show the application name when killing DockApps. It shows its wm_class instead, which is not always the same as the app name. This patch allows the Kill Application dialog window to show the application name in the window -- as expressed by using the basename of the path to the application. [crmafra: Added wtokensplit() to get only the app name] --- src/appicon.c | 6 +++++- src/dock.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/appicon.c b/src/appicon.c index e3164b7..4437e58 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -383,6 +383,8 @@ static void killCallback(WMenu * menu, WMenuEntry * entry) WApplication *wapp = (WApplication *) entry->clientdata; WFakeGroupLeader *fPtr; char *buffer; + char *shortname; + char *basename(const char *shortname); if (!WCHECK_STATE(WSTATE_NORMAL)) return; @@ -391,7 +393,9 @@ static void killCallback(WMenu * menu, WMenuEntry * entry) assert(entry->clientdata != NULL); - buffer = wstrconcat(wapp->app_icon ? wapp->app_icon->wm_class : NULL, + shortname = basename(wapp->app_icon->wm_instance); + + buffer = wstrconcat(wapp->app_icon ? shortname : NULL, _(" will be forcibly closed.\n" "Any unsaved changes will be lost.\n" "Please confirm.")); diff --git a/src/dock.c b/src/dock.c index 9f528ff..1d82a37 100644 --- a/src/dock.c +++ b/src/dock.c @@ -206,7 +206,9 @@ static void killCallback(WMenu * menu, WMenuEntry * entry) WScreen *scr = menu->menu->screen_ptr; WAppIcon *icon; WFakeGroupLeader *fPtr; - char *buffer; + char *buffer, *shortname, **argv; + char *basename(const char *shortname); + int argc; if (!WCHECK_STATE(WSTATE_NORMAL)) return; @@ -219,7 +221,12 @@ static void killCallback(WMenu * menu, WMenuEntry * entry) WCHANGE_STATE(WSTATE_MODAL); - buffer = wstrconcat(icon->wm_class, + /* strip away dir names */ + shortname = basename(icon->command); + /* separate out command options */ + wtokensplit(shortname, &argv, &argc); + + buffer = wstrconcat(argv[0], _(" will be forcibly closed.\n" "Any unsaved changes will be lost.\n" "Please confirm.")); @@ -257,6 +264,7 @@ static void killCallback(WMenu * menu, WMenuEntry * entry) } wfree(buffer); + wtokenfree(argv, argc); icon->editing = 0; -- 1.6.4.183.g04423 -- To unsubscribe, send mail to [email protected].
