Re: Saving treeview state

2007-02-09 Thread Jens Sauer
Am Donnerstag, den 08.02.2007, 18:24 -0500 schrieb Dave Moore:
 If this is a stupid question, please feel free to flame me.
 
 I have an app that has a treeview.  I would like to save some state
 information about this treeview to restore the next session.  Namely I would
 like to remember the column sizes and positions so the user doesnt have to
 keep resetting them everytime he loads the app.
 
 Is there a simple/obvious way to do this?  I've been googling for a few
 hours now and nothing is jumping off my screen.
 
 Thanks in advance.
 
 Dave
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Hi,

maybe you can get the columns with:
'gtk_tree_view_get_column'
and then you can get the width property of the column with:
'gtk_tree_view_column_get_width'

for the other properties there are also functions to get the value.

On restoring, I think you must set the width with this:
'gtk_tree_view_column_set_min_width'
or 'gtk_tree_view_column_set_fixed_width'

I never tried. But I think this should work.
I'm interested if this works.
-- 
Jens Sauer [EMAIL PROTECTED]

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


Re: how to make an animation ;)

2007-02-09 Thread tomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Feb 09, 2007 at 01:02:20AM +0100, Olivier Ramare wrote:
 Enrico Sardi wrote:
  Hi all!
 
  I want to make a simple animation in gtk with a pixbuf that rotates, how 
  can I make it?

 For every change of state of my application, the image changes.
 I have 10 files with the rotated images (I've created them with
 a repeated use of gimp) and I use the following code:
 --
 #define GTK_FLUSH while (gtk_events_pending()) gtk_main_iteration();
 void wait_fine(float intervalle)
 {
 float lheure = (clock()/CLOCKS_PER_SEC);
 while(((clock()/CLOCKS_PER_SEC) - lheure)  intervalle){;};
 }

The problem with this is that it'll keep your program (and most of your
computer ;) busy with the job. Better use a timer (or an idle) callback.

Even better: pixbufs know about animations and do it for you! With
gdk_pixbuf_animation_new_from_file()[1] you can load an animation from a
file (there are other functions aroud there if you want to build-up the
anim frame-by-frame). You can put this animated pixbuf in a GtkImage the
usual way with gtk_image_set_from_pixbuf()[2]

I'm too bogged down to cook up an example right now, but this might
help.

- 
[1] 
http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-animation.html#gdk-pixbuf-animation-new-from-file
[2] 
http://developer.gnome.org/doc/API/2.0/gtk/GtkImage.html#gtk-image-set-from-pixbuf

Regards
- -- tomás
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFzDy9Bcgs9XrR2kYRAvvaAJ0RUkyetf/UJV0A0fI6pwddCq9xdQCfaPg3
rzNrjOoa0qgtF4N+0DWx4pw=
=wasb
-END PGP SIGNATURE-

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

Catching the row deleted from a GtkTreeModel implementation

2007-02-09 Thread Fontana Nicola
I'm keeping some summary fields of a GtkListStore and I need to update them on 
every model change. The problem is while catching the row-deleted signal 
the row is yet deleted, so I can't access the row content to update my 
summary fields.

How can I do it?

Thanks,

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


RE: Catching the row deleted from a GtkTreeModel implementation

2007-02-09 Thread Suma H.S
how r u deleting the row?
It should be either through some key-press or mouse-click, in either case u
must select the row before selecting.
So...If it is through a key-press, catch the key-press signal and if it is
through a mouse-click,
catch mouse-click signal and access the selected row. Now do all the
updations u want and then delete the row from the model.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Fontana Nicola
Sent: Friday, February 09, 2007 2:36 AM
To: gtk-app-devel-list@gnome.org
Subject: Catching the row deleted from a GtkTreeModel implementation


I'm keeping some summary fields of a GtkListStore and I need to update them
on
every model change. The problem is while catching the row-deleted signal
the row is yet deleted, so I can't access the row content to update my
summary fields.

How can I do it?

Thanks,

-- Nicola
___
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


Re: Catching the row deleted from a GtkTreeModel implementation

