Re: Quitting an application

2008-03-28 Thread Sujith
Bastiaan Veelo writes:
 > I have not checked, but maybe gtk_main_leve() returns 0 if gtk_main() 
 > has not been called yet? If that would be of any help.

Yes, I checked and it does return 0 before gtk_main() has been called.
I'll play around with it. Thanks for the tip.

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


VALA and GTK

2008-03-28 Thread Martín RV (OPENGeoMap)
Hi all:

I am trying to find the best way to develop free software in the GNOME 
world . What do you think about VALA?.
Actually c # is a great language and i do not like c + + or JAVA  at 
all, but it is VALA a technology with  future?

For me, GObject it´s great, but with VALA is very quick when  you want 
*Object-oriented programming in C.*


-- MONO/ GTK # vs GTK + vs VALA :-\



In my work i am using Ruby / gnome, but only for very small things.

We never can touch Qt :-D , hehe

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


Re: Quitting an application

2008-03-28 Thread Bastiaan Veelo
Sujith wrote:
> Gabriele Greco writes:
>  > Intercept the delete_event or modify the callback where you do the
>  > gtk_main_quit() and insert there some thread sync code.
>  > 
>  > You should take care also when you add the rows to your Tree/ListStore if
>  > you do that directly from the  thread that scans the db.
>  > 
>  > I suppose there is a thread since if there isn't one when you quit the main
>  > loop nothing can crash it (except something you call after gtk_main()) :)
>  > 
>
> I don't have a separate thread that does the DB scanning.
> The sequence of operations is something like this:
>
> 1 * Init various GUI elements including the track treeview.
> 2 * Read the DB and append elements to the treeview.
> 3 * call gtk_main() and wait for events.
>
> Now, if the user quits between 2 and 3, it becomes an issue because gtk_main()
> hasn't been called yet and I can't check for the main loop.
> If gtk_main() has been invoked, I can check for the existence of the mainloop 
> like this:
>
> while(gtk_events_pending())
>   if (gtk_main_iteration_do(FALSE))
>   return;
>   

I have not checked, but maybe gtk_main_leve() returns 0 if gtk_main() 
has not been called yet? If that would be of any help.

> Is spawning a thread and cooking up some simple synchronization scheme the 
> only
> way to quit gracefully ?
>
> thanks,
> Sujith
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>   

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


g_array_copy how to?

2008-03-28 Thread Kaustubh Patil
Hi,

Can somebody please tell me how can I write a function
which returns a copy of a given GArray. The problem I
am facing is how to identify the type of the data in
the given array.

Also I would like to know how can I pass type as an
argument, like g_array_index does.

Thanks,
kaustubh 


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


List open modules

2008-03-28 Thread Bastiaan Veelo
Hi,

I would like to know the name of the theme engine that is drawing my 
application. How do I do that? I failed to find a way to get a list of 
open modules.

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


Re: Quitting an application

2008-03-28 Thread Sujith
Gabriele Greco writes:
 > Intercept the delete_event or modify the callback where you do the
 > gtk_main_quit() and insert there some thread sync code.
 > 
 > You should take care also when you add the rows to your Tree/ListStore if
 > you do that directly from the  thread that scans the db.
 > 
 > I suppose there is a thread since if there isn't one when you quit the main
 > loop nothing can crash it (except something you call after gtk_main()) :)
 > 

I don't have a separate thread that does the DB scanning.
The sequence of operations is something like this:

1 * Init various GUI elements including the track treeview.
2 * Read the DB and append elements to the treeview.
3 * call gtk_main() and wait for events.

Now, if the user quits between 2 and 3, it becomes an issue because gtk_main()
hasn't been called yet and I can't check for the main loop.
If gtk_main() has been invoked, I can check for the existence of the mainloop 
like this:

while(gtk_events_pending())
if (gtk_main_iteration_do(FALSE))
return;

Is spawning a thread and cooking up some simple synchronization scheme the only
way to quit gracefully ?

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


Re: GLib questions, GArray and GNode

2008-03-28 Thread Kaustubh Patil
Dear Jordan,

Thanks for quick answer. I am not very good in
extensive pointer programming. So it will be very nice
of you if you can clarify some more things. 

1. Is the following function ok? 

GArray* g_array_clone(GArray *array) {

int i;
GArray *clone = g_array_new(FALSE,FALSE,sizeof(long));

for(i=0;ilen;i++)
 
g_array_append_val(clone,(long)g_array_index(array,long,i));

return clone;

}


2. I want reconstruct a tree from a text file. For
that I need to iteratively read node information (node
names as a string) from the file and add the node to
the tree. In this case how can I add the string to the
->data?

