made the sidebar get the right icon for the hardware view by

* src/nautilus-sidebar-title.c: (update_icon):
	made the sidebar get the right icon for the hardware
	view by special-casing it like we do for services and man.
	As part of this, I made the sidebar work properly with
	.svg icons by calling the icon factory to load the icon.

	* libnautilus-extensions/nautilus-icon-factory.c:
	(nautilus_icon_factory_get_pixbuf_from_name):
	added a convenience routine to fetch icons by name.
	* libnautilus-extensions/nautilus-icon-factory.h:
	definition for the convenience routine.
This commit is contained in:
Andy Hertzfeld 2000-12-15 03:01:36 +00:00
parent 79c272c6d1
commit 366472b15c
6 changed files with 65 additions and 3 deletions

View file

@ -1,3 +1,17 @@
2000-12-14 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-sidebar-title.c: (update_icon):
made the sidebar get the right icon for the hardware
view by special-casing it like we do for services and man.
As part of this, I made the sidebar work properly with
.svg icons by calling the icon factory to load the icon.
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_get_pixbuf_from_name):
added a convenience routine to fetch icons by name.
* libnautilus-extensions/nautilus-icon-factory.h:
definition for the convenience routine.
2000-12-14 Robey Pointer <robey@eazel.com>
reviewed by: Maciej Stachowiak <mjs@eazel.com>

View file

@ -2254,6 +2254,24 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
gdk_pixbuf_unref (pixbuf);
}
/* Convenience routine for getting a pixbuf from an icon name
*/
GdkPixbuf * nautilus_icon_factory_get_pixbuf_from_name (const char *icon_name,
const char *modifier,
guint size_in_pixels,
gboolean anti_aliased)
{
GdkPixbuf *pixbuf;
NautilusScalableIcon *icon;
icon = nautilus_scalable_icon_new_from_text_pieces (NULL, icon_name, modifier, NULL, anti_aliased);
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (icon, size_in_pixels, size_in_pixels,
size_in_pixels, size_in_pixels, NULL, TRUE);
nautilus_scalable_icon_unref (icon);
return pixbuf;
}
static gboolean
embedded_text_rect_usable (const ArtIRect *embedded_text_rect)
{

View file

@ -144,7 +144,12 @@ void nautilus_icon_factory_get_pixmap_and_mask_for_file (Nautil
guint size_in_pixels,
GdkPixmap **pixmap,
GdkBitmap **mask);
/* Convenience routine for getting a pixbuf from an icon name
*/
GdkPixbuf * nautilus_icon_factory_get_pixbuf_from_name (const char *icon_name,
const char *modifer,
guint size_in_pixels,
gboolean anti_aliased);
/* Manage a scalable icon.
* Since the factory always passes out references to the same scalable
* icon, you can compare two scalable icons to see if they are the same

View file

@ -2254,6 +2254,24 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
gdk_pixbuf_unref (pixbuf);
}
/* Convenience routine for getting a pixbuf from an icon name
*/
GdkPixbuf * nautilus_icon_factory_get_pixbuf_from_name (const char *icon_name,
const char *modifier,
guint size_in_pixels,
gboolean anti_aliased)
{
GdkPixbuf *pixbuf;
NautilusScalableIcon *icon;
icon = nautilus_scalable_icon_new_from_text_pieces (NULL, icon_name, modifier, NULL, anti_aliased);
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon (icon, size_in_pixels, size_in_pixels,
size_in_pixels, size_in_pixels, NULL, TRUE);
nautilus_scalable_icon_unref (icon);
return pixbuf;
}
static gboolean
embedded_text_rect_usable (const ArtIRect *embedded_text_rect)
{

View file

@ -144,7 +144,12 @@ void nautilus_icon_factory_get_pixmap_and_mask_for_file (Nautil
guint size_in_pixels,
GdkPixmap **pixmap,
GdkBitmap **mask);
/* Convenience routine for getting a pixbuf from an icon name
*/
GdkPixbuf * nautilus_icon_factory_get_pixbuf_from_name (const char *icon_name,
const char *modifer,
guint size_in_pixels,
gboolean anti_aliased);
/* Manage a scalable icon.
* Since the factory always passes out references to the same scalable
* icon, you can compare two scalable icons to see if they are the same

View file

@ -418,10 +418,12 @@ update_icon (NautilusSidebarTitle *sidebar_title)
icon_path = nautilus_theme_get_image_path ("big_services_icon.png");
} else if (nautilus_istr_has_prefix (uri, "man:")) {
icon_path = nautilus_theme_get_image_path ("manual.png");
} else if (nautilus_istr_has_prefix (uri, "hardware:")) {
icon_path = nautilus_theme_get_image_path ("computer.svg");
}
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = nautilus_icon_factory_get_pixbuf_from_name (icon_path, NULL, NAUTILUS_ICON_SIZE_LARGE, TRUE);
} else if (nautilus_icon_factory_is_icon_ready_for_file (sidebar_title->details->file)) {
pixbuf = nautilus_icon_factory_get_pixbuf_for_file (sidebar_title->details->file,
"accept",