gtktreeview.c 339 KB
Newer Older
1
2
3
/* gtktreeview.c
 * Copyright (C) 2000  Red Hat, Inc.,  Jonathan Blandford <jrb@redhat.com>
 *
4
 * This library is free software; you can redistribute it and/or
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */


Manish Singh's avatar
Manish Singh committed
21
22
23
#include <string.h>
#include <gdk/gdkkeysyms.h>

24
25
#include "gtktreeview.h"
#include "gtkrbtree.h"
Havoc Pennington's avatar
Havoc Pennington committed
26
#include "gtktreednd.h"
27
28
29
#include "gtktreeprivate.h"
#include "gtkcellrenderer.h"
#include "gtkmain.h"
30
#include "gtkmarshalers.h"
31
32
33
#include "gtkbutton.h"
#include "gtkalignment.h"
#include "gtklabel.h"
Havoc Pennington's avatar
Havoc Pennington committed
34
35
#include "gtkhbox.h"
#include "gtkarrow.h"
36
#include "gtkintl.h"
37
#include "gtkbindings.h"
38
39
#include "gtkcontainer.h"
#include "gtkentry.h"
Jonathan Blandford's avatar
Jonathan Blandford committed
40
#include "gtktreemodelsort.h"
41

42
#define GTK_TREE_VIEW_SEARCH_DIALOG_KEY "gtk-tree-view-search-dialog"
43

Jonathan Blandford's avatar
Jonathan Blandford committed
44
#define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
45
#define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
Jonathan Blandford's avatar
Jonathan Blandford committed
46
#define GTK_TREE_VIEW_NUM_ROWS_PER_IDLE 500
47
#define SCROLL_EDGE_SIZE 15
48
#define EXPANDER_EXTRA_PADDING 4
49

Havoc Pennington's avatar
Havoc Pennington committed
50
51
52
53
54
55
56
/* The "background" areas of all rows/cells add up to cover the entire tree.
 * The background includes all inter-row and inter-cell spacing.
 * The "cell" areas are the cell_area passed in to gtk_cell_renderer_render(),
 * i.e. just the cells, no spacing.
 */

#define BACKGROUND_HEIGHT(node) (GTK_RBNODE_GET_HEIGHT (node))
Kristian Rietveld's avatar
Kristian Rietveld committed
57
#define CELL_HEIGHT(node, separator) ((BACKGROUND_HEIGHT (node)) - (separator))
Havoc Pennington's avatar
Havoc Pennington committed
58

59
60
#define TREE_WINDOW_Y_TO_RBTREE_Y(tree_view,y) ((y) + tree_view->priv->dy)
#define RBTREE_Y_TO_TREE_WINDOW_Y(tree_view,y) ((y) - tree_view->priv->dy)
61
62
63
64

/* This is in Window coordinates */
#define BACKGROUND_FIRST_PIXEL(tree_view,tree,node) (RBTREE_Y_TO_TREE_WINDOW_Y (tree_view, _gtk_rbtree_node_find_offset ((tree), (node))))
#define CELL_FIRST_PIXEL(tree_view,tree,node,separator) (BACKGROUND_FIRST_PIXEL (tree_view,tree,node) + separator/2)
65
66


67
typedef struct _GtkTreeViewChild GtkTreeViewChild;
68
69
70
71
72
struct _GtkTreeViewChild
{
  GtkWidget *widget;
  gint x;
  gint y;
73
74
  gint width;
  gint height;
75
76
};

Jonathan Blandford's avatar
Jonathan Blandford committed
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
typedef struct _TreeViewDragInfo TreeViewDragInfo;
struct _TreeViewDragInfo
{
  GdkModifierType start_button_mask;
  GtkTargetList *source_target_list;
  GdkDragAction source_actions;

  GtkTargetList *dest_target_list;

  guint source_set : 1;
  guint dest_set : 1;
};


/* Signals */
93
94
95
enum
{
  ROW_ACTIVATED,
96
97
98
99
  TEST_EXPAND_ROW,
  TEST_COLLAPSE_ROW,
  ROW_EXPANDED,
  ROW_COLLAPSED,
100
  COLUMNS_CHANGED,
101
  CURSOR_CHANGED,
102
  MOVE_CURSOR,
103
  SELECT_ALL,
104
  UNSELECT_ALL,
105
  SELECT_CURSOR_ROW,
106
107
108
  TOGGLE_CURSOR_ROW,
  EXPAND_COLLAPSE_CURSOR_ROW,
  SELECT_CURSOR_PARENT,
109
  START_INTERACTIVE_SEARCH,
110
111
112
  LAST_SIGNAL
};

113
/* Properties */
114
115
116
117
118
119
120
121
enum {
  PROP_0,
  PROP_MODEL,
  PROP_HADJUSTMENT,
  PROP_VADJUSTMENT,
  PROP_HEADERS_VISIBLE,
  PROP_HEADERS_CLICKABLE,
  PROP_EXPANDER_COLUMN,
122
  PROP_REORDERABLE,
123
124
  PROP_RULES_HINT,
  PROP_ENABLE_SEARCH,
125
  PROP_SEARCH_COLUMN
126
};
127
128

static void     gtk_tree_view_class_init           (GtkTreeViewClass *klass);
129
130
131
132
static void     gtk_tree_view_init                 (GtkTreeView      *tree_view);

/* object signals */
static void     gtk_tree_view_finalize             (GObject          *object);
133
134
135
static void     gtk_tree_view_set_property         (GObject         *object,
						    guint            prop_id,
						    const GValue    *value,
Jonathan Blandford's avatar
Jonathan Blandford committed
136
						    GParamSpec      *pspec);