Thanks in advance,
Kaustubh


--- Jordan Walsh <[EMAIL PROTECTED]> wrote:

> On Thu, 2008-03-27 at 10:01 -0700, Kaustubh Patil
> wrote:
> > Hi,
> > 
> > I am using glib (version 2.0) for developing some
> > applications. I have some questions about use of
> > Garray and GNode (G-n-ary tree).
> > 
> > 1. Is it safe to return an initialized GArray *
> from a
> > function? e.g. copying garray array1 into garray
> > array2 and then returning pointer to array2.
> > 
> > 2. For n-ary tree, is it possible to add strings
> > (static) as data?
> > 
> > 3. Is it possible to add a structure as data in
> > n-ary-tree? If yes, how to the functions like
> > g_node_find work?
> > 
> > Thanks in advance,
> > Kaustubh
> > 
> > 
> > 
> >  
>

> > Be a better friend, newshound, and 
> > know-it-all with Yahoo! Mobile.  Try it now. 
>
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > ___
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> >
>
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 1. Yes, just keep in mind to free any temporary
> data, and that garray2
> will have to be freed by whatever needs the copy.
> 
> 2. You can add anything as data (answers 3 also)
> data is just a pointer
> to the "actual data". to clarify.. no you cannot add
> an "int". but you
> can add a pointer to an int* or &int, string, GList,
> etc.
> 
> 3. yes.. just add a pointer to your structure as
> ->data and typecast
> where needed.
> 
> 
> 



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to get the preedit character from TextView?

2008-03-28 Thread KwangYul Seo
Hi,

I can get the text string from TextView,
but I can't get the last character in preedit mode before it commits.

Is it possible to get the character in preedit mode from TextView?

Thanks,
Kwang Yul Seo
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Quitting an application

2008-03-28 Thread Sujith
G Hasse writes:
 > This is a quite common problem in GUI design. How do you syncronize 
 > between a long job and a short fast one (as quitting). The first answer 
 > is that you should not do any long jobs. You should split the long work
 > in small ones, and let every other job have the ability to run. 
 > Alternative you could make a coprocess to read the DB and when the work
 > is done you get the result in one "operation". 
 > 
 > Well - the real answer is - it could be difficult. You might turn to 
 > some syncronization mechanism or maybee threads...
 > 

Thanks. I guess I have to rethink my design then. :)

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


Re: GLib questions, GArray and GNode

2008-03-28 Thread Jordan Walsh
On Thu, 2008-03-27 at 10:01 -0700, Kaustubh Patil wrote:
> Hi,
> 
> I am using glib (version 2.0) for developing some
> applications. I have some questions about use of
> Garray and GNode (G-n-ary tree).
> 
> 1. Is it safe to return an initialized GArray * from a
> function? e.g. copying garray array1 into garray
> array2 and then returning pointer to array2.
> 
> 2. For n-ary tree, is it possible to add strings
> (static) as data?
> 
> 3. Is it possible to add a structure as data in
> n-ary-tree? If yes, how to the functions like
> g_node_find work?
> 
> Thanks in advance,
> Kaustubh
> 
> 
> 
>   
> 
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

1. Yes, just keep in mind to free any temporary data, and that garray2
will have to be freed by whatever needs the copy.

2. You can add anything as data (answers 3 also) data is just a pointer
to the "actual data". to clarify.. no you cannot add an "int". but you
can add a pointer to an int* or &int, string, GList, etc.

3. yes.. just add a pointer to your structure as ->data and typecast
where needed.


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


Re: Freeze/Thaw a GtkWidget

2008-03-28 Thread Andrew Cowie
On Tue, 2008-03-25 at 22:24 -0400, Evan Charlton wrote:
> I'm curious how one would go about freezing (stopping UI updates) and
> thawing (applying and resuming UI updates) a GtkWidget, as well as any
> children of it.

You might have some success if you use the low level mechanism:
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-handler-block
and/or
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-handlers-block-matched
and/or
http://library.gnome.org/devel/gobject/stable/gobject-Signals.html#g-signal-stop-emission-by-name
etc. That's all at the individual signal level, but probably the
behaviour you're trying to block is in a signal handler somewhere.

A different tack would be to desensitize ("grey out") the Widget, ie
http://library.gnome.org/devel/gtk/2.12/GtkWidget.html#gtk-widget-set-sensitive
though that's probably not "stop UI updates" like you asked.

AfC
Sydney

-- 
Andrew Frederick Cowie
Managing Director
Operational Dynamics

Need sorting out or help scaling up? Call us.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list