How to use GtkEntry/GtkEntryCompletetion with gtk_cell_renderer_text_new

2007-07-10 Thread Rodrigo Miguel
Hello all,

I need to use a couple of function that I have for Mask Edit, those that I'm
using sucessfully with a bunch of gtkentry call backs.

So, is there any way to use that with gtk_cell_renderer_text_new and
gtkentry ? Or maybe I can change my functions to use key-press-event, but
I'm not able to use that in a cell render, or in a worse case, Can I get the
cell coordinates, then I can create a dialog/entry over that ?

Thanks in advance

Rodrigo Moreno
http://xhgtk.sourceforge.net/ - a set of gtk bindings for xharbour and
harbour languages
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Multiple threads and gtk_main()

2007-07-10 Thread Gabriele Greco
I've a few threads (more than one) doing some work (not accessing GTK 
functions), I'd like to have a general way to make them notify their 
work to the main loop.

I used the g_idle_add() in the previous context where I had only a 
thread with this behaviour, but with two or more threads the 
g_idle_add() method of notification is not correct IMHO (what happens if 
  two threads call g_idle_add() before the call of the first one is 
processed by the glib main loop?)

I thought about a mutex solution, something like this:

thread X:
lock idle_mutex
g_idle_add(my_idle_func)

my_idle_func:
unlock idle_mutex
[update the gui]
return FALSE

This way should work but when I use mutexes in context I've not full 
control on I always fear unhandled deadlock situations...

I though about using a GAsyncQueue for every thread but in this way the 
problem I have is how to notify the main loop that there is something on 
a queue, I've not found anything in the documentation... I fear the only 
  way it's to use a pipe or a socket, or an idle function, but in this 
case I will occur again in the locking problem, I hope I'm wrong about 
this so I'm asking here :)

-- 
Bye,
  Gabry
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Multiple threads and gtk_main()

2007-07-10 Thread Eduardo M KALINOWSKI
Gabriele Greco escreveu:
 I've a few threads (more than one) doing some work (not accessing GTK 
 functions), I'd like to have a general way to make them notify their 
 work to the main loop.

 I used the g_idle_add() in the previous context where I had only a 
 thread with this behaviour, but with two or more threads the 
 g_idle_add() method of notification is not correct IMHO (what happens if 
   two threads call g_idle_add() before the call of the first one is 
 processed by the glib main loop?)
 [...]
 I though about using a GAsyncQueue for every thread but in this way the 
 problem I have is how to notify the main loop that there is something on 
 a queue, I've not found anything in the documentation... I fear the only 
   way it's to use a pipe or a socket, or an idle function, but in this 
 case I will occur again in the locking problem, I hope I'm wrong about 
 this so I'm asking here :)
Make your threads add stuff to a single GAsyncQueue. Let an idle 
function (or a timeout function) always run, that checks the GAsyncQueue 
and does something if there is something to do, or simply returns if it 
is empty. Wouldn't that work?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Multiple threads and gtk_main()

2007-07-10 Thread wallace . owen
On Tue, 2007-07-10 at 17:44 +0200, Gabriele Greco wrote:
 I've a few threads (more than one) doing some work (not accessing GTK 
 functions), I'd like to have a general way to make them notify their 
 work to the main loop.
 
 I used the g_idle_add() in the previous context where I had only a 
 thread with this behaviour, but with two or more threads the 
 g_idle_add() method of notification is not correct IMHO (what happens if 
   two threads call g_idle_add() before the call of the first one is 
 processed by the glib main loop?)
 
 I thought about a mutex solution, something like this:
 
 thread X:
   lock idle_mutex
   g_idle_add(my_idle_func)
 
 my_idle_func:
   unlock idle_mutex
   [update the gui]
   return FALSE
 
 This way should work but when I use mutexes in context I've not full 
 control on I always fear unhandled deadlock situations...
 
 I though about using a GAsyncQueue for every thread but in this way the 
 problem I have is how to notify the main loop that there is something on 
 a queue, I've not found anything in the documentation... I fear the only 
   way it's to use a pipe or a socket, or an idle function, but in this 
 case I will occur again in the locking problem, I hope I'm wrong about 
 this so I'm asking here :)

If you were on a unix/linux box, I'd suggest writing to a pipe.  It
allows multiple writers and one reader, and you can make a select call
in a g_idle_add() callback to see if it's readable and handle it if so.*

I haven't experienced a locking problem with regard to writing to a pipe
or socket.  Multiple threads can be writing to a pipe, but each chunk
passed is guaranteed to be written intact, and you've only got one
reader, so no contention problem on that end.  As long as you always
know how much a writer has sent you (a length field in a fixed-size
header, or fixed-size messages).

And if all readers and writers are in the same address space, they only
need to pass the address of the object, so you are writing just
pointers, and using ring buffers, right?


  // Wally

*Let me add that I would first take a closer look at what gtk provides
that's more processor efficient than an idle-loop for checking whether
something is readable.
-- 
[EMAIL PROTECTED]
Office: 619.278.2084
Cell:   619.990.2286
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


installing gtk+-1.2.0

2007-07-10 Thread uma G
Dear GTKers,

I've been having trouble compiling GTK+ apps for some time now.
./configure always goes through its regular motions until:

checking for GLIB - version = 1.2.2... yes
checking for gtk-config... no
checking for GTK - version = 1.2.0... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
configure: error: Test for GTK failed.

My version is gtk+-1.2.0.  My glib is glib-1.2.2.  I
have no file called gtk-config, nor does it seem to exist in any
distributions of GTK+ whose list of files I've read on RPMfind.  I'd be
very obliged if you could sort me out on this.

Keep up the great work, and thanks,
Uma.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Multiple threads and gtk_main()

2007-07-10 Thread Chris Vine
On Tue, 2007-07-10 at 13:10 -0300, Eduardo M KALINOWSKI wrote:
[snip]
 Make your threads add stuff to a single GAsyncQueue. Let an idle 
 function (or a timeout function) always run, that checks the GAsyncQueue 
 and does something if there is something to do, or simply returns if it 
 is empty. Wouldn't that work?

That would work with a timeout, but not with an idle function.  Using
g_idle_add() in this way would create a busy loop.

Chris


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list