[vinagre] Fill the right ipv6 notation when using avahi dialog



commit 0ec7d0bb54787e23f35b37644936f042731612e5
Author: Jonh Wendell <jonh wendell intel com>
Date:   Thu Jul 11 16:54:33 2013 -0300

    Fill the right ipv6 notation when using avahi dialog
    
    fill the connect entry with '[]' around ipv6 addresses.

 vinagre/vinagre-connect.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/vinagre/vinagre-connect.c b/vinagre/vinagre-connect.c
index 388bf15..c23def6 100644
--- a/vinagre/vinagre-connect.c
+++ b/vinagre/vinagre-connect.c
@@ -364,14 +364,19 @@ vinagre_connect_find_button_cb (GtkButton            *button,
   if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT)
     {
       gchar *tmp;
+      AvahiAddress *address;
       char a[AVAHI_ADDRESS_STR_MAX];
 
-      avahi_address_snprint (a,
-                            sizeof(a),
-                            aui_service_dialog_get_address (AUI_SERVICE_DIALOG (d)));
-      tmp = g_strdup_printf ("%s::%d",
-                            a,
-                            aui_service_dialog_get_port (AUI_SERVICE_DIALOG (d)));
+      address = aui_service_dialog_get_address (AUI_SERVICE_DIALOG (d));
+      avahi_address_snprint (a, sizeof(a), address);
+      if (address->proto == AVAHI_PROTO_INET6)
+        tmp = g_strdup_printf ("[%s]::%d",
+                              a,
+                              aui_service_dialog_get_port (AUI_SERVICE_DIALOG (d)));
+      else
+        tmp = g_strdup_printf ("%s:%d",
+                              a,
+                              aui_service_dialog_get_port (AUI_SERVICE_DIALOG (d)));
 
       gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->host_entry))),
                          tmp);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]