Re: Modules and Name space

On Sep 15, 2004, at 11:26 PM, Kevin C. Krinke wrote:

I myself don't like the "Don't $verb" buttons because it's not really translatable...

true. i suffer from the "everybody where i am speaks my language" syndrome. :-/

I like flush_events() better as IMHO the former implies only visual updates but I don't like flush_events() that much either. How about something more direct then like process_pending_events()?

verbose, but accurate. still less to type than "Gtk2->main_iteration while Gtk2->events_pending". ;-)

C) either A or B but omit the Constants and/or Utils

Gtk2::Ex::Constants and Gtk2::Ex::Utils would be handy; i could see lots of useful stuff fitting nicely into those.

So you're implying the other way around? Leave the dialogs to Gtk2::MessageDialog and provide the Constants (minus :truth) and Utils modules? Hmm.

yes, mostly to avoid the duplication of Gtk2::MessageDialog. i do like the one-liners; i have my own one-liners package at work, including things like get_open_file_name(), get_save_file_name(), get_string(), etc. (actually implemented in C and bound to perl, but that's another story.)

they're pretty simple, e.g.:

# $name = Foo->get_open_file_name ($window, 'Choose something', 'foo.txt', TRUE);
  # returns undef if the user cancels, or a filename.
  # all parameters are optional.
  # if must_exist is true, the user must select an existing file.
  sub get_open_file_name {
     my (undef, $parent, $title, $initial_filename, $must_exist) = @_;
     my $filesel = Gtk2::FileSelection->new ($title || 'Open file');
     $filesel->set_transient_for ($parent) if $parent;
$filesel->set_filename ($initial_filename) if defined $initial_filename;
     my $filename;
     while ('ok' eq $filesel->run) {
         $filename = $filesel->get_filename;
         if ($must_exist && not -f $filename) {
            # don't accept; run again.
         } else {
     return $filename;

could be implemented such that it uses a Gtk2::FileChooser if you have support for it, etc.

The door is locked. I tried to open it, but the lock is harder to pick than a broken nose.
  -- Sensei, on 'I, Ninja'

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]