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

Re: Problem setting icon for Gtk2::StatusIcon



>>> my $image1 = Gtk2::Image->new_from_stock('gtk-refresh', 'menu' ) ;
>>
>>what is this for?
>
> If I recall correctly, you were making new Gtk2::Images in your callback,
> everytime it was called.

Yep, but you did not reference image1 later in your code :-P And used
my way instead (recreating each time...)

> This is inefficient, and in Tk it would probably cause a memory gain.

Might be, depends on how it is solved internally. Anyway, even with
this overhead, the reactivity of the systray icon using TrayIcon
instead of StatusIcon is much better.

> Gtk2 is much better about cleaning up it's closures, so it may not make a difference.
> However, the idea is to only make 2 Gtk2::Image objects, and reuse them, for efficiency.
> With only 2 images, why not pre-make them?

Two in the example, yes.

> Yeah, I was lazy there just for demo purposes. You also could
> do the toggle, by getting the current image, and switching to the other.
> Of course, a global toggle is nice sometimes, as a flag to other portions
> of the code, to signal what state you currently are in.

Maybe it's just me. I am obsessive about global variables. Usually I
only have $LOG_OF (file handle) and $DEBUG (easier to share with
modules).

> You seem to have a handle on what is happening, I'm just throwing some
> confusion your way :-).

I'm considering looking into the gtk sources -- I did look into the xs
files of Gtk2, but it seems all to be happening in gtk internals
(gtk_status_icon_set_from_stock). Maybe I shouldn't, though. I am
sitting at an airport on a way to a job interview  -- and I still
haven't prepared my presentation :-)

j.


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