=== modified file 'data/vinagre.glade'
--- data/vinagre.glade	2009-01-12 14:51:48 +0000
+++ data/vinagre.glade	2009-01-26 22:11:28 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Wed Dec 10 15:09:21 2008 -->
+<!--Generated with glade3 3.4.5 on Tue Jan 27 00:11:28 2009 -->
 <glade-interface>
   <widget class="GtkDialog" id="connect_dialog">
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -34,10 +34,118 @@
           <widget class="GtkTable" id="table1">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <property name="n_columns">4</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">3</property>
             <property name="column_spacing">6</property>
             <property name="row_spacing">6</property>
             <child>
+              <widget class="GtkLabel" id="label21">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label">   </property>
+              </widget>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkComboBoxEntry" id="socket_entry">
+                <property name="width_request">250</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="tooltip" translatable="yes" comments="Tooltip for host entry in connect dialog">UNIX Socket for local connection</property>
+                <child internal-child="entry">
+                  <widget class="GtkEntry" id="comboboxentry-entry3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="activates_default">True</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkRadioButton" id="radio_socket">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">_UNIX Socket:</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">radio_host</property>
+              </widget>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="open_button">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="receives_default">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label">gtk-open</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options"></property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkRadioButton" id="radio_host">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">_Host:</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="right_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkComboBoxEntry" id="host_entry">
+                <property name="width_request">250</property>
+                <property name="visible">True</property>
+                <property name="tooltip" translatable="yes" comments="Tooltip for host entry in connect dialog">host or host:display or host::port</property>
+                <child internal-child="entry">
+                  <widget class="GtkEntry" id="comboboxentry-entry1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="activates_default">True</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
               <widget class="GtkButton" id="find_button">
                 <property name="visible">True</property>
                 <property name="receives_default">True</property>
@@ -48,23 +156,10 @@
                 <property name="response_id">0</property>
               </widget>
               <packing>
-                <property name="left_attach">3</property>
-                <property name="right_attach">4</property>
-                <property name="x_options"></property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label" translatable="yes">_Host:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">host_entry</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
                 <property name="x_options"></property>
                 <property name="y_options"></property>
               </packing>
@@ -73,36 +168,19 @@
               <widget class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label">  </property>
+                <property name="label">   </property>
               </widget>
               <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options"></property>
               </packing>
             </child>
-            <child>
-              <widget class="GtkComboBoxEntry" id="host_entry">
-                <property name="width_request">250</property>
-                <property name="visible">True</property>
-                <property name="tooltip" translatable="yes" comments="Tooltip for host entry in connect dialog">host or host:display or host::port</property>
-                <child internal-child="entry">
-                  <widget class="GtkEntry" id="comboboxentry-entry1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="activates_default">True</property>
-                  </widget>
-                </child>
-              </widget>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="right_attach">3</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
           </widget>
           <packing>
             <property name="padding">4</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>

=== modified file 'src/vinagre-bookmarks.c'
--- src/vinagre-bookmarks.c	2008-12-11 17:40:20 +0000
+++ src/vinagre-bookmarks.c	2009-01-27 07:27:20 +0000
@@ -190,6 +190,20 @@
   return find_conn_by_host (book->priv->entries, host, port);
 }
 
+VinagreConnection *
+vinagre_bookmarks_exists_socket (VinagreBookmarks *book,
+                          const gchar *socket)
+{
+  VinagreConnection *conn = NULL;
+  GSList *l, *next;
+
+  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS (book), NULL);
+  g_return_val_if_fail (socket != NULL, NULL);
+
+  /* TODO */
+  return NULL;
+}
+
 static void
 vinagre_bookmarks_save_fill_xml (GSList *list, xmlTextWriter *writer)
 {

=== modified file 'src/vinagre-bookmarks.h'
--- src/vinagre-bookmarks.h	2008-12-11 17:40:20 +0000
+++ src/vinagre-bookmarks.h	2009-01-27 07:27:29 +0000
@@ -74,6 +74,9 @@
                                                const gchar *host,
                                                gint port);
 
+VinagreConnection  *vinagre_bookmarks_exists_socket (VinagreBookmarks *book,
+						     const gchar *socket);
+
 G_END_DECLS
 #endif  /* __VINAGRE_BOOKMARKS_H__ */
 /* vim: set ts=8: */

