evolution r36026 - trunk/plugins/google-account-setup



Author: mcrha
Date: Wed Aug 20 08:43:17 2008
New Revision: 36026
URL: http://svn.gnome.org/viewvc/evolution?rev=36026&view=rev

Log:
2008-08-20  Milan Crha  <mcrha redhat com>

	** Fix for bug #525555

	* google-source.c: (print_uri_noproto): Removed.
	* google-source.c: (user_changed): Do not leak.
	* google-source.c: (plugin_google): Get username from source, not URL.



Modified:
   trunk/plugins/google-account-setup/ChangeLog
   trunk/plugins/google-account-setup/google-source.c

Modified: trunk/plugins/google-account-setup/google-source.c
==============================================================================
--- trunk/plugins/google-account-setup/google-source.c	(original)
+++ trunk/plugins/google-account-setup/google-source.c	Wed Aug 20 08:43:17 2008
@@ -118,43 +118,6 @@
 
 
 /********************************************************************************************************************/
-/* the location field for google sources */
-/* stolen from calendar-weather eplugin */
-static gchar *
-print_uri_noproto (EUri *uri)
-{
-	gchar *uri_noproto;
-
-	if (uri->port != 0)
-		uri_noproto = g_strdup_printf (
-			"%s%s%s%s%s%s%s:%d%s%s%s",
-			uri->user ? uri->user : "",
-			uri->authmech ? ";auth=" : "",
-			uri->authmech ? uri->authmech : "",
-			uri->passwd ? ":" : "",
-			uri->passwd ? uri->passwd : "",
-			uri->user ? "@" : "",
-			uri->host ? uri->host : "",
-			uri->port,
-			uri->path ? uri->path : "",
-			uri->query ? "?" : "",
-			uri->query ? uri->query : "");
-	else
-		uri_noproto = g_strdup_printf (
-			"%s%s%s%s%s%s%s%s%s%s",
-			uri->user ? uri->user : "",
-			uri->authmech ? ";auth=" : "",
-			uri->authmech ? uri->authmech : "",
-			uri->passwd ? ":" : "",
-			uri->passwd ? uri->passwd : "",
-			uri->user ? "@" : "",
-			uri->host ? uri->host : "",
-			uri->path ? uri->path : "",
-			uri->query ? "?" : "",
-			uri->query ? uri->query : "");
-	return uri_noproto;
-}
-
 #if 0
 
 FIXME: Not sure why this function is declared but called no where. This needs fixing.
@@ -264,22 +227,9 @@
 static void
 user_changed (GtkEntry *editable, ESource *source)
 {
-	EUri       *euri;
 	char       *uri;
-	char       *ruri;
 	const char *user;
 
-	uri = e_source_get_uri (source);
-
-	if (uri == NULL) {
-		g_free (uri);
-		return;
-	}
-
-	euri = e_uri_new (uri);
-	g_free (euri->user);
-	euri->user = NULL;
-
 	/* two reasons why set readonly to FALSE:
 	   a) the e_source_set_relative_uri does nothing for readonly sources
 	   b) we are going to set default uri, which should be always writeable */
@@ -290,7 +240,7 @@
 	e_source_set_relative_uri (source, uri);
 	g_free (uri);
 
-	e_source_set_property (source, "username", gtk_entry_get_text (GTK_ENTRY (editable)));
+	e_source_set_property (source, "username", user);
 	e_source_set_property (source, "protocol", "google");
 	e_source_set_property (source, "auth-domain", "google");
 	e_source_set_property (source, "auth", (user && *user) ? "1" : NULL);
@@ -299,10 +249,6 @@
 	/* we changed user, thus reset the chosen calendar combo too, because
 	   other user means other calendars subscribed */
 	init_combo_values (GTK_COMBO_BOX (g_object_get_data (G_OBJECT (editable), "CalendarCombo")), _("Default"), NULL);
-
-	ruri = print_uri_noproto (euri);
-	g_free (ruri);
-	e_uri_free (euri);
 }
 
 static char *
@@ -623,7 +569,7 @@
 	GtkWidget    *label;
 	GtkWidget    *combo;
 	char         *uri;
-	char         *username;
+	const char   *username;
 	const char   *ssl_prop;
 	gboolean      ssl_enabled;
 	int           row;
@@ -651,7 +597,8 @@
 		return NULL;
 	}
 
-	username = euri->user;
+	username = e_source_get_property (source, "username");
+	g_free (euri->user);
 	euri->user = NULL;
 	uri = e_uri_to_string (euri, FALSE);
 
@@ -742,7 +689,6 @@
 			  source);
 
         g_free (uri);
-	g_free (username);
 
 	label = gtk_label_new_with_mnemonic (_("Cal_endar:"));
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);



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