diff options
author | Sivaiah Nallagatla <siva@src.gnome.org> | 2004-12-24 02:04:56 +0800 |
---|---|---|
committer | Sivaiah Nallagatla <siva@src.gnome.org> | 2004-12-24 02:04:56 +0800 |
commit | 72e4f1181ba63747f0204ef6f019a265c25cb616 (patch) | |
tree | d310913888d3d137d690444bc77291827fe75f88 /addressbook | |
parent | 67dee2832ef29749a2cf1db70e87c5dc469a6576 (diff) | |
download | gsoc2013-evolution-72e4f1181ba63747f0204ef6f019a265c25cb616.tar.gz gsoc2013-evolution-72e4f1181ba63747f0204ef6f019a265c25cb616.tar.zst gsoc2013-evolution-72e4f1181ba63747f0204ef6f019a265c25cb616.zip |
Merge from offline brnach
svn path=/trunk/; revision=28194
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 26 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-config.c | 45 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 36 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 9 |
4 files changed, 104 insertions, 12 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index c8736f7bd7..3122294aef 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,29 @@ +2004-12-23 Sivaiah Nallagatla <snallagatla@novell.com> + + Part of merge from offline branch + + * gui/widgets/addresbook-config.c (eabc_general_offline) : + fix some compile warings + (offline_status_changed_cb) : set "0" instead of NULL + as e-source property when offline is not checked + +2004-11-23 Sivaiah Nallagatla <snallagatla@novell.com> + + Part of merge from offline brnach + + * gui/widgets/eab-gui-util.c (eab_load_error_dialog) : + added message which gets prompted when user tries + to access a book which is not available in offline mode + + * gui/component/addressbook-config.c (eabc_general_offline) + (offline_status_changed_cb) : added a new check box + to properties page to mark a book for offline usage + + * gui/component/addressbook.c (load_source_cb) : do no try to + authenticate in case of offline mode. + (auth_required_cb) : new call back which gets called + when backend sends notification for password to client + 2004-12-23 Hans Petter Jansson <hpj@novell.com> This is the last we see of ESelectNames. diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index 8c7fe03968..7ffe5f50ee 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -29,6 +29,7 @@ #include <gtk/gtkspinbutton.h> #include <gtk/gtkcelllayout.h> #include <gtk/gtklabel.h> +#include <gtk/gtk.h> #include <libgnome/gnome-i18n.h> #include <bonobo/bonobo-generic-factory.h> @@ -546,6 +547,16 @@ name_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog) e_source_set_name (sdialog->source, gtk_entry_get_text (GTK_ENTRY (sdialog->display_name))); } +static void +offline_status_changed_cb (GtkWidget *widget, AddressbookSourceDialog *sdialog) +{ + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) + e_source_set_property (sdialog->source, "offline_sync", "1"); + else + e_source_set_property (sdialog->source, "offline_sync", "0"); + +} + static GtkWidget * eabc_general_name(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) { @@ -553,6 +564,7 @@ eabc_general_name(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, str const char *uri; GtkWidget *w; GladeXML *gui; + if (old) return old; @@ -572,12 +584,41 @@ eabc_general_name(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, str gtk_widget_set_sensitive (GTK_WIDGET(sdialog->display_name), FALSE); } } - + g_object_unref(gui); return w; } + +static GtkWidget * +eabc_general_offline(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) +{ + AddressbookSourceDialog *sdialog = data; + GtkWidget *offline_setting; + const char *offline_sync; + int row; + gboolean is_local_book; + + is_local_book = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "file:"); + offline_sync = e_source_get_property (sdialog->source, "offline_sync"); + if (old) + return old; + else { + row = ((GtkTable*)parent)->nrows; + offline_setting = gtk_check_button_new_with_label (N_("Copy book content locally for offline operation")); + gtk_widget_show (offline_setting); + gtk_container_add (GTK_CONTAINER (parent), offline_setting); + g_signal_connect (offline_setting, "toggled", G_CALLBACK (offline_status_changed_cb), sdialog); + + } + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (offline_setting), (offline_sync && g_str_equal (offline_sync, "1")) ? TRUE : FALSE); + if (is_local_book) + gtk_widget_hide (offline_setting); + return offline_setting; + +} + #ifdef HAVE_LDAP static void url_changed(AddressbookSourceDialog *sdialog) @@ -622,6 +663,7 @@ ssl_optionmenu_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog) e_source_set_property (sdialog->source, "ssl", ldap_unparse_ssl (sdialog->ssl)); } + static GtkWidget * eabc_general_host(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) { @@ -862,6 +904,7 @@ static EConfigItem eabc_items[] = { { E_CONFIG_PAGE, "00.general", N_("General") }, { E_CONFIG_SECTION, "00.general/10.display", N_("Addressbook") }, { E_CONFIG_ITEM, "00.general/10.display/10.name", "hbox122", eabc_general_name }, + { E_CONFIG_ITEM, "00.general/10.display/20.offline", NULL, eabc_general_offline }, #ifdef HAVE_LDAP { E_CONFIG_SECTION, "00.general/20.server", N_("Server Information") }, { E_CONFIG_ITEM, "00.general/20.server/00.host", "table31", eabc_general_host }, diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index cbf908c17f..dbeccd75fc 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -120,7 +120,8 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure) } } - data->cb (book, status, data->closure); + if (data->cb) + data->cb (book, status, data->closure); free_load_source_data (data); } @@ -209,12 +210,28 @@ addressbook_authenticate (EBook *book, gboolean previous_failure, ESource *sourc } else { /* they hit cancel */ - cb (book, E_BOOK_ERROR_CANCELLED, closure); + + cb (book, E_BOOK_ERROR_CANCELLED, closure); } g_free (uri); } + + +static void +auth_required_cb (EBook *book, gpointer data) +{ + LoadSourceData *load_source_data = g_new0(LoadSourceData, 1); + + load_source_data->source = g_object_ref (g_object_ref (e_book_get_source (book))); + load_source_data->cancelled = FALSE; + addressbook_authenticate (book, FALSE, load_source_data->source, + load_source_auth_cb, load_source_data); + + + +} static void load_source_cb (EBook *book, EBookStatus status, gpointer closure) { @@ -229,17 +246,16 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure) const gchar *auth; auth = e_source_get_property (load_source_data->source, "auth"); - - /* check if the addressbook needs authentication */ - if (auth && strcmp (auth, "none")) { - addressbook_authenticate (book, FALSE, load_source_data->source, - load_source_auth_cb, closure); - - return; + g_signal_connect (book, "auth_required", auth_required_cb, NULL); + + if (e_book_is_online (book)) { + addressbook_authenticate (book, FALSE, load_source_data->source, + load_source_auth_cb, closure); + return; + } } } - load_source_data->cb (book, status, load_source_data->closure); free_load_source_data (load_source_data); } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index b6b092c5b1..24bbe248d4 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -86,7 +86,14 @@ eab_load_error_dialog (GtkWidget *parent, ESource *source, EBookStatus status) uri = e_source_get_uri (source); - if (!strncmp (uri, "file:", 5)) { + if (status == E_BOOK_ERROR_OFFLINE_UNAVAILABLE) { + label_string = _("We were unable to open this addressbook. This either means " + "this book is not marked for offline usage or not yet downloaded " + "for offline usage. Please load the addressbook once in online mode " + "to download its contents"); + } + + else if (!strncmp (uri, "file:", 5)) { label_string = _("We were unable to open this addressbook. Please check that the " "path exists and that you have permission to access it."); |