137
138
139
static void     gtk_tree_view_get_property         (GObject         *object,
						    guint            prop_id,
						    GValue          *value,
Jonathan Blandford's avatar
Jonathan Blandford committed
140
						    GParamSpec      *pspec);
141

142
/* gtkobject signals */
Jonathan Blandford's avatar
Jonathan Blandford committed
143
144
static void     gtk_tree_view_destroy              (GtkObject        *object);

145
/* gtkwidget signals */
146
147
148
149
150
151
152
153
154
static void     gtk_tree_view_realize              (GtkWidget        *widget);
static void     gtk_tree_view_unrealize            (GtkWidget        *widget);
static void     gtk_tree_view_map                  (GtkWidget        *widget);
static void     gtk_tree_view_size_request         (GtkWidget        *widget,
						    GtkRequisition   *requisition);
static void     gtk_tree_view_size_allocate        (GtkWidget        *widget,
						    GtkAllocation    *allocation);
static gboolean gtk_tree_view_expose               (GtkWidget        *widget,
						    GdkEventExpose   *event);
155
156
static gboolean gtk_tree_view_key_press            (GtkWidget        *widget,
						    GdkEventKey      *event);
157
158
159
160
161
162
163
164
165
166
static gboolean gtk_tree_view_motion               (GtkWidget        *widget,
						    GdkEventMotion   *event);
static gboolean gtk_tree_view_enter_notify         (GtkWidget        *widget,
						    GdkEventCrossing *event);
static gboolean gtk_tree_view_leave_notify         (GtkWidget        *widget,
						    GdkEventCrossing *event);
static gboolean gtk_tree_view_button_press         (GtkWidget        *widget,
						    GdkEventButton   *event);
static gboolean gtk_tree_view_button_release       (GtkWidget        *widget,
						    GdkEventButton   *event);
167
168
static void     gtk_tree_view_set_focus_child      (GtkContainer     *container,
						    GtkWidget        *child);
169
170
static gint     gtk_tree_view_focus_out            (GtkWidget        *widget,
						    GdkEventFocus    *event);
171
static gint     gtk_tree_view_focus                (GtkWidget        *widget,
172
						    GtkDirectionType  direction);
173
static void     gtk_tree_view_grab_focus           (GtkWidget        *widget);
Kristian Rietveld's avatar
Kristian Rietveld committed
174
175
static void     gtk_tree_view_style_set            (GtkWidget        *widget,
						    GtkStyle         *previous_style);
176
177
178
179
180
181
182
183
184

/* container signals */
static void     gtk_tree_view_remove               (GtkContainer     *container,
						    GtkWidget        *widget);
static void     gtk_tree_view_forall               (GtkContainer     *container,
						    gboolean          include_internals,
						    GtkCallback       callback,
						    gpointer          callback_data);

Havoc Pennington's avatar
Havoc Pennington committed
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/* Source side drag signals */
static void gtk_tree_view_drag_begin       (GtkWidget        *widget,
                                            GdkDragContext   *context);
static void gtk_tree_view_drag_end         (GtkWidget        *widget,
                                            GdkDragContext   *context);
static void gtk_tree_view_drag_data_get    (GtkWidget        *widget,
                                            GdkDragContext   *context,
                                            GtkSelectionData *selection_data,
                                            guint             info,
                                            guint             time);
static void gtk_tree_view_drag_data_delete (GtkWidget        *widget,
                                            GdkDragContext   *context);

/* Target side drag signals */
static void     gtk_tree_view_drag_leave         (GtkWidget        *widget,
                                                  GdkDragContext   *context,
                                                  guint             time);
static gboolean gtk_tree_view_drag_motion        (GtkWidget        *widget,
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  guint             time);
static gboolean gtk_tree_view_drag_drop          (GtkWidget        *widget,
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  guint             time);
static void     gtk_tree_view_drag_data_received (GtkWidget        *widget,
                                                  GdkDragContext   *context,
                                                  gint              x,
                                                  gint              y,
                                                  GtkSelectionData *selection_data,
                                                  guint             info,
                                                  guint             time);

220
/* tree_model signals */
221
222
223
static void gtk_tree_view_set_adjustments                 (GtkTreeView     *tree_view,
							   GtkAdjustment   *hadj,
							   GtkAdjustment   *vadj);
224
static gboolean gtk_tree_view_real_move_cursor            (GtkTreeView     *tree_view,
225
							   GtkMovementStep  step,
226
							   gint             count);
227
228
229
static gboolean gtk_tree_view_real_select_all             (GtkTreeView     *tree_view);
static gboolean gtk_tree_view_real_unselect_all           (GtkTreeView     *tree_view);
static gboolean gtk_tree_view_real_select_cursor_row      (GtkTreeView     *tree_view,
230
							   gboolean         start_editing);
231
232
233
234
235
236
static gboolean gtk_tree_view_real_toggle_cursor_row      (GtkTreeView     *tree_view);
static gboolean gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView     *tree_view,
							       gboolean         logical,
							       gboolean         expand,
							       gboolean         open_all);
static gboolean gtk_tree_view_real_select_cursor_parent   (GtkTreeView     *tree_view);
237
static void gtk_tree_view_row_changed                     (GtkTreeModel    *model,
238
239
240
							   GtkTreePath     *path,
							   GtkTreeIter     *iter,
							   gpointer         data);
241
static void gtk_tree_view_row_inserted                    (GtkTreeModel    *model,
242
243
244
							   GtkTreePath     *path,
							   GtkTreeIter     *iter,
							   gpointer         data);
