Re: Setting Label and Icon widget of Widget returned by toolbar_add_item



 Jonathan,

 You will have to keep a pointer to the toolbar child widget (or search for it
in a for loop). In my case, I kept a pointer to the child widget as I added the
widget to the toolbar. 

  See the code below.

 <snip>
 w->cdrom_icon = gtk_image_new_from_stock (GTK_STOCK_CDROM,
                    gtk_toolbar_get_icon_size (GTK_TOOLBAR (w->toolbar)));
 w->start_tbr_tgle = gtk_toolbar_append_element (GTK_TOOLBAR (w->toolbar),
                    GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "_Start",
                    "Start/Stop Server", NULL, w->cdrom_icon, NULL, NULL);
     w->toolbarchild_start_tgle = ((GtkToolbarChild*) (g_list_last (GTK_TOOLBAR
(w->toolbar)->children)->data));
    gtk_label_set_use_underline (GTK_LABEL(w->toolbarchild_start_tgle->label),
TRUE);

  </snip>

 Notice how I apply changes to the label using 
 "w->toolbarchild_start_tgle->label"

 The same holds true for icons as well,

Hope this helps

Harring Figueiredo.



--- Jonathan Johnson <jon maccoding com> wrote:
Hi,

Before you all jump in and say, "Look at GtkToolButton!", I want to say 
that I don't want to support only 2.4 and up. I want to support 2.0 and 
up, since that is our previous requirement for our product, and we 
don't want to change it.

My problem is that I create a toolbar item, and at a later time, I want 
to set its attributes to something else. All of the calls that I see in 
the docs seem to be related to 2.4. I did notice GtkToolbarChild, which 
seems to be what GtkToolItem is based upon (or at least GtkToolButton), 
but I haven't had any luck with setting the properties on it. I'm not 
against using GtkToolButton if the gtk version is 2.4 or higher, but I 
want some mechanism to fall back on for systems lower than 2.4.

Any tips or links are greatly appreciated.

Thanks,
Jon

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


=====
==================================================================
Plese, don't send me any attachment in Micro$oft (.DOC, .PPT) format.
Read http://www.fsf.org/philosophy/no-word-attachments.html
Preferable attachments: .PDF, .HTML, .TXT
Please, consider adding this text to Your email signature.

Harring Figueiredo


        
                
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html



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