mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: port UI to new ABI
Some minor changes were necessary so that we could change the ABI in libsysprof-capture to be free from GLib (and therefore used by GLib). This also adds some wrappers for capture API in libsysprof so that we can continue to use GError from UI code.
This commit is contained in:
committed by
Philip Withnall
parent
608582d3c4
commit
97ddf5a0cc
@ -20,10 +20,73 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-capture-gobject.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sysprof-capture.h>
|
||||
|
||||
#include "sysprof-capture-gobject.h"
|
||||
|
||||
G_DEFINE_BOXED_TYPE (SysprofCaptureReader, sysprof_capture_reader, (GBoxedCopyFunc)sysprof_capture_reader_ref, (GBoxedFreeFunc)sysprof_capture_reader_unref)
|
||||
G_DEFINE_BOXED_TYPE (SysprofCaptureWriter, sysprof_capture_writer, (GBoxedCopyFunc)sysprof_capture_writer_ref, (GBoxedFreeFunc)sysprof_capture_writer_unref)
|
||||
G_DEFINE_BOXED_TYPE (SysprofCaptureCursor, sysprof_capture_cursor, (GBoxedCopyFunc)sysprof_capture_cursor_ref, (GBoxedFreeFunc)sysprof_capture_cursor_unref)
|
||||
|
||||
SysprofCaptureReader *
|
||||
sysprof_capture_reader_new_with_error (const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
SysprofCaptureReader *ret;
|
||||
|
||||
if (!(ret = sysprof_capture_reader_new (filename)))
|
||||
g_set_error_literal (error,
|
||||
G_FILE_ERROR,
|
||||
g_file_error_from_errno (errno),
|
||||
g_strerror (errno));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SysprofCaptureReader *
|
||||
sysprof_capture_reader_new_from_fd_with_error (int fd,
|
||||
GError **error)
|
||||
{
|
||||
SysprofCaptureReader *ret;
|
||||
|
||||
if (!(ret = sysprof_capture_reader_new_from_fd (fd)))
|
||||
g_set_error_literal (error,
|
||||
G_FILE_ERROR,
|
||||
g_file_error_from_errno (errno),
|
||||
g_strerror (errno));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SysprofCaptureReader *
|
||||
sysprof_capture_writer_create_reader_with_error (SysprofCaptureWriter *self,
|
||||
GError **error)
|
||||
{
|
||||
SysprofCaptureReader *ret;
|
||||
|
||||
if (!(ret = sysprof_capture_writer_create_reader (self)))
|
||||
g_set_error_literal (error,
|
||||
G_FILE_ERROR,
|
||||
g_file_error_from_errno (errno),
|
||||
g_strerror (errno));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
sysprof_capture_reader_save_as_with_error (SysprofCaptureReader *self,
|
||||
const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
if (!sysprof_capture_reader_save_as (self, filename))
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
G_FILE_ERROR,
|
||||
g_file_error_from_errno (errno),
|
||||
g_strerror (errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,4 +41,18 @@ GType sysprof_capture_writer_get_type (void);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GType sysprof_capture_cursor_get_type (void);
|
||||
|
||||
SYSPROF_AVAILABLE_IN_3_38
|
||||
SysprofCaptureReader *sysprof_capture_reader_new_with_error (const char *filename,
|
||||
GError **error);
|
||||
SYSPROF_AVAILABLE_IN_3_38
|
||||
SysprofCaptureReader *sysprof_capture_reader_new_from_fd_with_error (int fd,
|
||||
GError **error);
|
||||
SYSPROF_AVAILABLE_IN_3_38
|
||||
SysprofCaptureReader *sysprof_capture_writer_create_reader_with_error (SysprofCaptureWriter *self,
|
||||
GError **error);
|
||||
SYSPROF_AVAILABLE_IN_3_38
|
||||
bool sysprof_capture_reader_save_as_with_error (SysprofCaptureReader *self,
|
||||
const char *filename,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
#include <sysprof-capture.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
Reference in New Issue
Block a user