2007-02-09 Thread Vivien Malerba
On 2/9/07, Suma H.S [EMAIL PROTECTED] wrote:
 how r u deleting the row?
 It should be either through some key-press or mouse-click, in either case u
 must select the row before selecting.
 So...If it is through a key-press, catch the key-press signal and if it is
 through a mouse-click,
 catch mouse-click signal and access the selected row. Now do all the
 updations u want and then delete the row from the model.



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Fontana Nicola
 Sent: Friday, February 09, 2007 2:36 AM
 To: gtk-app-devel-list@gnome.org
 Subject: Catching the row deleted from a GtkTreeModel implementation


 I'm keeping some summary fields of a GtkListStore and I need to update them
 on
 every model change. The problem is while catching the row-deleted signal
 the row is yet deleted, so I can't access the row content to update my
 summary fields.

 How can I do it?

I would suggest a different approach: add your own column to the
GtkListStore which stores your information summary as a GObject (so
you know when that object is destroyed).

If you can't add a column to the GtkListStore, then I suggest creating
another GtkTreeModel implementation which proxies the GtkListStore
and adds a new column (in this case you'll have to write a method to
delete data so you'll know when it's deleted) - see the
GtkTreeModelFilter implementation for example.

Regards,

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


Re: Catching the row deleted from a GtkTreeModel implementation

2007-02-09 Thread Fontana Nicola
On Friday 09 February 2007 11:39, Suma H.S wrote:
 how r u deleting the row?
 It should be either through some key-press or mouse-click, in either case u
 must select the row before selecting.
 So...If it is through a key-press, catch the key-press signal and if it is
 through a mouse-click,
 catch mouse-click signal and access the selected row. Now do all the
 updations u want and then delete the row from the model.

The model management is inside a library and it is shared by more 
applications. Of course I can provide a function to call before a delete 
operation, but I am short in memory and I'm sure before or after to forget to 
call this function in the application.

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


Re: Catching the row deleted from a GtkTreeModel implementation

2007-02-09 Thread Fontana Nicola
On Friday 09 February 2007 11:55, Vivien Malerba wrote:
 I would suggest a different approach: add your own column to the
 GtkListStore which stores your information summary as a GObject (so
 you know when that object is destroyed).

This approach seems quite complex but yes, it makes the job. Maybe I'll try to 
use a custom G_TYPE_BOXED instead of a GObject to improve performances, but 
the concept is the same.

Thank you for your suggestion,
-- Nicola
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: how to make an animation ;)

2007-02-09 Thread Enrico Sardi
[EMAIL PROTECTED] pronuncio' le seguenti parole il 09/02/2007 10:19:

Hi Tomas!
 The problem with this is that it'll keep your program (and most of your
 computer ;) busy with the job. Better use a timer (or an idle) callback.

 Even better: pixbufs know about animations and do it for you! With
 gdk_pixbuf_animation_new_from_file()[1] you can load an animation from a
 file (there are other functions aroud there if you want to build-up the
 anim frame-by-frame). You can put this animated pixbuf in a GtkImage the
 usual way with gtk_image_set_from_pixbuf()[2]

   
I saw  gdk_pixbuf_animation_new_from_file but it  only works with  an 
animated file as input while I need to build the animation from a series 
of indipendent files...thanks for the help!

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


Re: GObject docs improvements

2007-02-09 Thread Stefan Kost
Hi,

Quoting David Ne?as (Yeti) [EMAIL PROTECTED]:

 On Thu, Feb 08, 2007 at 08:44:50AM +0100, Stefan Kost wrote:

 What I like to ask you is to reply to
 this mail and tell us what you don't understand yet, point out parts
 that can be improved, let us know if there are some nagging concerns
 about the way GObject works.

 Deriving from classes that implement interfaces and changing
 the implementation would worth an explanation and example.

Huh, sounds scary. We can do this. Do you have pointers to an example?
While checking for an example, just noticed that the Implemented  
Interfaces stuff in Gtkdoc seems quite borked. Need to fix that.

 If possible then please checkout the latest version and base your
 feedback on that one:
svn co http://svn.gnome.org/svn/glib/trunk glib
cd glib
./autogen.sh --prefix=$HOME/test

 I believe --enable-gtk-doc is missing here.
Yes. Keep forgetting that too.
make
cd docs/reference/gobject
evince html/index.html 

 Yeti

Thanks for the feedback

Stefan

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


Re: how to make an animation ;)

2007-02-09 Thread Olivier Ramare
Hi,

  I would ask gimp to create the animated part.
Open gimp with your first image.
Create as many layers as you have images.
Open each of the images and copy them
  in the successive layers
Use menu item Filter-Animation-play or replay I'm not sure
 to check the partial result.
Use Filter-Animation-optimise (GIF) to reduce the size.
Use File-Save as
  A dialog wil open and ask you if you want the image
