implemented theme indirection for throbbers, so themes can share throbbers

* src/nautilus-throbber.c: (load_themed_image),
	(nautilus_throbber_load_images):
	implemented theme indirection for throbbers, so themes can
	share throbbers
	* icons/ardmore/ardmore.xml:
	made the ardmore theme use the eazel theme's throbber

	* libnautilus-extensions/nautilus-icon-container.c:
	(nautilus_icon_container_update_icon):
	at Susan's suggestion, pinned emblem size to 100%, so emblems don't
	get huge when you scale up.
This commit is contained in:
Andy Hertzfeld 2000-10-15 07:56:06 +00:00
parent 7ec30bcaf0
commit a345ee5d27
5 changed files with 69 additions and 12 deletions

View file

@ -1,3 +1,17 @@
2000-10-15 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-throbber.c: (load_themed_image),
(nautilus_throbber_load_images):
implemented theme indirection for throbbers, so themes can
share throbbers
* icons/ardmore/ardmore.xml:
made the ardmore theme use the eazel theme's throbber
* libnautilus-extensions/nautilus-icon-container.c:
(nautilus_icon_container_update_icon):
at Susan's suggestion, pinned emblem size to 100%, so emblems don't
get huge when you scale up.
2000-10-14 Andy Hertzfeld <andy@eazel.com>
* src/nautilus-throbber.c: (nautilus_throbber_initialize_class),

View file

@ -5,5 +5,7 @@
<desktop BACKGROUND_TILE_IMAGE="backgrounds/fleur_de_lis.png" BACKGROUND_COLOR="rgb:FFFF/FFFF/FFFF"/>
<toolbar ICON_THEME="eazel" FRAME_TYPE="none"/>
<zoom_control NUMBER_V_OFFSET="-6" DIGIT_WIDTH="6"/>
<icon-images DEFAULT_THEME="eazel"/>
<throbber FRAME_COUNT="15" URL="http://www.eazel.com" IMAGE_THEME="eazel"/>
<description TEXT="This theme uses photo-realistic folders."/>
</theme>

View file

