Kees, I cannot seem figure out what your trying to do. The code I see in the notes is not something I understand; and I am an experienced gtk developer.
Please back away from the code for a minute and try to describe what it is your trying to achieve with this interface or application that spawned this series of notes. I'm hoping you just started off completely wrong with the wrong assumptions about how to achieve your goal. In which case I/we can put you back on track. But for now I cannot keep up. Why do I say this? 1. "i trying to make an object inherited from GTK_ACTION, this all is managed." Response: * If you want to inherit from GTK_ACTION you make a completely new widget. Look for info on writing widgets from scratch. * Wrapping a function around a g_object_new as you have done in both examples is miss-leading at best. You cannot make an existing gtk_object do something it was not designed to; i.e. add a struct in its object_new() parms. You can g_object_set|get_data() on an existing object; register a function for signal from an object so you can modify its external behaviour, on and on... Ok. Back to "tell me what your trying to do?" James, On Wed, 2008-06-11 at 23:54 +0200, Kees Scherpenhuijzen wrote: > 2008/5/14 Kees Scherpenhuijzen <[EMAIL PROTECTED]>: > > heyy, > > > > @ the moment i trying to make an object inherited from GTK_ACTION, > > this all is managed. > > Only now i'm trying to initialize the object with an variable, a > > struct. Ie read the manual about the wrapper that is used, only i > > can't seem > > to find a way in which i can add the struct to g_object_new or otherwise. > > > > to be clear, in this function: > > GtkAction* > > menu_action_new (const gchar *name, > > const gchar *label) > > { > > GtkAction* action; > > _thunar_return_val_if_fail (name != NULL, NULL); > > _thunar_return_val_if_fail (label != NULL, NULL); > > > > action = g_object_new (MENU_TYPE_ACTION, > > "hide-if-empty", FALSE, > > "label", label, > > "name", name, > > NULL); > > return action; > > } > > > > i want to add the struct so i don't need any get of set functions, is > > this possible? > > > > the thing i want to do is to init : > > menu_thing *item; > > in: > > struct _MenuTemplatesAction > > { > > GtkAction __parent__; > > menu_thing *item; > > }; > > > > I hope this enough info to get me close to an answer > > > > > > -- > > Kees > > > > Hi, > > I've saw some examples about this problem and tried it with no luck. i > saw that the object was cast and just added. > i've tried: > GtkAction* > menu_action_new (const gchar *name, > const gchar *label, > Model *model) > { > GtkAction* action; > _thunar_return_val_if_fail (name != NULL, NULL); > _thunar_return_val_if_fail (label != NULL, NULL); > > action = g_object_new (MENU_TYPE_ACTION, > "hide-if-empty", FALSE, > "label", label, > "name", name, > NULL); > > MENU_ACTION(action)->items = model; > > if(G_TYPE_FUNDAMENTAL (action) == G_TYPE_OBJECT) > { > g_message(model->menu->name); > g_message(action->items); > g_message("test"); > } > return action; > } > but it seems the second g_message won't print, it gives an segmentation fault. > > extra info: #define MENU_ACTION(obj) > (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENU_TYPE_ACTION, > MenuTemplatesAction)) > > What am i missing here? > > Thanks in advance > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list