=== modified file 'src/vinagre-connect.c'
--- src/vinagre-connect.c	2008-11-16 12:10:12 +0000
+++ src/vinagre-connect.c	2009-01-27 07:18:25 +0000
@@ -40,8 +40,12 @@
 typedef struct {
   GladeXML  *xml;
   GtkWidget *dialog;
+  GtkWidget *radio_host;
   GtkWidget *host_entry;
   GtkWidget *find_button;
+  GtkWidget *radio_socket;
+  GtkWidget *socket_entry;
+  GtkWidget *open_button;
   GtkWidget *fullscreen_check;
   GtkWidget *scaling_check;
   GtkWidget *viewonly_check;
@@ -53,17 +57,17 @@
 };
 
 static gchar*
-history_filename () {
+history_filename (const gchar *history_file) {
   return g_build_filename (g_get_user_data_dir (),
 			   "vinagre",
-			   "history",
+			   history_file,
 			   NULL);
 }
 
 static GPtrArray *
-saved_history (void)
+saved_history (const gchar *filename)
 {
-  gchar *filename, *file_contents = NULL;
+  gchar *file_contents = NULL;
   gchar **history_from_file = NULL, **list;
   gboolean success;
   gint len;
@@ -71,7 +75,6 @@
 
   array = g_ptr_array_new ();
 
-  filename = history_filename ();
   success = g_file_get_contents (filename,
 				 &file_contents,
 				 NULL,
@@ -93,23 +96,25 @@
 	g_ptr_array_add (array, *list++);
     }
 
-  g_free (filename);
   g_free (file_contents);
   return array;
 }
 
 static void
-setup_combo (GtkWidget *combo)
+setup_combo (GtkWidget *combo, const gchar *history_file)
 {
   GtkListStore *store;
   GtkTreeIter   iter;
   GtkEntryCompletion *completion;
   GPtrArray    *history;
   gint          i, size;
+  gchar        *filename;
 
   store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
 
-  history = saved_history ();
+  filename = history_filename (history_file);
+  history = saved_history (filename);
+  g_free (filename);
 
   g_object_get (vinagre_prefs_get_default (), "history-size", &size, NULL);
   if (size <= 0)
@@ -136,8 +141,8 @@
   g_object_unref (completion);
 }
 
-void
-save_history (GtkWidget *combo) {
+static void
+save_history (GtkWidget *combo, const gchar *history_file) {
   gchar *host;
   GPtrArray *history;
   guint i;
@@ -147,7 +152,8 @@
 
   host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
 
-  history = saved_history ();
+  filename = history_filename (history_file);
+  history = saved_history (filename);
   for (i=0; i<history->len; i++)
     if (!g_strcmp0 (g_ptr_array_index (history, i), host))
       {
@@ -161,7 +167,6 @@
   for (i=0; i<history->len; i++)
     g_string_append_printf (content, "%s\n", (char *) g_ptr_array_index (history, i));
 
-  filename = history_filename ();
   path = g_path_get_dirname (filename);
   g_mkdir_with_parents (path, 0755);
 
@@ -181,6 +186,21 @@
   }
 }
 
+static void
+vinagre_connect_radio_button_cb (GtkToggleButton            *button,
+				 VinagreConnectDialog *dialog)
+{
+  gboolean host_active;
+  
+  host_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radio_host));
+
+  gtk_widget_set_sensitive (dialog->host_entry, host_active);
+  gtk_widget_set_sensitive (dialog->find_button, host_active);
+
+  gtk_widget_set_sensitive (dialog->socket_entry, !host_active);
+  gtk_widget_set_sensitive (dialog->open_button, !host_active);
+}
+
 #ifdef VINAGRE_ENABLE_AVAHI
 static void
 vinagre_connect_find_button_cb (GtkButton            *button,
@@ -218,6 +238,61 @@
 }
 #endif
 
