Re: Cell Renderer Combo Callback

2007-09-12 Thread Damien Caliste
Hello,

Le 12/09/2007, dhk [EMAIL PROTECTED] a écrit :
 I have a combo render in a treeview and I can't get the callback to
 set the value once it's selected.
I didn't test the code you gave, so can't be sure, but I suggest to
remove the « text, Stock, » property from the combo rendrer.
   g_object_set(G_OBJECT(renderer), model, ls_combo,
text-column, 0,
text, Stock,
has-entry, FALSE,
editable, TRUE,
NULL);
In my own code, I also create my column with the text attribute
pointing to the right column id of my model:
 col = gtk_tree_view_column_new_with_attributes(ItemType, renderer,
text, 0, NULL);
That's the only differences I can figure out.

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

Re: Cell Renderer Combo Callback

2007-09-12 Thread dhk
Thanks, but it still doesn't work.  I think the problem is in getting
the iter for the list store which is used in the combo render or it
might be working and just not getting rendered to be visible.  I'm
fairly sure the problem is in the callback.

On Wed, 2007-09-12 at 13:47 +0200, Damien Caliste wrote:
 Hello,
 
 Le 12/09/2007, dhk [EMAIL PROTECTED] a écrit :
  I have a combo render in a treeview and I can't get the callback to
  set the value once it's selected.
 I didn't test the code you gave, so can't be sure, but I suggest to
 remove the « text, Stock, » property from the combo rendrer.
g_object_set(G_OBJECT(renderer), model, ls_combo,
 text-column, 0,
 text, Stock,
 has-entry, FALSE,
 editable, TRUE,
 NULL);
 In my own code, I also create my column with the text attribute
 pointing to the right column id of my model:
  col = gtk_tree_view_column_new_with_attributes(ItemType, renderer,
   text, 0, NULL);
 That's the only differences I can figure out.
 
 Damien.
 ___
 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


Animation with GTK+

2007-09-12 Thread Prokopenko, Konstantyn
Hello,

I'm totally new to the GUI application development in Linux X11. I was
mostly involved in embedded non-graphical development.
Now I need to create GUI interface application using GTK+. 
Could you advise me the best way to create animation of a rotating
object in GTK window? This object is going to be a picture of a device
rotating in sync with a real hardware device. Which library/extension I
can use?

Thank you.

Regards,
Konstantyn


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


Re: Cell Renderer Combo Callback

2007-09-12 Thread Damien Caliste
Hello,

Le 12/09/2007, dhk [EMAIL PROTECTED] a écrit :
 Thanks, but it still doesn't work.  I think the problem is in getting
 the iter for the list store which is used in the combo render or it
 might be working and just not getting rendered to be visible.  I'm
 fairly sure the problem is in the callback.
Ok, I test your code in some of mine to see what happen. The two points
I spoke about are relevant and should be applied. Because, with the
first (text, Stock) Stock is always drawn instead of the choice.
With the second, nothing is printed in the cell.

But, in the callback, going through a GtkTreePath (think to free it
after use) doesn't work (don't know why exactly). In my experience, I
use instead directly:
valid = gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(list),
  iter, path);
to get the iter from the string 'path'.

With these three points, it should work.

Damien.


PS: if you want a default value for your combo, like Stock, just add
Stock in your model.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Animation with GTK+

2007-09-12 Thread Lance Dillon
If you have an animated gif, you can use GtkImage.  If you need to actually 
sync it with something external, you can use GdkPixbufAnimation and 
GdkPixbufAnimationIter:

http://library.gnome.org/devel/gtk/unstable/GtkImage.html
http://library.gnome.org/devel/gdk-pixbuf/unstable/gdk-pixbuf-animation.html


- Original Message 
From: Prokopenko, Konstantyn [EMAIL PROTECTED]
To: gtk-app-devel-list@gnome.org
Sent: Wednesday, September 12, 2007 9:38:18 AM
Subject: Animation with GTK+

Hello,

I'm totally new to the GUI application development in Linux X11. I was
mostly involved in embedded non-graphical development.
Now I need to create GUI interface application using GTK+. 
Could you advise me the best way to create animation of a rotating
object in GTK window? This object is going to be a picture of a device
rotating in sync with a real hardware device. Which library/extension I
can use?

Thank you.

Regards,
Konstantyn


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





  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Changing a previously created GtkImage

