Re: g_signal_connect() and G_OBJECT

2017-06-30 Thread Emmanuele Bassi
The first argument of `g_signal_connect()` is a gpointer (i.e. a `void*`), so you don't need a cast at all — C will implicitly cast any pointer to `void*`, and from `void*` to any other pointer. Additionally, as you discovered, signals are GTypeInstance features — you can emit signals on anything

g_signal_connect() and G_OBJECT

2017-06-30 Thread Ingo Brückl
Hi, it seems that it was common practice to cast the first argument of g_signal_connect() to G_OBJECT when I started developing applications with GTK+ quite a while ago. At least I've learned it that way and am doing it ever since. I repeatedly see usage of g_signal_connect() without that cast

noob question: g_signal_connect()

2012-03-06 Thread Christopher Howard
Hi. I've installed the api documentation from the source code for both gtk+ and glib, but I can't seem to find an api description of g_signal_connect(). The examples I usually see are along the lines of code -- g_signal_connect (G_OBJECT (button[0]), draw, G_CALLBACK

Re: noob question: g_signal_connect()

2012-03-06 Thread David Nečas
On Tue, Mar 06, 2012 at 10:07:16AM -0900, Christopher Howard wrote: Hi. I've installed the api documentation from the source code for both gtk+ and glib, but I can't seem to find an api description of g_signal_connect(). http://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal

g_signal_connect, structs and my sanity

2008-11-03 Thread beginner.c
); base.sWidgets.window = glade_xml_get_widget (base.sWidgets.gxml, window); base.sWidgets.button = glade_xml_get_widget (base.sWidgets.gxml, button1); base.sWidgets.hscale = glade_xml_get_widget (base.sWidgets.gxml, hscale1); g_signal_connect (base.sWidgets.button

Re: g_signal_connect, structs and my sanity

2008-11-03 Thread David Munger
); } [...] g_signal_connect (base.sWidgets.hscale, change-value, G_CALLBACK (funcScale), base); ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: g_signal_connect, structs and my sanity

2008-11-03 Thread beginner.c
*widget, struct allStructs *base) { gdouble value; value = gtk_range_get_value (GTK_RANGE (widget)); printf(Qs: %i\n, value); printf(Qs: %i\n, base-sTestOne.a); } [...] g_signal_connect (base.sWidgets.hscale, change-value, G_CALLBACK (funcScale), base

Passing Struct to g_signal_connect

2008-10-19 Thread beginner.c
I need to pass a struct using g_signal_connect, but the issue I'm having is that I can't alter the elements of the struct within the called function e.g. void on_button2_clicked (struct allStructs *by_ptr) { gtk_label_set_text ((GtkLabel*)by_ptr-widgets.label, whatever); } main { blah

Re: Passing Struct to g_signal_connect

2008-10-19 Thread Till Harbaum / Lists
be very nasty bugs since they cause people to write to memory they are not supposed to write to. A classic door for hackers ... Till Am Sonntag 19 Oktober 2008 schrieb beginner.c: I need to pass a struct using g_signal_connect, but the issue I'm having is that I can't alter the elements

Re: Passing Struct to g_signal_connect

2008-10-19 Thread beginner.c
they cause people to write to memory they are not supposed to write to. A classic door for hackers ... Till Am Sonntag 19 Oktober 2008 schrieb beginner.c: I need to pass a struct using g_signal_connect, but the issue I'm having is that I can't alter the elements of the struct within the called

Re: Using g_signal_connect in class

2008-07-16 Thread Dave Foster
On Tue, Jul 15, 2008 at 6:36 AM, Gabriele Greco [EMAIL PROTECTED] wrote: static void handle_click_cbk(GtkWidget *mywidget_, MyClass *data) { data-handle_click(); } You can't make a callback function intended to be used by C code be inside of the C++ class. It will not be able to find it.

Using g_signal_connect in class

2008-07-15 Thread Marco Rocco
Hello, this is my first post on this mailing list, now i do my request: can i use g_signal_connect in a method of my class, using as c_handler a private function of class? ...and if i can, how i can do ? ___ gtk-app-devel-list mailing list gtk-app

Re: Using g_signal_connect in class

2008-07-15 Thread Gabriele Greco
On Tue, Jul 15, 2008 at 12:09 PM, Marco Rocco [EMAIL PROTECTED] wrote: Hello, this is my first post on this mailing list, now i do my request: can i use g_signal_connect in a method of my class, using as c_handler a private function of class? ...and if i can, how i can do ? If you use C

Using g_signal_connect in class

2008-07-15 Thread Marco Rocco
Hello, this is my first post on this mailing list, now i do my request: can i use g_signal_connect in a method of my class, using as c_handler a private function of class? ...and if i can, how i can do ? ___ gtk-app-devel-list mailing list gtk-app

Using g_signal_connect in class

2008-07-15 Thread Marco Rocco
, GUINT_TO_POINTER(1)); g_object_set(renderer, editable, TRUE, NULL); //setta il testo editabile g_signal_connect(renderer, edited, (GCallback) cell_edited_cbk, liststore); } void GtkClist::set(GladeXML *xml_file_glade, const char *nome_treeview, int ncolonne, ...){ treeview

g_signal_connect

2008-06-15 Thread Carlos Pereira
For the sake of elegance, which version people like more? 1) g_signal_connect (widget, signal, G_CALLBACK (callback), data); 2) g_signal_connect (G_OBJECT (widget), signal, G_CALLBACK (callback), data); 3) g_signal_connect (GTK_OBJECT (widget), signal, G_CALLBACK (callback), data); Carlos

