[vte] Add GError param to vte_pty_new_foreign
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] Add GError param to vte_pty_new_foreign
- Date: Wed, 24 Mar 2010 20:38:54 +0000 (UTC)
commit 1e684a5156f770c6238ef02e15b5d8713f43638d
Author: Christian Persch <chpe gnome org>
Date: Wed Mar 24 21:38:32 2010 +0100
Add GError param to vte_pty_new_foreign
src/pty.c | 22 +++++++++-------------
src/vte.c | 5 +++--
src/vtepty.h | 3 ++-
3 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/pty.c b/src/pty.c
index 9c61ece..49e6461 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -1756,6 +1756,7 @@ vte_pty_new (VtePtyFlags flags,
/**
* vte_pty_new_foreign:
* @fd: a file descriptor to the PTY
+ * @error: return location for a #GError, or %NULL
*
* Creates a new #VtePty for the PTY master @fd.
*
@@ -1764,26 +1765,21 @@ vte_pty_new (VtePtyFlags flags,
* Note that the newly created #VtePty will take ownership of @fd
* and close it on finalize.
*
- * Returns: a new #VtePty for @fd
+ * Returns: a new #VtePty for @fd, or %NULL on error with @error filled in
*
* Since: 0.26
*/
VtePty *
-vte_pty_new_foreign (int fd)
+vte_pty_new_foreign (int fd,
+ GError **error)
{
- VtePty *pty;
- GError *error = NULL;
-
g_return_val_if_fail(fd >= 0, NULL);
- pty = g_initable_new (VTE_TYPE_PTY,
- NULL /* cancellable */,
- &error,
- "fd", fd,
- NULL);
- g_assert(error == NULL);
-
- return pty;
+ return g_initable_new (VTE_TYPE_PTY,
+ NULL /* cancellable */,
+ error,
+ "fd", fd,
+ NULL);
}
/**
diff --git a/src/vte.c b/src/vte.c
index fd07f1f..aec2c85 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -13809,8 +13809,9 @@ vte_terminal_set_pty(VteTerminal *terminal, int pty_master)
return;
}
- pty = vte_pty_new_foreign(pty_master);
- g_assert(pty != NULL);
+ pty = vte_pty_new_foreign(pty_master, NULL);
+ if (pty == NULL)
+ return;
vte_terminal_set_pty_object(terminal, pty);
g_object_unref(pty);
diff --git a/src/vtepty.h b/src/vtepty.h
index 0336d09..ed99c8c 100644
--- a/src/vtepty.h
+++ b/src/vtepty.h
@@ -90,7 +90,8 @@ GType vte_pty_get_type (void);
VtePty *vte_pty_new (VtePtyFlags flags,
GError **error);
-VtePty *vte_pty_new_foreign (int fd);
+VtePty *vte_pty_new_foreign (int fd,
+ GError **error);
int vte_pty_get_fd (VtePty *pty);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]