~ubuntu-branches/ubuntu/oneiric/nautilus/oneiric

« back to all changes in this revision

Viewing changes to .pc/git_no_typeahead_timeout_segfault.patch/libnautilus-private/nautilus-icon-private.h

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha, Sebastien Bacher
  • Date: 2011-09-30 12:23:46 UTC
  • Revision ID: package-import@ubuntu.com-20110930122346-1ta7yqhz30g6fv9d
Tags: 1:3.2.0-0ubuntu5
[ Jeremy Bicha ]
* debian/patches/05_desktop_menu_export.patch:
  - Disable a few more items that don't work right in desktop mode

[ Sebastien Bacher ]
* git_handle_missing_icon.patch:
  - don't segfault on missing icon (lp: #860659)
* git_gsettings_signals.patch:
  - don't segfault on preferences changes (lp: #807234)
* git_no_typeahead_timeout_segfault.patch:
  - better handle the flush timeout, should avoid segfaults (lp: #804133) 
* git_dont_preview_empty_selection.patch:
  - check that the selection is non empty to avoid a segfault (lp: #812015)  
* git_correct_signal_handling.patch,
  git_no_signal_order_assert.patch,
  git_slot_closing.patch:
  - clean some signal handling issues leading to segfaults (lp: #795708)
* git_close_pane_cleaning.patch:
  - needed changes for the previous patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 
2
/* gnome-icon-container-private.h
 
3
 
 
4
   Copyright (C) 1999, 2000 Free Software Foundation
 
5
   Copyright (C) 2000 Eazel, Inc.
 
6
 
 
7
   The Gnome Library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Library General Public License as
 
9
   published by the Free Software Foundation; either version 2 of the
 
10
   License, or (at your option) any later version.
 
11
 
 
12
   The Gnome Library is distributed in the hope that it will be useful,
 
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
   Library General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU Library General Public
 
18
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
 
19
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
20
   Boston, MA 02111-1307, USA.
 
21
 
 
22
   Author: Ettore Perazzoli <ettore@gnu.org>
 
23
*/
 
24
 
 
25
#ifndef NAUTILUS_ICON_CONTAINER_PRIVATE_H
 
26
#define NAUTILUS_ICON_CONTAINER_PRIVATE_H
 
27
 
 
28
#include <eel/eel-glib-extensions.h>
 
29
#include <libnautilus-private/nautilus-icon-canvas-item.h>
 
30
#include <libnautilus-private/nautilus-icon-container.h>
 
31
#include <libnautilus-private/nautilus-icon-dnd.h>
 
32
 
 
33
/* An Icon. */
 
34
 
 
35
typedef struct {
 
36
        /* Object represented by this icon. */
 
37
        NautilusIconData *data;
 
38
 
 
39
        /* Canvas item for the icon. */
 
40
        NautilusIconCanvasItem *item;
 
41
 
 
42
        /* X/Y coordinates. */
 
43
        double x, y;
 
44
 
 
45
        /*
 
46
         * In RTL mode x is RTL x position, we use saved_ltr_x for
 
47
         * keeping track of x value before it gets converted into
 
48
         * RTL value, this is used for saving the icon position 
 
49
         * to the nautilus metafile. 
 
50
         */
 
51
         double saved_ltr_x;
 
52
        
 
53
        /* Scale factor (stretches icon). */
 
54
        double scale;
 
55
 
 
56
        /* Whether this item is selected. */
 
57
        eel_boolean_bit is_selected : 1;
 
58
 
 
59
        /* Whether this item was selected before rubberbanding. */
 
60
        eel_boolean_bit was_selected_before_rubberband : 1;
 
61
 
 
62
        /* Whether this item is visible in the view. */
 
63
        eel_boolean_bit is_visible : 1;
 
64
 
 
65
        /* Whether a monitor was set on this icon. */
 
66
        eel_boolean_bit is_monitored : 1;
 
67
 
 
68
        eel_boolean_bit has_lazy_position : 1;
 
69
} NautilusIcon;
 
70
 
 
71
 
 
72
/* Private NautilusIconContainer members. */
 
73
 
 
74
typedef struct {
 
75
        gboolean active;
 
76
 
 
77
        double start_x, start_y;
 
78
 
 
79
        EelCanvasItem *selection_rectangle;
 
80
 
 
81
        guint timer_id;
 
82
 
 
83
        guint prev_x, prev_y;
 
84
        EelDRect prev_rect;
 
85
        int last_adj_x;
 
86
        int last_adj_y;
 
87
} NautilusIconRubberbandInfo;
 
88
 
 
89
typedef enum {
 
90
        DRAG_STATE_INITIAL,
 
91
        DRAG_STATE_MOVE_OR_COPY,
 
92
        DRAG_STATE_STRETCH
 
93
} DragState;
 
94
 
 
95
typedef struct {
 
96
        /* Pointer position in canvas coordinates. */
 
97
        int pointer_x, pointer_y;
 
98
 
 
99
        /* Icon top, left, and size in canvas coordinates. */
 
100
        int icon_x, icon_y;
 
101
        guint icon_size;
 
102
} StretchState;
 
103
 
 
104
typedef enum {
 
105
        AXIS_NONE,
 
106
        AXIS_HORIZONTAL,
 
107
        AXIS_VERTICAL
 
108
} Axis;
 
109
 
 
110
enum {
 
111
        LABEL_COLOR,
 
112
        LABEL_COLOR_HIGHLIGHT,
 
113
        LABEL_COLOR_ACTIVE,
 
114
        LABEL_COLOR_PRELIGHT,
 
115
        LABEL_INFO_COLOR,
 
116
        LABEL_INFO_COLOR_HIGHLIGHT,
 
117
        LABEL_INFO_COLOR_ACTIVE,
 
118
        LAST_LABEL_COLOR
 
119
};
 
120
 
 
121
struct NautilusIconContainerDetails {
 
122
        /* List of icons. */
 
123
        GList *icons;
 
124
        GList *new_icons;
 
125
        GHashTable *icon_set;
 
126
 
 
127
        /* Current icon for keyboard navigation. */
 
128
        NautilusIcon *keyboard_focus;
 
129
        NautilusIcon *keyboard_rubberband_start;
 
130
 
 
131
        /* Current icon with stretch handles, so we have only one. */
 
132
        NautilusIcon *stretch_icon;
 
133
        double stretch_initial_x, stretch_initial_y;
 
134
        guint stretch_initial_size;
 
135
        
 
136
        /* Last highlighted drop target. */
 
137
        NautilusIcon *drop_target;
 
138
 
 
139
        /* Rubberbanding status. */
 
140
        NautilusIconRubberbandInfo rubberband_info;
 
141
 
 
142
        /* Timeout used to make a selected icon fully visible after a short
 
143
         * period of time. (The timeout is needed to make sure
 
144
         * double-clicking still works.)
 
145
         */
 
146
        guint keyboard_icon_reveal_timer_id;
 
147
        NautilusIcon *keyboard_icon_to_reveal;
 
148
 
 
149
        /* Used to coalesce selection changed signals in some cases */
 
150
        guint selection_changed_id;
 
151
        
 
152
        /* If a request is made to reveal an unpositioned icon we remember
 
153
         * it and reveal it once it gets positioned (in relayout).
 
154
         */
 
155
        NautilusIcon *pending_icon_to_reveal;
 
156
 
 
157
        /* If a request is made to rename an unpositioned icon we remember
 
158
         * it and start renaming it once it gets positioned (in relayout).
 
159
         */
 
160
        NautilusIcon *pending_icon_to_rename;
 
161
 
 
162
        /* Remembered information about the start of the current event. */
 
163
        guint32 button_down_time;
 
164
        
 
165
        /* Drag state. Valid only if drag_button is non-zero. */
 
166
        guint drag_button;
 
167
        NautilusIcon *drag_icon;
 
168
        int drag_x, drag_y;
 
169
        DragState drag_state;
 
170
        gboolean drag_started;
 
171
        StretchState stretch_start;
 
172
        gboolean drag_allow_moves;
 
173
 
 
174
        gboolean icon_selected_on_button_down;
 
175
        NautilusIcon *double_click_icon[2]; /* Both clicks in a double click need to be on the same icon */
 
176
        guint double_click_button[2];
 
177
 
 
178
        NautilusIcon *range_selection_base_icon;
 
179
        
 
180
        /* Renaming Details */
 
181
        gboolean renaming;
 
182
        GtkWidget *rename_widget;       /* Editable text item */
 
183
        char *original_text;                    /* Copy of editable text for later compare */
 
184
 
 
185
        /* Idle ID. */
 
186
        guint idle_id;
 
187
 
 
188
        /* Idle handler for stretch code */
 
189
        guint stretch_idle_id;
 
190
 
 
191
        /* Align idle id */
 
192
        guint align_idle_id;
 
193
 
 
194
        /* DnD info. */
 
195
        NautilusIconDndInfo *dnd_info;
 
196
 
 
197
        /* zoom level */
 
198
        int zoom_level;
 
199
 
 
200
        /* specific fonts used to draw labels */
 
201
        char *font;
 
202
        
 
203
        /* font sizes used to draw labels */
 
204
        int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1];
 
205
 
 
206
        /* State used so arrow keys don't wander if icons aren't lined up.
 
207
         */
 
208
        int arrow_key_start_x;
 
209
        int arrow_key_start_y;
 
210
        GtkDirectionType arrow_key_direction;
 
211
 
 
212
        /* Mode settings. */
 
213
        gboolean single_click_mode;
 
214
        gboolean auto_layout;
 
215
        gboolean tighter_layout;
 
216
        gboolean active_background;
 
217
 
 
218
        /* Whether for the vertical layout, all columns are supposed to
 
219
         * have the same width. */
 
220
        gboolean all_columns_same_width;
 
221
        
 
222
        /* Layout mode */
 
223
        NautilusIconLayoutMode layout_mode;
 
224
 
 
225
        /* Label position */
 
226
        NautilusIconLabelPosition label_position;
 
227
 
 
228
        /* Forced icon size, iff greater than 0 */
 
229
        int forced_icon_size;
 
230
 
 
231
        /* Should the container keep icons aligned to a grid */
 
232
        gboolean keep_aligned;
 
233
 
 
234
        /* Set to TRUE after first allocation has been done */
 
235
        gboolean has_been_allocated;
 
236
 
 
237
        int size_allocation_count;
 
238
        guint size_allocation_count_id;
 
239
        
 
240
        /* Is the container fixed or resizable */
 
241
        gboolean is_fixed_size;
 
242
        
 
243
        /* Is the container for a desktop window */
 
244
        gboolean is_desktop;
 
245
 
 
246
        /* Ignore the visible area the next time the scroll region is recomputed */
 
247
        gboolean reset_scroll_region_trigger;
 
248
        
 
249
        /* The position we are scaling to on stretch */
 
250
        double world_x;
 
251
        double world_y;
 
252
 
 
253
        /* margins to follow, used for the desktop panel avoidance */
 
254
        int left_margin;
 
255
        int right_margin;
 
256
        int top_margin;
 
257
        int bottom_margin;
 
258
 
 
259
        /* Whether we should use drop shadows for the icon labels or not */
 
260
        gboolean use_drop_shadows;
 
261
        gboolean drop_shadows_requested;
 
262
 
 
263
        /* a11y items used by canvas items */
 
264
        guint a11y_item_action_idle_handler;
 
265
        GQueue* a11y_item_action_queue;
 
266
 
 
267
        eel_boolean_bit is_loading : 1;
 
268
        eel_boolean_bit needs_resort : 1;
 
269
 
 
270
        eel_boolean_bit store_layout_timestamps : 1;
 
271
        eel_boolean_bit store_layout_timestamps_when_finishing_new_icons : 1;
 
272
        time_t layout_timestamp;
 
273
 
 
274
        /* interactive search */
 
275
        gboolean disable_popdown;
 
276
        gboolean imcontext_changed;
 
277
        int selected_iter;
 
278
        GtkWidget *search_window;
 
279
        GtkWidget *search_entry;
 
280
        guint search_entry_changed_id;
 
281
        guint typeselect_flush_timeout;
 
282
};
 
283
 
 
284
/* Private functions shared by mutiple files. */
 
285
NautilusIcon *nautilus_icon_container_get_icon_by_uri             (NautilusIconContainer *container,
 
286
                                                                   const char            *uri);
 
287
void          nautilus_icon_container_move_icon                   (NautilusIconContainer *container,
 
288
                                                                   NautilusIcon          *icon,
 
289
                                                                   int                    x,
 
290
                                                                   int                    y,
 
291
                                                                   double                 scale,
 
292
                                                                   gboolean               raise,
 
293
                                                                   gboolean               snap,
 
294
                                                                   gboolean               update_position);
 
295
void          nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *container,
 
296
                                                                   GList                 *icons);
 
297
char *        nautilus_icon_container_get_icon_uri                (NautilusIconContainer *container,
 
298
                                                                   NautilusIcon          *icon);
 
299
char *        nautilus_icon_container_get_icon_drop_target_uri    (NautilusIconContainer *container,
 
300
                                                                   NautilusIcon          *icon);
 
301
void          nautilus_icon_container_update_icon                 (NautilusIconContainer *container,
 
302
                                                                   NautilusIcon          *icon);
 
303
gboolean      nautilus_icon_container_has_stored_icon_positions   (NautilusIconContainer *container);
 
304
gboolean      nautilus_icon_container_scroll                      (NautilusIconContainer *container,
 
305
                                                                   int                    delta_x,
 
306
                                                                   int                    delta_y);
 
307
void          nautilus_icon_container_update_scroll_region        (NautilusIconContainer *container);
 
308
 
 
309
#endif /* NAUTILUS_ICON_CONTAINER_PRIVATE_H */