Example #1
0
static void
ide_editor_perspective_find_source_location (GtkWidget *widget,
                                             gpointer   user_data)
{
  struct {
    IdeFile *file;
    IdeEditorView *view;
  } *lookup = user_data;
  IdeBuffer *buffer;
  IdeFile *file;

  g_return_if_fail (IDE_IS_LAYOUT_VIEW (widget));

  if (lookup->view != NULL)
    return;

  if (!IDE_IS_EDITOR_VIEW (widget))
    return;

  buffer = ide_editor_view_get_buffer (IDE_EDITOR_VIEW (widget));
  file = ide_buffer_get_file (buffer);

  if (ide_file_equal (file, lookup->file))
    lookup->view = IDE_EDITOR_VIEW (widget);
}
Example #2
0
IdeSourceRange *
_ide_source_range_new (IdeSourceLocation *begin,
                       IdeSourceLocation *end)
{
  IdeSourceRange *ret;

  g_return_val_if_fail (begin, NULL);
  g_return_val_if_fail (end, NULL);
  g_return_val_if_fail (ide_file_equal (ide_source_location_get_file (begin),
                                        ide_source_location_get_file (end)),
                        NULL);

  ret = g_slice_new0 (IdeSourceRange);
  ret->ref_count = 1;
  ret->begin = ide_source_location_ref (begin);
  ret->end = ide_source_location_ref (end);

  return ret;
}