~mitya57/ubuntu/precise/nautilus/desktop-window-fixes

« back to all changes in this revision

Viewing changes to libnautilus-private/nautilus-icon-container.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-16 18:53:51 UTC
  • mfrom: (1.17.16 upstream) (2.2.10 experimental)
  • Revision ID: james.westby@ubuntu.com-20110516185351-9mpn1rya1t645ixq
Tags: 1:3.0.1.1-0ubuntu1
* Resynchronize on Debian using the GNOME3 ppa work, thanks to those who
  contributed there
* Known issues:
  - the indicator-application patch needs to be updated or dropped
    (design recommended to use a normal dialog for copies so maybe drop it)
  - the indicator-appmenu export patch needs to be updated
  - desktop icons are not displayed by default in GNOME3, you can set
    org.gnome.desktop.background show-desktop-icons to true in dconf-editor
    or using the gsettings command to get those back 
* New upstream version
* Remaining diffs:
* debian/changelog, debian/rules: set epoch number (which was added by error)
* debian/control.in:
  - Build-Depend on liblaunchpad-integration-dev, libappindicator-dev
  - Don't recommends desktop-base, don't suggests tracker
* debian/mount-archive.desktop:
* debian/mount-archive.desktop.in:
  - New nautilus context menu item to allow mounting zip, iso, etc
* debian/nautilus.gschema.override:
  - Change the default desktop icon configuration
* debian/nautilus-data.install:
  - Install Apport hook
* debian/nautilus.install:
  - Install mount-archive menu
* nautilus-desktop.desktop
* debian/source_nautilus.py:
  - Apport hook to list versions of files in /usr/lib/nautilus and reassign
    the crashes when there are not due to nautilus code directly
* debian/patches/00_do_not_require_unpackage_libexif.patch:
  - dropped, not required in Ubuntu since libexif is recent enough
* debian/patches/01_lpi.patch:
  - Launchpad changes.
* debian/patches/02_additional_marge_for_unity.patch:
  - ensure we don't move desktop icons when locking or unlocking the unity
    launcher 
* debian/patches/03_translations_list_update.patch:
  - Translate the mount-archive menu entry
* debian/patches/04_suppress_umount_in_ltsp.patch:
  - Don't list unmount and eject actions on LTSP clients
* debian/patches/05_desktop_menu_export.patch:
  - export the desktop menus for appmenu (lp #624274), commented for now
* debian/patches/06_never_exec_nonexec_launchers.patch:
  - Implement non-exec policy for .desktop handler.
* debian/patches/07_use_application_indicator.patch:
  - Use the application-indicator, needs to be updated
* debian/patches/08_fix_nautilus_desktop_autostart.patch
  - git commit, remove obsolete autostart code so that Nautilus windows
    can still be opened when desktop icons are shown
* debian/patches/09_no-initial-fade.patch:
  - Patch to disable the initial fade-in of the background without disabling 
    crossfades when the background is changed.
* debian/watch:
  - Watch unstable series
* Dropped:
* debian/patches/02_dont_set_default.patch:
  - deprecated in the new version
* debian/patches/03_menu_entry.patch:
  - no menu simplication needed with unity or gnome-shell
* debian/patches/17_disable_locked_automounting.patch:
  - the change is in the new upstream version
* debian/patches/82_gnome-app-install.patch:
  - don't use gnome-app-install it's deprecated
* debian/patches/90_git_audio_preview_url.patch:
  - the change is in the new version
* debian/patches/91_correct_rgba_use.patch:
  - the gtk rgba ubuntu specific work never landed no need to keep that one
* debian/patches/97_keyboard_nav_in_sidebar.patch:
  - the change is in the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <math.h>
30
30
#include "nautilus-icon-container.h"
31
31
 
32
 
#include "nautilus-debug-log.h"
33
32
#include "nautilus-global-preferences.h"
34
33
#include "nautilus-icon-private.h"
35
34
#include "nautilus-lib-self-check-functions.h"
 
35
#include "nautilus-selection-canvas-item.h"
36
36
#include "nautilus-marshal.h"
37
37
#include <atk/atkaction.h>
38
38
#include <eel/eel-accessibility.h>
39
 
#include <eel/eel-background.h>
40
39
#include <eel/eel-vfs-extensions.h>
41
 
#include <eel/eel-gdk-pixbuf-extensions.h>
42
 
#include <eel/eel-gnome-extensions.h>
43
40
#include <eel/eel-gtk-extensions.h>
44
41
#include <eel/eel-art-extensions.h>
45
42
#include <eel/eel-editable-label.h>
46
 
#include <eel/eel-marshal.h>
47
 
#include <eel/eel-string.h>
48
 
#include <eel/eel-preferences.h>
49
 
#include <eel/eel-enumeration.h>
50
 
#include <eel/eel-canvas-rect-ellipse.h>
 
43
 
51
44
#include <gdk/gdkkeysyms.h>
52
45
#include <gtk/gtk.h>
53
46
#include <gdk/gdkx.h>
55
48
#include <stdio.h>
56
49
#include <string.h>
57
50
 
 
51
#define DEBUG_FLAG NAUTILUS_DEBUG_ICON_CONTAINER
 
52
#include "nautilus-debug.h"
 
53
 
58
54
#define TAB_NAVIGATION_DISABLED
59
55
 
60
56
/* Interval for updating the rubberband selection, in milliseconds.  */
109
105
#define SNAP_SIZE_X             78
110
106
#define SNAP_SIZE_Y             20
111
107
 
112
 
#define DEFAULT_SELECTION_BOX_ALPHA 0x40
113
 
#define DEFAULT_HIGHLIGHT_ALPHA 0xff
114
 
#define DEFAULT_NORMAL_ALPHA 0xff
115
 
#define DEFAULT_PRELIGHT_ALPHA 0xff
116
 
#define DEFAULT_LIGHT_INFO_COLOR 0xAAAAFD
117
 
#define DEFAULT_DARK_INFO_COLOR  0x33337F
118
 
 
119
 
#define DEFAULT_NORMAL_ICON_RENDER_MODE 0
120
 
#define DEFAULT_PRELIGHT_ICON_RENDER_MODE 1
121
 
#define DEFAULT_NORMAL_ICON_SATURATION 255
122
 
#define DEFAULT_PRELIGHT_ICON_SATURATION 255
123
 
#define DEFAULT_NORMAL_ICON_BRIGHTNESS 255
124
 
#define DEFAULT_PRELIGHT_ICON_BRIGHTNESS 255
125
 
#define DEFAULT_NORMAL_ICON_LIGHTEN 0
126
 
#define DEFAULT_PRELIGHT_ICON_LIGHTEN 0
127
 
 
128
108
#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH       20
129
109
#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT      20
130
110
 
182
162
                                                                     gboolean               commit);
183
163
static NautilusIcon *get_icon_being_renamed                         (NautilusIconContainer *container);
184
164
static void          finish_adding_new_icons                        (NautilusIconContainer *container);
185
 
static void          update_label_color                             (EelBackground         *background,
186
 
                                                                     NautilusIconContainer *icon_container);
187
165
static inline void   icon_get_bounding_box                          (NautilusIcon          *icon,
188
166
                                                                     int                   *x1_return,
189
167
                                                                     int                   *y1_return,
214
192
static double        get_mirror_x_position                     (NautilusIconContainer *container,
215
193
                                                                NautilusIcon *icon,
216
194
                                                                double x);
 
195
static void         text_ellipsis_limit_changed_container_callback  (gpointer callback_data);
217
196
 
218
197
static int compare_icons_horizontal (NautilusIconContainer *container,
219
198
                                     NautilusIcon *icon_a,
296
275
icon_free (NautilusIcon *icon)
297
276
{
298
277
        /* Destroy this canvas item; the parent will unref it. */
299
 
        gtk_object_destroy (GTK_OBJECT (icon->item));
 
278
        eel_canvas_item_destroy (EEL_CANVAS_ITEM (icon->item));
300
279
        g_free (icon);
301
280
}
302
281
 
319
298
        int container_x, container_y, container_width, container_height;
320
299
        EelDRect icon_bounds;
321
300
        int item_width, item_height;
322
 
        int height_above, height_below, width_left, width_right;
 
301
        int height_above, width_left;
323
302
        int min_x, max_x, min_y, max_y;
324
303
 
325
304
        if (icon->x == x && icon->y == y) {
370
349
 
371
350
                /* determine icon rectangle relative to item rectangle */
372
351
                height_above = icon_bounds.y0 - y1;
373
 
                height_below = y2 - icon_bounds.y1;
374
352
                width_left = icon_bounds.x0 - x1;
375
 
                width_right = x2 - icon_bounds.x1;
376
353
 
377
354
                min_x = container_left + DESKTOP_PAD_HORIZONTAL + width_left;
378
355
                max_x = container_right - DESKTOP_PAD_HORIZONTAL - item_width + width_left;
565
542
        GtkAdjustment *hadj, *vadj;
566
543
        int old_h_value, old_v_value;
567
544
 
568
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
569
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
 
545
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
 
546
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
570
547
 
571
548
        /* Store the old ajustment values so we can tell if we
572
549
         * ended up actually scrolling. We may not have in a case
576
553
        old_h_value = gtk_adjustment_get_value (hadj);
577
554
        old_v_value = gtk_adjustment_get_value (vadj);
578
555
        
579
 
        eel_gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
580
 
        eel_gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
 
556
        gtk_adjustment_set_value (hadj, gtk_adjustment_get_value (hadj) + delta_x);
 
557
        gtk_adjustment_set_value (vadj, gtk_adjustment_get_value (vadj) + delta_y);
581
558
 
582
559
        /* return TRUE if we did scroll */
583
560
        return gtk_adjustment_get_value (hadj) != old_h_value || gtk_adjustment_get_value (vadj) != old_v_value;
704
681
reveal_icon (NautilusIconContainer *container,
705
682
             NautilusIcon *icon)
706
683
{
707
 
        NautilusIconContainerDetails *details;
708
684
        GtkAllocation allocation;
709
685
        GtkAdjustment *hadj, *vadj;
710
686
        EelIRect bounds;
716
692
        
717
693
        set_pending_icon_to_reveal (container, NULL);
718
694
 
719
 
        details = container->details;
720
695
        gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
721
696
 
722
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
723
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
 
697
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
 
698
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
724
699
 
725
700
        if (nautilus_icon_container_is_auto_layout (container)) {
726
701
                /* ensure that we reveal the entire row/column */
729
704
                item_get_canvas_bounds (EEL_CANVAS_ITEM (icon->item), &bounds, TRUE);
730
705
        }
731
706
        if (bounds.y0 < gtk_adjustment_get_value (vadj)) {
732
 
                eel_gtk_adjustment_set_value (vadj, bounds.y0);
 
707
                gtk_adjustment_set_value (vadj, bounds.y0);
733
708
        } else if (bounds.y1 > gtk_adjustment_get_value (vadj) + allocation.height) {
734
 
                eel_gtk_adjustment_set_value
 
709
                gtk_adjustment_set_value
735
710
                        (vadj, bounds.y1 - allocation.height);
736
711
        }
737
712
 
738
713
        if (bounds.x0 < gtk_adjustment_get_value (hadj)) {
739
 
                eel_gtk_adjustment_set_value (hadj, bounds.x0);
 
714
                gtk_adjustment_set_value (hadj, bounds.x0);
740
715
        } else if (bounds.x1 > gtk_adjustment_get_value (hadj) + allocation.width) {
741
 
                eel_gtk_adjustment_set_value
 
716
                gtk_adjustment_set_value
742
717
                        (hadj, bounds.x1 - allocation.width);
743
718
        }
744
719
}
826
801
static void inline
827
802
emit_atk_focus_tracker_notify (NautilusIcon *icon)
828
803
{
829
 
        AtkObject *atk_object = eel_accessibility_for_object (icon->item);
 
804
        AtkObject *atk_object = atk_gobject_accessible_for_object (G_OBJECT (icon->item));
830
805
        atk_focus_tracker_notify (atk_object);
831
806
}
832
807
 
890
865
        for (list = group->item_list; list; list = list->next) {
891
866
                child = list->data;
892
867
 
 
868
                if (!NAUTILUS_IS_ICON_CANVAS_ITEM (child)) {
 
869
                        continue;
 
870
                }
 
871
 
893
872
                if (child->flags & EEL_CANVAS_ITEM_VISIBLE) {
894
873
                        set = TRUE;
895
874
                        if (!NAUTILUS_IS_ICON_CANVAS_ITEM (child) ||
922
901
        for (; list; list = list->next) {
923
902
                child = list->data;
924
903
 
 
904
                if (!NAUTILUS_IS_ICON_CANVAS_ITEM (child)) {
 
905
                        continue;
 
906
                }
 
907
 
925
908
                if (!(child->flags & EEL_CANVAS_ITEM_VISIBLE))
926
909
                        continue;
927
910
 
1015
998
        width = (allocation.width) / canvas->pixels_per_unit;
1016
999
        height = (allocation.height) / canvas->pixels_per_unit;
1017
1000
 
1018
 
        old_scroll_x = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_hadjustment (GTK_LAYOUT (canvas))));
1019
 
        old_scroll_y = gtk_adjustment_get_value (GTK_ADJUSTMENT (gtk_layout_get_vadjustment (GTK_LAYOUT (canvas))));
 
1001
        old_scroll_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)));
 
1002
        old_scroll_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)));
