set_icon for window objects?!?
- From: Stefan Siegel <siegel informatik uni-kl de>
- To: Gtk-Perl <gtk-perl-list gnome org>
- Subject: set_icon for window objects?!?
- Date: Wed, 22 Aug 2001 19:35:39 +0200
Hi all,
I have an application currently written in C, which I try to rewrite
in Perl. I hope I can ease my live by doing so ;-)
But currently I've got a problem.
I'd like to specify a window icon associated with my window. In
C I was using the following function:
+---------------------------------------------------------------
|void set_window_icon(GtkWidget *window, gchar **xpm_d){
| GtkStyle *style;
| GdkPixmap *pixmap;
| GdkBitmap *mask;
| gchar** tmp;
|
| gtk_widget_realize(window);
| style = gtk_widget_get_style(window);
|
| tmp=(xpm_d)?xpm_d: (gchar **)window_icon_xpm;
| pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask,
| &style->bg[GTK_STATE_NORMAL], tmp);
|
| gdk_window_set_icon(window->window, 0, pixmap, mask);
|}
+---------------------------------------------------------------
using it with:
+---------------------------------------------------------------
| set_window_icon(global_window, NULL);
+---------------------------------------------------------------
This was not the best solution, I know but it worked.
I've alreadyrealized, when I place a PNG icon with the name of my
perl script in "/usr/share/pixmaps" I get what I want. But as my
application is louchd by a wrapper, it has an ugly name like
"foo.real" which forces me to add not only "foo.png" (used by the
"foo.desktop") but also a "foo.real.png" to the pixmap folder.
This is an ugly thing, which I'd like to avoid.
So here comes my question:
I know about "set_title" to set a window title:
+---------------------------------------------------------------
| $global_window->set_title( _("My shiny new foo application"));
+---------------------------------------------------------------
is there something similar to set the associated icon, like:
+---------------------------------------------------------------
| $global_window->set_icon("foo.png");
+---------------------------------------------------------------
If not I'd like to see it in next release.
(Maybe with a second parameter indicating an additional path to search
the icon in ...?!?)
--
_
Tschüss und bis demnächst/à bientôt, _|_|_
(") *
Stefan /v\ /
»( )« Penguin Powered!
+----------------------------------------------------(m-m)------------------+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]