path for icon
Dear friends, in my GTK(3) app, I am using icons as gtk_window_set_icon(GTK_WINDOW(window), create_pixbuf("images/icon.svg")); or GtkWidget *ast4im = gtk_image_new_from_file ("images/mkb3.png"); The problem is, when I am running the app away from the source directory, those images are broken, obviously due to the fact that the path is missing. One solution is to put absolute path, but then the code will not be portable. Is there any better way of doing it? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: path for icon
On Wed, 05 Sep 2012 04:12:03 +0100 Rudra Banerjee wrote: > Is there any better way of doing it? As a matter of fact, I just asked this very same question this past Sunday. Here is the answer: https://mail.gnome.org/archives/gtk-app-devel-list/2012-September/msg2.html Depending on your needs, here is a different answer: https://mail.gnome.org/archives/gtk-app-devel-list/2012-September/msg4.html I myself went with the first solution. -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: path for icon
On 09/04/2012 11:58 PM, Frank Cox wrote: Here is the answer: https://mail.gnome.org/archives/gtk-app-devel-list/2012-September/msg2.html Depending on your needs, here is a different answer: https://mail.gnome.org/archives/gtk-app-devel-list/2012-September/msg4.html I myself went with the first solution. A third answer is to define a string that is your path: #if defined( WINDOWS ) #define ICON_PATH "../images/" #else #define ICON_PATH "/foo/bar/images/" #endif foo() { gtk_image_new_from_file( ICON_PATH "mkb3.png" ); } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list