+/* Check if filter_info->filename is Unix domain socket or not */
+static gboolean
+unix_socket_filter_func (const GtkFileFilterInfo *filter_info,
+			 gpointer data)
+{
+  GFile *file;
+  gboolean result = FALSE;
+  
+  file = g_file_new_for_path (filter_info->filename);
+  result = (g_file_query_file_type (file,
+				    G_FILE_QUERY_INFO_NONE,
+				    NULL)
+	    == G_FILE_TYPE_SPECIAL);
+
+  g_object_unref (file);
+
+  return result;
+}
+
+static void
+vinagre_connect_open_button_cb (GtkButton            *button,
+				VinagreConnectDialog *dialog)
+{
+  GtkWidget *d;
+  GtkFileFilter *unix_socket_filter;
+  
+  d = gtk_file_chooser_dialog_new ("Open File",
+				   GTK_WINDOW (dialog->dialog),
+				   GTK_FILE_CHOOSER_ACTION_OPEN,
+				   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				   GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+				   NULL);
+
+  unix_socket_filter = gtk_file_filter_new ();
+  gtk_file_filter_add_custom (unix_socket_filter,
+			      GTK_FILE_FILTER_FILENAME,
+			      unix_socket_filter_func,
+			      NULL,
+			      NULL);
+
+  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (d), unix_socket_filter);
+
+  if (gtk_dialog_run (GTK_DIALOG (d)) == GTK_RESPONSE_ACCEPT)
+    {
+      gchar *filename;
+      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (d));
+      gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->socket_entry))),
+			  filename);
+      g_free (filename);
+    }
+
+  gtk_object_destroy (GTK_OBJECT (unix_socket_filter));
+  gtk_widget_destroy (d);
+}
+
 VinagreConnection *vinagre_connect (VinagreWindow *window)
 {
   VinagreConnection    *conn = NULL;
@@ -228,13 +303,27 @@
   dialog.dialog = glade_xml_get_widget (dialog.xml, "connect_dialog");
   gtk_window_set_transient_for (GTK_WINDOW (dialog.dialog), GTK_WINDOW (window));
 
+  dialog.radio_host  = glade_xml_get_widget (dialog.xml, "radio_host");
   dialog.host_entry  = glade_xml_get_widget (dialog.xml, "host_entry");
   dialog.find_button = glade_xml_get_widget (dialog.xml, "find_button");
+  dialog.radio_socket  = glade_xml_get_widget (dialog.xml, "radio_socket");
+  dialog.socket_entry  = glade_xml_get_widget (dialog.xml, "socket_entry");
+  dialog.open_button = glade_xml_get_widget (dialog.xml, "open_button");
   dialog.fullscreen_check = glade_xml_get_widget (dialog.xml, "fullscreen_check");
   dialog.viewonly_check = glade_xml_get_widget (dialog.xml, "viewonly_check");
   dialog.scaling_check = glade_xml_get_widget (dialog.xml, "scaling_check");
 
-  setup_combo (dialog.host_entry);
+  setup_combo (dialog.host_entry, "history");
+  setup_combo (dialog.socket_entry, "history-socket");
+
+  g_signal_connect (dialog.radio_host,
+		    "clicked",
+		    G_CALLBACK (vinagre_connect_radio_button_cb),
+		    &dialog);
+  g_signal_connect (dialog.radio_socket,
+		    "clicked",
+		    G_CALLBACK (vinagre_connect_radio_button_cb),
+		    &dialog);
 
 #ifdef VINAGRE_ENABLE_AVAHI
   g_signal_connect (dialog.find_button,
@@ -246,22 +335,44 @@
   gtk_widget_set_no_show_all (dialog.find_button, TRUE);
 #endif
 
+  g_signal_connect (dialog.open_button,
+		    "clicked",
+		    G_CALLBACK (vinagre_connect_open_button_cb),
+		    &dialog);
+
   gtk_widget_show_all (dialog.dialog);
   result = gtk_dialog_run (GTK_DIALOG (dialog.dialog));
 
   if (result == GTK_RESPONSE_OK)
     {
       gchar *host = NULL, *error_msg = NULL;
+      gchar *socket = NULL;
+      gboolean host_active = TRUE;
 
-      host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog.host_entry));
       gtk_widget_hide (GTK_WIDGET (dialog.dialog));
-
-      if (!host || !g_strcmp0 (host, ""))
-	goto fail;
-
-      save_history (dialog.host_entry);
-
-      conn = vinagre_connection_new_from_string (host, &error_msg, TRUE);
+      host_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog.radio_host));
+      if (host_active)
+	{
+	  host = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog.host_entry));
+
+	  if (!host || !g_strcmp0 (host, ""))
+	    goto fail;
+
+	  save_history (dialog.host_entry, "history");
+
+	  conn = vinagre_connection_new_from_string (host, &error_msg, TRUE);
+	}
+      else
+	{
+	  socket = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog.socket_entry));
+	  if (!socket || !g_strcmp0 (socket, ""))
+	    goto fail;
+
+	  save_history (dialog.socket_entry, "history-socket");
+
+	  conn = vinagre_connection_new_from_socket (socket, &error_msg, TRUE);
+	}
+      
       if (conn)
 	{
 	  g_object_set (conn,

=== modified file 'src/vinagre-connection.c'
--- src/vinagre-connection.c	2008-12-11 19:26:13 +0000
+++ src/vinagre-connection.c	2009-01-27 07:27:42 +0000
@@ -32,6 +32,7 @@
   VinagreConnectionProtocol protocol;
   gchar *host;
   gint   port;
+  gchar *socket;
   gchar *name;
   gchar *username;
   gchar *password;
@@ -48,6 +49,7 @@
   PROP_PROTOCOL,
   PROP_HOST,
   PROP_PORT,
+  PROP_SOCKET,
   PROP_NAME,
   PROP_USERNAME,
   PROP_PASSWORD,
@@ -74,6 +76,7 @@
   conn->priv->protocol = VINAGRE_CONNECTION_PROTOCOL_VNC;
   conn->priv->host = NULL;
   conn->priv->port = 0;
+  conn->priv->socket = NULL;
   conn->priv->password = NULL;
   conn->priv->username = NULL;
   conn->priv->name = NULL;
@@ -90,6 +93,7 @@
   VinagreConnection *conn = VINAGRE_CONNECTION (object);
 
   g_free (conn->priv->host);
+  g_free (conn->priv->socket);
   g_free (conn->priv->username);
   g_free (conn->priv->password);
   g_free (conn->priv->name);
@@ -121,6 +125,10 @@
 	vinagre_connection_set_port (conn, g_value_get_int (value));
 	break;
 
+      case PROP_SOCKET:
+	vinagre_connection_set_socket (conn, g_value_get_string (value));
+	break;
+
       case PROP_USERNAME:
 	vinagre_connection_set_username (conn, g_value_get_string (value));
 	break;
@@ -183,6 +191,10 @@
 	g_value_set_int (value, conn->priv->port);
 	break;
 
+      case PROP_SOCKET:
+	g_value_set_string (value, conn->priv->socket);
+	break;
+
       case PROP_USERNAME:
 	g_value_set_string (value, conn->priv->username);
 	break;
@@ -281,6 +293,18 @@
                                                       G_PARAM_STATIC_BLURB));
 
   g_object_class_install_property (object_class,
+                                   PROP_SOCKET,
+                                   g_param_spec_string ("socket",
+                                                        "Unix socket",
+	                                                "Unix domain socket",
+                                                        NULL,
+	                                                G_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_BLURB));
+
+  g_object_class_install_property (object_class,
                                    PROP_NAME,
                                    g_param_spec_string ("username",
                                                         "username",
@@ -457,6 +481,24 @@
 }
 
 void
+vinagre_connection_set_socket (VinagreConnection *conn,
+			     const gchar *socket)
+{
+  g_return_if_fail (VINAGRE_IS_CONNECTION (conn));
+
+  if (conn->priv->socket)
+    g_free (conn->priv->socket);
+  conn->priv->socket = g_strdup (socket);
+}
+const gchar *
+vinagre_connection_get_socket (VinagreConnection *conn)
+{
+  g_return_val_if_fail (VINAGRE_IS_CONNECTION (conn), NULL);
+
+  return conn->priv->socket;
+}
+
+void
 vinagre_connection_set_username (VinagreConnection *conn,
 			     const gchar *username)
 {
@@ -538,6 +580,9 @@
   if (conn->priv->host)
         return g_strdup_printf ("%s:%d", conn->priv->host, conn->priv->port);
 
+  if (conn->priv->socket)
+    return g_strdup (conn->priv->socket);
+
   return NULL;
 }
 
@@ -567,6 +612,7 @@
 
   vinagre_connection_set_host (new_conn, vinagre_connection_get_host (conn));
   vinagre_connection_set_port (new_conn, vinagre_connection_get_port (conn));
+  vinagre_connection_set_socket (new_conn, vinagre_connection_get_socket (conn));
   vinagre_connection_set_username (new_conn, vinagre_connection_get_username (conn));
   vinagre_connection_set_password (new_conn, vinagre_connection_get_password (conn));
   vinagre_connection_set_name (new_conn, vinagre_connection_get_name (conn));
@@ -658,6 +704,24 @@
 }
 
 VinagreConnection *
