Re: [gnome-love] gtk_window_set_icon_name not working for GTK stock items



Hi Bastien,


Hey Jaap,

On Mon, 2005-06-20 at 23:34 +0200, Jaap Haitsma wrote:
Anybody what I'm doing wrong.

If I do  gtk_window_set_default_icon_name(window, "gnome-dev-cdrom"); I
get the right window icon
However if I use a gtk stock item e.g. GTK_STOCK_CUT and do
gtk_window_set_default_icon_name(window, GTK_STOCK_CUT);
it does not work

Am I missing something or is this a bug in GTK?

For any bug, especially if you think there's a bug in GTK+, don't expect
GTK+ (or developers of any other library) to have to build your
application.
Your best bet is to create the smallest possible program that would
reproduce the problem, and say which version of GTK+ you showed the
problem with.

In your particular case, something like:

// Compile with
// gcc -Wall -o test test.c `pkg-config --libs --cflags gtk+-2.0`

#include <gtk/gtk.h>

int main (int argc, char **argv)
{
      GtkWidget *window1, *window2;

      gtk_init (&argc, &argv);

      window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

//    gtk_window_set_default_icon_name ("gnome-dev-cdrom");
      gtk_window_set_default_icon_name (GTK_STOCK_CUT);

      gtk_widget_show (window1);
      gtk_widget_show (window2);
      gtk_main ();
      return 0;
}

You'd see that gtk_window_set_default_icon_name only takes one argument,
the name of the default icon for all the windows of your program, and no
GtkWindow argument.
You'll want to use gtk_window_set_icon_name() instead to change the icon
of just the one window.


Thanks for your reply
By mistake I copied _set_default_icon_name in the mail, the subject was OK.

Does the example program you give work correctly for you?

Jaap







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