diff options
author | Andy Hertzfeld <andy@src.gnome.org> | 2000-07-11 22:32:08 +0000 |
---|---|---|
committer | Andy Hertzfeld <andy@src.gnome.org> | 2000-07-11 22:32:08 +0000 |
commit | 9cc19b08e87197f457be50acc2c2de3b99759941 (patch) | |
tree | 08366d467075730d2bfa79c8017097543c7084ec | |
parent | 315415683d8c413a5bbedca71bcce59e68e6d7c9 (diff) | |
download | nautilus-9cc19b08e87197f457be50acc2c2de3b99759941.tar.gz |
drew a frame around the background tiles at Arlo's request
drew a frame around the background tiles at Arlo's request
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | icons/Makefile.am | 1 | ||||
-rw-r--r-- | icons/chit_frame.png | bin | 0 -> 820 bytes | |||
-rw-r--r-- | src/nautilus-property-browser.c | 50 |
4 files changed, 56 insertions, 4 deletions
@@ -1,3 +1,12 @@ +2000-07-11 Andy Hertzfeld <andy@eazel.com> + + * src/nautilus-property-browser.c: (make_drag_image), + (make_background_chit), (make_properties_from_directory_path): + drew a frame around the background tiles at Arlo's request + * icons/Makefile.am: + * icons/chit_frame.png: + added Arlo's image for the chit frame + 2000-07-11 Robin Slomkowski <rslomkow@eazel.com> * components/services/vault/command-line/Makefile.am: diff --git a/icons/Makefile.am b/icons/Makefile.am index 6e196eb95..693fb0601 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -8,6 +8,7 @@ icon_DATA =\ audio.png \ About_Image.png \ backgrounds.png \ + chit_frame.png \ colors.png \ computer.png \ computer.svg \ diff --git a/icons/chit_frame.png b/icons/chit_frame.png Binary files differnew file mode 100644 index 000000000..66540ab89 --- /dev/null +++ b/icons/chit_frame.png diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c index 723d205b5..1b2dacc49 100644 --- a/src/nautilus-property-browser.c +++ b/src/nautilus-property-browser.c @@ -113,6 +113,8 @@ static void nautilus_property_browser_drag_data_get (GtkWidget guint info, guint32 time); static void nautilus_property_browser_theme_changed (gpointer user_data); +static GdkPixbuf* make_background_chit (GdkPixbuf *background_tile, + GdkPixbuf *frame); /* misc utilities */ static char *strip_extension (const char *string_to_strip); @@ -450,8 +452,8 @@ ensure_uri_is_image(const char *uri) static GdkPixbuf * make_drag_image(NautilusPropertyBrowser *property_browser, const char* file_name) { - GdkPixbuf *pixbuf; - char *image_file_name; + GdkPixbuf *pixbuf, *frame; + char *image_file_name, *temp_str; image_file_name = g_strdup_printf ("%s/%s/%s", NAUTILUS_DATADIR, @@ -476,7 +478,11 @@ make_drag_image(NautilusPropertyBrowser *property_browser, const char* file_name /* background properties are always a fixed size, while others are pinned to the max size */ if (!strcmp(property_browser->details->category, "backgrounds")) { - pixbuf = gdk_pixbuf_scale_simple (pixbuf, MAX_ICON_WIDTH, MAX_ICON_HEIGHT, GDK_INTERP_BILINEAR); + temp_str = nautilus_pixmap_file ("chit_frame.png"); + frame = gdk_pixbuf_new_from_file (temp_str); + g_free (temp_str); + pixbuf = make_background_chit (pixbuf, frame); + gdk_pixbuf_unref (frame); } else { pixbuf = nautilus_gdk_pixbuf_scale_to_fit (pixbuf, MAX_ICON_WIDTH, MAX_ICON_HEIGHT); } @@ -1223,12 +1229,35 @@ add_to_content_table(NautilusPropertyBrowser *property_browser, GtkWidget* widge GTK_FILL, GTK_FILL, padding, padding); } +/* utility to make an attractive background image by compositing with a frame */ +static GdkPixbuf* +make_background_chit (GdkPixbuf *background_tile, GdkPixbuf *frame) +{ + GdkPixbuf *pixbuf; + double scale_x, scale_y; + + /* start with the frame */ + pixbuf = gdk_pixbuf_copy (frame); + + scale_x = ((double) MAX_ICON_WIDTH) / gdk_pixbuf_get_width (background_tile); + scale_y = ((double) MAX_ICON_HEIGHT) / gdk_pixbuf_get_height (background_tile); + + /* draw the scaled tile on top of it */ + + gdk_pixbuf_scale (background_tile, pixbuf, 3, 3, MAX_ICON_WIDTH - 2, MAX_ICON_HEIGHT - 2, + 0.0, 0.0, scale_x, scale_y, GDK_INTERP_BILINEAR); + gdk_pixbuf_unref (background_tile); + return pixbuf; +} + /* make_properties_from_directory_path generates widgets corresponding all of the objects in the passed in directory */ static int make_properties_from_directory_path(NautilusPropertyBrowser *property_browser, const char* directory_uri, int index) { + char *temp_str; NautilusBackground *background; + GdkPixbuf *background_frame; GnomeVFSResult result; GnomeVFSFileInfo *current_file_info; GnomeVFSDirectoryList *list; @@ -1240,6 +1269,15 @@ make_properties_from_directory_path(NautilusPropertyBrowser *property_browser, c return index; } + /* load the frame if necessary */ + if (!strcmp(property_browser->details->category, "backgrounds")) { + temp_str = nautilus_pixmap_file ("chit_frame.png"); + background_frame = gdk_pixbuf_new_from_file (temp_str); + g_free (temp_str); + } else { + background_frame = NULL; + } + /* interate through the directory for each file */ current_file_info = gnome_vfs_directory_list_first(list); while (current_file_info != NULL) { @@ -1259,7 +1297,7 @@ make_properties_from_directory_path(NautilusPropertyBrowser *property_browser, c g_free(image_file_name); if (!strcmp(property_browser->details->category, "backgrounds")) { - pixbuf = gdk_pixbuf_scale_simple (pixbuf, MAX_ICON_WIDTH, MAX_ICON_HEIGHT, GDK_INTERP_BILINEAR); + pixbuf = make_background_chit (pixbuf, background_frame); } else { pixbuf = nautilus_gdk_pixbuf_scale_to_fit (pixbuf, MAX_ICON_WIDTH, MAX_ICON_HEIGHT); } @@ -1309,6 +1347,10 @@ make_properties_from_directory_path(NautilusPropertyBrowser *property_browser, c current_file_info = gnome_vfs_directory_list_next(list); } + if (background_frame != NULL) { + gdk_pixbuf_unref (background_frame); + } + gnome_vfs_directory_list_destroy(list); return index; } |