Javascript Question

This forum is for anything that doesn't specifically have to do with Better Than Wolves
Post Reply
User avatar
Camerinthus
Posts: 294
Joined: Wed Jul 20, 2011 4:06 pm
Location: New York (Not the city)

Javascript Question

Post by Camerinthus »

This is for a friend who's making an addition to his computer which is running Linux Mint (12, I believe). Basically, he's making a little mod with a messaging popup (hover over an icon on taskbar, menu pops up) with a "Mail" option, along with several others. However, he wants it to not show up (only the Mail one) when the program it uses isn't installed.

How would you do that?


(To try to clarify: hover over icon in taskbar -> menu with ~5 options (looks sort of like mini start menu) -> mail icon + link at top)
IGN: Camerinthus
User avatar
OneTripleZero
Posts: 66
Joined: Sun Oct 02, 2011 6:17 pm
Location: Canada

Re: Javascript Question

Post by OneTripleZero »

This is a desktop application he's making? Do you mean Java, not Javascript? (They're two completely different things) If you mean Java, you might want to edit your title to bring in more traffic :)
Be ashamed to die until you have won some victory for Humanity - Horace Mann
User avatar
Elensaar
Posts: 308
Joined: Tue Jul 05, 2011 8:47 pm
Location: Oslo, Norway

Re: Javascript Question

Post by Elensaar »

No matter which one he's actually using, his app needs to check at startup if the third-party mail app is available. Worst-case scenario: try to run it and handle the error as an "available = false" ;) But most APIs used for coding these kinds of things have some call you can make to check the existence of files and such.
Lots of planets have a north...!
User avatar
OneTripleZero
Posts: 66
Joined: Sun Oct 02, 2011 6:17 pm
Location: Canada

Re: Javascript Question

Post by OneTripleZero »

Right. There's really too little info here to give meaningful help without running the risk that we'll steer you both in the wrong direction. However, things such as popups typically initialize their contents when they are opened, not when their containing application is initialized, so they're probably going to need to look into the method(s)/routine(s) where the popup is generated, and make a check there to see if the mail app is installed. How will this be done? There's a lot of possibilities here so I won't speculate, but if your friend is knowledgeable enough to be writing Linux app extensions/mods they'll probably know where/how to do that.

edit: It sounds at first like I'm disagreeing with Elensaar re: proper time to check for the mail app, so I should clarify: checking for the mail app at the startup for your friend's app is probably best, and then they should store that result somewhere. When changing the contents of the popup, your friend will probably check his previously stored reference, and set the contents of the popup that way.
Be ashamed to die until you have won some victory for Humanity - Horace Mann
Post Reply