Re: Hm. ItemFactory vs. gtk2-perl 0.90 ? :)



On Mon, 2003-07-21 at 13:51, Ross McFarland wrote:

i'm not opposed to this, but if this is the case it would be best to complain
on any unknown hash value, which would change the code that's in there as of
right now, make things slightly less efficient, but in the end perhaps be the
best solution. i was headed in this direction myself. i'll mull it over a
little longer, if i end up liking the idea that will probably be what happens.

proposed change to the behavior of Gtk2::ItemFactory->create_item under
the hash input type:

foreach (keys %$entry)
{
        if( $_ eq 'path' )
        {
                $path = $entry->{path};
        }
        elsif( $_ eq 'accelerator' )
        {
                $accelerator = $entry->{accelerator};
        }
        elsif( $_ eq 'callback' )
        {
                $callback = $entry->{callback};
        }
        elsif( $_ eq 'callback_action' )
        {
                $callback_action = $entry->{callback_action};
        }
        elsif( $_ eq 'item_type' )
        {
                $item_type = $entry->{item_type};
        }
        elsif( $_ eq 'extra_data' )
        {
                $extra_data = $entry->{extra_data};
        }
        else
        {
                carp("Gtk Item Factory Entry; unknown key ($_) "
                   . "ignored, legal keys are: path, "
                   . "accelerator, accel, callback, "
                   . "callback_action, item_type, extra_data");
        }
}

reason i post this is two fold. 1) desire for a consensus on whether or
not this is the best manner/behavior. 2) for you perl magicians out
there to suggest a better way of doing this. i can think of things that
involve evals and such but i think they're ulgy and less efficent than
the straight forward approach above. i'll commit this unless i hear
otherwise or get something better within a day or two.

-rm




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