1020
1003
 
1021
1004
        x1 = MIN (x1, old_x1 + old_scroll_x);
1022
1005
        y1 = MIN (y1, old_y1 + old_scroll_y);
1123
1106
                         x1, y1, x2, y2);
1124
1107
        }
1125
1108
 
1126
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
1127
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
 
1109
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
 
1110
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
1128
1111
 
1129
1112
        /* Scroll by 1/4 icon each time you click. */
1130
1113
        step_increment = nautilus_get_icon_size_for_zoom_level
1131
1114
                (container->details->zoom_level) / 4;
1132
1115
        if (gtk_adjustment_get_step_increment (hadj) != step_increment) {
1133
1116
                gtk_adjustment_set_step_increment (hadj, step_increment);
1134
 
                gtk_adjustment_changed (hadj);
1135
1117
        }
1136
1118
        if (gtk_adjustment_get_step_increment (vadj) != step_increment) {
1137
1119
                gtk_adjustment_set_step_increment (vadj, step_increment);
1138
 
                gtk_adjustment_changed (vadj);
1139
1120
        }
1140
 
 
1141
 
        /* Now that we have a new scroll region, clamp the
1142
 
         * adjustments so we are within the valid scroll area.
1143
 
         */
1144
 
        eel_gtk_adjustment_clamp_value (hadj);
1145
 
        eel_gtk_adjustment_clamp_value (vadj);
1146
1121
}
1147
1122
 
1148
1123
static int
1282
1257
{
1283
1258
        GList *p, *line_start;
1284
1259
        NautilusIcon *icon;
1285
 
        double canvas_width, y, canvas_height;
 
1260
        double canvas_width, y;
1286
1261
        GArray *positions;
1287
1262
        IconPositions *position;
1288
1263
        EelDRect bounds;
1291
1266
        double max_height_above, max_height_below;
1292
1267
        double height_above, height_below;
1293
1268
        double line_width;
1294
 
        gboolean gridded_layout;
1295
1269
        double grid_width;
1296
1270
        double max_text_width, max_icon_width;
1297
1271
        int icon_width;
1309
1283
        
1310
1284
        /* Lay out icons a line at a time. */
1311
1285
        canvas_width = CANVAS_WIDTH(container, allocation);
1312
 
        canvas_height = CANVAS_HEIGHT(container, allocation);
1313
 
 
1314
1286
        max_icon_width = max_text_width = 0.0;
1315
1287
 
1316
1288
        if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
1329
1301
        } else {
1330
1302
                grid_width = STANDARD_ICON_GRID_WIDTH;
1331
1303
        }
1332
 
 
1333
 
        gridded_layout = !nautilus_icon_container_is_tighter_layout (container);
1334
1304
        
1335
1305
        line_width = container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE ? ICON_PAD_LEFT : 0;
1336
1306
        line_start = icons;
1350
1320
                icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
1351
1321
                text_bounds = nautilus_icon_canvas_item_get_text_rectangle (icon->item, TRUE);
1352
1322
 
1353
 
                if (gridded_layout) {
1354
 
                        icon_width = ceil ((bounds.x1 - bounds.x0)/grid_width) * grid_width;
1355
 
 
1356
 
 
1357
 
                } else {
1358
 
                        icon_width = (bounds.x1 - bounds.x0) + ICON_PAD_RIGHT + 8; /* 8 pixels extra for fancy selection box */
1359
 
                }               
 
1323
                icon_width = ceil ((bounds.x1 - bounds.x0)/grid_width) * grid_width;
1360
1324
                
1361
1325
                /* Calculate size above/below baseline */
1362
1326
                height_above = icon_bounds.y1 - bounds.y0;
1401
1365
                position->height = icon_bounds.y1 - icon_bounds.y0;
1402
1366
 
1403
1367
                if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
1404
 
                        if (gridded_layout) {
1405
 
                                position->x_offset = max_icon_width + ICON_PAD_LEFT + ICON_PAD_RIGHT - (icon_bounds.x1 - icon_bounds.x0);
1406
 
                        } else {
1407
 
                                position->x_offset = icon_width - ((icon_bounds.x1 - icon_bounds.x0) + (text_bounds.x1 - text_bounds.x0));
1408
 
                        }
 
1368
                        position->x_offset = max_icon_width + ICON_PAD_LEFT + ICON_PAD_RIGHT - (icon_bounds.x1 - icon_bounds.x0);
1409
1369
                        position->y_offset = 0;
1410
1370
                } else {
1411
1371
                        position->x_offset = (icon_width - (icon_bounds.x1 - icon_bounds.x0)) / 2;
1480
1440
{
1481
1441
        GList *p, *line_start;
1482
1442
        NautilusIcon *icon;
1483
 
        double canvas_width, x, canvas_height;
 
1443
        double x, canvas_height;
1484
1444
        GArray *positions;
1485
1445
        IconPositions *position;
1486
1446
        EelDRect icon_bounds;
1487
1447
        EelDRect text_bounds;
1488
 
        EelCanvasItem *item;
1489
1448
        GtkAllocation allocation;
1490
1449
 
1491
1450
        double line_height;
1514
1473
        gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
1515
1474
 
1516
1475
        /* Lay out icons a column at a time. */
1517
 
        canvas_width = CANVAS_WIDTH(container, allocation);
1518
1476
        canvas_height = CANVAS_HEIGHT(container, allocation);
1519
1477
 
1520
1478
        max_icon_width = max_text_width = 0.0;
1541
1499
 
1542
1500
        for (p = icons; p != NULL; p = p->next) {
1543
1501
                icon = p->data;
1544
 
                item = EEL_CANVAS_ITEM (icon->item);
1545
1502
 
1546
1503
                /* If this icon doesn't fit, it's time to lay out the column that's queued up. */
1547
1504
 
1979
1936
        GList *p, *placed_icons, *unplaced_icons;
1980
1937
        int total, new_length, placed;
1981
1938
        NautilusIcon *icon;
1982
 
        int width, height, max_width, column_width, icon_width, icon_height;
 
1939
        int height, max_width, column_width, icon_width, icon_height;
1983
1940
        int x, y, x1, x2, y1, y2;
1984
1941
        EelDRect icon_rect;
1985
1942
        GtkAllocation allocation;
1986
1943
 
1987
1944
        /* Get container dimensions */
1988
1945
        gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
1989
 
        width  = CANVAS_WIDTH(container, allocation);
1990
1946
        height = CANVAS_HEIGHT(container, allocation);
1991
1947
 
1992
1948
        /* Determine which icons have and have not been placed */
2057
2013
                        int icon_height_for_bound_check;
2058
2014
                        gboolean should_snap;
2059
2015
                        
2060
 
                        should_snap = !(container->details->tighter_layout && !container->details->keep_aligned);
 
2016
                        should_snap = container->details->keep_aligned;
2061
2017
                        
2062
2018
                        y = DESKTOP_PAD_VERTICAL;
2063
2019
 
2548
2504
        band_info = &container->details->rubberband_info;
2549
2505
 
2550
2506
        g_assert (band_info->timer_id != 0);
2551
 
        g_assert (EEL_IS_CANVAS_RECT (band_info->selection_rectangle) ||
2552
 
                  EEL_IS_CANVAS_RECT (band_info->selection_rectangle));
2553
2507
 
2554
2508
        adj_changed = FALSE;
2555
2509
        gtk_widget_get_allocation (widget, &allocation);
2556
2510
 
2557
 
        adj_x = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
 
2511
        adj_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
2558
2512
        if (adj_x != band_info->last_adj_x) {
2559
2513
                band_info->last_adj_x = adj_x;
2560
2514
                adj_changed = TRUE;
2561
2515
        }
2562
2516
 
2563
 
        adj_y = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
 
2517
        adj_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
2564
2518
        if (adj_y != band_info->last_adj_y) {
2565
2519
                band_info->last_adj_y = adj_y;
2566
2520
                adj_changed = TRUE;
2597
2551
 
2598
2552
        /* Remember to convert from widget to scrolled window coords */
2599
2553
        eel_canvas_window_to_world (EEL_CANVAS (container),
2600
 
                                    x + gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container))),
2601
 
                                    y + gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container))),
 
2554
                                    x + gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container))),
 
2555
                                    y + gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container))),
2602
2556
                                    &world_x, &world_y);
2603
2557
 
2604
2558
        if (world_x < band_info->start_x) {
2655
2609
        AtkObject *accessible;
2656
2610
        NautilusIconContainerDetails *details;
2657
2611
        NautilusIconRubberbandInfo *band_info;
2658
 
        guint fill_color, outline_color;
2659
 
        GdkColor *fill_color_gdk;
2660
 
        guchar fill_color_alpha;
 
2612
        GdkRGBA *fill_color_gdk, outline, color;
2661
2613
        GList *p;
2662
2614
        NautilusIcon *icon;
2663
 
        GtkStyle *style;
 
2615
        GtkStyleContext *style;
2664
2616
 
2665
2617
        details = container->details;
2666
2618
        band_info = &details->rubberband_info;
2677
2629
                (EEL_CANVAS (container), event->x, event->y,
2678
2630
                 &band_info->start_x, &band_info->start_y);
2679
2631
 
2680
 
        gtk_widget_style_get (GTK_WIDGET (container),
2681
 
                              "selection_box_color", &fill_color_gdk,
2682
 
                              "selection_box_alpha", &fill_color_alpha,
2683
 
                              NULL);
 
2632
        style = gtk_widget_get_style_context (GTK_WIDGET (container));
 
2633
        gtk_style_context_get_style (style,
 
2634
                                     "selection_box_rgba", &fill_color_gdk,
 
2635
                                     NULL);
2684
2636
 
2685
2637
        if (!fill_color_gdk) {
2686
 
                style = gtk_widget_get_style (GTK_WIDGET (container));
2687
 
                fill_color_gdk = gdk_color_copy (&style->base[GTK_STATE_SELECTED]);
2688
 
        }
2689
 
        
2690
 
        fill_color = eel_gdk_color_to_rgb (fill_color_gdk) << 8 | fill_color_alpha;
2691
 
 
2692
 
        gdk_color_free (fill_color_gdk);
2693
 
        
2694
 
        outline_color = fill_color | 255;
2695
 
        
 
2638
                gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
 
2639
                                                        &color);
 
2640
                fill_color_gdk = gdk_rgba_copy (&color);
 
2641
        }
 
2642
 
 
2643
        if (fill_color_gdk->alpha == 1) {
 
2644
                fill_color_gdk->alpha = 0.25;
 
2645
        }
 
2646
 
 
2647
        outline = *fill_color_gdk;
 
2648
        eel_make_color_inactive (&outline);
 
2649
 
2696
2650
        band_info->selection_rectangle = eel_canvas_item_new
