aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/calendar-http
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/calendar-http')
-rw-r--r--plugins/calendar-http/ChangeLog11
-rw-r--r--plugins/calendar-http/calendar-http.c69
-rw-r--r--plugins/calendar-http/org-gnome-calendar-http.eplug.xml4
3 files changed, 84 insertions, 0 deletions
diff --git a/plugins/calendar-http/ChangeLog b/plugins/calendar-http/ChangeLog
index 16968f8182..839d2ca8fb 100644
--- a/plugins/calendar-http/ChangeLog
+++ b/plugins/calendar-http/ChangeLog
@@ -1,3 +1,14 @@
+2007-07-25 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #268162
+
+ * org-gnome-calendar-http.eplug.xml:
+ Added new entry for username.
+ * calendar-http.c: (e_calendar_http_auth):
+ Creates and setup entry for username.
+ * calendar-http.c: (username_changed):
+ New callback when user changes username entry content.
+
2007-03-20 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #419524
diff --git a/plugins/calendar-http/calendar-http.c b/plugins/calendar-http/calendar-http.c
index 755f13db2d..a8016e4dc2 100644
--- a/plugins/calendar-http/calendar-http.c
+++ b/plugins/calendar-http/calendar-http.c
@@ -40,6 +40,8 @@ GtkWidget *e_calendar_http_url (EPlugin *epl, EConfigHookItemFactoryData *data);
GtkWidget *e_calendar_http_refresh (EPlugin *epl, EConfigHookItemFactoryData *data);
gboolean e_calendar_http_check (EPlugin *epl, EConfigHookPageCheckData *data);
GtkWidget * e_calendar_http_secure (EPlugin *epl, EConfigHookItemFactoryData *data);
+GtkWidget *e_calendar_http_auth (EPlugin *epl, EConfigHookItemFactoryData *data);
+
static gchar *
print_uri_noproto (EUri *uri)
{
@@ -352,6 +354,73 @@ e_calendar_http_secure (EPlugin *epl, EConfigHookItemFactoryData *data)
return secure_setting;
}
+static void
+username_changed (GtkEntry *entry, ESource *source)
+{
+ const gchar *username;
+
+ username = gtk_entry_get_text (GTK_ENTRY (entry));
+
+ if (username && username[0]) {
+ e_source_set_property (source, "auth", "1");
+ e_source_set_property (source, "username", username);
+ } else {
+ e_source_set_property (source, "auth", NULL);
+ e_source_set_property (source, "username", NULL);
+ }
+}
+
+GtkWidget *
+e_calendar_http_auth (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+ static GtkWidget *label;
+ GtkWidget *entry, *parent;
+ int row;
+ ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target;
+ ESource *source = t->source;
+ EUri *uri;
+ char* uri_text;
+ static GtkWidget *hidden = NULL;
+
+ if (!hidden)
+ hidden = gtk_label_new ("");
+
+ if (data->old)
+ gtk_widget_destroy (label);
+
+ uri_text = e_source_get_uri (t->source);
+ uri = e_uri_new (uri_text);
+ g_free (uri_text);
+ if ((strcmp (uri->protocol, "http") &&
+ strcmp (uri->protocol, "https") &&
+ strcmp (uri->protocol, "webcal"))) {
+ e_uri_free (uri);
+ return hidden;
+ }
+ e_uri_free (uri);
+
+ parent = data->parent;
+
+ row = ((GtkTable*)parent)->nrows;
+
+ label = gtk_label_new_with_mnemonic (_("Userna_me:"));
+ gtk_widget_show (label);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+ gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, GTK_SHRINK, 0, 0);
+
+ uri_text = e_source_get_property (t->source, "username");
+
+ entry = gtk_entry_new ();
+ gtk_widget_show (entry);
+ gtk_entry_set_text (GTK_ENTRY (entry), uri_text ? uri_text : "");
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
+ g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (username_changed), t->source);
+
+ gtk_table_attach (GTK_TABLE (parent), entry, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+ return entry;
+}
+
gboolean
e_calendar_http_check (EPlugin *epl, EConfigHookPageCheckData *data)
{
diff --git a/plugins/calendar-http/org-gnome-calendar-http.eplug.xml b/plugins/calendar-http/org-gnome-calendar-http.eplug.xml
index 0d7e45b836..3d4f885aec 100644
--- a/plugins/calendar-http/org-gnome-calendar-http.eplug.xml
+++ b/plugins/calendar-http/org-gnome-calendar-http.eplug.xml
@@ -22,6 +22,10 @@
factory="e_calendar_http_secure"/>
<item
type="item_table"
+ path="00.general/00.source/51.auth"
+ factory="e_calendar_http_auth"/>
+ <item
+ type="item_table"
path="00.general/00.source/60.refresh"
factory="e_calendar_http_refresh"/>
</group>