GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The case of the disappearing tray icon

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
realistik



Joined: 17 Mar 2010
Posts: 4

PostPosted: Wed Mar 17, 2010 9:17 pm    Post subject: The case of the disappearing tray icon Reply with quote

Hi everybody. A few months back I wrote a C#/Gtk# app to automatically change my desktop background in Xfce 4.6. A couple of days after that I wrote the same app with C/Gtk+. I'm running Xubuntu 9.10 x86 and have my panel set to autohide. My app is accessible via a tray icon, however, when I bring up my panel from autohide, my tray icon is rarely visible, at least immediately, even though the app is running. I was wondering if this is a commonly-known problem where I just didn't write enough code or something.

It appears I can't post a link to my source without having posted at least 2 messages...
Back to top
realistik



Joined: 17 Mar 2010
Posts: 4

PostPosted: Wed Mar 17, 2010 9:18 pm    Post subject: Second post Reply with quote

Sorry to do this in this manner...
Back to top
realistik



Joined: 17 Mar 2010
Posts: 4

PostPosted: Wed Mar 17, 2010 9:19 pm    Post subject: The source code Reply with quote

My source is available at Google Code.
Back to top
tadeboro
Never Seen the Sunlight


Joined: 23 Jul 2008
Posts: 2114
Location: Slovenia

PostPosted: Fri Mar 19, 2010 11:39 pm    Post subject: Reply with quote

Hello and welcome to the GTK+ forums.

Looking at your code and wp_switch() function, I get a feeling that using fork() and execlp() is causing you troubles, since application "flow" doesn't return to main loop as soon as possible. Idling in main loop is needed in order to give GTK+ time to process all of the events.

Try using GLib provided utility function in form of g_spawn_*() family of functions to do what you want. And if spawned command will not return relatively fast, I would strongly encourage you to use _async() family, since this will make your application respond as expected.

I'm not familiar with XFCE much, so I cannot guarantee that this will work, but replacing all of your fork() related stuff with g_spawn_async() call should do the trick. Post back if you need more help.

Tadej
Back to top
realistik



Joined: 17 Mar 2010
Posts: 4

PostPosted: Sat Mar 20, 2010 8:03 pm    Post subject: Thanks! Reply with quote

Thanks for the tip! I have done very little programming on Linux in general, and even less for GUI. Sounds like I need to go do some studying on GLib. :)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP