vinagre r622 - in trunk: . src
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vinagre r622 - in trunk: . src
- Date: Thu, 19 Feb 2009 20:17:11 +0000 (UTC)
Author: jwendell
Date: Thu Feb 19 20:17:11 2009
New Revision: 622
URL: http://svn.gnome.org/viewvc/vinagre?rev=622&view=rev
Log:
2009-02-19 Jonh Wendell <jwendell gnome org>
* src/vinagre-connection.c,
* src/vinagre-tab.c: Allow IPv6 address in command line as well in
the connection dialog. The address must be enclosed by square braces,
for instance: [::a:b:c:d]. This is the same syntax used by RealVNC.
Closes Ubuntu #290394. The command line help and man page should be
updated to reflect this, though.
Modified:
trunk/ChangeLog
trunk/src/vinagre-connection.c
trunk/src/vinagre-tab.c
Modified: trunk/src/vinagre-connection.c
==============================================================================
--- trunk/src/vinagre-connection.c (original)
+++ trunk/src/vinagre-connection.c Thu Feb 19 20:17:11 2009
@@ -587,6 +587,7 @@
gchar **server, **url;
gint lport;
gchar *lhost;
+ gchar ipv6_host[255] = {0,};
*error_msg = NULL;
*host = NULL;
@@ -607,6 +608,18 @@
else
lhost = (gchar *) uri;
+ if (lhost[0] == '[')
+ {
+ int i;
+ for (i = 1; lhost[i] && lhost[i] != ']'; i++)
+ {
+ ipv6_host[i-1] = lhost[i];
+ lhost[i-1] = '_';
+ }
+ ipv6_host[i-1] = '\0';
+ lhost[i] = '_';
+ }
+
if (g_strrstr (lhost, "::") != NULL)
{
server = g_strsplit (lhost, "::", 2);
@@ -621,7 +634,7 @@
lport += 5900;
}
- lhost = server[0];
+ lhost = ipv6_host[0] ? ipv6_host : server[0];
*host = g_strdup (lhost);
*port = lport;
@@ -845,9 +858,12 @@
{
GString *uri;
gchar *result;
+ gboolean is_ipv6;
g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), NULL);
+ is_ipv6 = g_strstr_len (conn->priv->host, -1, ":") != NULL;
+
if (has_protocol)
{
uri = g_string_new (vinagre_connection_protos [conn->priv->protocol-1]);
@@ -856,13 +872,17 @@
else
uri = g_string_new (NULL);
+ if (is_ipv6)
+ g_string_append_c (uri, '[');
g_string_append (uri, conn->priv->host);
+ if (is_ipv6)
+ g_string_append_c (uri, ']');
if (vinagre_connection_default_port [conn->priv->protocol-1] != conn->priv->port)
g_string_append_printf (uri, "::%d", conn->priv->port);
- result = g_strdup (uri->str);
- g_string_free (uri, TRUE);
+ result = uri->str;
+ g_string_free (uri, FALSE);
return result;
}
Modified: trunk/src/vinagre-tab.c
==============================================================================
--- trunk/src/vinagre-tab.c (original)
+++ trunk/src/vinagre-tab.c Thu Feb 19 20:17:11 2009
@@ -436,7 +436,7 @@
{
GtkRecentManager *manager;
GtkRecentData *data;
- GString *uri;
+ gchar *uri;
static gchar *groups[2] = {
"vinagre",
@@ -446,11 +446,7 @@
manager = gtk_recent_manager_get_default ();
data = g_slice_new (GtkRecentData);
- uri = g_string_new (NULL);
- g_string_printf (uri, "vnc://%s:%d",
- vinagre_connection_get_host (tab->priv->conn),
- vinagre_connection_get_port (tab->priv->conn));
-
+ uri = vinagre_connection_get_string_rep (tab->priv->conn, TRUE);
data->display_name = vinagre_connection_get_best_name (tab->priv->conn);
data->description = NULL;
data->mime_type = g_strdup ("application/x-remote-connection");
@@ -459,12 +455,12 @@
data->groups = groups;
data->is_private = FALSE;
- if (!gtk_recent_manager_add_full (manager, uri->str, data))
+ if (!gtk_recent_manager_add_full (manager, uri, data))
vinagre_utils_show_error (NULL,
_("Error saving recent connection."),
GTK_WINDOW (tab->priv->window));
- g_string_free (uri, TRUE);
+ g_free (uri);
g_free (data->app_exec);
g_free (data->mime_type);
g_free (data->display_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]