[vte/vte-next] Rename API
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next] Rename API
- Date: Thu, 26 May 2011 20:44:35 +0000 (UTC)
commit 51d34727cabf1868a70fbb2b026f71142b90a798
Author: Christian Persch <chpe gnome org>
Date: Thu May 26 22:38:05 2011 +0200
Rename API
Add _sync suffix and GCancellable argument.
doc/reference/vte-sections.txt | 8 ++++----
src/pty.c | 20 ++++++++++++--------
src/vte.c | 25 +++++++++++++++----------
src/vte.h | 10 ++++++----
src/vteapp.c | 14 +++++++++++---
src/vtepty.h | 12 +++++++-----
6 files changed, 55 insertions(+), 34 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index a73b8f2..d92420f 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -63,10 +63,10 @@ vte_get_default_emulation
vte_get_user_shell
<SUBSECTION>
-vte_terminal_fork_command_full
+vte_terminal_fork_command_sync
vte_terminal_get_pty
vte_terminal_set_pty
-vte_terminal_pty_new
+vte_terminal_pty_new_sync
vte_terminal_watch_child
<SUBSECTION Standard>
@@ -106,8 +106,8 @@ VteTerminalClassPrivate
VtePtyFlags
VtePtyError
VtePty
-vte_pty_new
-vte_pty_new_foreign
+vte_pty_new_sync
+vte_pty_new_foreign_sync
vte_pty_close
vte_pty_child_setup
vte_pty_get_fd
diff --git a/src/pty.c b/src/pty.c
index 33e6087..f944d53 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -1611,8 +1611,9 @@ vte_pty_error_quark(void)
}
/**
- * vte_pty_new:
+ * vte_pty_new_sync:
* @flags: flags from #VtePtyFlags
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Allocates a new pseudo-terminal.
@@ -1643,19 +1644,21 @@ vte_pty_error_quark(void)
* Since: 0.26
*/
VtePty *
-vte_pty_new (VtePtyFlags flags,
- GError **error)
+vte_pty_new_sync (VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
return g_initable_new (VTE_TYPE_PTY,
- NULL /* cancellable */,
+ cancellable,
error,
"flags", flags,
NULL);
}
/**
- * vte_pty_new_foreign:
+ * vte_pty_new_foreign_sync:
* @fd: (transfer full): a file descriptor to the PTY
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Creates a new #VtePty for the PTY master @fd.
@@ -1670,13 +1673,14 @@ vte_pty_new (VtePtyFlags flags,
* Since: 0.26
*/
VtePty *
-vte_pty_new_foreign (int fd,
- GError **error)
+vte_pty_new_foreign_sync (int fd,
+ GCancellable *cancellable,
+ GError **error)
{
g_return_val_if_fail(fd >= 0, NULL);
return g_initable_new (VTE_TYPE_PTY,
- NULL /* cancellable */,
+ cancellable,
error,
"fd", fd,
NULL);
diff --git a/src/vte.c b/src/vte.c
index a13b1a1..a927652 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2904,9 +2904,10 @@ _vte_terminal_disconnect_pty_write(VteTerminal *terminal)
}
/**
- * vte_terminal_pty_new:
+ * vte_terminal_pty_new_sync:
* @terminal: a #VteTerminal
* @flags: flags from #VtePtyFlags
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Creates a new #VtePty, and sets the emulation property
@@ -2915,12 +2916,14 @@ _vte_terminal_disconnect_pty_write(VteTerminal *terminal)
* See vte_pty_new() for more information.
*
* Returns: (transfer full): a new #VtePty
- * Since: 0.26
+ *
+ * Since: 0.30
*/
VtePty *
-vte_terminal_pty_new(VteTerminal *terminal,
- VtePtyFlags flags,
- GError **error)
+vte_terminal_pty_new_sync(VteTerminal *terminal,
+ VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
VteTerminalPrivate *pvt;
VtePty *pty;
@@ -2929,7 +2932,7 @@ vte_terminal_pty_new(VteTerminal *terminal,
pvt = terminal->pvt;
- pty = vte_pty_new(flags, error);
+ pty = vte_pty_new_sync(flags, cancellable, error);
if (pty == NULL)
return NULL;
@@ -3020,7 +3023,7 @@ vte_get_user_shell (void)
}
/**
- * vte_terminal_fork_command_full:
+ * vte_terminal_fork_command_sync:
* @terminal: a #VteTerminal
* @pty_flags: flags from #VtePtyFlags
* @working_directory: (allow-none): the name of a directory the command should start
@@ -3032,6 +3035,7 @@ vte_get_user_shell (void)
* @child_setup: (allow-none) (scope call): function to run in the child just before exec(), or %NULL
* @child_setup_data: user data for @child_setup
* @child_pid: (out) (allow-none) (transfer full): a location to store the child PID, or %NULL
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Starts the specified command under a newly-allocated controlling
@@ -3050,10 +3054,10 @@ vte_get_user_shell (void)
*
* Returns: %TRUE on success, or %FALSE on error with @error filled in
*
- * Since: 0.26
+ * Since: 0.30
*/
gboolean
-vte_terminal_fork_command_full(VteTerminal *terminal,
+vte_terminal_fork_command_sync(VteTerminal *terminal,
VtePtyFlags pty_flags,
const char *working_directory,
char **argv,
@@ -3062,6 +3066,7 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
GSpawnChildSetupFunc child_setup,
gpointer child_setup_data,
GPid *child_pid /* out */,
+ GCancellable *cancellable,
GError **error)
{
VtePty *pty;
@@ -3072,7 +3077,7 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
g_return_val_if_fail(child_setup_data == NULL || child_setup, FALSE);
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
- pty = vte_pty_new(pty_flags, error);
+ pty = vte_terminal_pty_new_sync(terminal, pty_flags, cancellable, error);
if (pty == NULL)
return FALSE;
diff --git a/src/vte.h b/src/vte.h
index 48cf23c..3d91d0b 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -178,14 +178,15 @@ GType vte_terminal_get_type(void);
GtkWidget *vte_terminal_new(void);
-VtePty *vte_terminal_pty_new (VteTerminal *terminal,
- VtePtyFlags flags,
- GError **error);
+VtePty *vte_terminal_pty_new_sync (VteTerminal *terminal,
+ VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
void vte_terminal_watch_child (VteTerminal *terminal,
GPid child_pid);
-gboolean vte_terminal_fork_command_full(VteTerminal *terminal,
+gboolean vte_terminal_fork_command_sync(VteTerminal *terminal,
VtePtyFlags pty_flags,
const char *working_directory,
char **argv,
@@ -194,6 +195,7 @@ gboolean vte_terminal_fork_command_full(VteTerminal *terminal,
GSpawnChildSetupFunc child_setup,
gpointer child_setup_data,
GPid *child_pid /* out */,
+ GCancellable *cancellable,
GError **error);
/* Send data to the terminal to display, or to the terminal's forked command
diff --git a/src/vteapp.c b/src/vteapp.c
index f5e42cb..3c16f80 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -1039,7 +1039,7 @@ main(int argc, char **argv)
command = "/bin/sh";
if (!g_shell_parse_argv(command, &command_argc, &command_argv, &err) ||
- !vte_terminal_fork_command_full(terminal,
+ !vte_terminal_fork_command_sync(terminal,
pty_flags,
NULL,
command_argv,
@@ -1047,6 +1047,7 @@ main(int argc, char **argv)
G_SPAWN_SEARCH_PATH,
NULL, NULL,
&pid,
+ NULL /* cancellable */,
&err)) {
g_warning("Failed to fork: %s\n", err->message);
g_error_free(err);
@@ -1063,18 +1064,25 @@ main(int argc, char **argv)
#endif
} else {
#ifdef HAVE_FORK
+ GError *err = NULL;
VtePty *pty;
pid_t pid;
int i;
- pty = vte_pty_new(VTE_PTY_DEFAULT, NULL);
+ pty = vte_pty_new_sync(VTE_PTY_DEFAULT, NULL, &err);
+ if (pty == NULL) {
+ g_printerr ("Failed to create PTY: %s\n", err->message);
+ g_error_free(err);
+ return 1;
+ }
+
pid = fork();
switch (pid) {
case -1:
g_object_unref(pty);
/* abnormal */
g_warning("Error in vte_terminal_forkpty(): %s",
- strerror(errno));
+ g_strerror(errno));
break;
case 0:
/* child */
diff --git a/src/vtepty.h b/src/vtepty.h
index a0aea6a..bc680b7 100644
--- a/src/vtepty.h
+++ b/src/vtepty.h
@@ -23,7 +23,7 @@
#ifndef VTE_PTY_H
#define VTE_PTY_H
-#include <glib-object.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -87,11 +87,13 @@ typedef struct _VtePtyClass VtePtyClass;
GType vte_pty_get_type (void);
-VtePty *vte_pty_new (VtePtyFlags flags,
- GError **error);
+VtePty *vte_pty_new_sync (VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
-VtePty *vte_pty_new_foreign (int fd,
- GError **error);
+VtePty *vte_pty_new_foreign_sync (int fd,
+ GCancellable *cancellable,
+ GError **error);
int vte_pty_get_fd (VtePty *pty);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]