2697
2651
                (eel_canvas_root
2698
2652
                 (EEL_CANVAS (container)),
2699
 
                 EEL_TYPE_CANVAS_RECT,
 
2653
                 NAUTILUS_TYPE_SELECTION_CANVAS_ITEM,
2700
2654
                 "x1", band_info->start_x,
2701
2655
                 "y1", band_info->start_y,
2702
2656
                 "x2", band_info->start_x,
2703
2657
                 "y2", band_info->start_y,
2704
 
                 "fill_color_rgba", fill_color,
2705
 
                 "outline_color_rgba", outline_color,
 
2658
                 "fill_color_rgba", fill_color_gdk,
 
2659
                 "outline_color_rgba", &outline,
2706
2660
                 "width_pixels", 1,
2707
2661
                 NULL);
2708
2662
 
 
2663
        gdk_rgba_free (fill_color_gdk);
 
2664
 
2709
2665
        accessible = atk_gobject_accessible_for_object
2710
2666
                (G_OBJECT (band_info->selection_rectangle));
2711
2667
        atk_object_set_name (accessible, "selection");
2712
2668
        atk_object_set_description (accessible, _("The selection rectangle"));
2713
2669
 
2714
 
        band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
2715
 
        band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
 
2670
        band_info->prev_x = event->x - gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
 
2671
        band_info->prev_y = event->y - gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
2716
2672
 
2717
2673
        band_info->active = TRUE;
2718
2674
 
2747
2703
 
2748
2704
        /* Destroy this canvas item; the parent will unref it. */
2749
2705
        eel_canvas_item_ungrab (band_info->selection_rectangle, time);
2750
 
        gtk_object_destroy (GTK_OBJECT (band_info->selection_rectangle));
 
2706
        nautilus_selection_canvas_item_fade_out (NAUTILUS_SELECTION_CANVAS_ITEM (band_info->selection_rectangle), 150);
2751
2707
        band_info->selection_rectangle = NULL;
2752
2708
 
2753
2709
        /* if only one item has been selected, use it as range
3987
3943
}
3988
3944
#endif
3989
3945
 
3990
 
/* GtkObject methods.  */
3991
 
 
3992
3946
static void
3993
 
destroy (GtkObject *object)
 
3947
destroy (GtkWidget *object)
3994
3948
{
3995
3949
        NautilusIconContainer *container;
3996
3950
 
4040
3994
        }
4041
3995
 
4042
3996
 
4043
 
        GTK_OBJECT_CLASS (nautilus_icon_container_parent_class)->destroy (object);
 
3997
        GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->destroy (object);
4044
3998
}
4045
3999
 
4046
4000
static void
4050
4004
 
4051
4005
        details = NAUTILUS_ICON_CONTAINER (object)->details;
4052
4006
 
4053
 
        eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
4054
 
                                         nautilus_icon_container_theme_changed,
4055
 
                                         object);
4056
 
        
 
4007
        g_signal_handlers_disconnect_by_func (nautilus_icon_view_preferences,
 
4008
                                              text_ellipsis_limit_changed_container_callback,
 
4009
                                              object);
 
4010
        g_signal_handlers_disconnect_by_func (nautilus_desktop_preferences,
 
4011
                                              text_ellipsis_limit_changed_container_callback,
 
4012
                                              object);
 
4013
 
4057
4014
        g_hash_table_destroy (details->icon_set);
4058
4015
        details->icon_set = NULL;
4059
4016
 
4076
4033
 
4077
4034
/* GtkWidget methods.  */
4078
4035
 
4079
 
static void
4080
 
size_request (GtkWidget *widget,
4081
 
              GtkRequisition *requisition)
4082
 
{
4083
 
        GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->size_request (widget, requisition);
4084
 
        requisition->width = 1;
4085
 
        requisition->height = 1;
4086
 
}
4087
 
 
4088
4036
static gboolean
4089
4037
clear_size_allocation_count (gpointer data)
4090
4038
{
4151
4099
}
4152
4100
 
4153
4101
static void
 
4102
setup_background (NautilusIconContainer *container)
 
4103
{
 
4104
        GdkWindow *window;
 
4105
        GdkRGBA color;
 
4106
        GtkStyleContext *style;
 
4107
 
 
4108
        if (container->details->is_desktop) {
 
4109
                return;
 
4110
        }
 
4111
 
 
4112
        style = gtk_widget_get_style_context (GTK_WIDGET (container));
 
4113
 
 
4114
        DEBUG ("Container %p: setting up background, is_active %d", container,
 
4115
               container->details->active_background);
 
4116
 
 
4117
        window = gtk_layout_get_bin_window (GTK_LAYOUT (container));
 
4118
 
 
4119
        if (!container->details->active_background) {
 
4120
                gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &color);
 
4121
 
 
4122
                DEBUG ("Container %p, making color inactive", container);
 
4123
                eel_make_color_inactive (&color);
 
4124
 
 
4125
                gtk_widget_override_background_color (GTK_WIDGET (container), GTK_STATE_FLAG_NORMAL,
 
4126
                                                      &color);
 
4127
                gtk_style_context_set_background (style, window);
 
4128
        } else {
 
4129
                DEBUG ("Container %p, removing color override", container);
 
4130
                gtk_widget_override_background_color (GTK_WIDGET (container), GTK_STATE_FLAG_NORMAL,
 
4131
                                                      NULL);
 
4132
                gtk_style_context_set_background (style, window);
 
4133
        }
 
4134
}
 
4135
 
 
4136
static void
4154
4137
realize (GtkWidget *widget)
4155
4138
{
4156
 
        GdkBitmap *stipple;
4157
4139
        GtkAdjustment *vadj, *hadj;
4158
4140
        NautilusIconContainer *container;
4159
4141
 
4164
4146
        /* Ensure that the desktop window is native so the background
4165
4147
           set on it is drawn by X. */
4166
4148
        if (container->details->is_desktop) {
4167
 
                gdk_x11_drawable_get_xid (gtk_layout_get_bin_window (GTK_LAYOUT (widget)));
 
4149
                gdk_x11_window_get_xid (gtk_layout_get_bin_window (GTK_LAYOUT (widget)));
4168
4150
        }
4169
4151
 
4170
4152
        /* Set up DnD.  */
4171
 
        nautilus_icon_dnd_init (container, NULL);
 
4153
        nautilus_icon_dnd_init (container);
4172
4154
 
 
4155
        setup_background (container);
4173
4156
        setup_label_gcs (container);
4174
4157
 
4175
 
        stipple = eel_stipple_bitmap_for_screen
4176
 
                (gdk_drawable_get_screen (GDK_DRAWABLE (gtk_widget_get_window (widget))));
4177
 
 
4178
 
        nautilus_icon_dnd_set_stipple (container, stipple);
4179
 
 
4180
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (widget));
 
4158
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget));
4181
4159
        g_signal_connect (hadj, "value_changed",
4182
4160
                          G_CALLBACK (handle_hadjustment_changed), widget);
4183
4161
 
4184
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
 
4162
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget));
4185
4163
        g_signal_connect (vadj, "value_changed",
4186
4164
                          G_CALLBACK (handle_vadjustment_changed), widget);
4187
4165
 
4190
4168
static void
4191
4169
unrealize (GtkWidget *widget)
4192
4170
{
4193
 
        int i;
4194
4171
        NautilusIconContainer *container;
4195
4172
 
4196
4173
        container = NAUTILUS_ICON_CONTAINER (widget);
4197
4174
 
4198
 
        for (i = 0; i < LAST_LABEL_COLOR; i++) {
4199
 
                if (container->details->label_gcs [i]) {
4200
 
                        g_object_unref (container->details->label_gcs [i]);
4201
 
                        container->details->label_gcs [i] = NULL;
4202
 
                }
4203
 
        }
4204
 
 
4205
4175
        nautilus_icon_dnd_fini (container);
4206
4176
 
4207
4177
        if (container->details->typeselect_flush_timeout) {
4213
4183
}
4214
4184
 
4215
4185
static void
4216
 
style_set (GtkWidget *widget,
4217
 
           GtkStyle  *previous_style)
 
4186
style_updated (GtkWidget *widget)
4218
4187
{
4219
4188
        NautilusIconContainer *container;
4220
 
        gboolean frame_text;
4221
 
        
 
4189
 
4222
4190
        container = NAUTILUS_ICON_CONTAINER (widget);
4223
 
 
4224
 
        gtk_widget_style_get (GTK_WIDGET (container),
4225
 
                              "frame_text", &frame_text,
4226
 
                              NULL);
4227
 
 
4228
 
        container->details->use_drop_shadows = container->details->drop_shadows_requested && !frame_text;
4229
 
 
4230
 
        nautilus_icon_container_theme_changed (NAUTILUS_ICON_CONTAINER (widget));       
 
4191
        container->details->use_drop_shadows = container->details->drop_shadows_requested;
 
4192
 
 
4193
        /* Don't chain up to parent, if this is a desktop container,
 
4194
         * because that resets the background of the window.
 
4195
         */
 
4196
        if (!nautilus_icon_container_get_is_desktop (container)) {
 
4197
                GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->style_updated (widget);
 
4198
        }
 
4199
 
 
4200
        nautilus_icon_container_theme_changed (NAUTILUS_ICON_CONTAINER (widget));
4231
4201
 
4232
4202
        if (gtk_widget_get_realized (widget)) {
4233
4203
                invalidate_label_sizes (container);
4234
4204
                nautilus_icon_container_request_update_all (container);
4235
4205
        }
4236
 
 
4237
 
        /* Don't chain up to parent, because that sets the background of the window and we're doing
4238
 
           that ourself with some delay, so this would cause flickering */
4239
4206
}
4240
4207
 
4241
4208
static gboolean
4426
4393
        last_click_time = current_time;
4427
4394
 
4428
4395
        /* Only allow double click */
4429
 
        return (click_count == 1);
 
4396
        if (click_count == 1) {
 
4397
                click_count = 0;
 
4398
                return TRUE;
 
4399
        } else {
 
4400
                return FALSE;
 
4401
        }
4430
4402
}
4431
4403
 
4432
4404
static void
4493
4465
                                cursor,
4494
4466
                                GDK_CURRENT_TIME);
4495
4467
        if (cursor)
4496
 
                gdk_cursor_unref (cursor);
 
4468
                g_object_unref (cursor);
4497
4469
 
4498
4470
        /* Ensure the window itself is focused.. */
4499
4471
        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
4500
4472
        if (toplevel != NULL && gtk_widget_get_realized (toplevel)) {
4501
 
                eel_gdk_window_focus (gtk_widget_get_window (toplevel), GDK_CURRENT_TIME);
 
4473
                gdk_window_focus (gtk_widget_get_window (toplevel), GDK_CURRENT_TIME);
4502
4474
        }
4503
4475
 
4504
4476
        return TRUE;
4550
4522
        container->details->world_y = world_y;
4551
4523
 
4552
4524
        if (container->details->stretch_idle_id == 0) {         
4553
 
                container->details->stretch_idle_id = g_idle_add ((GtkFunction) update_stretch_at_idle, container);
 
4525
                container->details->stretch_idle_id = g_idle_add ((GSourceFunc) update_stretch_at_idle, container);
4554
4526
        }
4555
4527
}
4556
4528
 
4570
4542
        icon_get_size (container, icon, &size);
4571
4543
 
4572
4544
        switch (event->keyval) {
4573
 
        case GDK_equal:
4574
 
        case GDK_plus:
4575
 
        case GDK_KP_Add:
 
4545
        case GDK_KEY_equal:
 
4546
        case GDK_KEY_plus:
 
4547
        case GDK_KEY_KP_Add:
4576
4548
                icon_set_size (container, icon, size + 5, FALSE, FALSE);
4577
4549
                break;
4578
 
        case GDK_minus:
4579
 
        case GDK_KP_Subtract:
 
4550
        case GDK_KEY_minus:
 
4551
        case GDK_KEY_KP_Subtract:
4580
4552
                icon_set_size (container, icon, size - 5, FALSE, FALSE);
4581
4553
                break;
4582
 
        case GDK_0:
4583
 
        case GDK_KP_0:
 
4554
        case GDK_KEY_0:
 
4555
        case GDK_KEY_KP_0:
4584
4556
                nautilus_icon_container_move_icon (container, icon,
4585
4557
                                                   icon->x, icon->y,
4586
4558
                                                   1.0,
4685
4657
                                nautilus_icon_container_did_not_drag (container, event);
4686
4658
                        } else {
4687
4659
                                nautilus_icon_dnd_end_drag (container);
4688
 
                                nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
4689
 
                                                    "end drag from icon container");
 
4660
                                DEBUG ("Ending drag from icon container");
4690
4661
                        }
