~ubuntu-branches/debian/experimental/brasero/experimental

« back to all changes in this revision

Viewing changes to src/eggtreemultidnd.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2011-03-29 16:33:51 UTC
  • mfrom: (1.3.18 upstream) (5.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110329163351-ac3wgbh4mplmhnht
Tags: 2.91.93-1
* Only depend on growisofs instead of dvd+rw-tools.
* New upstream pre-release.
* Update build-dependencies, package names, and paths.
* Require totem-plparser 2.32 since its soname changed.
* Do not include GIR package for now, since the versioning is broken 
  (see Bugzilla #646069).
* 01_pkglibdir.patch: dropped, upstream now has a variable we can use 
  for that effect.
* 11_nautilus_menu_no_display.patch, 31_link_libice.patch, 
  50_checksum.patch: dropped, merged upstream.
* 90_relibtoolize.patch: dropped, unnecessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
    priv_data->button_release_handler = 0;
197
197
  }
198
198
 
199
 
  for (l = priv_data->event_list; l != NULL; l = l->next) 
 
199
  for (l = priv_data->event_list; l != NULL && gtk_widget_get_realized (widget); l = l->next)
200
200
    gtk_propagate_event (widget, l->data);
201
201
 
202
202
  stop_drag_check (widget);
234
234
                          (GDestroyNotify) path_list_free);
235
235
}
236
236
 
 
237
static void
 
238
egg_tree_multi_drag_begin (GtkWidget *tree,
 
239
                           GdkDragContext *context,
 
240
                           gpointer user_data)
 
241
{
 
242
  gtk_drag_set_icon_default (context);
 
243
  g_signal_stop_emission_by_name (tree, "drag-begin");
 
244
}
 
245
 
237
246
static GList *
238
247
get_context_data (GdkDragContext *context)
239
248
{
332
341
      model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
333
342
      if (egg_tree_multi_drag_source_row_draggable (EGG_TREE_MULTI_DRAG_SOURCE (model), path_list))
334
343
        {
 
344
          gulong sig;
 
345
 
 
346
          /* This is to disconnect the default signal handler for treeviews as
 
347
           * it sometimes gives a warning. The default handler just sets the
 
348
           * icon which we do as well in our callback so it is fine. */
 
349
          sig = g_signal_connect (widget,
 
350
                                  "drag-begin",
 
351
                                  G_CALLBACK (egg_tree_multi_drag_begin),
 
352
                                  NULL);
335
353
          context = gtk_drag_begin (widget,
336
354
                                    gtk_drag_source_get_target_list (widget),
337
355
                                    di->source_actions,
338
 
                                    priv_data->pressed_button,
 
356
                                    priv_data->pressed_button,
339
357
                                    (GdkEvent*)event);
 
358
          g_signal_handler_disconnect (widget, sig);
340
359
          set_context_data (context, path_list);
341
 
          gtk_drag_set_icon_default (context);
342
 
 
343
360
        }
344
361
      else
345
362
        {
360
377
  gint cell_x, cell_y;
361
378
  GtkTreeSelection *selection;
362
379
  EggTreeMultiDndData *priv_data;
363
 
 
 
380
  
364
381
  tree_view = GTK_TREE_VIEW (widget);
365
382
  priv_data = g_object_get_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING);
366
383
  if (priv_data == NULL)
369
386
      g_object_set_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING, priv_data);
370
387
    }
371
388
 
372
 
  if (g_slist_find (priv_data->event_list, event)) 
 
389
  if (g_slist_find (priv_data->event_list, event))
373
390
    return FALSE;
374
391
 
375
 
  if (priv_data->event_list) 
 
392
  if (priv_data->event_list)
376
393
    {
377
394
      /* save the event to be propagated in order */
378
395
      priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
379
396
      return TRUE;
380
397
    }
381
 
  
 
398
 
382
399
  if (event->type == GDK_2BUTTON_PRESS)
383
 
        return FALSE;
 
400
    return FALSE;
384
401
  
385
402
  if (event->button == 3)
386
403
    return FALSE;
391
408
                                 &cell_x, &cell_y);
392
409
 
393
410
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
394
 
 
395
411
  if (path && gtk_tree_selection_path_is_selected (selection, path))
396
412
    {
397
 
      GList *iter;
398
 
      GList *selected;
399
 
      GtkWidgetClass *widget_klass;
400
 
 
401
 
      /* The call to ::button_press_event will unselect all selected rows so
402
 
       * we must save the selection and select all previously selected rows
403
 
       * again. */
404
 
      selected = gtk_tree_selection_get_selected_rows (selection, NULL);
405
 
 
406
 
      widget_klass = GTK_WIDGET_GET_CLASS (tree_view);
407
 
      widget_klass->button_press_event (widget, event);
408
 
 
409
 
      for (iter = selected; iter; iter = iter->next) {
410
 
        gtk_tree_selection_select_path (selection, iter->data);
411
 
        gtk_tree_path_free (iter->data);
412
 
      }
413
 
      g_list_free (selected);
414
 
 
415
413
      priv_data->pressed_button = event->button;
416
414
      priv_data->x = event->x;
417
415
      priv_data->y = event->y;