Gtk tool-bar running icon under MS-Windows

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Gtk tool-bar running icon under MS-Windows

John Woodsman
When running a Gtk program under MS-Windows, there is a little icon that 
appears in the tool-tray bar at the bottom of the screen - one for each program
that is running.

Major applications like Word or Chrome have their own unique logos. 
But the icon for all my Gtk programs just shows the Gtk logo.  
I would rather display an icon unique to each of my programs. 
As it is, the icon is really just showing the graphics lib my program used.

I have been stumbling for an answer to this question in the Gtk manual, as
well as web searches, but have not come close to finding any discussion
that relates to this actual topic.  So any help in how to phrase this question 
would be appreciated.  I keep finding unrelated information, such as how
to make shortcut icons, since most websites are aimed at helping regular
users, more than developers.

Any ideas ?
Thanks!

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
LRN
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gtk tool-bar running icon under MS-Windows

LRN
On 5/26/2017 6:05 AM, John Woodsman wrote:
> When running a Gtk program under MS-Windows, there is a little icon that
> appears in the tool-tray bar at the bottom of the screen - one for each program
> that is running.
>
> Major applications like Word or Chrome have their own unique logos.
> But the icon for all my Gtk programs just shows the Gtk logo.  
> I would rather display an icon unique to each of my programs.
> As it is, the icon is really just showing the graphics lib my program used.
>

Just give a non-default icon to the window, and that's what you'll see on the
taskbar. If you use Glade UI definition files, it would look like this:

  <object class="GtkApplicationWindow" id="my_main_window_id">
    <property name="icon_name">name-of-the-icon-of-your-app</property>

And in Glade itself it's just like any other property.

Obviously, you'll need to install the icon in an appropriate place
(share/icons/hicolor/<size>/apps/<name-of-the-icon-of-your-app>.png) and run
gtk-update-icon-cache for it to be found.

--
O< ascii ribbon - stop html email! - www.asciiribbon.org

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list

0x6759BA74.asc (3K) Download Attachment
signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gtk tool-bar running icon under MS-Windows

Gtk+ - General mailing list
In reply to this post by John Woodsman
Hi John,

Another alternative is to use a Windows resource file (.rc) file to
specify the .ico file that you want to use for your app (as in any
Windows app), use the resource compiler (rc.exe for instance) to compile
the resource file and link the compiled resource file into your app, and
so you won't need to ship that icon file as a result.

With blessings!

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gtk tool-bar running icon under MS-Windows

Gtk+ - General mailing list
In reply to this post by John Woodsman

Hi John,

Another option is to draw the icon with cairo. You can do this at run time if you want. This way you can experiment drawing icons and if you get something that you like you can always save it out to a file. I haven't tested the following on Windows but I would think that it will work fine.

Eric

https://github.com/cecashon/OrderedSetVelociRaptor/blob/master/Misc/cairo_drawings/cairo_icon1.c



_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Gtk tool-bar running icon under MS-Windows

Rafal Luzynski
In reply to this post by LRN
26.05.2017 05:27 LRN <[hidden email]> wrote:

> [...]
> Just give a non-default icon to the window, and that's what you'll see on the
> taskbar. If you use Glade UI definition files, it would look like this:
>
> <object class="GtkApplicationWindow" id="my_main_window_id">
> <property name="icon_name">name-of-the-icon-of-your-app</property>
>
> And in Glade itself it's just like any other property.
>
> Obviously, you'll need to install the icon in an appropriate place
> (share/icons/hicolor/<size>/apps/<name-of-the-icon-of-your-app>.png) and run
> gtk-update-icon-cache for it to be found.

This looks like a good solution to me. But instead of placing the icons
in external files you (I'm talking to John) may be also interested in
GResource framework [1] which does a similar thing like Windows resources,
that means embeds images and other data files inside the executable file
but is not based on Windows API. You will need a glib-compile-resources
utility. [2] Also you should see how GtkApplication object handles the
embedded resources. [3]

Regards,

Rafal

[1] https://developer.gnome.org/gio/stable/GResource.html
[2] https://developer.gnome.org/gio/stable/glib-compile-resources.html
[3]
https://developer.gnome.org/gtk3/stable/GtkApplication.html#automatic-resources
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Loading...