4691
4662
                        break;
4692
4663
                case DRAG_STATE_STRETCH:
4758
4729
                                                              event, 
4759
4730
                                                              canvas_x,
4760
4731
                                                              canvas_y);
4761
 
                                nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
4762
 
                                                    "begin drag from icon container");
 
4732
                                DEBUG ("Beginning drag from icon container");
4763
4733
                        }
4764
4734
                        break;
4765
4735
                case DRAG_STATE_STRETCH:
4790
4760
 
4791
4761
 
4792
4762
        cont_window = gtk_widget_get_window (GTK_WIDGET (container));
4793
 
        screen = gdk_drawable_get_screen (cont_window);
 
4763
        screen = gdk_window_get_screen (cont_window);
4794
4764
 
4795
4765
        monitor_num = gdk_screen_get_monitor_at_window (screen, cont_window);
4796
4766
        gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
4798
4768
        gtk_widget_realize (search_dialog);
4799
4769
 
4800
4770
        gdk_window_get_origin (cont_window, &cont_x, &cont_y);
4801
 
        gdk_drawable_get_size (cont_window, &cont_width, &cont_height);
4802
 
        gtk_widget_size_request (search_dialog, &requisition);
4803
 
 
4804
 
        if (cont_x + cont_width - requisition.width > gdk_screen_get_width (screen)) {
 
4771
        cont_width = gdk_window_get_width (cont_window);
 
4772
        cont_height = gdk_window_get_height (cont_window);
 
4773
 
 
4774
        gtk_widget_get_preferred_size (search_dialog, &requisition, NULL);
 
4775
 
 
4776
        if (cont_x + cont_width > gdk_screen_get_width (screen)) {
4805
4777
                x = gdk_screen_get_width (screen) - requisition.width;
4806
4778
        } else if (cont_x + cont_width - requisition.width < 0) {
4807
4779
                x = 0;
4809
4781
                x = cont_x + cont_width - requisition.width;
4810
4782
        }
4811
4783
 
4812
 
        if (cont_y + cont_height > gdk_screen_get_height (screen)) {
 
4784
        if (cont_y + cont_height + requisition.height > gdk_screen_get_height (screen)) {
4813
4785
                y = gdk_screen_get_height (screen) - requisition.height;
4814
4786
        } else if (cont_y + cont_height < 0) { /* isn't really possible ... */
4815
4787
                y = 0;
5064
5036
{
5065
5037
        gboolean ret;
5066
5038
        gint len;
5067
 
        gint count = 0;
5068
5039
        const gchar *text;
5069
5040
 
5070
5041
        text = gtk_entry_get_text (GTK_ENTRY (container->details->search_entry));
5096
5067
                container->details->selected_iter += up?(-1):(1);
5097
5068
        } else {
5098
5069
                /* return to old iter */
5099
 
                count = 0;
5100
5070
                nautilus_icon_container_search_iter (container, text,
5101
5071
                                        container->details->selected_iter);
5102
5072
        }
5140
5110
        g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
5141
5111
 
5142
5112
        /* close window and cancel the search */
5143
 
        if (event->keyval == GDK_Escape || event->keyval == GDK_Tab) {
 
5113
        if (event->keyval == GDK_KEY_Escape || event->keyval == GDK_KEY_Tab) {
5144
5114
                nautilus_icon_container_search_dialog_hide (widget, container);
5145
5115
                return TRUE;
5146
5116
        }
5147
5117
 
5148
5118
        /* close window and activate alternate */
5149
 
        if (event->keyval == GDK_Return && event->state & GDK_SHIFT_MASK) {
 
5119
        if (event->keyval == GDK_KEY_Return && event->state & GDK_SHIFT_MASK) {
5150
5120
                nautilus_icon_container_search_dialog_hide (widget,
5151
5121
                                                            container);
5152
5122
 
5155
5125
        }
5156
5126
 
5157
5127
        /* select previous matching iter */
5158
 
        if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up) {
 
5128
        if (event->keyval == GDK_KEY_Up || event->keyval == GDK_KEY_KP_Up) {
5159
5129
                nautilus_icon_container_search_move (widget, container, TRUE);
5160
5130
                retval = TRUE;
5161
5131
        }
5162
5132
 
5163
5133
        if (((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == (GDK_CONTROL_MASK | GDK_SHIFT_MASK))
5164
 
            && (event->keyval == GDK_g || event->keyval == GDK_G)) {
 
5134
            && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) {
5165
5135
                nautilus_icon_container_search_move (widget, container, TRUE);
5166
5136
                retval = TRUE;
5167
5137
        }
5168
5138
 
5169
5139
        /* select next matching iter */
5170
 
        if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down) {
 
5140
        if (event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_KP_Down) {
5171
5141
                nautilus_icon_container_search_move (widget, container, FALSE);
5172
5142
                retval = TRUE;
5173
5143
        }
5174
5144
 
5175
5145
        if (((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
5176
 
            && (event->keyval == GDK_g || event->keyval == GDK_G)) {
 
5146
            && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) {
5177
5147
                nautilus_icon_container_search_move (widget, container, FALSE);
5178
5148
                retval = TRUE;
5179
5149
        }
5229
5199
static void
5230
5200
nautilus_icon_container_ensure_interactive_directory (NautilusIconContainer *container)
5231
5201
{
5232
 
        GtkWidget *frame, *vbox, *toplevel;
5233
 
 
5234
 
        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
 
5202
        GtkWidget *frame, *vbox;
5235
5203
 
5236
5204
        if (container->details->search_window != NULL) {
5237
5205
                return;
5354
5322
{
5355
5323
        GdkEventButton button_event = { 0 };
5356
5324
 
 
5325
        /* ensure we clear the drag state before showing the menu */
 
5326
        clear_drag_state (container);
 
5327
 
5357
5328
        g_signal_emit_by_name (container, signal, &button_event);
5358
5329
 
5359
5330
        return TRUE;
5371
5342
 
5372
5343
        if (is_renaming (container) || is_renaming_pending (container)) {
5373
5344
                switch (event->keyval) {
5374
 
                case GDK_Return:
5375
 
                case GDK_KP_Enter:
 
5345
                case GDK_KEY_Return:
 
5346
                case GDK_KEY_KP_Enter:
5376
5347
                        end_renaming_mode (container, TRUE);    
5377
5348
                        handled = TRUE;
5378
5349
                        break;                  
5379
 
                case GDK_Escape:
 
5350
                case GDK_KEY_Escape:
5380
5351
                        end_renaming_mode (container, FALSE);
5381
5352
                        handled = TRUE;
5382
5353
                        break;
5385
5356
                }
5386
5357
        } else {
5387
5358
                switch (event->keyval) {
5388
 
                case GDK_Home:
5389
 
                case GDK_KP_Home:
 
5359
                case GDK_KEY_Home:
 
5360
                case GDK_KEY_KP_Home:
5390
5361
                        keyboard_home (container, event);
5391
5362
                        handled = TRUE;
5392
5363
                        break;
5393
 
                case GDK_End:
5394
 
                case GDK_KP_End:
 
5364
                case GDK_KEY_End:
 
5365
                case GDK_KEY_KP_End:
5395
5366
                        keyboard_end (container, event);
5396
5367
                        handled = TRUE;
5397
5368
                        break;
5398
 
                case GDK_Left:
5399
 
                case GDK_KP_Left:
 
5369
                case GDK_KEY_Left:
 
5370
                case GDK_KEY_KP_Left:
5400
5371
                        /* Don't eat Alt-Left, as that is used for history browsing */
5401
5372
                        if ((event->state & GDK_MOD1_MASK) == 0) {
5402
5373
                                keyboard_left (container, event);
5403
5374
                                handled = TRUE;
5404
5375
                        }
5405
5376
                        break;
5406
 
                case GDK_Up:
5407
 
                case GDK_KP_Up:
 
5377
                case GDK_KEY_Up:
 
5378
                case GDK_KEY_KP_Up:
5408
5379
                        /* Don't eat Alt-Up, as that is used for alt-shift-Up */
5409
5380
                        if ((event->state & GDK_MOD1_MASK) == 0) {
5410
5381
                                keyboard_up (container, event);
5411
5382
                                handled = TRUE;
5412
5383
                        }
5413
5384
                        break;
5414
 
                case GDK_Right:
5415
 
                case GDK_KP_Right:
 
5385
                case GDK_KEY_Right:
 
5386
                case GDK_KEY_KP_Right:
5416
5387
                        /* Don't eat Alt-Right, as that is used for history browsing */
5417
5388
                        if ((event->state & GDK_MOD1_MASK) == 0) {
5418
5389
                                keyboard_right (container, event);
5419
5390
                                handled = TRUE;
5420
5391
                        }
5421
5392
                        break;
5422
 
                case GDK_Down:
5423
 
                case GDK_KP_Down:
 
5393
                case GDK_KEY_Down:
 
5394
                case GDK_KEY_KP_Down:
5424
5395
                        /* Don't eat Alt-Down, as that is used for Open */
5425
5396
                        if ((event->state & GDK_MOD1_MASK) == 0) {
5426
5397
                                keyboard_down (container, event);
5427
5398
                                handled = TRUE;
5428
5399
                        }
5429
5400
                        break;
5430
 
                case GDK_space:
 
5401
                case GDK_KEY_space:
5431
5402
                        keyboard_space (container, event);
5432
5403
                        handled = TRUE;
5433
5404
                        break;
5434
5405
#ifndef TAB_NAVIGATION_DISABLED
5435
 
                case GDK_Tab:
5436
 
                case GDK_ISO_Left_Tab:
 
5406
                case GDK_KEY_Tab:
 
5407
                case GDK_KEY_ISO_Left_Tab:
5437
5408
                        select_previous_or_next_icon (container, 
5438
5409
                                                      (event->state & GDK_SHIFT_MASK) == 0, event);
5439
5410
                        handled = TRUE;
5440
5411
                        break;
5441
5412
#endif
5442
 
                case GDK_Return:
5443
 
                case GDK_KP_Enter:
 
5413
                case GDK_KEY_Return:
 
5414
                case GDK_KEY_KP_Enter:
5444
5415
                        if ((event->state & GDK_SHIFT_MASK) != 0) {
5445
5416
                                activate_selected_items_alternate (container, NULL);
5446
5417
                        } else {
5449
5420
                        
5450
5421
                        handled = TRUE;
5451
5422
                        break;
5452
 
                case GDK_Escape:
 
5423
                case GDK_KEY_Escape:
5453
5424
                        handled = undo_stretching (container);
5454
5425
                        break;
5455
 
                case GDK_plus:
5456
 
                case GDK_minus:
5457
 
                case GDK_equal:
5458
 
                case GDK_KP_Add:
5459
 
                case GDK_KP_Subtract:
5460
 
                case GDK_0:
5461
 
                case GDK_KP_0:
 
5426
                case GDK_KEY_plus:
 
5427
                case GDK_KEY_minus:
 
5428
                case GDK_KEY_equal:
 
5429
                case GDK_KEY_KP_Add:
 
5430
                case GDK_KEY_KP_Subtract:
 
5431
                case GDK_KEY_0:
 
5432
                case GDK_KEY_KP_0:
5462
5433
                        if (event->state & GDK_CONTROL_MASK) {
5463
5434
                                handled = keyboard_stretching (container, event);
5464
5435
                        }
5465
5436
                        break;
5466
 
                case GDK_F10:
 
5437
                case GDK_KEY_F10:
5467
5438
                        /* handle Ctrl+F10 because we want to display the
5468
5439
                         * background popup even if something is selected.
5469
5440
                         * The other cases are handled by popup_menu().
5473
5444
                                                         "context_click_background");
5474
5445
                        }
5475
5446
                        break;
5476
 
                case GDK_v:
 
5447
                case GDK_KEY_v:
5477
5448
                        /* Eat Control + v to not enable type ahead */
5478
5449
                        if ((event->state & GDK_CONTROL_MASK) != 0) {
5479
5450
                                handled = TRUE;
5492
5463
         * start the typeahead find capabilities.
5493
5464
         * Copied from NautilusIconContainer */
5494
5465
        if (!handled &&
5495
 
            event->keyval != GDK_slash /* don't steal slash key event, used for "go to" */ &&
5496
 
            event->keyval != GDK_BackSpace &&
5497
 
            event->keyval != GDK_Delete) {
 
5466
            event->keyval != GDK_KEY_slash /* don't steal slash key event, used for "go to" */ &&
 
5467
            event->keyval != GDK_KEY_BackSpace &&
 
5468
            event->keyval != GDK_KEY_Delete) {
5498
5469
                GdkEvent *new_event;
5499
5470
                GdkWindow *window;
5500
5471
                char *old_text;
5575
5546
 
5576
5547
static void
5577
5548
draw_canvas_background (EelCanvas *canvas,
5578
 
                        int x, int y, int width, int height)
 
5549
                        cairo_t   *cr)
5579
5550
{
5580
5551
        /* Don't chain up to the parent to avoid clearing and redrawing */
5581
5552
}
5582
5553
 
5583
5554
 
5584
 
static gboolean
5585
 
expose_event (GtkWidget      *widget,
5586
 
              GdkEventExpose *event)
5587
 
{
5588
 
/*      g_warning ("Expose Icon Container %p '%d,%d: %d,%d'",
5589
 
                   widget,
5590
 
                   event->area.x, event->area.y,
5591
 
                   event->area.width, event->area.height); */
5592
 
        
5593
 
        return GTK_WIDGET_CLASS (nautilus_icon_container_parent_class)->expose_event (widget, event);
5594
 
}
5595
 
 
5596
5555
static AtkObject *
5597
5556
get_accessible (GtkWidget *widget)
5598
5557
{
5653
5612
 
5654
5613
        container = NAUTILUS_ICON_CONTAINER (object);
5655
5614
        if (nautilus_icon_container_get_is_desktop (container)) {
5656
 
                eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
5657
 
                                                          text_ellipsis_limit_changed_container_callback,
5658
 
                                                          container, G_OBJECT (container));
 
5615
                g_signal_connect_swapped (nautilus_desktop_preferences,
 
5616
                                          "changed::" NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
 
5617
                                          G_CALLBACK (text_ellipsis_limit_changed_container_callback),
 
5618
                                          container);
5659
5619
        } else {
5660
 
                eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
5661
 
                                                          text_ellipsis_limit_changed_container_callback,
5662
 
                                                          container, G_OBJECT (container));
 
5620
                g_signal_connect_swapped (nautilus_icon_view_preferences,
 
5621
                                          "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
 
5622
                                          G_CALLBACK (text_ellipsis_limit_changed_container_callback),
 
5623
                                          container);
5663
5624
        }
5664
5625
 
5665
5626
        return object;
5676
5637
 
5677
5638
        G_OBJECT_CLASS (class)->constructor = nautilus_icon_container_constructor;
5678
5639
        G_OBJECT_CLASS (class)->finalize = finalize;
5679
 
        GTK_OBJECT_CLASS (class)->destroy = destroy;
5680
5640
 
5681
5641
        /* Signals.  */
5682
5642
 
5808
5768
                                G_STRUCT_OFFSET (NautilusIconContainerClass,
5809
5769
                                                 get_icon_uri),
5810
5770
                                NULL, NULL,
5811
 
                                eel_marshal_STRING__POINTER,
 
5771
                                nautilus_marshal_STRING__POINTER,
5812
5772
                                G_TYPE_STRING, 1,
5813
5773
                                G_TYPE_POINTER);
5814
5774
        signals[GET_ICON_DROP_TARGET_URI]
5818
5778
                                G_STRUCT_OFFSET (NautilusIconContainerClass,
5819
5779
                                                 get_icon_drop_target_uri),
5820
5780
                                NULL, NULL,
5821
 
                                eel_marshal_STRING__POINTER,
 
5781
                                nautilus_marshal_STRING__POINTER,
5822
5782
                                G_TYPE_STRING, 1,
5823
5783
                                G_TYPE_POINTER);
5824
5784
        signals[MOVE_COPY_ITEMS] 
5901
5861
                                G_STRUCT_OFFSET (NautilusIconContainerClass, 
5902
5862
                                                 get_container_uri),
5903
5863
                                NULL, NULL,
5904
 
                                eel_marshal_STRING__VOID,
 
5864
                                nautilus_marshal_STRING__VOID,
5905
5865
                                G_TYPE_STRING, 0);
5906
5866
        signals[CAN_ACCEPT_ITEM] 
5907
5867
                = g_signal_new ("can_accept_item",
5910
5870
                                G_STRUCT_OFFSET (NautilusIconContainerClass, 
5911
5871
                                                 can_accept_item),
5912
5872
                                NULL, NULL,
5913
 
                                eel_marshal_INT__POINTER_STRING,
 
5873
                                nautilus_marshal_INT__POINTER_STRING,
5914
5874
                                G_TYPE_INT, 2,
5915
5875
                                G_TYPE_POINTER,
5916
5876
                                G_TYPE_STRING);
5921
5881
                                G_STRUCT_OFFSET (NautilusIconContainerClass,
5922
5882
                                                 get_stored_icon_position),
5923
5883
                                NULL, NULL,
5924
 
                                eel_marshal_BOOLEAN__POINTER_POINTER,
 
5884
                                nautilus_marshal_BOOLEAN__POINTER_POINTER,
5925
5885
                                G_TYPE_BOOLEAN, 2,
5926
5886
                                G_TYPE_POINTER,
5927
5887
                                G_TYPE_POINTER);
5932
5892
                                G_STRUCT_OFFSET (NautilusIconContainerClass,
5933
5893
                                                 get_stored_layout_timestamp),
5934
5894
                                NULL, NULL,
5935
 
                                eel_marshal_BOOLEAN__POINTER_POINTER,
 
5895
                                nautilus_marshal_BOOLEAN__POINTER_POINTER,
5936
5896
                                G_TYPE_BOOLEAN, 2,
5937
5897
                                G_TYPE_POINTER,
5938
5898
                                G_TYPE_POINTER);
5943
5903
                                G_STRUCT_OFFSET (NautilusIconContainerClass,
5944
5904
                                                 store_layout_timestamp),
5945
5905
                                NULL, NULL,
5946
 
                                eel_marshal_BOOLEAN__POINTER_POINTER,
 
5906
                                nautilus_marshal_BOOLEAN__POINTER_POINTER,
5947
5907
                                G_TYPE_BOOLEAN, 2,
5948
5908
                                G_TYPE_POINTER,
5949
5909
                                G_TYPE_POINTER);
6027
5987
        /* GtkWidget class.  */
6028
5988
 
6029
5989
        widget_class = GTK_WIDGET_CLASS (class);
6030
 
        widget_class->size_request = size_request;
 
5990
        widget_class->destroy = destroy;
6031
5991
        widget_class->size_allocate = size_allocate;
6032
5992
        widget_class->realize = realize;
6033
5993
        widget_class->unrealize = unrealize;
6037
5997
        widget_class->key_press_event = key_press_event;
6038
5998
        widget_class->popup_menu = popup_menu;
6039
5999
        widget_class->get_accessible = get_accessible;
6040
 
        widget_class->style_set = style_set;
6041
 
        widget_class->expose_event = expose_event;
 
6000
        widget_class->style_updated = style_updated;
6042
6001
        widget_class->grab_notify = grab_notify_cb;
6043
6002
 
6044
6003
        canvas_class = EEL_CANVAS_CLASS (class);
6045
6004
        canvas_class->draw_background = draw_canvas_background;
6046
6005
 
6047
6006
        class->start_interactive_search = nautilus_icon_container_start_interactive_search;
6048
 
        
6049
 
        gtk_widget_class_install_style_property (widget_class,
6050
 
                                                 g_param_spec_boolean ("frame_text",
6051
 
                                                                       "Frame Text",
6052
 
                                                                       "Draw a frame around unselected text",
6053
 
                                                                       FALSE,
6054
 
                                                                       G_PARAM_READABLE));
6055
6007
 
6056
6008
        gtk_widget_class_install_style_property (widget_class,
6057
 
                                                 g_param_spec_boxed ("selection_box_color",
6058
 
                                                                     "Selection Box Color",
 
6009
                                                 g_param_spec_boxed ("selection_box_rgba",
 
6010
                                                                     "Selection Box RGBA",
6059
6011
                                                                     "Color of the selection box",
6060
 
                                                                     GDK_TYPE_COLOR,
6061
 
                                                                     G_PARAM_READABLE));
6062
 
        gtk_widget_class_install_style_property (widget_class,
6063
 
                                                 g_param_spec_uchar ("selection_box_alpha",
6064
 
                                                                     "Selection Box Alpha",
6065
 
                                                                     "Opacity of the selection box",
6066
 
                                                                     0, 0xff,
6067
 
                                                                     DEFAULT_SELECTION_BOX_ALPHA,
6068
 
                                                                     G_PARAM_READABLE));
6069
 
 
6070
 
        gtk_widget_class_install_style_property (widget_class,
6071
 
                                                 g_param_spec_uchar ("highlight_alpha",
6072
 
                                                                     "Highlight Alpha",
6073
 
                                                                     "Opacity of the highlight for selected icons",
6074
 
                                                                     0, 0xff,
6075
 
                                                                     DEFAULT_HIGHLIGHT_ALPHA,
6076
 
                                                                     G_PARAM_READABLE));
6077
 
        gtk_widget_class_install_style_property (widget_class,
6078
 
                                                 g_param_spec_uchar ("normal_alpha",
6079
 
                                                                     "Normal Alpha",
6080
 
                                                                     "Opacity of the normal icons if frame_text is set",
6081
 
                                                                     0, 0xff,
6082
 
                                                                     DEFAULT_NORMAL_ALPHA,
6083
 
                                                                     G_PARAM_READABLE));
6084
 
        gtk_widget_class_install_style_property (widget_class,
6085
 
                                                 g_param_spec_uchar ("prelight_alpha",
6086
 
                                                                     "Prelight Alpha",
6087
 
                                                                     "Opacity of the prelight icons if frame_text is set",
6088
 
                                                                     0, 0xff,
6089
 
                                                                     DEFAULT_PRELIGHT_ALPHA,
6090
 
                                                                     G_PARAM_READABLE));
6091
 
        gtk_widget_class_install_style_property (widget_class,
6092
 
                                                 g_param_spec_boxed ("light_info_color",
6093
 
                                                                     "Light Info Color",
6094
 
                                                                     "Color used for information text against a dark background",
6095
 
                                                                     GDK_TYPE_COLOR,
6096
 
                                                                     G_PARAM_READABLE));
6097
 
        gtk_widget_class_install_style_property (widget_class,
6098
 
                                                 g_param_spec_boxed ("dark_info_color",
6099
 
                                                                     "Dark Info Color",
6100
 
                                                                     "Color used for information text against a light background",
6101
 
                                                                     GDK_TYPE_COLOR,
6102
 
                                                                     G_PARAM_READABLE));
6103
 
 
6104
 
        gtk_widget_class_install_style_property (widget_class,
6105
 
                                                 g_param_spec_uint ("normal_icon_render_mode",
6106
 
                                                                     "Normal Icon Render Mode",
6107
 
                                                                     "Mode of normal icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
6108
 
                                                                     0, 3,
6109
 
                                                                     DEFAULT_NORMAL_ICON_RENDER_MODE,
6110
 
                                                                     G_PARAM_READABLE));
6111
 
        gtk_widget_class_install_style_property (widget_class,
6112
 
                                                 g_param_spec_uint ("prelight_icon_render_mode",
6113
 
                                                                     "Prelight Icon Render Mode",
6114
 
                                                                     "Mode of prelight icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
6115
 
                                                                     0, 3,
6116
 
                                                                     DEFAULT_PRELIGHT_ICON_RENDER_MODE,
6117
 
                                                                     G_PARAM_READABLE));
6118
 
        gtk_widget_class_install_style_property (widget_class,
6119
 
                                                 g_param_spec_boxed ("normal_icon_color",
6120
 
                                                                     "Icon Normal Color",
6121
 
                                                                     "Color used for colorizing icons in normal state (default base[NORMAL])",
6122
 
                                                                     GDK_TYPE_COLOR,
6123
 
                                                                     G_PARAM_READABLE));
6124
 
        gtk_widget_class_install_style_property (widget_class,
6125
 
                                                 g_param_spec_boxed ("prelight_icon_color",
6126
 
                                                                     "Icon Prelight Color",
6127
 
                                                                     "Color used for colorizing prelighted icons (default base[PRELIGHT])",
6128
 
                                                                     GDK_TYPE_COLOR,
6129
 
                                                                     G_PARAM_READABLE));
6130
 
        gtk_widget_class_install_style_property (widget_class,
6131
 
                                                 g_param_spec_uint ("normal_icon_saturation",
6132
 
                                                                     "Normal Icon Saturation",
6133
 
                                                                     "Saturation of icons in normal state",
6134
 
                                                                     0, 255,
6135
 
                                                                     DEFAULT_NORMAL_ICON_SATURATION,
6136
 
                                                                     G_PARAM_READABLE));
6137
 
        gtk_widget_class_install_style_property (widget_class,
6138
 
                                                 g_param_spec_uint ("prelight_icon_saturation",
6139
 
                                                                     "Prelight Icon Saturation",
6140
 
                                                                     "Saturation of icons in prelight state",
6141
 
                                                                     0, 255,
6142
 
                                                                     DEFAULT_PRELIGHT_ICON_SATURATION,
6143
 
                                                                     G_PARAM_READABLE));
6144
 
        gtk_widget_class_install_style_property (widget_class,
6145
 
                                                 g_param_spec_uint ("normal_icon_brightness",
6146
 
                                                                     "Normal Icon Brightness",
6147
 
                                                                     "Brightness of icons in normal state",
6148
 
                                                                     0, 255,
6149
 
                                                                     DEFAULT_NORMAL_ICON_BRIGHTNESS,
6150
 
                                                                     G_PARAM_READABLE));
6151
 
        gtk_widget_class_install_style_property (widget_class,
6152
 
                                                 g_param_spec_uint ("prelight_icon_brightness",
6153
 
                                                                     "Prelight Icon Brightness",
6154
 
                                                                     "Brightness of icons in prelight state",
6155
 
                                                                     0, 255,
6156
 
                                                                     DEFAULT_PRELIGHT_ICON_BRIGHTNESS,
6157
 
                                                                     G_PARAM_READABLE));
6158
 
        gtk_widget_class_install_style_property (widget_class,
6159
 
                                                 g_param_spec_uint ("normal_icon_lighten",
6160
 
                                                                     "Normal Icon Lighten",
6161
 
                                                                     "Lighten icons in normal state",
6162
 
                                                                     0, 255,
6163
 
                                                                     DEFAULT_NORMAL_ICON_LIGHTEN,
6164
 
                                                                     G_PARAM_READABLE));
6165
 
        gtk_widget_class_install_style_property (widget_class,
6166
 
                                                 g_param_spec_uint ("prelight_icon_lighten",
6167
 
                                                                     "Prelight Icon Lighten",
6168
 
                                                                     "Lighten icons in prelight state",
6169
 
                                                                     0, 255,
6170
 
                                                                     DEFAULT_PRELIGHT_ICON_LIGHTEN,
 
6012
                                                                     GDK_TYPE_RGBA,
6171
6013
                                                                     G_PARAM_READABLE));
6172
6014
        gtk_widget_class_install_style_property (widget_class,
6173
6015
                                                 g_param_spec_boolean ("activate_prelight_icon_label",
6179
6021
 
6180
6022
        binding_set = gtk_binding_set_by_class (class);
6181
6023
 
6182
 
        gtk_binding_entry_add_signal (binding_set, GDK_f, GDK_CONTROL_MASK, "start_interactive_search", 0);
6183
 
        gtk_binding_entry_add_signal (binding_set, GDK_F, GDK_CONTROL_MASK, "start_interactive_search", 0);
 
6024
        gtk_binding_entry_add_signal (binding_set, GDK_KEY_f, GDK_CONTROL_MASK, "start_interactive_search", 0);
 
6025
        gtk_binding_entry_add_signal (binding_set, GDK_KEY_F, GDK_CONTROL_MASK, "start_interactive_search", 0);
6184
6026
}
6185
6027
 
6186
6028
static void
6252
6094
        return success;
6253
6095
}
6254
6096
 
 
6097
static const char * zoom_level_names[] = {
 
6098
        "smallest",
 
6099
        "smaller",
 
6100
        "small",
 
6101
        "standard",
 
6102
        "large",
 
6103
        "larger",
 
6104
        "largest"
 
6105
};
 
6106
 
6255
6107
static void
6256
6108
text_ellipsis_limit_changed_callback (gpointer callback_data)
6257
6109
{
6258
6110
        char **pref;
6259
6111
        unsigned int i;
6260
6112
        int one_limit;
6261
 
        const EelEnumeration *eenum;
6262
 
        const EelEnumerationEntry *entry;
6263
6113
 
6264
 
        pref = eel_preferences_get_string_array (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT);
 
6114
        pref = g_settings_get_strv (nautilus_icon_view_preferences,
 
6115
                                    NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT);
6265
6116
 
6266
6117
        /* set default */
6267
6118
        get_text_ellipsis_limit_for_zoom (pref, NULL, &one_limit);
6270
6121
        }
6271
6122
 
6272
6123
        /* override for each zoom level */
6273
 
        eenum = eel_enumeration_lookup ("default_zoom_level");
6274
 
        g_assert (eenum != NULL);
6275
 
        for (i = 0; i < eel_enumeration_get_length (eenum); i++) {
6276
 
                entry = eel_enumeration_get_nth_entry (eenum, i);
6277
 
                if (get_text_ellipsis_limit_for_zoom (pref, entry->name, &one_limit)) {
6278
 
                        text_ellipsis_limits[entry->value] = one_limit;
 
6124
        for (i = 0; i < G_N_ELEMENTS(zoom_level_names); i++) {
 
6125
                if (get_text_ellipsis_limit_for_zoom (pref,
 
6126
                                                      zoom_level_names[i],
 
6127
                                                      &one_limit)) {
 
6128
                        text_ellipsis_limits[i] = one_limit;
6279
6129
                }
6280
6130
        }
6281
6131
 
6287
6137
{
6288
6138
        int pref;
6289
6139
 
6290
 
        pref = eel_preferences_get_integer (NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT);
 
6140
        pref = g_settings_get_int (nautilus_desktop_preferences, NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT);
6291
6141
        desktop_text_ellipsis_limit = pref;
6292
6142
}
6293
6143
 
6295
6145
nautilus_icon_container_init (NautilusIconContainer *container)
6296
6146
{
6297
6147
        NautilusIconContainerDetails *details;
6298
 
        EelBackground *background;
6299
6148
        static gboolean setup_prefs = FALSE;
6300
 
        
 
6149
 
6301
6150
        details = g_new0 (NautilusIconContainerDetails, 1);
6302
6151
 
6303
6152
        details->icon_set = g_hash_table_new (g_direct_hash, g_direct_equal);
6304
6153
        details->layout_timestamp = UNDEFINED_TIME;
6305
 
 
6306
 
        details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
 
6154
        details->active_background = TRUE;
 
6155
        details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
6307
6156
 
6308
6157
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -2 * PANGO_SCALE;
6309
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -2 * PANGO_SCALE;
6310
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -0 * PANGO_SCALE;
6311
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
6312
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 0 * PANGO_SCALE;
6313
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 0 * PANGO_SCALE;
6314
 
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 0 * PANGO_SCALE;
 
6158
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -2 * PANGO_SCALE;
 
6159
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -0 * PANGO_SCALE;
 
6160
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
 
6161
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 0 * PANGO_SCALE;
 
6162
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 0 * PANGO_SCALE;
 
6163
        details->font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 0 * PANGO_SCALE;
6315
6164
 
6316
6165
        container->details = details;
6317
6166
 
6318
 
        /* when the background changes, we must set up the label text color */
6319
 
        background = eel_get_widget_background (GTK_WIDGET (container));
6320
 
        
6321
 
        g_signal_connect_object (background, "appearance_changed",
6322
 
                                 G_CALLBACK (update_label_color), container, 0);
6323
 
 
6324
6167
        g_signal_connect (container, "focus-in-event",
6325
6168
                          G_CALLBACK (handle_focus_in_event), NULL);
6326
6169
        g_signal_connect (container, "focus-out-event",
6327
6170
                          G_CALLBACK (handle_focus_out_event), NULL);
6328
6171
 
6329
 
        eel_background_set_use_base (background, TRUE);
6330
 
        
6331
6172
        /* read in theme-dependent data */
6332
6173
        nautilus_icon_container_theme_changed (container);
6333
 
        eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME,
6334
 
                                      nautilus_icon_container_theme_changed,
6335
 
                                      container);
6336
6174
 
6337
6175
        if (!setup_prefs) {
6338
 
                eel_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
6339
 
                                              text_ellipsis_limit_changed_callback,
6340
 
                                              NULL);
 
6176
                g_signal_connect_swapped (nautilus_icon_view_preferences,
 
6177
                                          "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
 
6178
                                          G_CALLBACK (text_ellipsis_limit_changed_callback),
 
6179
                                          NULL);
6341
6180
                text_ellipsis_limit_changed_callback (NULL);
6342
6181
 
6343
 
                eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
6344
 
                                              desktop_text_ellipsis_limit_changed_callback,
6345
 
                                              NULL);
 
6182
                g_signal_connect_swapped (nautilus_icon_view_preferences,
 
6183
                                          "changed::" NAUTILUS_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
 
6184
                                          G_CALLBACK (desktop_text_ellipsis_limit_changed_callback),
 
6185
                                          NULL);
6346
6186
                desktop_text_ellipsis_limit_changed_callback (NULL);
6347
6187
 
6348
6188
                setup_prefs = TRUE;
6483
6323
        }
6484
6324
 
6485
6325
        if (event->button == CONTEXTUAL_MENU_BUTTON) {
 
6326
                clear_drag_state (container);
 
6327
 
6486
6328
                g_signal_emit (container,
6487
6329
                               signals[CONTEXT_CLICK_SELECTION], 0,
6488
6330
                               event);
6498
6340
                     gpointer data)
6499
6341
{
6500
6342
        NautilusIconContainer *container;
6501
 
        NautilusIconContainerDetails *details;
6502
6343
        NautilusIcon *icon;
6503
6344
 
6504
6345
        container = NAUTILUS_ICON_CONTAINER (data);
6505
 
        details = container->details;
6506
6346
 
6507
6347
        icon = NAUTILUS_ICON_CANVAS_ITEM (item)->user_data;
6508
6348
        g_assert (icon != NULL);
6592
6432
        gboolean better_icon;
6593
6433
        gboolean compare_lt;
6594
6434
 
6595
 
        hadj_v = gtk_adjustment_get_value (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
6596
 
        vadj_v = gtk_adjustment_get_value (gtk_layout_get_vadjustment (GTK_LAYOUT (container)));
6597
 
        h_page_size = gtk_adjustment_get_page_size (gtk_layout_get_hadjustment (GTK_LAYOUT (container)));
 
6435
        hadj_v = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
 
6436
        vadj_v = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container)));
 
6437
        h_page_size = gtk_adjustment_get_page_size (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container)));
6598
6438
 
6599
6439
        if (nautilus_icon_container_is_layout_rtl (container)) {
6600
6440
                x = hadj_v + h_page_size - ICON_PAD_LEFT - 1;
6661
6501
        GList *l;
6662
6502
        NautilusIcon *icon;
6663
6503
        GtkAdjustment *hadj, *vadj;
6664
 
        EelCanvasItem *item;
6665
6504
        EelIRect bounds;
6666
6505
        GtkAllocation allocation;
6667
6506
 
6668
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
6669
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
 
6507
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
 
6508
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
6670
6509
        gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
6671
6510
 
6672
6511
        /* We need to force a relayout now if there are updates queued
6680
6519
                if (icon->data == data &&
6681
6520
                    icon_is_positioned (icon)) {
6682
6521
 
6683
 
                        item = EEL_CANVAS_ITEM (icon->item);
6684
 
 
6685
6522
                        if (nautilus_icon_container_is_auto_layout (container)) {
6686
6523
                                /* ensure that we reveal the entire row/column */
6687
6524
                                icon_get_row_and_column_bounds (container, icon, &bounds, TRUE);
6691
6528
 
6692
6529
                        if (nautilus_icon_container_is_layout_vertical (container)) {
6693
6530
                                if (nautilus_icon_container_is_layout_rtl (container)) {
6694
 
                                        eel_gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
 
6531
                                        gtk_adjustment_set_value (hadj, bounds.x1 - allocation.width);
6695
6532
                                } else {
6696
 
                                        eel_gtk_adjustment_set_value (hadj, bounds.x0);
 
6533
                                        gtk_adjustment_set_value (hadj, bounds.x0);
6697
6534
                                }
6698
6535
                        } else {
6699
 
                                eel_gtk_adjustment_set_value (vadj, bounds.y0);
 
6536
                                gtk_adjustment_set_value (vadj, bounds.y0);
6700
6537
                        }
6701
6538
                }
6702
6539
                
6878
6715
nautilus_icon_container_get_icon_images (NautilusIconContainer *container,
6879
6716
                                         NautilusIconData      *data,
6880
6717
                                         int                    size,
6881
 
                                         GList                **emblem_pixbufs,
6882
6718
                                         char                 **embedded_text,
6883
6719
                                         gboolean               for_drag_accept,
6884
6720
                                         gboolean               need_large_embeddded_text,
6890
6726
        klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
6891
6727
        g_assert (klass->get_icon_images != NULL);
6892
6728
 
6893
 
        return klass->get_icon_images (container, data, size, emblem_pixbufs, embedded_text, for_drag_accept, need_large_embeddded_text, embedded_text_needs_loading, has_open_window);
 
6729
        return klass->get_icon_images (container, data, size, embedded_text, for_drag_accept, need_large_embeddded_text, embedded_text_needs_loading, has_open_window);
6894
6730
}
6895
6731
 
6896
6732
static void
6967
6803
        gboolean visible;
6968
6804
        GtkAllocation allocation;
6969
6805
 
6970
 
        hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (container));
6971
 
        vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (container));
 
6806
        hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
 
6807
        vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
6972
6808
        gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
6973
6809
 
6974
6810
        min_x = gtk_adjustment_get_value (hadj);
7049
6885
        int n_attach_points;
7050
6886
        gboolean has_embedded_text_rect;
7051
6887
        GdkPixbuf *pixbuf;
7052
 
        GList *emblem_pixbufs;
7053
6888
        char *editable_text, *additional_text;
7054
6889
        char *embedded_text;
7055
6890
        GdkRectangle embedded_text_rect;
7078
6913
        icon_size = MAX (icon_size, min_image_size);
7079
6914
        icon_size = MIN (icon_size, max_image_size);
7080
6915
 
 
6916
        DEBUG ("Icon size, getting for size %d", icon_size);
 
6917
 
7081
6918
        /* Get the icons. */
7082
 
        emblem_pixbufs = NULL;
7083
6919
        embedded_text = NULL;
7084
6920
        large_embedded_text = icon_size > ICON_SIZE_FOR_LARGE_EMBEDDED_TEXT;
7085
6921
        icon_info = nautilus_icon_container_get_icon_images (container, icon->data, icon_size,
7086
 
                                                             &emblem_pixbufs,
7087
6922
                                                             &embedded_text,
7088
6923
                                                             icon == details->drop_target,                                                           
7089
6924
                                                             large_embedded_text, &embedded_text_needs_loading,
7090
6925
                                                             &has_open_window);
7091
6926
 
7092
 
 
7093
 
        if (container->details->forced_icon_size > 0)
 
6927
        if (container->details->forced_icon_size > 0) {
7094
6928
                pixbuf = nautilus_icon_info_get_pixbuf_at_size (icon_info, icon_size);
7095
 
        else
 
6929
        } else {
7096
6930
                pixbuf = nautilus_icon_info_get_pixbuf (icon_info);
 
6931
        }
 
6932
 
7097
6933
        nautilus_icon_info_get_attach_points (icon_info, &attach_points, &n_attach_points);
7098
6934
        has_embedded_text_rect = nautilus_icon_info_get_embedded_rect (icon_info,
7099
6935
                                                                       &embedded_text_rect);
 
6936
 
 
6937
        g_object_unref (icon_info);
7100
6938
 
7101
6939
        if (has_embedded_text_rect && embedded_text_needs_loading) {
7102
6940
                icon->is_monitored = TRUE;
7115
6953
         * happened to be typing at that moment.
7116
6954
         */
7117
6955
        if (icon == get_icon_being_renamed (container) &&
7118
 
            eel_strcmp (editable_text, 
7119
 
                        nautilus_icon_canvas_item_get_editable_text (icon->item)) != 0) {
 
6956
            g_strcmp0 (editable_text,
 
6957
                       nautilus_icon_canvas_item_get_editable_text (icon->item)) != 0) {
7120
6958
                end_renaming_mode (container, FALSE);
7121
6959
        }
7122
6960
 
7128
6966
 
7129
6967
        nautilus_icon_canvas_item_set_image (icon->item, pixbuf);
7130
6968
        nautilus_icon_canvas_item_set_attach_points (icon->item, attach_points, n_attach_points);
7131
 
        nautilus_icon_canvas_item_set_emblems (icon->item, emblem_pixbufs);
7132
6969
        nautilus_icon_canvas_item_set_embedded_text_rect (icon->item, &embedded_text_rect);
7133
6970
        nautilus_icon_canvas_item_set_embedded_text (icon->item, embedded_text);
7134
6971
 
7135
6972
        /* Let the pixbufs go. */
7136
6973
        g_object_unref (pixbuf);
7137
 
        eel_gdk_pixbuf_list_free (emblem_pixbufs);
7138
6974
 
7139
6975
        g_free (editable_text);
7140
6976
        g_free (additional_text);
7141
 
 
7142
 
        g_object_unref (icon_info);
7143
6977
}
7144
6978
 
7145
6979
static gboolean
8067
7901
        g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
8068
7902
}
8069
7903
 
8070
 
 
8071
 
/* Toggle the tighter layout boolean. */
8072
 
void
8073
 
nautilus_icon_container_set_tighter_layout (NautilusIconContainer *container,
8074
 
                                            gboolean tighter_layout)
8075
 
{
8076
 
        g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
8077
 
        g_return_if_fail (tighter_layout == FALSE || tighter_layout == TRUE);
8078
 
 
8079
 
        if (container->details->tighter_layout == tighter_layout) {
8080
 
                return;
8081
 
        }
8082
 
 
8083
 
        container->details->tighter_layout = tighter_layout;
8084
 
 
8085
 
        if (container->details->auto_layout) {
8086
 
                invalidate_label_sizes (container);
8087
 
                redo_layout (container);
8088
 
 
8089
 
                g_signal_emit (container, signals[LAYOUT_CHANGED], 0);
8090
 
        } else {
8091
 
                /* in manual layout, label sizes still change, even though
8092
 
                 * the icons don't move.
8093
 
                 */
8094
 
                invalidate_label_sizes (container);     
8095
 
                nautilus_icon_container_request_update_all (container); 
8096
 
        }
8097
 
}
8098
 
 
8099
7904
gboolean
8100
7905
nautilus_icon_container_is_keep_aligned (NautilusIconContainer *container)
8101
7906
{
8233
8038
        return container->details->auto_layout;
8234
8039
}
8235
8040
 
8236
 
gboolean
8237
 
nautilus_icon_container_is_tighter_layout (NautilusIconContainer *container)
8238
 
{
8239
 
        g_return_val_if_fail (NAUTILUS_IS_ICON_CONTAINER (container), FALSE);
8240
 
 
8241
 
        return container->details->tighter_layout;
8242
 
}
8243
 
 
8244
8041
static void
8245
8042
pending_icon_to_rename_destroy_callback (NautilusIconCanvasItem *item, NautilusIconContainer *container)
8246
8043
{
8440
8237
        } else {
8441
8238
                eel_filename_get_rename_region (editable_text, &start_offset, &end_offset);
8442
8239
        }
 
8240
 
 
8241
        gtk_widget_show (details->rename_widget);
 
8242
        gtk_widget_grab_focus (details->rename_widget);
 
8243
 
8443
8244
        eel_editable_label_select_region (EEL_EDITABLE_LABEL (details->rename_widget),
8444
8245
                                          start_offset,
8445
8246
                                          end_offset);
8446
 
        gtk_widget_show (details->rename_widget);
8447
 
        
8448
 
        gtk_widget_grab_focus (details->rename_widget);
8449
8247
        
8450
8248
        g_signal_emit (container,
8451
8249
                       signals[RENAMING_ICON], 0,
8558
8356
 
8559
8357
/* update the label color when the background changes */
8560
8358
 
8561
 
GdkGC *
8562
 
nautilus_icon_container_get_label_color_and_gc (NautilusIconContainer *container,
8563
 
                                                GdkColor             **color,
8564
 
                                                gboolean               is_name,
8565
 
                                                gboolean               is_highlight,
8566
 
                                                gboolean                  is_prelit)
 
8359
void
 
8360
nautilus_icon_container_get_label_color (NautilusIconContainer *container,
 
8361
                                         GdkRGBA               *color,
 
8362
                                         gboolean               is_name,
 
8363
                                         gboolean               is_highlight,
 
8364
                                         gboolean               is_prelit)
8567
8365
{
8568
8366
        int idx;
8569
8367
        
8594
8392
        }
8595
8393
 
8596
8394
        if (color) {
8597
 
                *color = &container->details->label_colors [idx];
 
8395
                *color = container->details->label_colors[idx];
8598
8396
        }
8599
 
 
8600
 
        return container->details->label_gcs [idx];
8601
8397
}
8602
8398
 
8603
8399
static void
8604
 
setup_gc_with_fg (NautilusIconContainer *container, int idx, guint32 color)
 
8400
setup_gc_with_fg (NautilusIconContainer *container, int idx, GdkRGBA *color)
8605
8401
{
8606
 
        GdkGC *gc;
8607
 
        GdkColor gcolor;
8608
 
 
8609
 
        gcolor = eel_gdk_rgb_to_color (color);
8610
 
        container->details->label_colors [idx] = gcolor;
8611
 
 
8612
 
        gc = gdk_gc_new (gtk_layout_get_bin_window (GTK_LAYOUT (container)));
8613
 
        gdk_gc_set_rgb_fg_color (gc, &gcolor);
8614
 
 
8615
 
        if (container->details->label_gcs [idx]) {
8616
 
                g_object_unref (container->details->label_gcs [idx]);
8617
 
        }
8618
 
 
8619
 
        container->details->label_gcs [idx] = gc;
 
8402
        container->details->label_colors[idx] = *color;
8620
8403
}
8621
8404
 
8622
8405
static void
8623
8406
setup_label_gcs (NautilusIconContainer *container)
8624
8407
{
8625
 
        EelBackground *background;
8626
8408
        GtkWidget *widget;
8627
 
        GdkColor *light_info_color, *dark_info_color;
8628
 
        guint light_info_value, dark_info_value;
8629
 
        gboolean frame_text;
8630
 
        GtkStyle *style;
 
8409
        GtkStyleContext *style;
 
8410
        GdkRGBA color;
8631
8411
        
8632
8412
        if (!gtk_widget_get_realized (GTK_WIDGET (container)))
8633
8413
                return;
8636
8416
 
8637
8417
        g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
8638
8418
 
8639
 
        background = eel_get_widget_background (GTK_WIDGET (container));
8640
 
 
8641
8419
        /* read the info colors from the current theme; use a reasonable default if undefined */
8642
 
        gtk_widget_style_get (GTK_WIDGET (container),
8643
 
                              "light_info_color", &light_info_color,
8644
 
                              "dark_info_color", &dark_info_color,
8645
 
                              NULL);
8646
 
        style = gtk_widget_get_style (widget);
8647
 
 
8648
 
        if (light_info_color) {
8649
 
                light_info_value = eel_gdk_color_to_rgb (light_info_color);
8650
 
                gdk_color_free (light_info_color);
8651
 
        } else {
8652
 
                light_info_value = DEFAULT_LIGHT_INFO_COLOR;
8653
 
        }
8654
 
 
8655
 
        if (dark_info_color) {
8656
 
                dark_info_value = eel_gdk_color_to_rgb (dark_info_color);
8657
 
                gdk_color_free (dark_info_color);
8658
 
        } else {
8659
 
                dark_info_value = DEFAULT_DARK_INFO_COLOR;
8660
 
        }
8661
 
 
8662
 
        setup_gc_with_fg (container, LABEL_COLOR_HIGHLIGHT, eel_gdk_color_to_rgb (&style->text[GTK_STATE_SELECTED]));
8663
 
        setup_gc_with_fg (container, LABEL_COLOR_ACTIVE, eel_gdk_color_to_rgb (&style->text[GTK_STATE_ACTIVE]));
8664
 
        setup_gc_with_fg (container, LABEL_COLOR_PRELIGHT, eel_gdk_color_to_rgb (&style->text[GTK_STATE_PRELIGHT]));
8665
 
        setup_gc_with_fg (container, 
8666
 
                          LABEL_INFO_COLOR_HIGHLIGHT, 
8667
 
                          eel_gdk_color_is_dark (&style->base[GTK_STATE_SELECTED]) ? light_info_value : dark_info_value);
8668
 
        setup_gc_with_fg (container, 
8669
 
                          LABEL_INFO_COLOR_ACTIVE, 
8670
 
                          eel_gdk_color_is_dark (&style->base[GTK_STATE_ACTIVE]) ? light_info_value : dark_info_value);
8671
 
                
8672
 
        /* If NautilusIconContainer::frame_text is set, we can safely
8673
 
         * use the foreground color from the theme, because it will
8674
 
         * always be displayed against the gtk background */
8675
 
        gtk_widget_style_get (widget,
8676
 
                              "frame_text", &frame_text,
8677
 
                              NULL);
8678
 
 
8679
 
        if (frame_text || !eel_background_is_set(background)) {
8680
 
                setup_gc_with_fg (container, LABEL_COLOR, 
8681
 
                                  eel_gdk_color_to_rgb (&style->text[GTK_STATE_NORMAL]));
8682
 
                setup_gc_with_fg (container, 
8683
 
                                  LABEL_INFO_COLOR, 
8684
 
                                  eel_gdk_color_is_dark (&style->base[GTK_STATE_NORMAL]) ? light_info_value : dark_info_value);
8685
 
        } else {
8686
 
                if (container->details->use_drop_shadows || eel_background_is_dark (background)) {
8687
 
                        setup_gc_with_fg (container, LABEL_COLOR, 0xEFEFEF);
8688
 
                        setup_gc_with_fg (container, 
8689
 
                                          LABEL_INFO_COLOR, 
8690
 
                                          light_info_value);
8691
 
                } else { /* converse */
8692
 
                        setup_gc_with_fg (container, LABEL_COLOR, 0x000000);
8693
 
                        setup_gc_with_fg (container, 
8694
 
                                          LABEL_INFO_COLOR, 
8695
 
                                          dark_info_value);
8696
 
                }
8697
 
        }
8698
 
}
8699
 
 
8700
 
static void
8701
 
update_label_color (EelBackground         *background,
8702
 
                    NautilusIconContainer *container)
8703
 
{
8704
 
        g_assert (EEL_IS_BACKGROUND (background));
8705
 
 
8706
 
        setup_label_gcs (container);
8707
 
}
8708
 
 
 
8420
        style = gtk_widget_get_style_context (widget);
 
8421
 
 
8422
        gtk_style_context_get_color (style,
 
8423
                                     GTK_STATE_FLAG_SELECTED,
 
8424
                                     &color);
 
8425
        setup_gc_with_fg (container, LABEL_COLOR_HIGHLIGHT, &color);
 
8426
        setup_gc_with_fg (container, LABEL_INFO_COLOR_HIGHLIGHT, &color);
 
8427
 
 
8428
 
 
8429
        gtk_style_context_get_color (style, GTK_STATE_FLAG_ACTIVE, &color);
 
8430
        setup_gc_with_fg (container, LABEL_COLOR_ACTIVE, &color);
 
8431
        setup_gc_with_fg (container, LABEL_INFO_COLOR_ACTIVE, &color);
 
8432
 
 
8433
        gtk_style_context_get_color (style, GTK_STATE_FLAG_PRELIGHT, &color);
 
8434
        setup_gc_with_fg (container, LABEL_COLOR_PRELIGHT, &color);
 
8435
 
 
8436
        gtk_style_context_get_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
 
8437
        setup_gc_with_fg (container, LABEL_INFO_COLOR, 
 
8438
                          &color);
 
8439
        
 
8440
        if (!nautilus_icon_container_get_is_desktop (container)) {
 
8441
                gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color);
 
8442
                setup_gc_with_fg (container, LABEL_COLOR, &color);
 
8443
        } else {
 
8444
                GdkRGBA tmp;
 
8445
 
 
8446
                gdk_rgba_parse (&tmp, "#EFEFEF");
 
8447
                setup_gc_with_fg (container, LABEL_COLOR, &tmp);
 
8448
        }
 
8449
}
8709
8450
 
8710
8451
/* Return if the icon container is a fixed size */
8711
8452
gboolean
8765
8506
nautilus_icon_container_set_use_drop_shadows (NautilusIconContainer  *container,
8766
8507
                                              gboolean                use_drop_shadows)
8767
8508
{
8768
 
        gboolean frame_text;
8769
 
        
8770
 
        gtk_widget_style_get (GTK_WIDGET (container),
8771
 
                              "frame_text", &frame_text,
8772
 
                              NULL);
8773
 
 
8774
8509
        if (container->details->drop_shadows_requested == use_drop_shadows) {
8775
8510
                return;
8776
8511
        }
8777
8512
 
8778
8513
        container->details->drop_shadows_requested = use_drop_shadows;
8779
 
        container->details->use_drop_shadows = use_drop_shadows && !frame_text;
 
8514
        container->details->use_drop_shadows = use_drop_shadows;
8780
8515
        gtk_widget_queue_draw (GTK_WIDGET (container));
8781
8516
}
8782
8517
 
8786
8521
nautilus_icon_container_theme_changed (gpointer user_data)
8787
8522
{
8788
8523
        NautilusIconContainer *container;
8789
 
        GtkStyle *style;
8790
 
        GdkColor *prelight_icon_color, *normal_icon_color;
8791
 
        guchar highlight_alpha, normal_alpha, prelight_alpha;
 
8524
        GtkStyleContext *style;
 
8525
        GdkRGBA color;
8792
8526
 
8793
8527
        container = NAUTILUS_ICON_CONTAINER (user_data);
8794
 
        
8795
 
        /* load the highlight color */
8796
 
        gtk_widget_style_get (GTK_WIDGET (container),
8797
 
                              "highlight_alpha", &highlight_alpha,
8798
 
                              NULL);
8799
 
        
8800
 
        style = gtk_widget_get_style (GTK_WIDGET (container));
8801
 
 
8802
 
        container->details->highlight_color_rgba = 
8803
 
                EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_SELECTED].red >> 8, 
8804
 
                                     style->base[GTK_STATE_SELECTED].green >> 8, 
8805
 
                                     style->base[GTK_STATE_SELECTED].blue >> 8,
8806
 
                                     highlight_alpha);
