Strict Standards: Redefining already defined constructor for class wpdb in /home/darkshadow/nightproductions.net/blog/wp-includes/wp-db.php on line 52

Deprecated: Assigning the return value of new by reference is deprecated in /home/darkshadow/nightproductions.net/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/darkshadow/nightproductions.net/blog/wp-includes/cache.php on line 389

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 657

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 657

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 657

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 657

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /home/darkshadow/nightproductions.net/blog/wp-includes/classes.php on line 682

Deprecated: Assigning the return value of new by reference is deprecated in /home/darkshadow/nightproductions.net/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/darkshadow/nightproductions.net/blog/wp-includes/theme.php on line 507
Ramblings of a Mad Poet • Blog Archive • Introducing Polish: A new framework

Introducing Polish: A new framework

May 25, 2007 at 2:16 PM

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/darkshadow/nightproductions.net/blog/wp-includes/formatting.php on line 74

A month ago, Paul Kim over at Noodlesoft made a post about a proposal for a new way to install. In it, he described how it might be advantageous to display a dialog to the user asking them if they’d like to install the application if it were running from a disk image (or some other unwritable media).

As it so happens, I had already intended to write some code that checked that very thing, to fix a problem with Picture Switcher. I hesitate to call it a bug — it’s more like an unintended side effect. The problem was that in my last version, I decided to add in a dialog asking the user if they would like PS to run when they logged in. All fairly standard. What I hadn’t taken into account (and this would be a bug), was users running PS from the disk image. I should have put in a check for that. The unintended side effect is that, after having said yes to that dialog, every time they logged in the disk image would be mounted and run PS from there. I hadn’t even known the login items would do such a thing. Suffice to say, I’ve gotten some support emails about this issue.

So, I needed to write some code to both check if PS was running from a disk image and some code to fix the login item problem. I was working on another portion of PS when Paul made his proposal, but this past week I came back to fix up that section. The end result: a new framework.

Polish handles this and also handles login items. It will check if you are running from unwritable media OR running from the user’s download folder (for those of you using zip files or internet-enabled disk images), and if it is, will display a dialog asking the user if they’d like to copy the application to a different location. Polish can also check to see if the application is a login item, and if not display a dialog asking the user if they’d like it to run when they log in. You don’t have to check for either — you can check for whichever one suits your needs.

I wrote up my own code based loosely on the LoginItemsAE code for Polish, using NSAppleEventDescriptor (mostly — there are a few lower level AE calls that are still present). It does work. You can use Polish for the preferences section of your application, if you allow the user to add/remove it from the login items list. You’re not limited to just the check.

Here is the dialog presented to the user if they are running from some unwritable media or running from their download folder:
Polish's copy dialog

Note that I decided to use the term ‘copy’ rather than ‘install’ — I felt that had less of a psychological factor attached to it. ‘Install’ implies that more than just the application may be copied to the hard drive.

Here is the dialog presented to the user when asked if they’d like the application to run when they login:
Polish's login item dialog

The images are taken from the test application that comes with the framework. “Polish Test” will, of course, be replaced by your application’s name.

I can hear a few of you now: “Oh no, those dialogs are terrible! That won’t go with my application…” Well I actually thought of that. If you are using some sort of custom window scheme, or just don’t like they way the dialogs look, you can customize them or entirely replace them with your own window.

The download for the Polish framework contains a built version of the framework, a test application, the source to both of those, and documentation.

Head on over my Developer page to download it. The reference is also available there online, if you wish to look through it before downloading Polish.

For anyone curious as to why I named the framework “Polish” — well, I think the framework adds some polish to an application. But also, the Sparkle framework had a little influence, as well. ;)

2 Responses to “Introducing Polish: A new framework”

Conor Comments:

Thank you for sharing your sweat and labour with the rest of the Cocoa community. Especially in a nice little packaged framework.


Darkshadow Comments:

Of course. :) How could I not have? The code is too big to just go with one app. ;)



Comments are closed.