245
static void gtk_tree_view_row_has_child_toggled           (GtkTreeModel    *model,
246
247
248
							   GtkTreePath     *path,
							   GtkTreeIter     *iter,
							   gpointer         data);
249
static void gtk_tree_view_row_deleted                     (GtkTreeModel    *model,
250
251
							   GtkTreePath     *path,
							   gpointer         data);
252
static void gtk_tree_view_rows_reordered                  (GtkTreeModel    *model,
253
254
255
256
257
							   GtkTreePath     *parent,
							   GtkTreeIter     *iter,
							   gint            *new_order,
							   gpointer         data);

Jonathan Blandford's avatar
Jonathan Blandford committed
258
259
260
261
262
263
264
265
/* Incremental reflow */
static gboolean validate_row             (GtkTreeView *tree_view,
					  GtkRBTree   *tree,
					  GtkRBNode   *node,
					  GtkTreeIter *iter,
					  GtkTreePath *path);
static void     validate_visible_area    (GtkTreeView *tree_view);
static gboolean validate_rows_handler    (GtkTreeView *tree_view);
266
static gboolean validate_rows            (GtkTreeView *tree_view);
Jonathan Blandford's avatar
Jonathan Blandford committed
267
268
static gboolean presize_handler_callback (gpointer     data);
static void     install_presize_handler  (GtkTreeView *tree_view);
269
static void     install_scroll_sync_handler (GtkTreeView *tree_view);
270
static void	gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view);
271
static void     gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view);
272
273


274
/* Internal functions */
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
static gboolean gtk_tree_view_is_expander_column             (GtkTreeView       *tree_view,
							      GtkTreeViewColumn *column);
static void     gtk_tree_view_add_move_binding               (GtkBindingSet     *binding_set,
							      guint              keyval,
							      guint              modmask,
							      GtkMovementStep    step,
							      gint               count);
static gint     gtk_tree_view_unref_and_check_selection_tree (GtkTreeView       *tree_view,
							      GtkRBTree         *tree);
static void     gtk_tree_view_queue_draw_path                (GtkTreeView       *tree_view,
							      GtkTreePath       *path,
							      GdkRectangle      *clip_rect);
static void     gtk_tree_view_queue_draw_arrow               (GtkTreeView       *tree_view,
							      GtkRBTree         *tree,
							      GtkRBNode         *node,
							      GdkRectangle      *clip_rect);
static void     gtk_tree_view_draw_arrow                     (GtkTreeView       *tree_view,
							      GtkRBTree         *tree,
							      GtkRBNode         *node,
							      gint               x,
							      gint               y);
static void     gtk_tree_view_get_arrow_xrange               (GtkTreeView       *tree_view,
297
							      GtkRBTree         *tree,
298
299
300
301
302
303
304
305
306
307
308
							      gint              *x1,
							      gint              *x2);
static gint     gtk_tree_view_new_column_width               (GtkTreeView       *tree_view,
							      gint               i,
							      gint              *x);
static void     gtk_tree_view_adjustment_changed             (GtkAdjustment     *adjustment,
							      GtkTreeView       *tree_view);
static void     gtk_tree_view_build_tree                     (GtkTreeView       *tree_view,
							      GtkRBTree         *tree,
							      GtkTreeIter       *iter,
							      gint               depth,
Jonathan Blandford's avatar
Jonathan Blandford committed
309
							      gboolean           recurse);
310
311
312
static gboolean gtk_tree_view_discover_dirty_iter            (GtkTreeView       *tree_view,
							      GtkTreeIter       *iter,
							      gint               depth,
313
314
							      gint              *height,
							      GtkRBNode         *node);
315
316
317
318
319
320
321
static void     gtk_tree_view_discover_dirty                 (GtkTreeView       *tree_view,
							      GtkRBTree         *tree,
							      GtkTreeIter       *iter,
							      gint               depth);
static void     gtk_tree_view_clamp_node_visible             (GtkTreeView       *tree_view,
							      GtkRBTree         *tree,
							      GtkRBNode         *node);
322
323
static void     gtk_tree_view_clamp_column_visible           (GtkTreeView       *tree_view,
							      GtkTreeViewColumn *column);
324
325
326
327
328
329
330
331
332
333
334
335
336
337
static gboolean gtk_tree_view_maybe_begin_dragging_row       (GtkTreeView       *tree_view,
							      GdkEventMotion    *event);
static void     gtk_tree_view_focus_to_cursor                (GtkTreeView       *tree_view);
static void     gtk_tree_view_move_cursor_up_down            (GtkTreeView       *tree_view,
							      gint               count);
static void     gtk_tree_view_move_cursor_page_up_down       (GtkTreeView       *tree_view,
							      gint               count);
static void     gtk_tree_view_move_cursor_left_right         (GtkTreeView       *tree_view,
							      gint               count);
static void     gtk_tree_view_move_cursor_start_end          (GtkTreeView       *tree_view,
							      gint               count);
static gboolean gtk_tree_view_real_collapse_row              (GtkTreeView       *tree_view,
							      GtkTreePath       *path,
							      GtkRBTree         *tree,
338
339
							      GtkRBNode         *node,
							      gboolean           animate);
340
341
342
343
static gboolean gtk_tree_view_real_expand_row                (GtkTreeView       *tree_view,
							      GtkTreePath       *path,
							      GtkRBTree         *tree,
							      GtkRBNode         *node,
344
345
							      gboolean           open_all,
							      gboolean           animate);
346
347
static void     gtk_tree_view_real_set_cursor                (GtkTreeView       *tree_view,
							      GtkTreePath       *path,
348
349
							      gboolean           clear_and_select,
							      gboolean           clamp_node);
350
static gboolean gtk_tree_view_has_special_cell               (GtkTreeView       *tree_view);
351

Kristian Rietveld's avatar
Kristian Rietveld committed
352
static gboolean expand_collapse_timeout                      (gpointer           data);
Kristian Rietveld's avatar
Kristian Rietveld committed
353
static gboolean do_expand_collapse                           (GtkTreeView       *tree_view);
Kristian Rietveld's avatar
Kristian Rietveld committed
354

355
356
357
358
359
/* interactive search */
static void     gtk_tree_view_search_dialog_destroy     (GtkWidget        *search_dialog,
							 GtkTreeView      *tree_view);
static void     gtk_tree_view_search_position_func      (GtkTreeView      *tree_view,
							 GtkWidget        *search_dialog);
360
361
362
363
364
365
static void     gtk_tree_view_search_disable_popdown    (GtkEntry         *entry,
							 GtkMenu          *menu,
							 gpointer          data);
static gboolean gtk_tree_view_real_search_enable_popdown(gpointer          data);
static void     gtk_tree_view_search_enable_popdown     (GtkWidget        *widget,
							 gpointer          data);
366
367
368
369
370
371
372
373
374
375
376
377
378
379
static gboolean gtk_tree_view_search_delete_event       (GtkWidget        *widget,
							 GdkEventAny      *event,
							 GtkTreeView      *tree_view);
static gboolean gtk_tree_view_search_button_press_event (GtkWidget        *widget,
							 GdkEventButton   *event,
							 GtkTreeView      *tree_view);
static gboolean gtk_tree_view_search_key_press_event    (GtkWidget        *entry,
							 GdkEventKey      *event,
							 GtkTreeView      *tree_view);
static void     gtk_tree_view_search_move               (GtkWidget        *window,
							 GtkTreeView      *tree_view,
							 gboolean          up);
static gboolean gtk_tree_view_search_equal_func         (GtkTreeModel     *model,
							 gint              column,
380
							 const gchar      *key,
381
382
							 GtkTreeIter      *iter,
							 gpointer          search_data);
383
384
385
static gboolean gtk_tree_view_search_iter               (GtkTreeModel     *model,
							 GtkTreeSelection *selection,
							 GtkTreeIter      *iter,
386
							 const gchar      *text,
387
388
389
390
							 gint             *count,
							 gint              n);
static void     gtk_tree_view_search_init               (GtkWidget        *entry,
							 GtkTreeView      *tree_view);
391
392
393
394
395
396
static void     gtk_tree_view_put                       (GtkTreeView      *tree_view,
							 GtkWidget        *child_widget,
							 gint              x,
							 gint              y,
							 gint              width,
							 gint              height);
397
398
399
400
401
402
403
404
405
static gboolean gtk_tree_view_start_editing             (GtkTreeView      *tree_view,
							 GtkTreePath      *cursor_path);
static void gtk_tree_view_real_start_editing (GtkTreeView       *tree_view,
					      GtkTreeViewColumn *column,
					      GtkTreePath       *path,
					      GtkCellEditable   *cell_editable,
					      GdkRectangle      *cell_area,
					      GdkEvent          *event,
					      guint              flags);
Jonathan Blandford's avatar
Jonathan Blandford committed
406
407
static void gtk_tree_view_stop_editing                  (GtkTreeView *tree_view,
							 gboolean     cancel_editing);
408
static gboolean gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view);
409
410
411
static GtkTreeViewColumn *gtk_tree_view_get_drop_column (GtkTreeView       *tree_view,
							 GtkTreeViewColumn *column,
							 gint               drop_position);
412

413
414

static GtkContainerClass *parent_class = NULL;
415
static guint tree_view_signals [LAST_SIGNAL] = { 0 };
416

417
418
419
420
421


/* GType Methods
 */

Manish Singh's avatar
Manish Singh committed
422
GType
423
424
gtk_tree_view_get_type (void)
{
Manish Singh's avatar
Manish Singh committed
425
  static GType tree_view_type = 0;
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441

  if (!tree_view_type)
    {
      static const GTypeInfo tree_view_info =
      {
        sizeof (GtkTreeViewClass),
	NULL,		/* base_init */
	NULL,		/* base_finalize */
        (GClassInitFunc) gtk_tree_view_class_init,
	NULL,		/* class_finalize */
	NULL,		/* class_data */
        sizeof (GtkTreeView),
	0,              /* n_preallocs */
        (GInstanceInitFunc) gtk_tree_view_init
      };

Manish Singh's avatar
Manish Singh committed
442
443
444
      tree_view_type =
	g_type_register_static (GTK_TYPE_CONTAINER, "GtkTreeView",
				&tree_view_info, 0);
445
446
447
448
449
450
451
452
    }

  return tree_view_type;
}