8807
 
        container->details->active_color_rgba = 
8808
 
                EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_ACTIVE].red >> 8, 
8809
 
                                     style->base[GTK_STATE_ACTIVE].green >> 8, 
8810
 
                                     style->base[GTK_STATE_ACTIVE].blue >> 8,
8811
 
                                     highlight_alpha);
8812
 
 
8813
 
        /* load the prelight icon color */
8814
 
        gtk_widget_style_get (GTK_WIDGET (container),
8815
 
                              "prelight_icon_color", &prelight_icon_color,
8816
 
                              NULL);
8817
 
 
8818
 
        if (prelight_icon_color) {
8819
 
                container->details->prelight_icon_color_rgba = 
8820
 
                        EEL_RGBA_COLOR_PACK (prelight_icon_color->red >> 8, 
8821
 
                                             prelight_icon_color->green >> 8, 
8822
 
                                             prelight_icon_color->blue >> 8,
8823
 
                                             255);
8824
 
        } else { /* if not defined by rc, set to default value */
8825
 
                container->details->prelight_icon_color_rgba = 
8826
 
                        EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8,
8827
 
                                             style->base[GTK_STATE_PRELIGHT].green >> 8,
8828
 
                                             style->base[GTK_STATE_PRELIGHT].blue >> 8,
8829
 
                                             255);