Re: g_signal_connect

2008-06-15 Thread Carlos Pereira
Brian J. Tarricone wrote: On Sun, 15 Jun 2008 19:40:22 +0100 Carlos Pereira wrote: For the sake of elegance, which version people like more? 1) g_signal_connect (widget, signal, G_CALLBACK (callback), data); I think this was the intended use -- the first param is of type gpointer so

g_signal_connect() Issue

2008-05-06 Thread svalbard colaco
Hi all; I wanted to Know what could be the reason for not being able to connect the select / activate /deselect signal with a widget using g_signal_connect( ) function? I connected a menu widget with the signal select but it fails to respond to it; the menu widget gets rendered

Using g_signal_connect in an event handler

2006-10-17 Thread Lorenzo Marcon
have to use the g_signal_connect function again in the event handler called by the button pressure. The problem is that I do not seem able to pass correctly arguments in this second call. int main(int argc, char *argv[]) { ... gpointer data[5]; ... data[0

Re: Using g_signal_connect in an event handler

2006-10-17 Thread Yeti
) { ... g_signal_connect (G_OBJECT (event_box), button-press-event, G_CALLBACK (x_click_callback), data[1]); } gboolean x_click_callback(GtkWidget *event_box, gpointer data) { //Here I get segfault if I try to remove the tab. } Because the prototype of the signal handler is different

Re: Using g_signal_connect in an event handler

2006-10-17 Thread Brian J. Tarricone
data. Not to mention the fact that 'data' is allocated on the stack and ceases to exist after this function exits, so the pointer you pass to g_signal_connect() will be garbage later. Not only should you use a struct for convenience as David suggests, but you need to allocate the struct on the heap

Re: Using g_signal_connect in an event handler

2006-10-17 Thread Yeti
' is allocated on the stack and ceases to exist after this function exits, so the pointer you pass to g_signal_connect() will be garbage later. Not only should you use a struct for convenience as David suggests, but you need to allocate the struct on the heap (via g_malloc() or g_new(), etc

Re: can't ercieve data passed to g_signal_connect

2006-04-21 Thread rachit goel
]=GTK_EVENT_BOX(gtk_event_box_new());// create the event box . . . . . data1 = g_strdup_printf( %d ,iter) ; g_print(\n at signal connect string -- %s ,data1); g_signal_connect ((gpointer)eventt[iter],leave_notify_event, G_CALLBACK (mouse_leave1),data1

Re: can't ercieve data passed to g_signal_connect

2006-04-21 Thread John Cupitt
On 4/21/06, rachit goel [EMAIL PROTECTED] wrote: g_signal_connect ((gpointer)eventt[iter],button_press_event, G_CALLBACK (tab_click1), data1); void tab_click1(GtkWidget *widget,gchar* data1) You have the type of your callback wrong: http://developer.gnome.org/doc/API/2.0/gtk

Re: can't ercieve data passed to g_signal_connect

2006-04-21 Thread David Necas (Yeti)
On Fri, Apr 21, 2006 at 12:45:35PM +0100, rachit goel wrote: g_signal_connect ((gpointer)eventt[iter],leave_notify_event, G_CALLBACK (mouse_leave1),data1); g_signal_connect ((gpointer)eventt[iter],button_press_event, G_CALLBACK (tab_click1), data1

re:re:Re: can't ercieve data passed to g_signal_connect

2006-04-21 Thread rachit goel
thanks guys i was mistaken in my assumption about omitting the arguments well thanks anyways that solved the probs Send instant messages to your online friends http://uk.messenger.yahoo.com ___ gtk-app-devel-list mailing list

can't ercieve data passed to g_signal_connect

2006-04-20 Thread rachit goel
hi, i am having a problem i just can't recieve the data passed to signal handler using g_signal_connect() . it always gets messed up. plz its rather critical for me at this stage any help will be appreciated also i am using gtk-2.6.7 on fc4-i386

Re: can't ercieve data passed to g_signal_connect

2006-04-20 Thread David Necas (Yeti)
On Thu, Apr 20, 2006 at 08:25:57PM +0100, rachit goel wrote: i am having a problem You have the problem... i just can't recieve the data passed to signal handler using g_signal_connect() . it always gets messed up. ...you did not post enough information. What's your code? Yeti

Tell me about difference between g_signal_connect and g_signal_connect_after

2006-01-12 Thread Cool Guy
In reference, g_signal_connect : The handler will be called before the default handler of the signal. g_signal_connect_after : The handler will be called after the default handler of the signal. But, I don't know why is different g_signal_connect and g_signal_connect_after. Where is example

Re: Tell me about difference between g_signal_connect and g_signal_connect_after

2006-01-12 Thread Tristan Van Berkom
Cool Guy wrote: In reference, g_signal_connect : The handler will be called before the default handler of the signal. g_signal_connect_after : The handler will be called after the default handler of the signal. But, I don't know why is different g_signal_connect and g_signal_connect_after

strangeness of g_signal_connect

2005-07-25 Thread Colossus
Hi, In my app I have the following: g_signal_connect ((gpointer) AddFile_button, clicked, G_CALLBACK (on_add_files_activate), dummy); I have noticed that if the function on_add_files_activate is declared with only one parameter, gpointer data , I never

Re: strangeness of g_signal_connect

2005-07-25 Thread David Necas (Yeti)
On Mon, Jul 25, 2005 at 09:18:57AM -0700, Colossus wrote: g_signal_connect ((gpointer) AddFile_button, clicked, G_CALLBACK (on_add_files_activate), dummy); I have noticed that if the function on_add_files_activate is declared with only one parameter

Re: strangeness of g_signal_connect

2005-07-25 Thread Annamalai Gurusami
Colossus [EMAIL PROTECTED] writes: In my app I have the following: g_signal_connect ((gpointer) AddFile_button, clicked, G_CALLBACK (on_add_files_activate), dummy); I normally write the above call like this: g_signal_connect( G_OBJECT

Re: strangeness of g_signal_connect

2005-07-25 Thread Colossus
Annamalai Gurusami wrote: g_signal_connect( G_OBJECT(AddFile_button), clicked, G_CALLBACK(on_add_files_activate), dummy); The actual parameters of the callback function is determined by the event and the widget handling the event. Here you are handling the clicked event

Re: strangeness of g_signal_connect

2005-07-25 Thread Annamalai Gurusami
Colossus [EMAIL PROTECTED] writes: Annamalai Gurusami wrote: g_signal_connect( G_OBJECT(AddFile_button), clicked, G_CALLBACK(on_add_files_activate), dummy); The actual parameters of the callback function is determined by the event and the widget handling the event. Here

variables in g_signal_connect

2005-07-14 Thread Michal Porzuczek
connection as: g_signal_connect ((gpointer) Horizontal_Zoom_In, clicked, G_CALLBACK (Horizontal_Zoom_In_clicked), graph_type); where graph_type is an int. as a result I get a warning: passing argument 4

Re: variables in g_signal_connect

2005-07-14 Thread Christopher Anderson
(GtkWidget *widget, int gt) and the signal connection as: g_signal_connect ((gpointer) Horizontal_Zoom_In, clicked, G_CALLBACK (Horizontal_Zoom_In_clicked), graph_type); where graph_type is an int. as a result I get a warning

RE: variables in g_signal_connect

2005-07-14 Thread Gyözö Both
use GINT_TO_POINTER: Horizontal_Zoom_In_clicked(GtkWidget *widget, gpointer gt) g_signal_connect ((gpointer) Horizontal_Zoom_In, clicked, G_CALLBACK (Horizontal_Zoom_In_clicked), GINT_TO_POINTER(graph_type)); and GPOINTER_TO_INT(gt) in the callback to get

Re: g_signal_connect: what are the detailed_signal ?

2005-05-19 Thread Muthiah Annamalai
for g_signal_connect for the GtkWidget types. /* from GtkContainer.h */ struct _GtkContainerClass { GtkWidgetClass parent_class; void(*add)(GtkContainer*container, GtkWidget *widget); void(*remove) (GtkContainer

g_signal_connect: what are the detailed_signal ?

2005-05-17 Thread Colossus
Hi, I need to know what are is the signal strings to give to g_signal_connect() but I didn't find any specs of them in doc. Possible ? -- Colossus Cpsed, a Linux OpenGL 3D scene editor http://cpsed.sourceforge.net/ ___ gtk-app-devel-list mailing list gtk

g_signal_connect arguments

2005-05-08 Thread franfernandezb
(){ .. GtkWidget *isRoot; GtkWidget *entry1; GtkWidget *entry2; isRoot = gtk_check_button_new_with_label (root qdisc); entry1 = gtk_entry_new(); entry2 = gtk_entry_new(); .. g_signal_connect(G_OBJECT (button), clicked, G_CALLBACK (callback_create), ???); The problem is that I don't know how

g_signal_connect

2005-05-03 Thread Tomaz Canabrava
Little trouble here =) the g_signal_connect works like what? g_signal_connect(GTK_WIDGET(widget), signal(clicked), G_CALLBACK(Function), (gpointer) Data); but the callbacks functions have the GtkWidget *Widget as a 1st parameter, and... well, i simply don't get it. =) Does anyone cares

g_signal_connect isn't working

2005-03-10 Thread Pier-Luc Charbonneau
(GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), delete_event,G_CALLBACK (delete_event), NULL); button = gtk_button_new_with_label(Hi!); table = gtk_table_new (2, 1, FALSE); gtk_container_add(GTK_CONTAINER(window),table); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,0,1

Re: g_signal_connect isn't working

2005-03-10 Thread Olexiy Avramchenko
Pier-Luc Charbonneau wrote: static gboolean recalculate_psi_consumption(GtkWidget *widget, gpointer data) This is your callback declaration. It takes 2 parameters. g_signal_connect(G_OBJECT(start),key_press_event,G_CALLBACK(recalculate_psi_consumption),(gpointer)psi); key-press-event signal