[evolution-patches] evolution-webcal URI display
- From: William Jon McCann <mccannwj pha jhu edu>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] evolution-webcal URI display
- Date: Mon, 22 Mar 2004 15:40:03 -0500
Hi,
Here is a patch to fix URI display in dialogs. Currently, URIs are
passed to the user unmodified. This causes:
- Pango markup to fail when certain characters are present in query
string (ampersand I think)
- Long URIs (especially with long query strings) to make the window
larger than the screen and difficult to close or respond
- Exposure of unnecessary technical details such as
protocol/port/username/password/query-string, etc. to the user
I have attached screenshots of the behavior and a patch.
Please let me know if this looks ok.
Thanks,
Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-webcal/ChangeLog,v
retrieving revision 1.4
diff -u -p -r1.4 ChangeLog
--- ChangeLog 9 Mar 2004 05:42:26 -0000 1.4
+++ ChangeLog 22 Mar 2004 20:27:40 -0000
@@ -1,3 +1,11 @@
+2004-03-22 William Jon McCann <mccann jhu edu>
+
+ * src/evolution-webcal-notify.[ch] (e_webcal_query_user):
+ * src/evolution-webcal-main.c (e_webcal_load, e_webcal_read)
+ (e_webcal_open_cal_http): Parse URIs before sending them to
+ the user in order to remove passwords and query strings and
+ shorten long URLs.
+
2004-03-09 Rodney Dawes <dobey ximian com>
* TODO: Added a TODO file
Index: src/evolution-webcal-main.c
===================================================================
RCS file: /cvs/gnome/evolution-webcal/src/evolution-webcal-main.c,v
retrieving revision 1.3
diff -u -p -r1.3 evolution-webcal-main.c
--- src/evolution-webcal-main.c 9 Mar 2004 05:42:47 -0000 1.3
+++ src/evolution-webcal-main.c 22 Mar 2004 20:27:40 -0000
@@ -35,12 +35,15 @@ static void e_webcal_load (const gchar *
comp = icalparser_parse_string (body);
if (comp == NULL) {
+ SoupUri * suri;
gchar * message;
+ suri = soup_uri_new (uri);
message = g_strdup_printf (_("There was an error parsing the calendar, "
"\"%s\". Please verify that it is a valid "
"calendar, and try again."),
- g_basename (uri));
+ g_basename (suri->path));
+ soup_uri_free (suri);
e_webcal_display_error (_("Error Parsing Calendar"),
message,
@@ -93,29 +96,36 @@ static void e_webcal_read (SoupMessage *
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
gchar * errorstring;
+ gchar * location;
+ SoupUri * suri;
+
+ suri = soup_uri_new (uri);
+ location = g_strdup_printf ("%s%s", suri->host, suri->path);
+ soup_uri_free (suri);
switch (msg->status_code) {
/* Handle some common error codes here */
case SOUP_STATUS_FORBIDDEN:
errorstring = g_strdup_printf (_("Access to the calendar at \"%s\" "
- "is forbidden."), uri);
+ "is forbidden."), location);
break;
case SOUP_STATUS_NOT_FOUND:
errorstring = g_strdup_printf (_("The calendar at \"%s\" was not "
- "found on the server."), uri);
+ "found on the server."), location);
break;
case SOUP_STATUS_INTERNAL_SERVER_ERROR:
errorstring = g_strdup_printf (_("There was an internal server error "
- "while trying to load \"%s\"."), uri);
+ "while trying to load \"%s\"."), location);
break;
default:
errorstring = g_strdup_printf (_("There was an error loading the "
- "calendar at \"%s\"."), uri);
+ "calendar at \"%s\"."), location);
break;
}
e_webcal_display_error (_("Error Loading Calendar"),
errorstring,
NULL);
+ g_free (location);
g_free (errorstring);
g_free (data);
bonobo_main_quit ();
@@ -140,11 +150,17 @@ static void e_webcal_open_cal_http (cons
message = soup_message_new (SOUP_METHOD_GET, uri);
if (!SOUP_IS_MESSAGE (message)) {
gchar * errorstring;
+ gchar * location;
+ SoupUri * suri;
- errorstring = g_strdup_printf (_("The URI \"%s\" is invalid."), olduri);
+ suri = soup_uri_new (olduri);
+ location = g_strdup_printf ("%s%s", suri->host, suri->path);
+ soup_uri_free (suri);
+ errorstring = g_strdup_printf (_("The URI \"%s\" is invalid."), location);
e_webcal_display_error (_("Invalid URI Specified"),
errorstring,
NULL);
+ g_free (location);
g_free (errorstring);
g_free (olduri);
bonobo_main_quit ();
Index: src/evolution-webcal-notify.c
===================================================================
RCS file: /cvs/gnome/evolution-webcal/src/evolution-webcal-notify.c,v
retrieving revision 1.4
diff -u -p -r1.4 evolution-webcal-notify.c
--- src/evolution-webcal-notify.c 9 Mar 2004 05:42:47 -0000 1.4
+++ src/evolution-webcal-notify.c 22 Mar 2004 20:27:40 -0000
@@ -178,6 +178,7 @@ void e_webcal_query_user (const gchar *
ESourceGroup * group;
ESourceList * sources;
GSList * l;
+ SoupUri * suri;
sources = e_source_list_new_for_gconf_default ("/apps/evolution/calendar/sources");
@@ -276,7 +277,9 @@ void e_webcal_query_user (const gchar *
gtk_widget_show (vbox);
/* Name */
- mrkname = g_strdup_printf ("<b>%s</b>", name ? name : g_basename (caluri));
+ suri = soup_uri_new (caluri);
+ mrkname = g_strdup_printf ("<b>%s</b>", name ? name : g_basename (suri->path));
+ soup_uri_free (suri);
label = gtk_label_new (mrkname);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
g_free (mrkname);
Index: src/evolution-webcal-notify.h
===================================================================
RCS file: /cvs/gnome/evolution-webcal/src/evolution-webcal-notify.h,v
retrieving revision 1.2
diff -u -p -r1.2 evolution-webcal-notify.h
--- src/evolution-webcal-notify.h 18 Feb 2004 04:37:59 -0000 1.2
+++ src/evolution-webcal-notify.h 22 Mar 2004 20:27:40 -0000
@@ -25,6 +25,7 @@
#include <gnome.h>
#include <gtk/gtk.h>
#include <libgnomeui/gnome-icon-theme.h>
+#include <libsoup/soup.h>
void e_webcal_display_error (const gchar * title, const gchar * message,
GtkWidget * parent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]