Update statusIcon gtk pixbuf

View: New views
3 Messages — Rating Filter:   Alert me  

Update statusIcon gtk pixbuf

by SomeIrishGuy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

private StatusIcon trayIcon;

in the constructor i have

Constructor
{
this.trayIcon = new StatusIcon(getStatusIconPixbuf());
......
}


private Pixbuf getStatusIconPixbuf() // returns a generated pixbuf
{
.......
}




this works fine, but i would like to be able to change the pixbuf
icon in the statusmenu at periodical intervals using a timer

i seems to cause havok though, as the menu no longer draws correctly and the pixbuf just goes blank

i presume i've done something to the main thread (cross invocation exception), but i cant find any documentation on how to invoke a change managed by a delegate for this event.

Thanks.
Dave.

mono 2.4
gtk#2.12.8

Re: Update statusIcon gtk pixbuf

by Bojan Rajkovic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

SomeIrishGuy wrote:

> private StatusIcon trayIcon;
>
> in the constructor i have
>
> Constructor
> {
> this.trayIcon = new StatusIcon(getStatusIconPixbuf());
> ......
> }
>
>
> private Pixbuf getStatusIconPixbuf() // returns a generated pixbuf
> {
> .......
> }
>
>
>
>
> this works fine, but i would like to be able to change the pixbuf
> icon in the statusmenu at periodical intervals using a timer
>
> i seems to cause havok though, as the menu no longer draws correctly
and the

> pixbuf just goes blank
>
> i presume i've done something to the main thread (cross invocation
> exception), but i cant find any documentation on how to invoke a change
> managed by a delegate for this event.
>
> Thanks.
> Dave.
>
> mono 2.4
> gtk#2.12.8
Use Application.Invoke with a delegate that sets the status icon.

- --
Bojan Rajkovic <bojanr@...>
Biochemistry '10, Brandeis University
PGP Signature Key ID: 0x8783D016
PGP Encryption Key ID: 0x2497B8B2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBCAAGBQJKJE56AAoJEO4IwQyHg9AW4VgQAJ9N6r4zwbVAOqgLEF6Yj+dY
Bbxm6Ggr75mBWPkYny2jlqXqUZTw6hn9+GEsyV9hA/T9U5Zl3imkDavOcH7uEHBc
Z5CCKBrkDBjN8u0CTn1jCpzKg9ZSxjF+EhtsOX8e71w5Kj9tjf5xiuBfQGMMrhNq
wRI8gz+hfnsrJHuMOSkkzebYoFLE94Om0kOyeFjVZxIp9BVRmNGnFHlWocFHkVjW
xdQbEiGpuqjL3ueKX/1L+PsU7X4kvj6dr79RXTEMuhWCuSVZ7kQ5vON/ttsldoj9
+3z1KkzdzdWjKhpIU2nLTqy5SW5WqEe9TkOZuQrnc9SqATsqflOvVsieEzVCj8e+
LBmDWXidG8C/daFJ27DIqUp/nURI5brXZCAVa6mrBptxKu9VNcAHm+ZoBxhFp/G8
g4Teg+anYGm2+/oyk16GBHwz//1WpTSlAYP1pIOCnn1Vau12NgWiyq22I47uenlo
vB2iKZfsYNer/35Xt3UGq1RsNibNklTtoTF1q/J5aF2IrkTEdrwr7pMKmJg9sBUz
aLBlKzthlM8oVfSm1a+IAyqQfohoeDetoQhAF5LZj63+8owcSf3spshRWowfJxiF
c7OhsNibpCb5lLyRuy2AwRn6i9YK5WavXRRTRzQWyl8W1x2TlPe486Mr7rsmxixE
ym+AxZzcMReWBgqRDuQv
=UzYI
-----END PGP SIGNATURE-----

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: Update statusIcon gtk pixbuf

by lordphoenix-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le Fri, 29 May 2009 13:11:29 -0700 (PDT),
SomeIrishGuy <dave@...> a écrit :

>
> i presume i've done something to the main thread (cross invocation
> exception), but i cant find any documentation on how to invoke a
> change managed by a delegate for this event.
in Elapsed event of timer you must do :

Gtk.Application.Invoke(delegate{
        //change your icon here
});


_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

signature.asc (204 bytes) Download Attachment