8830
 
        }
8831
 
  
8832
 
  
8833
 
        /* load the normal icon color */
8834
 
        gtk_widget_style_get (GTK_WIDGET (container),
8835
 
                              "normal_icon_color", &normal_icon_color,
8836
 
                              NULL);
8837
 
 
8838
 
        if (normal_icon_color) {
8839
 
                container->details->normal_icon_color_rgba = 
8840
 
                        EEL_RGBA_COLOR_PACK (normal_icon_color->red >> 8, 
8841
 
                                             normal_icon_color->green >> 8, 
8842
 
                                             normal_icon_color->blue >> 8,
8843
 
                                             255);
8844
 
        } else { /* if not defined by rc, set to default value */
8845
 
                container->details->normal_icon_color_rgba = 
8846
 
                        EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8, 
8847
 
                                             style->base[GTK_STATE_NORMAL].green >> 8, 
8848
 
                                             style->base[GTK_STATE_NORMAL].blue >> 8,
8849
 
                                             255);
8850
 
        }
8851
 
 
8852
 
 
8853
 
        /* load the normal color */
8854
 
        gtk_widget_style_get (GTK_WIDGET (container),
8855
 
                              "normal_alpha", &normal_alpha,
8856
 
                              NULL);
8857
 
 
8858
 
        container->details->normal_color_rgba = 