@ -3369,7 +3369,9 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
GList *emblem_scalable_icons, *emblem_pixbufs, *p;
char *editable_text, *additional_text;
GdkFont *font;
int pinned_zoom_level;
double pinned_scale_x, pinned_scale_y;
guint smooth_font_size;
NautilusScalableFont *smooth_font;
@ -3391,6 +3393,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
max_image_size = MAXIMUM_IMAGE_SIZE * GNOME_CANVAS (container)->pixels_per_unit;
max_emblem_size = MAXIMUM_EMBLEM_SIZE * GNOME_CANVAS (container)->pixels_per_unit;
/* Get the appropriate images for the file. */
icon_get_size (container, icon, &icon_size_x, &icon_size_y);
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
@ -3404,13 +3407,27 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
nautilus_scalable_icon_unref (scalable_icon);
emblem_pixbufs = NULL;
/* pin emblem size at 100% */
if (container->details->zoom_level > NAUTILUS_ZOOM_LEVEL_STANDARD) {
pinned_zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
} else {
pinned_zoom_level = container->details->zoom_level;
}
pinned_scale_x = icon->scale_x > 1.0 ? 1.0 : icon->scale_x;
pinned_scale_y = icon->scale_y > 1.0 ? 1.0 : icon->scale_y;
icon_size_x = MAX (nautilus_get_icon_size_for_zoom_level (pinned_zoom_level)
* pinned_scale_x, NAUTILUS_ICON_SIZE_SMALLEST);
icon_size_y = MAX (nautilus_get_icon_size_for_zoom_level (pinned_zoom_level)
* pinned_scale_y, NAUTILUS_ICON_SIZE_SMALLEST);
for (p = emblem_scalable_icons; p != NULL; p = p->next) {
emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data,
icon_size_x,
icon_size_y,
max_emblem_size * icon->scale_x,
max_emblem_size * icon->scale_y,
max_emblem_size * pinned_scale_x,
max_emblem_size * pinned_scale_y,
NULL);
if (emblem_pixbuf != NULL) {
emblem_pixbufs = g_list_prepend

View file

@ -3369,7 +3369,9 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
GList *emblem_scalable_icons, *emblem_pixbufs, *p;
char *editable_text, *additional_text;
GdkFont *font;
int pinned_zoom_level;
double pinned_scale_x, pinned_scale_y;
guint smooth_font_size;
NautilusScalableFont *smooth_font;
@ -3391,6 +3393,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
max_image_size = MAXIMUM_IMAGE_SIZE * GNOME_CANVAS (container)->pixels_per_unit;
max_emblem_size = MAXIMUM_EMBLEM_SIZE * GNOME_CANVAS (container)->pixels_per_unit;
/* Get the appropriate images for the file. */
icon_get_size (container, icon, &icon_size_x, &icon_size_y);
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
@ -3404,13 +3407,27 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
nautilus_scalable_icon_unref (scalable_icon);
emblem_pixbufs = NULL;
/* pin emblem size at 100% */
if (container->details->zoom_level > NAUTILUS_ZOOM_LEVEL_STANDARD) {
pinned_zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
} else {
pinned_zoom_level = container->details->zoom_level;
}
pinned_scale_x = icon->scale_x > 1.0 ? 1.0 : icon->scale_x;
pinned_scale_y = icon->scale_y > 1.0 ? 1.0 : icon->scale_y;
icon_size_x = MAX (nautilus_get_icon_size_for_zoom_level (pinned_zoom_level)
* pinned_scale_x, NAUTILUS_ICON_SIZE_SMALLEST);
icon_size_y = MAX (nautilus_get_icon_size_for_zoom_level (pinned_zoom_level)
* pinned_scale_y, NAUTILUS_ICON_SIZE_SMALLEST);
for (p = emblem_scalable_icons; p != NULL; p = p->next) {
emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data,
icon_size_x,
icon_size_y,
max_emblem_size * icon->scale_x,
max_emblem_size * icon->scale_y,
max_emblem_size * pinned_scale_x,
max_emblem_size * pinned_scale_y,
NULL);
if (emblem_pixbuf != NULL) {
emblem_pixbufs = g_list_prepend

View file

@ -350,12 +350,17 @@ nautilus_throbber_unload_images (NautilusThrobber *throbber)
}
static GdkPixbuf*
load_themed_image (const char *file_name, gboolean small_mode)
load_themed_image (const char *file_name, const char *image_theme, gboolean small_mode)
{
GdkPixbuf *pixbuf, *temp_pixbuf;
char *image_path;
image_path = nautilus_theme_get_image_path (file_name);
if (image_theme == NULL) {
image_path = nautilus_theme_get_image_path (file_name);
} else {
image_path = nautilus_theme_get_image_path_from_theme (file_name, image_theme);
}
if (image_path) {
pixbuf = gdk_pixbuf_new_from_file (image_path);
@ -387,13 +392,14 @@ static void
nautilus_throbber_load_images (NautilusThrobber *throbber)
{
int index;
char *throbber_frame_name, *frames;
char *throbber_frame_name, *image_theme, *frames;
GdkPixbuf *pixbuf;
nautilus_throbber_unload_images (throbber);
throbber->details->quiescent_pixbuf = load_themed_image ("throbber/rest.png", throbber->details->small_mode);
image_theme = nautilus_theme_get_theme_data ("throbber", "IMAGE_THEME");
throbber->details->quiescent_pixbuf = load_themed_image ("throbber/rest.png", image_theme, throbber->details->small_mode);
/* images are of the form throbber/001.png, 002.png, etc, so load them into a list */
frames = nautilus_theme_get_theme_data ("throbber", "FRAME_COUNT");
@ -407,7 +413,7 @@ nautilus_throbber_load_images (NautilusThrobber *throbber)
index = 1;
while (index <= throbber->details->max_frame) {
throbber_frame_name = make_throbber_frame_name (index);
pixbuf = load_themed_image (throbber_frame_name, throbber->details->small_mode);
pixbuf = load_themed_image (throbber_frame_name, image_theme, throbber->details->small_mode);
g_free (throbber_frame_name);
if (pixbuf == NULL) {
throbber->details->max_frame = index - 1;
@ -416,6 +422,7 @@ nautilus_throbber_load_images (NautilusThrobber *throbber)
throbber->details->image_list = g_list_append (throbber->details->image_list, pixbuf);
index += 1;
}
g_free (image_theme);
}
/* handle button presses by emitting the location changed signal */