Re: Pass more widgets as gpointer.

2009-04-22 Thread Freddie Unpenstein
You can use a few tricks to help manage these one-shot constructs... One that I used quite a while ago, was a wrapper around a simple array that stores array size and free functions for each member, so a simple "free" function can rip through and clear everything out. It's good as long as you'r

Re: Hiding a GtkDialog and Cancel Callback

2009-04-22 Thread arne
hello, > Well, I'm not sure the Dialog might be Destroyed. How are you call it? It is created with with the whole application in my glade file with glade_xml_new(), but it is not shown because I just gtk_show_all() my other window. > Because if you call gtk_widget_destroy (dialog) this might ha

RE: GtkDialog created from GtkBuilder (glade 3) isn't returning agtk.ResponseType

2009-04-22 Thread Ethan Baldridge
Never mind - I spent two hours looking at this and then realized I needed to set a Response ID on the button itself. I thought it defaulted for the stock buttons. -Original Message- From: gtk-app-devel-list-boun...@gnome.org [mailto:gtk-app-devel-list-boun...@gnome.org] On Behalf Of Ethan

GtkDialog created from GtkBuilder (glade 3) isn't returning a gtk.ResponseType

2009-04-22 Thread Ethan Baldridge
I can't figure out what I'm doing wrong. I'm trying to make a login dialog - I created it in Glade-3 making sure to use a GtkDialog template. But the result is always 0, which isn't in the ResponseType enum at all. def login(self): self.builder.add_from_file("transmission.gl

Re: Pass more widgets as gpointer.

2009-04-22 Thread Dov Grobgeld
As I've said in he past, I believe the best thing is to sub-class GtkWindow and then make all the pointers you want to pass around members of your new class. Conceptually this looks like: class MyWindow : GtkWindow { GtkWidget *w_label; GtkWidget *w_button;

Re: Hiding a GtkDialog and Cancel Callback

2009-04-22 Thread Vlad Volodin
Hi, Arne Well, I'm not sure the Dialog might be Destroyed. How are you call it? Because if you call gtk_widget_destroy (dialog) this might happen. But with GtkDialog from XML hm I'm not sure. Can you check the same thing with other (not Cancel) buttons? And the other advice/suggestion can you

Hiding a GtkDialog and Cancel Callback

2009-04-22 Thread arne
Hello, I Build my application with glade, also a dialog. The Dialog is created from xml at startup, but not shown. If I need the Dialog I show it and if i don't need it I hide it. In the Callback of the Cancel button of the Dialog I just hide the Dialog. But If I press the Cancel button, somet

Re: Pass more widgets as gpointer.

2009-04-22 Thread Vlad Volodin
Hi, Jens Yes, your way is good (thank you for a small code, maybe I will use it in my projects). But, are you sure your way is safe? You don't know the size of array (at the first), where do you free the array of pointers itself (try g_malloc and g_free, because it is GLIB :) ) (at the second). An

Re: Pass more widgets as gpointer.

2009-04-22 Thread Jens Hansen
Hi All. Thanks for all ideas, to this problem. I figured out how to pass more widgets in an array, which is IMHO the best way to do it. Just for reference, the following snippet. "Packing" the widgets pointers in the array GtkWidget * *data; data = malloc(sizeof(GtkWidget *)*3); data[0]=spinbu

Re: Pass more widgets as gpointer.

2009-04-22 Thread Vlad Volodin
Hello again Well, yes, you are right about globals (I don't use them, but tried to show one of the ways to resolve a task). But, I think, usage of many structures also makes code hard readable. Just imagine, you have Struct1 (with some objects), Struct2, Struct3 etc. There are too many structures w