[vinagre] Added the argument "gchar *known_protocol" to vinagre_connection_split_string().



commit ce542a4c378c6908f730fa9e8734e47e72b05d8e
Author: Jonh Wendell <jwendell gnome org>
Date:   Fri Jul 31 11:44:31 2009 -0300

    Added the argument "gchar *known_protocol" to vinagre_connection_split_string().
    
    If you know in advance what's the protocol of the URI you want to split,
    then you should pass it. Otherwise pass NULL.

 vinagre/vinagre-connection.c |   13 ++++++++++---
 vinagre/vinagre-connection.h |    9 +++++----
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/vinagre/vinagre-connection.c b/vinagre/vinagre-connection.c
index efa4647..1462da7 100644
--- a/vinagre/vinagre-connection.c
+++ b/vinagre/vinagre-connection.c
@@ -499,6 +499,7 @@ vinagre_connection_get_icon (VinagreConnection *conn)
 
 gboolean
 vinagre_connection_split_string (const gchar *uri,
+				 const gchar *known_protocol,
 				 gchar       **protocol,
 				 gchar       **host,
 				 gint         *port,
@@ -517,12 +518,18 @@ vinagre_connection_split_string (const gchar *uri,
   url = g_strsplit (uri, "://", 2);
   if (g_strv_length (url) == 2)
     {
-      *protocol = g_strdup (url[0]);
+      if (known_protocol)
+	*protocol = g_strdup (known_protocol);
+      else
+	*protocol = g_strdup (url[0]);
       lhost = url[1];
     }
   else
     {
-      *protocol = g_strdup ("vnc");
+      if (known_protocol)
+	*protocol = g_strdup (known_protocol);
+      else
+	*protocol = g_strdup ("vnc");
       lhost = (gchar *) uri;
     }
 
@@ -582,7 +589,7 @@ vinagre_connection_new_from_string (const gchar *uri, gchar **error_msg, gboolea
   gchar  *host, *protocol;
   VinagrePlugin *plugin;
 
-  if (!vinagre_connection_split_string (uri, &protocol, &host, &port, error_msg))
+  if (!vinagre_connection_split_string (uri, NULL, &protocol, &host, &port, error_msg))
     return NULL;
 
   if (use_bookmarks)
diff --git a/vinagre/vinagre-connection.h b/vinagre/vinagre-connection.h
index 26cd0c4..dd8c20e 100644
--- a/vinagre/vinagre-connection.h
+++ b/vinagre/vinagre-connection.h
@@ -93,10 +93,11 @@ VinagreConnection*  vinagre_connection_new_from_string	(const gchar *url, gchar
 VinagreConnection*  vinagre_connection_new_from_file	(const gchar *uri, gchar **error_msg, gboolean use_bookmarks);
 
 gboolean	    vinagre_connection_split_string	(const gchar *uri,
-							 gchar **protocol,
-							 gchar **host,
-							 gint   *port,
-							 gchar **error_msg);
+							 const gchar *known_protocol,
+							 gchar       **protocol,
+							 gchar       **host,
+							 gint        *port,
+							 gchar       **error_msg);
 
 gchar*		    vinagre_connection_get_string_rep	(VinagreConnection *conn,
 							 gboolean has_protocol);



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