[Glade-users] Dynamic toolbar images/stock items




 Jim, I needed to same feature, but for the label. The only way I could figure
out was somethign like this (Hopefully there is an easier way.) But here it
goes anyway.

static GtkToolbarChild* child;  /* used to change the Start/Stop button */
static void init_toolbar_child(GtkToolbar* toolbar)
{
    GList* list = NULL;
    g_return_if_fail(toolbar != NULL);
    list = toolbar->children;
    while( (child = (GtkToolbarChild*)(g_list_next(list))->data))
    {
        if(child->label != NULL)
        {
            if(!strcmp("Start", gtk_label_get_text(GTK_LABEL(child->label))))
            {
                break;  /* found the button*/
            }
        }
    }
}

  I call this function from init, and set the static variable child to it,
after that, I can do whaterver I want to the child var.

 The whole problem that makes this thing a pain is that the button is really
placed as a GtkToolbarChild. Check the code and see what this struct looks
like.

   Good luck.

   I hope this helps

HArring

HArring.

--- Jim Deas <jdeas jadsystems com> wrote:
I am using the standard toobar with stock graphics.
How can I change these graphics in code (like after
a button push). I have created a pix_object but I do not
know how to get it into the toolbar container to replace
the stock item icon already there. How do I get a reference
to replace the icon?

Regards,
J. Deas


_______________________________________________
Glade-users maillist  -  Glade-users lists ximian com
http://lists.ximian.com/mailman/listinfo/glade-users


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]