Re: WHere is the icons



On Wed, Aug 12, 2015 at 7:15 AM, Igor Korot <ikorot01 gmail com> wrote:
Daniel,

On Tue, Aug 11, 2015 at 2:09 AM, Daniel Kasak <d j kasak dk gmail com> wrote:
> 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'.

Problem is I am not running under GNOME. I have KDE4 installed on my machine and
I'm trying to port the GTK2 app to work with GTK3.

I don't use KDE, but I recommend using Gnome, at least until you're on top of these issues. Read up on the ways of setting your icon theme if you're not going to use Gnome. I don't use Gnome either, by the way ( and so I know what it's like to get gtk+ to play nicely outside it ).
 
The thing is - I want to have a clean compilation before saying: this
works fine. ;-)

Now, since you mention "best practice", let me ask you - what is it?
Using named icon? If yes - can you throw in some code? I will see if
that will find the icon...

No code at this point, sorry. To be honest, I'm only just barely across icon handling myself. I'm not developing gtk+ stuff full-time any more, and only return to it occasionally ( sadly, usually to see that more stuff has broken ).

Here's part of a response I got a while back when I posted about none of my icons being rendered any more:

---

This whole mess has been deprecated (and rightfully so) because it
makes it impossible to actually determine what will go to the screen
reliably; it was added before we had icon themes, and survived far too
long afterwards.

If you want to use symbolic names for icons, as opposed to loading
assets using GdkPixbuf, you should use the name of the icon in the
icon theme — in this case, 'document-new' instead of 'gtk-new' (which
is the string hiding behind the GTK_STOCK_NEW symbol).

The deprecation notes for each stock item here:

  https://developer.gnome.org/gtk3/stable/gtk3-Stock-Items.html

And the freedesktop.org icon naming specification here:

  http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

Should give you a head start on porting your code and your coding
practices. The Adwaita icon theme (which is used as a template for
most icon themes available these days) contains more icons that you
can use.

---

Dan

On Wed, Aug 12, 2015 at 7:15 AM, Igor Korot <ikorot01 gmail com> wrote:
Daniel,

On Tue, Aug 11, 2015 at 2:09 AM, Daniel Kasak <d j kasak dk gmail com> wrote:
> 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'.

Problem is I am not running under GNOME. I have KDE4 installed on my machine and
I'm trying to port the GTK2 app to work with GTK3.

The thing is - I want to have a clean compilation before saying: this
works fine. ;-)

Now, since you mention "best practice", let me ask you - what is it?
Using named icon? If yes - can you throw in some code? I will see if
that will find the icon...

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

Now, I may be able to install GNOME and run it there just to make sure KDE is
out of the picture. ;-)

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

Yup, I will need it.

Thank you.

>
> Dan
>
> On Tue, Aug 11, 2015 at 1:31 PM, Igor Korot <ikorot01 gmail com> wrote:
>>
>> Stefan et al,
>>
>> On Mon, Aug 10, 2015 at 2:23 PM, Stefan Salewski <mail 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
>
>



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