Wednesday, October 1, 2008

World's Worst Programmer

Yep, that's me. You'd think that after spending an entire day going through Ubiquity's source code, that I'd at least be able to do something with it. Curse you Thunderbird!

So I managed to figure out where the function is that initiates Ubiquity when the user presses the appropriate key binding. I've also managed to figure out how commands are called upon, where they're stored, and how they're written. On top of all of this I've even managed to figure out where the key binding to pop up the Ubiquity window is located. So what's the problem then?

I CAN'T GET IT TO DO ANYTHING! From what I've seen, Ubiquity activates by listening for an incoming key binding. If it receives the correct key binding (which is defaulted to CTRL+Space) it will pop up. Ok so I tried porting it over to Thunderbird and using the key binding to pop up the window. Well... I guess Thunderbird is already making use of the CTRL+Space key binding. It's a binding in Thunderbird that allows you to select and unselect a highlighted e-mail.

Ok so NO PROBLEM! I think to myself. Naturally, if I can't get it to pop up using that key binding, I suppose I'll just change the binding. So I find one that I like that isn't currently being used by Thunderbird. No dice. Still doesn't want to pop up. At this point I'm kind of thinking that there's more to it than simply having the Javascript create the Ubiquity window after hitting the binding. Incase you're wondering, I did change the appropriate layout files in the manifest files, so that's not the problem (at least I don't think so).

So, there is the possibility that the event handler listening for the key binding isn't even operating. Alright, I'll just add a function to Ubiquity that immediately pops up the window when a menu item is clicked, and I'll add that menu item under the Thunderbird Tools tab. I've done it with several test extensions I've written so far. Shouldn't be too hard to add this menu item for Ubiquity. I know where the function is that pops up the window, so I create my own function that calls upon that function in Ubiquity's browser.js file. To add the Tool bar menu item, I just copy my code from my good old "Hello World!" extension and change the appropriate fields and point it to the Ubiquity function that I wrote. Thunderbird spits out an error on my menuitem id=. Nice, it doesn't do that for my crappy little extension. Guess I'm probably missing something. I double checked the code and there's no difference in the characters declaring the variable name at all.

It's just one of these times where I feel like a cave man that's come across a car. It looks nice and shiney, and I know it probably does something cool. I just don't know what it does, how it does it, or where to begin finding out. What I'm trying to do with Ubiquity right now is like a cave man trying to use the car's exhaust as a club. Unfortunately, I don't even know how to detach the exhaust pipe. I know that the club isn't the real purpose of the car, but if I have something nice and shiney infront of me, I might as well make use of it somehow. Who knows, I might even learn how to use a wheel next if I can get this exhaust club thing going.

Despite figuring out how everything begins between Ubiquity and Firefox, I'm still the worst programmer ever. Not that I honestly thought I'd even make it as far as I did doing what I was doing. However, one thing's for sure, I probably should have listened more closely when we were learning Javascript rather than dozing off. Javascript... pfft... who will EVER need that? Oh wait...

2 comments:

Tony Lai said...

Scott my good man, you're not nearly the world's worst programmer. FAR from it. Believe me, I've seen far worse =)

Anyhow, I know the browser.js file pretty well now, so if you'd like anything just let me know!

By the way, just FYI, Ubiquity's shortcut key defaults to Alt+Space on Linux systems. Just letting you know!

Cheers and good luck!

Scott said...

Yeah I already figured out how to add my own shortcuts and what Ubiquity defaults its bindings to. I've been testing this under Windows XP and the default key binding will be ALT+D if Ubiquity is not running under the Firefox browser.

My main problem at the moment is that my overlay file is borked and I need to figure out why. I'll work on that later today... hopefully I'll figure out what's going wrong.