fix and move the code into capplet_set_icon.

2002-06-27  Jody Goldberg <jody@gnome.org>

	* gnome-keybinding-properties.c (setup_dialog) : fix and move the code
	  into capplet_set_icon.

2002-06-27  Jody Goldberg <jody@gnome.org>

	http://bugzilla.gnome.org/show_bug.cgi?id=86593
	* main.c (setup_dialog) : watch for missing icons

2002-06-27  Jody Goldberg <jody@gnome.org>

	* capplet-util.c (capplet_set_icon) : new util.
This commit is contained in:
Jody Goldberg 2002-06-27 18:30:15 +00:00 committed by Jody Goldberg
parent 5719b6cda4
commit 1eeebe40c9
7 changed files with 43 additions and 16 deletions

View file

@ -314,6 +314,7 @@ capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err)
g_error_free (err);
}
}
/**
* capplet_help :
* @parent :
@ -339,3 +340,28 @@ capplet_help (GtkWindow *parent, char const *helpfile, char const *section)
_("There was an error displaying help: %s"),
error);
}
/**
* capplet_set_icon :
* @window :
* @file_name :
*
* A quick utility routine to avoid the cut-n-paste of bogus code
* that caused several bugs.
**/
void
capplet_set_icon (GtkWidget *window, char const *icon_file_name)
{
char *path = gnome_program_locate_file (NULL,
GNOME_FILE_DOMAIN_APP_PIXMAP,
icon_file_name, TRUE, NULL);
if (path != NULL) {
GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
if (icon_pixbuf != NULL) {
gtk_window_set_icon (GTK_WINDOW (window), icon_pixbuf);
g_object_unref (icon_pixbuf);
}
g_free (path);
}
}