static void
gtk_tree_view_class_init (GtkTreeViewClass *class)
{
453
  GObjectClass *o_class;
454
455
456
  GtkObjectClass *object_class;
  GtkWidgetClass *widget_class;
  GtkContainerClass *container_class;
457
  GtkBindingSet *binding_set;
458

459
  parent_class = g_type_class_peek_parent (class);
460
  binding_set = gtk_binding_set_by_class (class);
461

462
463
464
465
466
  o_class = (GObjectClass *) class;
  object_class = (GtkObjectClass *) class;
  widget_class = (GtkWidgetClass *) class;
  container_class = (GtkContainerClass *) class;

467
  /* GObject signals */
468
469
  o_class->set_property = gtk_tree_view_set_property;
  o_class->get_property = gtk_tree_view_get_property;
470
  o_class->finalize = gtk_tree_view_finalize;
471

472
  /* GtkObject signals */
Jonathan Blandford's avatar
Jonathan Blandford committed
473
  object_class->destroy = gtk_tree_view_destroy;
474

475
476
  /* GtkWidget signals */
  widget_class->map = gtk_tree_view_map;
477
478
479
480
  widget_class->realize = gtk_tree_view_realize;
  widget_class->unrealize = gtk_tree_view_unrealize;
  widget_class->size_request = gtk_tree_view_size_request;
  widget_class->size_allocate = gtk_tree_view_size_allocate;
481
482
  widget_class->button_press_event = gtk_tree_view_button_press;
  widget_class->button_release_event = gtk_tree_view_button_release;
483
  widget_class->motion_notify_event = gtk_tree_view_motion;
484
  widget_class->expose_event = gtk_tree_view_expose;
485
  widget_class->key_press_event = gtk_tree_view_key_press;
486
487
488
  widget_class->enter_notify_event = gtk_tree_view_enter_notify;
  widget_class->leave_notify_event = gtk_tree_view_leave_notify;
  widget_class->focus_out_event = gtk_tree_view_focus_out;
Havoc Pennington's avatar
Havoc Pennington committed
489
490
491
492
493
494
495
496
  widget_class->drag_begin = gtk_tree_view_drag_begin;
  widget_class->drag_end = gtk_tree_view_drag_end;
  widget_class->drag_data_get = gtk_tree_view_drag_data_get;
  widget_class->drag_data_delete = gtk_tree_view_drag_data_delete;
  widget_class->drag_leave = gtk_tree_view_drag_leave;
  widget_class->drag_motion = gtk_tree_view_drag_motion;
  widget_class->drag_drop = gtk_tree_view_drag_drop;
  widget_class->drag_data_received = gtk_tree_view_drag_data_received;
497
  widget_class->focus = gtk_tree_view_focus;
498
  widget_class->grab_focus = gtk_tree_view_grab_focus;
Kristian Rietveld's avatar
Kristian Rietveld committed
499
  widget_class->style_set = gtk_tree_view_style_set;
500

501
  /* GtkContainer signals */
502
  container_class->remove = gtk_tree_view_remove;
503
504
  container_class->forall = gtk_tree_view_forall;
  container_class->set_focus_child = gtk_tree_view_set_focus_child;
505
506

  class->set_scroll_adjustments = gtk_tree_view_set_adjustments;
507
  class->move_cursor = gtk_tree_view_real_move_cursor;
508
  class->select_all = gtk_tree_view_real_select_all;
509
  class->unselect_all = gtk_tree_view_real_unselect_all;
510
  class->select_cursor_row = gtk_tree_view_real_select_cursor_row;
511
512
513
  class->toggle_cursor_row = gtk_tree_view_real_toggle_cursor_row;
  class->expand_collapse_cursor_row = gtk_tree_view_real_expand_collapse_cursor_row;
  class->select_cursor_parent = gtk_tree_view_real_select_cursor_parent;
514
  class->start_interactive_search = gtk_tree_view_real_start_interactive_search;
515

516
  /* Properties */
517

518
519
  g_object_class_install_property (o_class,
                                   PROP_MODEL,
Tim Janik's avatar
Tim Janik committed
520
521
522
523
524
                                   g_param_spec_object ("model",
							_("TreeView Model"),
							_("The model for the tree view"),
							GTK_TYPE_TREE_MODEL,
							G_PARAM_READWRITE));
Jonathan Blandford's avatar
Jonathan Blandford committed
525

526
527
528
529
  g_object_class_install_property (o_class,
                                   PROP_HADJUSTMENT,
                                   g_param_spec_object ("hadjustment",
							_("Horizontal Adjustment"),
Jonathan Blandford's avatar
Jonathan Blandford committed
530
                                                        _("Horizontal Adjustment for the widget"),
531
532
533
534
535
536
537
                                                        GTK_TYPE_ADJUSTMENT,
                                                        G_PARAM_READWRITE));

  g_object_class_install_property (o_class,
                                   PROP_VADJUSTMENT,
                                   g_param_spec_object ("vadjustment",
							_("Vertical Adjustment"),
Jonathan Blandford's avatar
Jonathan Blandford committed
538
                                                        _("Vertical Adjustment for the widget"),
539
540
541
542
543
544
545
                                                        GTK_TYPE_ADJUSTMENT,
                                                        G_PARAM_READWRITE));

  g_object_class_install_property (o_class,
                                   PROP_HEADERS_VISIBLE,
                                   g_param_spec_boolean ("headers_visible",
							 _("Visible"),
Jonathan Blandford's avatar
Jonathan Blandford committed
546
							 _("Show the column header buttons"),
547
							 TRUE,
548
549
550
551
552
553
							 G_PARAM_READWRITE));

  g_object_class_install_property (o_class,
                                   PROP_HEADERS_CLICKABLE,
                                   g_param_spec_boolean ("headers_clickable",
							 _("Headers Clickable"),
Jonathan Blandford's avatar
Jonathan Blandford committed
554
							 _("Column headers respond to click events"),
555
							 FALSE,
556
							 G_PARAM_WRITABLE));
557
558
559

  g_object_class_install_property (o_class,
                                   PROP_EXPANDER_COLUMN,
560
561
562
563
564
                                   g_param_spec_object ("expander_column",
							_("Expander Column"),
							_("Set the column for the expander column"),
							GTK_TYPE_TREE_VIEW_COLUMN,
							G_PARAM_READWRITE));
565

566
567
568
569
570
571
572
573
  g_object_class_install_property (o_class,
                                   PROP_REORDERABLE,
                                   g_param_spec_boolean ("reorderable",
							 _("Reorderable"),
							 _("View is reorderable"),
							 FALSE,
							 G_PARAM_READWRITE));

574
575
576
577
  g_object_class_install_property (o_class,
                                   PROP_RULES_HINT,
                                   g_param_spec_boolean ("rules_hint",
							 _("Rules Hint"),
Jonathan Blandford's avatar
Jonathan Blandford committed
578
							 _("Set a hint to the theme engine to draw rows in alternating colors"),
579
580
581
							 FALSE,
							 G_PARAM_READWRITE));

582
583
584
585
586
587
588
    g_object_class_install_property (o_class,
				     PROP_ENABLE_SEARCH,
				     g_param_spec_boolean ("enable_search",
							   _("Enable Search"),
							   _("View allows user to search through columns interactively"),
							   TRUE,
							   G_PARAM_READWRITE));
589

590
591
592
593
594
595
596
597
598
    g_object_class_install_property (o_class,
				     PROP_SEARCH_COLUMN,
				     g_param_spec_int ("search_column",
						       _("Search Column"),
						       _("Model column to search through when searching through code"),
						       -1,
						       G_MAXINT,
						       0,
						       G_PARAM_READWRITE));
599

600
  /* Style properties */
601
#define _TREE_VIEW_EXPANDER_SIZE 10
602
#define _TREE_VIEW_VERTICAL_SEPARATOR 2
603
#define _TREE_VIEW_HORIZONTAL_SEPARATOR 2
604
    
605
  gtk_widget_class_install_style_property (widget_class,
606
607
					   g_param_spec_int ("expander_size",
							     _("Expander Size"),
Soren Sandmann's avatar
Soren Sandmann committed
608
							     _("Size of the expander arrow"),
609
610
							     0,
							     G_MAXINT,
611
							     _TREE_VIEW_EXPANDER_SIZE,
612
							     G_PARAM_READABLE));
613

614
615
616
  gtk_widget_class_install_style_property (widget_class,
					   g_param_spec_int ("vertical_separator",
							     _("Vertical Separator Width"),
Soren Sandmann's avatar
Soren Sandmann committed
617
							     _("Vertical space between cells.  Must be an even number"),
618
619
620
621
							     0,
							     G_MAXINT,
							     _TREE_VIEW_VERTICAL_SEPARATOR,
							     G_PARAM_READABLE));
622

623
  gtk_widget_class_install_style_property (widget_class,
624
625
					   g_param_spec_int ("horizontal_separator",
							     _("Horizontal Separator Width"),
Soren Sandmann's avatar
Soren Sandmann committed
626
							     _("Horizontal space between cells.  Must be an even number"),
627
628
629
630
631
							     0,
							     G_MAXINT,
							     _TREE_VIEW_HORIZONTAL_SEPARATOR,
							     G_PARAM_READABLE));

632
633
634
  gtk_widget_class_install_style_property (widget_class,
					   g_param_spec_boolean ("allow_rules",
								 _("Allow Rules"),
Soren Sandmann's avatar
Soren Sandmann committed
635
								 _("Allow drawing of alternating color rows"),
636
637
638
								 TRUE,
								 G_PARAM_READABLE));

639
640
641
  gtk_widget_class_install_style_property (widget_class,
					   g_param_spec_boolean ("indent_expanders",
								 _("Indent Expanders"),
Soren Sandmann's avatar
Soren Sandmann committed
642
								 _("Make the expanders indented"),
643
								 TRUE,
644
								 G_PARAM_READABLE));
Manish Singh's avatar
Manish Singh committed
645

646
647
648
649
650
651
652
653
654
655
656
657
658
659
  gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_boxed ("even_row_color",
                                                               _("Even Row Color"),
                                                               _("Color to use for even rows"),
							       GDK_TYPE_COLOR,
G_PARAM_READABLE));

  gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_boxed ("odd_row_color",
                                                               _("Odd Row Color"),
                                                               _("Color to use for odd rows"),
							       GDK_TYPE_COLOR,
G_PARAM_READABLE));