8859
 
                EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8, 
8860
 
                                     style->base[GTK_STATE_NORMAL].green >> 8, 
8861
 
                                     style->base[GTK_STATE_NORMAL].blue >> 8,
8862
 
                                     normal_alpha);
8863
 
 
8864
 
 
8865
 
        /* load the prelight color */
8866
 
        gtk_widget_style_get (GTK_WIDGET (container),
8867
 
                              "prelight_alpha", &prelight_alpha,
8868
 
                              NULL);
8869
 
 
8870
 
        container->details->prelight_color_rgba = 
8871
 
                EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8, 
8872
 
                                     style->base[GTK_STATE_PRELIGHT].green >> 8, 
8873
 
                                     style->base[GTK_STATE_PRELIGHT].blue >> 8,
8874
 
                                     prelight_alpha);
8875
 
 
 
8528
        style = gtk_widget_get_style_context (GTK_WIDGET (container));
 
8529
 
 
8530
        gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED, &color);
 
8531
        container->details->highlight_color_rgba = color;
 
8532
 
 
8533
        gtk_style_context_get_background_color (style, GTK_STATE_FLAG_ACTIVE, &color);  
 
8534
        container->details->active_color_rgba = color;
 
8535
 
 
8536
        gtk_style_context_get_background_color (style, GTK_STATE_FLAG_PRELIGHT, &color);
 
8537
        container->details->prelight_color_rgba = color;
 
8538
  
 
8539
        gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &color);
 
8540
        container->details->normal_color_rgba = color;
8876
8541
 
8877
8542
        setup_label_gcs (container);
8878
8543
}
8883
8548
{
8884
8549
        g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
8885
8550
 
8886
 
        if (eel_strcmp (container->details->font, font) == 0) {
 
8551
        if (g_strcmp0 (container->details->font, font) == 0) {
8887
8552
                return;
8888
8553
        }
8889
8554
 
9013
8678
 
9014
8679
}
9015
8680
 
 
8681
void
 
8682
nautilus_icon_container_set_active (NautilusIconContainer *container,
 
8683
                                    gboolean active)
 
8684
{
 
8685
        container->details->active_background = active;
 
8686
 
 
8687
        if (gtk_widget_get_realized (GTK_WIDGET (container))) {
 
8688
                setup_background (container);
 
8689
        }
 
8690
}
 
8691
 
9016
8692
/* NautilusIconContainerAccessible */
9017
8693
 
9018
8694
static NautilusIconContainerAccessiblePrivate *