On Wed, 12 Nov 2008 15:26:52 +0100
"Carlos R. Mafra" <[EMAIL PROTECTED]> wrote:
>
> Take a look at the struct called WAppIcon inside src/appicon.h
>
> > I'll give that a shot.
>
> If your computer explode don't blame me! :-)
>
>
I got it working, but it was wm_instance that holds the command. In the case of
my test app the full path is used to run it, so I had to use basename to
shorten that. At first I was getting an 'assignment makes pointer from an
integer without a cast' error.
This is what I wound up using in appicon.c:
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;
WCHANGE_STATE(WSTATE_MODAL);
assert(entry->clientdata!=NULL);
shortname = basename(wapp->app_icon->wm_instance);
buffer = wstrconcat(wapp->app_icon ? shortname : NULL,
_(" will be forcicbly closed.\n"
"Any unsaved changes will be lost.\n"
"Please confirm."));
fPtr = wapp->main_window_desc->fake_group;
.............
Using this also worked, but somehow looked more hackish:
char *shortname;
...
shortname = (char*) basename(wapp->app_icon->wm_instance);
In dock.c, substituting with 'icon->command' worked as
'wapp->app_icon->wm_instance' above. I'll do the same thing there using
basename to pretty up the output:
char *shortname;
char *basename(const char *shortname);
...
shortname = basename(icon->command);
buffer = wstrconcat(shortname ,
_(" will be forcicbly closed.\n"
"Any unsaved changes will be lost.\n"
"Please confirm."));
Thanks fgain for mentioning it. I would have just left it alone since I didn't
fix it on the first try. My C skills are really, really poor, so even little
things escape me, but searching and studying to fix something may someday get
me out of the hole...
Gilbert
--
To unsubscribe, send mail to [EMAIL PROTECTED]