660
  /* Signals */
661
  widget_class->set_scroll_adjustments_signal =
Manish Singh's avatar
Manish Singh committed
662
663
664
665
666
667
668
669
670
    g_signal_new ("set_scroll_adjustments",
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, set_scroll_adjustments),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT_OBJECT,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_ADJUSTMENT,
		  GTK_TYPE_ADJUSTMENT);
671

672
  tree_view_signals[ROW_ACTIVATED] =
Manish Singh's avatar
Manish Singh committed
673
674
675
676
677
678
679
680
681
    g_signal_new ("row_activated",
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, row_activated),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED_OBJECT,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_TREE_PATH,
		  GTK_TYPE_TREE_VIEW_COLUMN);
682

683
  tree_view_signals[TEST_EXPAND_ROW] =
684
    g_signal_new ("test_expand_row",
Manish Singh's avatar
Manish Singh committed
685
686
687
688
689
690
691
692
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, test_expand_row),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED_BOXED,
		  G_TYPE_BOOLEAN, 2,
		  GTK_TYPE_TREE_ITER,
		  GTK_TYPE_TREE_PATH);
693

694
  tree_view_signals[TEST_COLLAPSE_ROW] =
695
    g_signal_new ("test_collapse_row",
Manish Singh's avatar
Manish Singh committed
696
697
698
699
700
701
702
703
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, test_collapse_row),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED_BOXED,
		  G_TYPE_BOOLEAN, 2,
		  GTK_TYPE_TREE_ITER,
		  GTK_TYPE_TREE_PATH);
