On Fri, Feb 05, 2010 at 06:47:31PM +0900, Bokyun Na wrote: > I appreciate for your attention on my problem. > I think we have a little bit different point of view on this problem. > > I want to make a callback function on several buttons or even on drawing > areas. > For example, when I clicked a button, A, this callback function knows that > button A is clicked and > When button B is clicked the callback function knows that B is clicked. > That is, > > void on_window_partition (GtkWidget *widget, dm_t *dm) > { > if (button A is clicked) then printf("button A is clicked"); > else if (button B is clicked) then printf ("button B is clicked"); > ... > } > > Of course, you can say every callback function for every button. But I > should take only one callback function for several buttons to detect which a > button is clicked. IMO this was explained in the first answer but anyway. You get the button that was clicked as the first argument (GtkWidget *widget above). This is THE ultimate identification as you have the object. For instance, to get the corresponding drawing area you put inside just use gtk_bin_get_child(widget). Anyway, if you want some kind of names (and please consider if you really do because it seems you are trying do something unnecessarily convoluted) you can do g_object_set_data(G_OBJECT(button), "id", "A"); ... g_object_set_data(G_OBJECT(button), "id", "B"); ... when you construct the buttons and then do g_print("Button %s was pressed.\n", g_object_get_data(G_OBJECT(widget), "id")); in the callback. Yeti _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list