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

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

Reply via email to