704

705
  tree_view_signals[ROW_EXPANDED] =
706
    g_signal_new ("row_expanded",
Manish Singh's avatar
Manish Singh committed
707
708
709
710
711
712
713
714
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, row_expanded),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED_BOXED,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_TREE_ITER,
		  GTK_TYPE_TREE_PATH);
715
716

  tree_view_signals[ROW_COLLAPSED] =
717
    g_signal_new ("row_collapsed",
Manish Singh's avatar
Manish Singh committed
718
719
720
721
722
723
724
725
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, row_collapsed),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED_BOXED,
		  G_TYPE_NONE, 2,
		  GTK_TYPE_TREE_ITER,
		  GTK_TYPE_TREE_PATH);
726

727
  tree_view_signals[COLUMNS_CHANGED] =
728
    g_signal_new ("columns_changed",
Manish Singh's avatar
Manish Singh committed
729
730
731
732
733
734
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, columns_changed),
		  NULL, NULL,
		  _gtk_marshal_NONE__NONE,
		  G_TYPE_NONE, 0);
735

736
737
  tree_view_signals[CURSOR_CHANGED] =
    g_signal_new ("cursor_changed",
Manish Singh's avatar
Manish Singh committed
738
739
740
741
742
743
		  G_TYPE_FROM_CLASS (o_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkTreeViewClass, cursor_changed),
		  NULL, NULL,
		  _gtk_marshal_NONE__NONE,
		  G_TYPE_NONE, 0);
744

745
  tree_view_signals[MOVE_CURSOR] =
746
    g_signal_new ("move_cursor",
Manish Singh's avatar
Manish Singh committed
747
748
749
750
751
752
753
754
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, move_cursor),
		  NULL, NULL,
		  _gtk_marshal_BOOLEAN__ENUM_INT,
		  G_TYPE_BOOLEAN, 2,
		  GTK_TYPE_MOVEMENT_STEP,
		  G_TYPE_INT);
755

756
757
  tree_view_signals[SELECT_ALL] =
    g_signal_new ("select_all",
Manish Singh's avatar
Manish Singh committed
758
759
760
761
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, select_all),
		  NULL, NULL,
762
763
		  _gtk_marshal_BOOLEAN__NONE,
		  G_TYPE_BOOLEAN, 0);
764

765
766
767
  tree_view_signals[UNSELECT_ALL] =
    g_signal_new ("unselect_all",
		  G_TYPE_FROM_CLASS (object_class),
Manish Singh's avatar
Manish Singh committed
768
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
769
770
		  G_STRUCT_OFFSET (GtkTreeViewClass, unselect_all),
		  NULL, NULL,
771
772
		  _gtk_marshal_BOOLEAN__NONE,
		  G_TYPE_BOOLEAN, 0);
773

774
  tree_view_signals[SELECT_CURSOR_ROW] =
775
    g_signal_new ("select_cursor_row",
Manish Singh's avatar
Manish Singh committed
776
777
778
779
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_row),
		  NULL, NULL,
780
781
		  _gtk_marshal_BOOLEAN__BOOLEAN,
		  G_TYPE_BOOLEAN, 1,
782
		  G_TYPE_BOOLEAN);
783

784
  tree_view_signals[TOGGLE_CURSOR_ROW] =
785
    g_signal_new ("toggle_cursor_row",
Manish Singh's avatar
Manish Singh committed
786
787
788
789
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, toggle_cursor_row),
		  NULL, NULL,
790
791
		  _gtk_marshal_BOOLEAN__NONE,
		  G_TYPE_BOOLEAN, 0);
792

793
  tree_view_signals[EXPAND_COLLAPSE_CURSOR_ROW] =
794
    g_signal_new ("expand_collapse_cursor_row",
Manish Singh's avatar
Manish Singh committed
795
796
797
798
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, expand_collapse_cursor_row),
		  NULL, NULL,
799
800
		  _gtk_marshal_BOOLEAN__BOOLEAN_BOOLEAN_BOOLEAN,
		  G_TYPE_BOOLEAN, 3,
Manish Singh's avatar
Manish Singh committed
801
802
803
		  G_TYPE_BOOLEAN,
		  G_TYPE_BOOLEAN,
		  G_TYPE_BOOLEAN);
804

805
  tree_view_signals[SELECT_CURSOR_PARENT] =
806
    g_signal_new ("select_cursor_parent",
Manish Singh's avatar
Manish Singh committed
807
808
809
810
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_parent),
		  NULL, NULL,
811
812
		  _gtk_marshal_BOOLEAN__NONE,
		  G_TYPE_BOOLEAN, 0);
813

814
815
  tree_view_signals[START_INTERACTIVE_SEARCH] =
    g_signal_new ("start_interactive_search",
Manish Singh's avatar
Manish Singh committed
816
817
818
819
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkTreeViewClass, start_interactive_search),
		  NULL, NULL,
820
821
		  _gtk_marshal_BOOLEAN__NONE,
		  G_TYPE_BOOLEAN, 0);
822

823
  /* Key bindings */
824
825
  gtk_tree_view_add_move_binding (binding_set, GDK_Up, 0,
				  GTK_MOVEMENT_DISPLAY_LINES, -1);
826
827
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_Up, 0,
				  GTK_MOVEMENT_DISPLAY_LINES, -1);
828
829
830

  gtk_tree_view_add_move_binding (binding_set, GDK_Down, 0,
				  GTK_MOVEMENT_DISPLAY_LINES, 1);