2007-09-12 Thread tsaud

I have created an image from a file using 
image1 = gtk_image_new_from_file(pictures/Empty.gif);
gtk_widget_set_name (image1, image1);

and displalyed it using:
gtk_widget_show(image1);
gtk_box_pack_start(GTK_BOX (hbox1), image1, TRUE, TRUE, 0);

and that works fine.  The image is correctly displayed where I want it. 
Later, when a particular event happens (right now I have assigned it to a
button press), I want to change the image to the image in the file
pictures/Full.gif (which is exactly the same size as Empty.gif).  To do
that, I did the following:

void on_button1_pressed (GtkButton *button, gpointer user_data)
{
   GtkWidget *imageptr;
   imageptr = lookup_widget(GTK_WIDGET(button), image1);
   if(imageptr != NULL)
   {
  gtk_image_set_from_file(GTK_IMAGE(imageptr), pictures/Full.gif);
   }
   else
  fprintf(stderr, image1 not found\n);
}

When I press the button, the image is replaced by a broken image icon, not
the new image.  What am I doing wrong?  I am obviously getting the correct
widget with the lookup_widget call, since the image changed.  The file
Empty.gif and the file Full.gif are in the same directory, and when I
change the gtk_image_new_from_file() call to load the Full.gif file, that
works fine as well, so I know the file is there and readable.  I just don't
understand why it didn't change to the new image.

Thanks,
T


-- 
View this message in context: 
http://www.nabble.com/Changing-a-previously-created-GtkImage-tf4431950.html#a12643884
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

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


Re: Changing a previously created GtkImage

2007-09-12 Thread Yeti
On Wed, Sep 12, 2007 at 01:52:43PM -0700, tsaud wrote:
 
 I have created an image from a file using 
 image1 = gtk_image_new_from_file(pictures/Empty.gif);
 gtk_widget_set_name (image1, image1);
 
 and displalyed it using:
 gtk_widget_show(image1);
 gtk_box_pack_start(GTK_BOX (hbox1), image1, TRUE, TRUE, 0);
 
 and that works fine.  The image is correctly displayed where I want it. 
 Later, when a particular event happens (right now I have assigned it to a
 button press), I want to change the image to the image in the file
 pictures/Full.gif (which is exactly the same size as Empty.gif).  To do
 that, I did the following:
 
 void on_button1_pressed (GtkButton *button, gpointer user_data)
 {
GtkWidget *imageptr;
imageptr = lookup_widget(GTK_WIDGET(button), image1);
if(imageptr != NULL)
{
   gtk_image_set_from_file(GTK_IMAGE(imageptr), pictures/Full.gif);
}
else
   fprintf(stderr, image1 not found\n);
 }
 
 When I press the button, the image is replaced by a broken image icon, not
 the new image.  What am I doing wrong?  I am obviously getting the correct
 widget with the lookup_widget call, since the image changed.  The file
 Empty.gif and the file Full.gif are in the same directory, and when I
 change the gtk_image_new_from_file() call to load the Full.gif file, that
 works fine as well, so I know the file is there and readable.  I just don't
 understand why it didn't change to the new image.

Can't the working directory change meanwhile?  Paths such as
pictures/Full.gif seem quite fragile to me.

1) Try g_file_test() to check whether pictures/Full.gif
   exists as the time on_button1_pressed() is called.
2) Try to load the image with gdk_pixbuf_load() and look at
   the error your obtain.

Yeti

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


Question about gchar g_strconcat()

2007-09-12 Thread [EMAIL PROTECTED]
hello,

gchar *file;
file=test;
  
file = g_strconcat(/some/path/, file, .txt, NULL);
g_printf(%s, file);


My question is do i must allocate memory for file ?

Fred

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


Re: Question about gchar g_strconcat()

2007-09-12 Thread Yeti
On Wed, Sep 12, 2007 at 08:20:18PM +0200, [EMAIL PROTECTED] wrote:
 gchar *file;
 file=test;
   
 file = g_strconcat(/some/path/, file, .txt, NULL);
 g_printf(%s, file);
 
 
 My question is do i must allocate memory for file ?

The topic of this list is the development of Gtk+, not with
Gtk+.  Direct questions like this to gtk-list.

The short answer is: No, but you have to *free* it.  See the
documentation of g_strconcat().  And you should use
g_build_filename().

Yeti

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