[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

   Good luck.

   I hope this helps



--- 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?

J. Deas

Glade-users maillist  -  Glade-users lists ximian com

Do you Yahoo!?
Yahoo! Web Hosting - establish your business online

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