831
832
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_Down, 0,
				  GTK_MOVEMENT_DISPLAY_LINES, 1);
833
834
835
836
837
838
839
840
841

  gtk_tree_view_add_move_binding (binding_set, GDK_p, GDK_CONTROL_MASK,
				  GTK_MOVEMENT_DISPLAY_LINES, -1);

  gtk_tree_view_add_move_binding (binding_set, GDK_n, GDK_CONTROL_MASK,
				  GTK_MOVEMENT_DISPLAY_LINES, 1);

  gtk_tree_view_add_move_binding (binding_set, GDK_Home, 0,
				  GTK_MOVEMENT_BUFFER_ENDS, -1);
842
843
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_Home, 0,
				  GTK_MOVEMENT_BUFFER_ENDS, -1);
844
845
846

  gtk_tree_view_add_move_binding (binding_set, GDK_End, 0,
				  GTK_MOVEMENT_BUFFER_ENDS, 1);
847
848
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_End, 0,
				  GTK_MOVEMENT_BUFFER_ENDS, 1);
849
850
851

  gtk_tree_view_add_move_binding (binding_set, GDK_Page_Up, 0,
				  GTK_MOVEMENT_PAGES, -1);
852
853
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_Page_Up, 0,
				  GTK_MOVEMENT_PAGES, -1);
854
855
856

  gtk_tree_view_add_move_binding (binding_set, GDK_Page_Down, 0,
				  GTK_MOVEMENT_PAGES, 1);
857
858
859
  gtk_tree_view_add_move_binding (binding_set, GDK_KP_Page_Down, 0,
				  GTK_MOVEMENT_PAGES, 1);

860

861
  gtk_binding_entry_add_signal (binding_set, GDK_Right, 0, "move_cursor", 2,
Manish Singh's avatar
Manish Singh committed
862
863
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, 1);
864

865
  gtk_binding_entry_add_signal (binding_set, GDK_Left, 0, "move_cursor", 2,
Manish Singh's avatar
Manish Singh committed
866
867
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, -1);
868

869
870
871
872
873
874
875
876
877
878
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, 0, "move_cursor", 2,
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, 1);

  gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0, "move_cursor", 2,
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, -1);

  gtk_binding_entry_add_signal (binding_set, GDK_Right, GDK_CONTROL_MASK,
                                "move_cursor", 2,
Manish Singh's avatar
Manish Singh committed
879
880
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, 1);
881

882
883
884
885
886
887
888
889
890
891
892
893
  gtk_binding_entry_add_signal (binding_set, GDK_Left, GDK_CONTROL_MASK,
                                "move_cursor", 2,
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, -1);

  gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, GDK_CONTROL_MASK,
                                "move_cursor", 2,
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, 1);

  gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, GDK_CONTROL_MASK,
                                "move_cursor", 2,
Manish Singh's avatar
Manish Singh committed
894
895
				G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
				G_TYPE_INT, -1);
896

897
898
  gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_row", 0);

899
  gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK, "select_all", 0);
900
901
902
903
  gtk_binding_entry_add_signal (binding_set, GDK_slash, GDK_CONTROL_MASK, "select_all", 0);

  gtk_binding_entry_add_signal (binding_set, GDK_A, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "unselect_all", 0);
  gtk_binding_entry_add_signal (binding_set, GDK_backslash, GDK_CONTROL_MASK, "unselect_all", 0);
904

905
  gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_SHIFT_MASK, "select_cursor_row", 1,
Manish Singh's avatar
Manish Singh committed
906
				G_TYPE_BOOLEAN, TRUE);
907
908

  gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "select_cursor_row", 1,
Manish Singh's avatar
Manish Singh committed
909
				G_TYPE_BOOLEAN, TRUE);
910
911
912
913
914
915
  gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "select_cursor_row", 1,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, "select_cursor_row", 1,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "select_cursor_row", 1,
				G_TYPE_BOOLEAN, TRUE);
916

917
918
  /* expand and collapse rows */
  gtk_binding_entry_add_signal (binding_set, GDK_plus, 0, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
919
920
921
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, FALSE);
922
923
  /* Not doable on US keyboards */
  gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
924
925
926
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
927
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, 0, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
928
929
930
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, FALSE);
931
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
932
933
934
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
935
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
936
937
938
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
939
940
  gtk_binding_entry_add_signal (binding_set, GDK_Right, GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
941
942
943
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
944
945
946
947
948
949
950
951
952
953
954
955
956
957
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_Right,
                                GDK_CONTROL_MASK | GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Right,
                                GDK_CONTROL_MASK | GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
958
959
960
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE,
				G_TYPE_BOOLEAN, TRUE);
961
962

  gtk_binding_entry_add_signal (binding_set, GDK_minus, 0, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
963
964
965
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE);
966
  gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
967
968
969
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
970
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Subtract, 0, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
971
972
973
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE);
974
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Subtract, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
975
976
977
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
978
979
980
981
982
983
984
985
986
987
988
989
990
  gtk_binding_entry_add_signal (binding_set, GDK_Left, GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
  gtk_binding_entry_add_signal (binding_set, GDK_Left,
                                GDK_CONTROL_MASK | GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
Manish Singh's avatar
Manish Singh committed
991
992
993
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
994
995
996
  gtk_binding_entry_add_signal (binding_set, GDK_KP_Left,
                                GDK_CONTROL_MASK | GDK_SHIFT_MASK,
                                "expand_collapse_cursor_row", 3,
997
998
999
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, FALSE,
				G_TYPE_BOOLEAN, TRUE);
1000