summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-icon-container.c
diff options
context:
space:
mode:
authorAndy Hertzfeld <andy@src.gnome.org>2000-10-25 06:42:59 +0000
committerAndy Hertzfeld <andy@src.gnome.org>2000-10-25 06:42:59 +0000
commitb8b81a3431f04bd84025e6189a7cae24b89941c2 (patch)
treeb8246ab75e1bd7b9c54f38b4cbaf5bf1a35e41f3 /libnautilus-private/nautilus-icon-container.c
parentc9516573ee2f9e4e35210154afc8a9531249dbe2 (diff)
downloadnautilus-b8b81a3431f04bd84025e6189a7cae24b89941c2.tar.gz
worked on bug 3898, selection in the aa icon view is too slow. Fixed by
worked on bug 3898, selection in the aa icon view is too slow. Fixed by using a fill to make the selection pixbuf with some tiny blits for the rounded corners, instead of stretching a pixbuf. Also, made the selection color themable in the process. * libnautilus-extensions/nautilus-icon-canvas-item.c: (clear_rounded_corners), (draw_label_text_aa): make the selection pixbuf with a fill and then some blits for the corner. * libnautilus-extensions/nautilus-icon-container.c: (nautilus_icon_container_initialize), (icon_destroy), (nautilus_icon_container_set_is_fixed_size), (nautilus_icon_container_theme_changed): made it read the selection color from the current theme * libnautilus-extensions/nautilus-icon-private.h: added a field to keep the selection color w/alpha. * icons/default.xml: added semi-transparent gray selection color to default theme.
Diffstat (limited to 'libnautilus-private/nautilus-icon-container.c')
-rw-r--r--libnautilus-private/nautilus-icon-container.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 64e3281d6..6eff40acf 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -109,6 +109,8 @@
static void activate_selected_items (NautilusIconContainer *container);
static void nautilus_icon_container_initialize_class (NautilusIconContainerClass *class);
static void nautilus_icon_container_initialize (NautilusIconContainer *container);
+static void nautilus_icon_container_theme_changed (gpointer user_data);
+
static void compute_stretch (StretchState *start,
StretchState *current);
static NautilusIcon *get_first_selected_icon (NautilusIconContainer *container);
@@ -3082,7 +3084,6 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
{
NautilusIconContainerDetails *details;
NautilusBackground *background;
- char *text_frame_path;
details = g_new0 (NautilusIconContainerDetails, 1);
@@ -3128,10 +3129,9 @@ nautilus_icon_container_initialize (NautilusIconContainer *container)
update_label_color,
GTK_OBJECT (container));
- /* fetch the highlight frame */
- text_frame_path = nautilus_theme_get_image_path ("text-selection-frame.png");
- container->details->highlight_frame = gdk_pixbuf_new_from_file (text_frame_path);
- g_free (text_frame_path);
+ /* read in theme-dependent data */
+ nautilus_icon_container_theme_changed (container);
+ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, nautilus_icon_container_theme_changed, container);
container->details->rename_widget = NULL;
container->details->original_text = NULL;
@@ -3384,6 +3384,10 @@ icon_destroy (NautilusIconContainer *container,
details->drop_target = NULL;
}
+ nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
+ nautilus_icon_container_theme_changed,
+ container);
+
icon_free (icon);
if (was_selected) {
@@ -4686,6 +4690,36 @@ nautilus_icon_container_set_is_fixed_size (NautilusIconContainer *container,
container->details->is_fixed_size = is_fixed_size;
}
+/* handle theme changes */
+
+static void
+nautilus_icon_container_theme_changed (gpointer user_data)
+{
+ NautilusIconContainer *container;
+ char *text_frame_path, *highlight_color_str;
+
+ container = NAUTILUS_ICON_CONTAINER (user_data);
+
+ /* load the highlight frame */
+ text_frame_path = nautilus_theme_get_image_path ("text-selection-frame.png");
+ if (container->details->highlight_frame) {
+ gdk_pixbuf_unref (container->details->highlight_frame);
+ }
+
+ container->details->highlight_frame = gdk_pixbuf_new_from_file (text_frame_path);
+ g_free (text_frame_path);
+
+ /* load the highlight color */
+ highlight_color_str = nautilus_theme_get_theme_data ("directory", "HIGHLIGHT_COLOR_RGBA");
+
+ if (highlight_color_str == NULL) {
+ container->details->highlight_color = 0x00000066;
+ } else {
+ container->details->highlight_color = strtoul (highlight_color_str, NULL, 0);
+ g_free (highlight_color_str);
+ }
+}
+
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
static char *