Sorting GtkListStore date column

2006-03-12 Thread Guy Rouillier
I'm fairly new to GTK programming, and I'm helping out on an open source 
GTK-based project (gcvs, part of the cvsgui project.)  We have a 
GtkListStore with a column containing date.  The column is specified as 
G_TYPE_STRING.  When sorted, it does an alphanumeric sort, so in English 
it puts all the Fridays together first, followed by all the Mondays, 
Saturdays, Sundays, etc.


Obviously, I want to sort this in date sequence.  How do I accomplish 
this?  I searched the archives before posting and couldn't find anything 
applicable.  Thanks.


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


Re: Handling Unix signals in a GTK+ application

2006-03-12 Thread Gus Koppel
Chris Vine wrote:

 On Saturday 11 March 2006 22:36, Thomas Okken wrote:
   [Using a pipe] is generally the best way of dealing
   with asynchronous (Unix) signals, but for simple
   cases another approach is just to set a flag of type
   volatile sig_atomic_t in the Unix signal handler,
   and then check and act on the status of the flag in
   the glib event loop with an idle handler set up with
   g_idle_add().
 
  The downside of that approach is that you have to
  busy-wait on that flag, while the pipe approach allows
  the application to be completely idle (and still have
  fast response to the signal)... I went with the pipe
  approach; using the sample code referred to by another
  poster, it turned out to be pretty easy.
 
 That's not right.  Idle handlers do not busy wait.  They do trigger 
 invocations of the event loop at indeterminate intervals.  They are also very 
 common (if you don't want to communicate with the glib event loop from other 
 threads with a pipe, you are likely to end up with using a GAsyncQueue object 
 and an idle handler).

The main problem I see with idle handlers is that there may be
application types on which they rarely or never get triggered, simply
because the app doesn't go idle. This is commonly the case for games and
multimedia applications, which may consume all CPU power there is,
possibly generating their own GTK+ signals for redrawings or other tasks
all the time, or other sorts of applications which perform long
calculations and may see the main loop only via gtk_main_iteration() if
there are events pending. Such applications wouldn't enter idle state
(hence not triggering the idle handler) for potentially long periods. On
the other hand, news from a pipe could still be received and processed
nearly instantaneous, as they have higher priority than idle events.

However, if you know your application belongs to the majority of GTK+
applications, that is, it stays in the outermost main loop, spending
most of its time actually being idle, then using the idle handler may be
appropriate. But as explained, it's not quite as fail-safe as pipes.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


change color of certian words in a text

2006-03-12 Thread 吕晋鹏
i want to change the color of certian words in a text,for example:
when you input some word in a text ,then certain words are changed color.
if i were a bird ,then i can fly,when i input the sentence ,then word if
and word then change color(from black to red),but other words still keep
original color,how can i do it?
thank you!
regards
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


AMD64 Installation/Usage-Experience Checklist?

2006-03-12 Thread Tony Freeman
I was just on the Ubuntu site 

http://www.ubuntu.com/testing/flight5

... and noted that they have a checklist of sorts for people to report
back on their installation and experience using the software.  

( scoll down the page to the 'testing' section or click here for the
long vesion of the test checklist:
https://wiki.ubuntu.com/Testing/Long )

I was just wondering if AMD64 should have the same sort of thing?  Such
a check list could be posted on this site:

http://www.debian.org/ports/amd64/

... with a request that people join the mailing list to submit the
results of their experience.



-- Tony



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


Re: Sorting GtkListStore date column

2006-03-12 Thread Chris Vine
On Sunday 12 March 2006 19:30, Chris Vine wrote:
 On Sunday 12 March 2006 09:11, Guy Rouillier wrote:
  I'm fairly new to GTK programming, and I'm helping out on an open source
  GTK-based project (gcvs, part of the cvsgui project.)  We have a
  GtkListStore with a column containing date.  The column is specified as
  G_TYPE_STRING.  When sorted, it does an alphanumeric sort, so in English
  it puts all the Fridays together first, followed by all the Mondays,
  Saturdays, Sundays, etc.
 
  Obviously, I want to sort this in date sequence.  How do I accomplish
  this?  I searched the archives before posting and couldn't find anything
  applicable.  Thanks.

 You can sort on a hidden column in the list store (that is, one not
 displayed in a tree view) which has, say, this format:  MMDDSS

Sorry, that should of course be MMDDHHMMSS (expressed numerically).

Chris

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


Re: Handling Unix signals in a GTK+ application

2006-03-12 Thread Thomas Okken
Gus Koppel wrote:

 However, if you know your application belongs to the
 majority of GTK+ applications, that is, it stays in
the
 outermost main loop, spending most of its time
actually
 being idle, then using the idle handler may  be
 appropriate. But as explained, it's not quite as
 fail-safe as pipes.

My application is scriptable, so while it's running a
script, an idle handler would never get invoked... Not
that that's such a problem, because it would be easy
enough to insert a check for an interrupted flag in
the script interpreter's main loop. My concern is what
happens when the application actually *is* idle. Using
an idle handler does not prevent you from having to
busy-wait in that case, it just means you're using a
fancy mechanism to do it; you still have to make the
compromise between fast response (by having an idle
handler that basically sucks up all free CPU cycles)
or being multitask-friendly (by using a timer so you
only check every second, say). The big plus of the
pipe approach is you get the best of both.

soapboxI think GTK+ really should have its
XtNoticeSignal() equivalent. It's a strange omission,
IMHO -- but I guess it keeps falling through the
cracks because it's not too difficult to work around./soapbox

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Sorting GtkListStore date column

2006-03-12 Thread Guy Rouillier

Chris Vine wrote:


Obviously, I want to sort this in date sequence.  How do I accomplish
this?  I searched the archives before posting and couldn't find anything
applicable.  Thanks.


You can sort on a hidden column in the list store (that is, one not
displayed in a tree view) which has, say, this format:  MMDDSS



Sorry, that should of course be MMDDHHMMSS (expressed numerically).


Thanks, Chris and Fredderic for the suggestions.  Fredderic, gCvs is is 
a desktop GUI to manage CVS repositories, so the date range for listed 
files can span multiple years.  Hence, a day-of-the-week approach won't 
work.


I'll use the approach of storing the time_t corresponding to each 
displayed date in a hidden column, and use that hidden column as the 
sort column for the date column.  Out of curiosity, would it also be 
possible to do this in a single column by storing just the time_t, and 
using a custom renderer to transform the time_t value into a displayable 
string?  Is sorting done on the rendered text or on the underlying data?


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