flattened (all layers on one image) or if you want to register
that as an animation. You want the latter and the job if done.

  I don't know how to automate this algorithm since
I'm not script-fu writer ---
  FWIW :-)
  Olivier

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


Re: GObject docs improvements

2007-02-09 Thread Shixin Zeng
Sorry, I forgot a CC to the list.

On 2/9/07, Shixin Zeng [EMAIL PROTECTED] wrote:
 Thanks. But I want some explanation about the interface of gobject. I
 can't understand what it is from a sentence like GType's Interfaces
 are very similar to Java's interfaces. because I know nothing about
 Java, and I don't want to dig into Java just for this concept.

 On 2/8/07, Stefan Kost [EMAIL PROTECTED] wrote:
  hi,
 
  yesterday I committed a first batch of cleanups to the GObject docs.
  http://developer.gnome.org/doc/API/2.0/gobject/index.html
 
  IMHO this is a crucial documentation for the GNOME platform and it can
  be improved further. Marc-Andre Lureau and Zeeshan Ali already joined
  in the quest to improve this. What I like to ask you is to reply to
  this mail and tell us what you don't understand yet, point out parts
  that can be improved, let us know if there are some nagging concerns
  about the way GObject works. Are there details that should be
  explained by a picture?
 
  If possible then please checkout the latest version and base your
  feedback on that one:
 svn co http://svn.gnome.org/svn/glib/trunk glib
 cd glib
 ./autogen.sh --prefix=$HOME/test
 make
 cd docs/reference/gobject
 evince html/index.html 
  you don't need to install it.
 
  Thanks!
 
  Stefan
 
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 


 --
 Best Regards

 Shixin Zeng



-- 
Best Regards

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


Re: when and where to destroy popup menu?

2007-02-09 Thread Guy Rouillier
Zhang Yang wrote:
 Hello.
 I have created a popup menu in my function(list below). But I have a
 question when and where to destroy it?.

I see in your sample below you are not connecting the popup_menu signal, 
which is the one you want for context menus.  You don't need to destroy 
it, Gtk does that for you, after dispatching the proper event from the 
selected menu item.

-- 
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: scrolledview

2007-02-09 Thread James Scott Jr
On Thu, 2007-02-08 at 05:53 +, [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On Wed, Feb 07, 2007 at 08:32:26PM +0100, Mehmet YASAR wrote:
  [EMAIL PROTECTED] a écrit :
 [...]
   how can I know that all the widget have done their size negotiations ?
   I can't rely on the realized signal since the gtkvbox is already 
   realized ...
   
   I'd put my bets on the widget's size-allocate signal -- but I don't know
   for sure.
  
  I had already done some experimentation and I've found that widgets may 
  get more than one size-allocate signal.
 
 [...]
 
 Yes, I suppose you'd have to track the size as it changes. If you have
 to do an action  hwenever the size really, truly changed (meaning it has
 been displayed and all is quiescent), perhaps an idle handler would be
 the right place.
 
 Regards
 - -- tomás
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.1 (GNU/Linux)
 
 iD8DBQFFyrrRBcgs9XrR2kYRAv5IAJ492lpDlVYRLNQMTW5tyQg7tyzCtQCfdpVr
 CbfgmDGn4JNUmPkHHam9lZI=
 =UcZq
 -END PGP SIGNATURE-
 

Mehmet,

An idle handler would be a good fit here.  I assumed that you are
creating and filling textviews during the startup of your program and
possibly before you enter the main_loop or gtk_main.  Or possibly in a
routine that does everything at once.  Here is the potential problem:
your create and populate actions require some additional gtk messages to
be processed, which are waiting to get serviced by the gtk_main() loop.
So thing s will not appear to settle down until after the gtk_main has
been allowed to run.  Using an idle handler puts your call to a
Position/Size routine at the back of the waiting queue of needed
messages, so by the time it's processed the other messages have done
their job and all the textviews/scrollbars/gtkvboxes, and scrolled
windows have settled down.  -- wait, this assumes you issued a
gtk_widget_show{_all} on the main window containing all this stuff!  Its
the gtk_widget_show that starts the cascade of messages which includes
the size and realize messages.  

g_idle_add() or g_timeout_add(250,...) show do the trick.

James,



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

James Scott, Jr. 
Registered Linux User #270764
FC6 on Dual AMD-MP 2400+
Author: {gfhcm, gkrellfah2,gapcmon,giw}.sourceforge.net
http://mysite.verizon.net/skoona/index.html
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list