+vinagre_connection_new_from_socket (const gchar *uri, gchar **error_msg, gboolean use_bookmarks)
+{
+  VinagreConnection *conn = NULL;
+
+  if (use_bookmarks)
+    conn = vinagre_bookmarks_exists_socket (vinagre_bookmarks_get_default (),
+					    uri);
+
+  if (!conn)
+    {
+      conn = vinagre_connection_new ();
+      vinagre_connection_set_socket (conn, uri);
+    }
+
+  return conn;
+}
+
+VinagreConnection *
 vinagre_connection_new_from_file (const gchar *uri, gchar **error_msg, gboolean use_bookmarks)
 {
   GKeyFile          *file;

=== modified file 'src/vinagre-connection.h'
--- src/vinagre-connection.h	2008-11-16 12:10:12 +0000
+++ src/vinagre-connection.h	2009-01-26 22:20:58 +0000
@@ -71,6 +71,10 @@
 void		    vinagre_connection_set_port		(VinagreConnection *conn,
 							 gint port);
 
+const gchar*	    vinagre_connection_get_socket	(VinagreConnection *conn);
+void		    vinagre_connection_set_socket	(VinagreConnection *conn,
+							 const gchar *socket);
+
 const gchar*	    vinagre_connection_get_username	(VinagreConnection *conn);
 void		    vinagre_connection_set_username	(VinagreConnection *conn,
 							 const gchar *username);
@@ -92,6 +96,7 @@
 VinagreConnection*  vinagre_connection_clone		(VinagreConnection *conn);
 
 VinagreConnection*  vinagre_connection_new_from_string	(const gchar *url, gchar **error_msg, gboolean use_bookmarks);
+VinagreConnection*  vinagre_connection_new_from_socket	(const gchar *url, gchar **error_msg, gboolean use_bookmarks);
 VinagreConnection*  vinagre_connection_new_from_file	(const gchar *uri, gchar **error_msg, gboolean use_bookmarks);
 
 GdkPixbuf*          vinagre_connection_get_icon	(VinagreConnection *conn);

=== modified file 'src/vinagre-tab.c'
--- src/vinagre-tab.c	2008-12-18 14:43:16 +0000
+++ src/vinagre-tab.c	2009-01-26 22:54:19 +0000
@@ -28,6 +28,14 @@
 #include <gnome-keyring.h>
 #include <vncdisplay.h>
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <fcntl.h>
+#include <errno.h>
+
+
 #include "vinagre-notebook.h"
 #include "vinagre-tab.h"
 #include "vinagre-utils.h"
@@ -302,6 +310,7 @@
 {
   gchar *port;
   gint  shared;
+  gboolean result = FALSE;
 
   vnc_display_set_force_size (VNC_DISPLAY(tab->priv->vnc),
 			      !vinagre_connection_get_scaling (tab->priv->conn));
@@ -316,7 +325,30 @@
   vnc_display_set_shared_flag (VNC_DISPLAY (tab->priv->vnc),
 			       shared);
 
-  if (vnc_display_open_host (VNC_DISPLAY(tab->priv->vnc), vinagre_connection_get_host (tab->priv->conn), port))
+  if (vinagre_connection_get_host (tab->priv->conn))
+    {
+      result = vnc_display_open_host (VNC_DISPLAY(tab->priv->vnc), vinagre_connection_get_host (tab->priv->conn), port);
+    }
+  else
+    {
+      int s, len;
+      struct sockaddr_un sa;
+
+      s = socket (AF_UNIX, SOCK_STREAM, 0);
+      if (s != -1)
+	{
+	  sa.sun_family = AF_UNIX;
+	  strcpy (sa.sun_path, vinagre_connection_get_socket (tab->priv->conn));
+	  len = strlen (sa.sun_path) + sizeof (sa.sun_family);
+	  
+	  if (connect (s, (struct sockaddr *)&sa, len) != -1)
+	    {
+	      result = vnc_display_open_fd (VNC_DISPLAY(tab->priv->vnc), s);
+	    }
+	}
+    }
+  
+  if (result)
     gtk_widget_grab_focus (tab->priv->vnc);
   else
     vinagre_utils_show_error (NULL, _("Error connecting to host."), NULL);

