I posted on this topic a little while back ( a month or 2 from memory ).
The icon theme you're using has to have icons of the same name that you're
trying to use. If you're using a 'default' ( eg adwaita ) icon theme in
conjunction with icon names that *used* to work a couple of years ago,
you're likely to have issues. Either choose an older icon theme, or migrate
to the new 'best practices'.

You can also run with GTK_DEBUG=icontheme set - this can show you some info
about where gtk is looking to find icons. See
https://developer.gnome.org/gtk3/stable/gtk-running.html

Good luck, Gentoo warrior :) Oh ... you're running 'stable' ... luck not
required ;)

Dan

On Tue, Aug 11, 2015 at 1:31 PM, Igor Korot <ikoro...@gmail.com> wrote:

> Stefan et al,
>
> On Mon, Aug 10, 2015 at 2:23 PM, Stefan Salewski <m...@ssalewski.de>
> wrote:
> > On Mon, 2015-08-10 at 12:28 -0400, Igor Korot wrote:
> >> But then how do I set the label for such button?
> >> It looks like this function can be used for bitmap buttons only (no
> >> labels).
> >
> > Of course you can continue using the deprecated stock item, as long as
> > that still works...
> >
> > My impression is, that recommendation for recent GTK3 is to have only
> > textual label for buttons and menu items generally, with some
> > exceptions...
> >
> > We can use gtk_button_new() with a container widget argument, which may
> > contain a label and an image. Some details I found here
> >
> > https://developer.gnome.org/gtk3/stable/GtkImageMenuItem.html
> >
> > Unfortunately that is some more work now...
>
> Here is what I have right now:
>
> [code]
> static
> GtkWidget *gtk_my_dialog_add_button_to (GtkBox *box, const gchar *label,
>                                             const gchar *stock, gint
> response_id)
> {
>     /* create the button */
>     GtkWidget *button = gtk_button_new_with_mnemonic (label);
>     gtk_widget_set_can_default(button, true);
>     GtkWidget *image = NULL;
> #if GTK_CHECK_VERSION( 3, 10, 0 )
>     if( !gtk_check_version( 3, 10, 0 ) )
>     {
>         image = gtk_image_new_from_icon_name( stock, GTK_ICON_SIZE_BUTTON
> );
>     }
>     else
> #endif
>     {
>         /* add a stock icon inside it */
>         wxGCC_WARNING_SUPPRESS(deprecated-declarations);
>         image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
>     wxGCC_WARNING_RESTORE()
>     }
>     gtk_button_set_image (GTK_BUTTON (button), image);
>
>     /* add to the given (container) widget */
>     if (box)
>         gtk_box_pack_end (box, button, FALSE, TRUE, 8);
>
>     /* add the button to the dialog's action area */
>     gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, response_id);
>
>    return button;
> }
>
> extern "C" {
> static void gtk_my_dialog_init(GTypeInstance* instance, void*)
> {
> // some code
> #if GTK_CHECK_VERSION( 3, 10, 0 )
>     if( !gtk_check_version( 3, 10, 0 ) )
>     {
>         continuebtn = gtk_assert_dialog_add_button( dlg, "Continue",
> "yes", GTK_ASSERT_DIALOG_CONTINUE);
>     }
>     else
> #endif
>     {
>         wxGCC_WARNING_SUPPRESS(deprecated-declarations);
>         continuebtn = gtk_assert_dialog_add_button (dlg, "_Continue",
> GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE);
>         wxGCC_WARNING_RESTORE();
>     }
> // some more code
> }
> [/code]
>
> I am running currently KDE-4 on Gentoo Linux (stable). This peice of
> code works when running against GTK+-2.24, i.e. I see
> both label and the icon. However, when running against GTK+-3.16.5 all
> I can see is just a text and no icon.
>
> What am I doing wrong? Am I using the right replacements? Do I use it
> properly?
>
> Thank you.
>
> >
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to