Changeset 1784
- Timestamp:
- 04/13/07 02:01:38
- Files:
-
- trunk/libtinymail-acap/tny-acap-account-store.c (modified) (9 diffs)
- trunk/libtinymail-acap/tny-acap-account-store.h (modified) (1 diff)
- trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c (modified) (2 diffs)
- trunk/libtinymail-gpe/tny-gpe-account-store.c (modified) (2 diffs)
- trunk/libtinymail-maemo/tny-maemo-account-store.c (modified) (2 diffs)
- trunk/libtinymail-olpc/tny-olpc-account-store.c (modified) (2 diffs)
- trunk/libtinymail/tny-password-getter.c (modified) (2 diffs)
- trunk/libtinymail/tny-password-getter.h (modified) (2 diffs)
- trunk/libtinymailui-gnome-keyring (modified) (1 prop)
- trunk/libtinymailui-gnome-keyring/tny-gnome-keyring-password-getter.c (modified) (8 diffs)
- trunk/libtinymailui-gtk/tny-gtk-password-dialog.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-acap/tny-acap-account-store.c
r1783 r1784 23 23 #include <glib.h> 24 24 25 #include <tny-password-getter.h> 25 26 #include <tny-account-store.h> 26 27 #include <tny-acap-account-store.h> … … 38 39 { 39 40 TnyAccountStore *real; 41 TnyPasswordGetter *pwdgetter; 42 guint connchanged_signal; 40 43 }; 41 44 … … 69 72 70 73 74 75 static void 76 connection_changed (TnyDevice *device, gboolean online, gpointer user_data) 77 { 78 TnyAcapAccountStore *self; 79 80 /* TODO: sync journal! */ 81 } 82 83 71 84 static void 72 85 tny_acap_account_store_get_accounts (TnyAccountStore *self, TnyList *list, TnyGetAccountsRequestType types) 73 86 { 74 87 TnyAcapAccountStorePriv *priv = TNY_ACAP_ACCOUNT_STORE_GET_PRIVATE (self); 75 76 /* TODO: if online, sync local with remote */ 88 TnyDevice *device = tny_account_store_get_device (priv->real); 89 90 if (tny_device_is_online (device)) 91 { 92 gboolean cancel = FALSE; 93 const gchar *passw = tny_password_getter_get_password (priv->pwdgetter, 94 "ACAP", _("Give the password for your ACAP server"), &cancel); 95 96 if (!cancel) 97 g_print ("Using %s as password for ACAP\n", passw); 98 99 /* TODO: if online, sync local with remote. 100 Don't forget the journal! */ 101 } 102 103 g_object_unref (G_OBJECT (device)); 77 104 78 105 tny_account_store_get_accounts (self, list, types); … … 94 121 95 122 123 static void 124 add_account_journal (TnyAccountStore *self, TnyAccount *account, const gchar *type) 125 { 126 g_warning ("Not implemented\n"); 127 128 /* TODO: implement for ACAP */ 129 130 return; 131 } 96 132 97 133 static void … … 99 135 { 100 136 TnyAcapAccountStorePriv *priv = TNY_ACAP_ACCOUNT_STORE_GET_PRIVATE (self); 101 102 add_account_remote (self, TNY_ACCOUNT (account), "store"); 137 TnyDevice *device = tny_account_store_get_device (priv->real); 138 139 if (tny_device_is_online (device)) 140 add_account_remote (self, TNY_ACCOUNT (account), "store"); 141 else 142 add_account_journal (self, TNY_ACCOUNT (account), "store"); 143 144 g_object_unref (G_OBJECT (device)); 103 145 104 146 tny_account_store_add_store_account (priv->real, account); … … 111 153 { 112 154 TnyAcapAccountStorePriv *priv = TNY_ACAP_ACCOUNT_STORE_GET_PRIVATE (self); 113 114 add_account_remote (self, TNY_ACCOUNT (account), "transport"); 155 TnyDevice *device = tny_account_store_get_device (priv->real); 156 157 if (tny_device_is_online (device)) 158 add_account_remote (self, TNY_ACCOUNT (account), "transport"); 159 else 160 add_account_journal (self, TNY_ACCOUNT (account), "transport"); 161 162 g_object_unref (G_OBJECT (device)); 115 163 116 164 tny_account_store_add_transport_account (priv->real, account); … … 134 182 **/ 135 183 TnyAccountStore* 136 tny_acap_account_store_new (TnyAccountStore *real )184 tny_acap_account_store_new (TnyAccountStore *real, TnyPasswordGetter *pwdgetter) 137 185 { 138 186 TnyAcapAccountStore *self = g_object_new (TNY_TYPE_ACAP_ACCOUNT_STORE, NULL); 139 187 TnyAcapAccountStorePriv *priv = TNY_ACAP_ACCOUNT_STORE_GET_PRIVATE (self); 188 TnyDevice *device; 140 189 141 190 priv->real = TNY_ACCOUNT_STORE (g_object_ref (G_OBJECT (real))); 191 priv->pwdgetter = TNY_PASSWORD_GETTER (g_object_ref (G_OBJECT (pwdgetter))); 192 193 device = tny_account_store_get_device (priv->real); 194 priv->connchanged_signal = g_signal_connect ( 195 G_OBJECT (device), "connection_changed", 196 G_CALLBACK (connection_changed), self); 197 g_object_unref (G_OBJECT (device)); 142 198 143 199 return TNY_ACCOUNT_STORE (self); … … 151 207 152 208 priv->real = NULL; 209 priv->pwdgetter; 153 210 154 211 return; … … 161 218 { 162 219 TnyAcapAccountStorePriv *priv = TNY_ACAP_ACCOUNT_STORE_GET_PRIVATE (object); 163 220 TnyDevice *device; 221 222 device = tny_account_store_get_device (priv->real); 223 g_signal_handler_disconnect (G_OBJECT (device), 224 priv->connchanged_signal); 225 g_object_unref (G_OBJECT (device)); 164 226 165 227 if (priv->real) 166 228 g_object_unref (G_OBJECT (priv->real)); 229 230 if (priv->pwdgetter) 231 g_object_unref (G_OBJECT (priv->pwdgetter)); 167 232 168 233 (*parent_class->finalize) (object); trunk/libtinymail-acap/tny-acap-account-store.h
r1782 r1784 48 48 49 49 GType tny_acap_account_store_get_type (void); 50 TnyAccountStore* tny_acap_account_store_new (TnyAccountStore *real );50 TnyAccountStore* tny_acap_account_store_new (TnyAccountStore *real, TnyPasswordGetter *pwdgetter); 51 51 TnyAccountStore* tny_acap_account_store_get_real (TnyAcapAccountStore *self); 52 52 trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c
r1783 r1784 78 78 79 79 pwdgetter = tny_platform_factory_new_password_getter (platfact); 80 retval = (gchar*) tny_password_getter_get_password (pwdgetter, account, prompt, cancel); 80 retval = (gchar*) tny_password_getter_get_password (pwdgetter, 81 tny_account_get_id (account), prompt, cancel); 81 82 g_object_unref (G_OBJECT (pwdgetter)); 82 83 … … 92 93 93 94 pwdgetter = tny_platform_factory_new_password_getter (platfact); 94 tny_password_getter_forget_password (pwdgetter, account);95 tny_password_getter_forget_password (pwdgetter, tny_account_get_id (account)); 95 96 g_object_unref (G_OBJECT (pwdgetter)); 96 97 trunk/libtinymail-gpe/tny-gpe-account-store.c
r1783 r1784 76 76 77 77 pwdgetter = tny_platform_factory_new_password_getter (platfact); 78 retval = (gchar*) tny_password_getter_get_password (pwdgetter, account, prompt, cancel); 78 retval = (gchar*) tny_password_getter_get_password (pwdgetter, 79 tny_account_get_id (account), prompt, cancel); 79 80 g_object_unref (G_OBJECT (pwdgetter)); 80 81 … … 90 91 91 92 pwdgetter = tny_platform_factory_new_password_getter (platfact); 92 tny_password_getter_forget_password (pwdgetter, account);93 tny_password_getter_forget_password (pwdgetter, tny_account_get_id (account)); 93 94 g_object_unref (G_OBJECT (pwdgetter)); 94 95 trunk/libtinymail-maemo/tny-maemo-account-store.c
r1783 r1784 77 77 78 78 pwdgetter = tny_platform_factory_new_password_getter (platfact); 79 retval = (gchar*) tny_password_getter_get_password (pwdgetter, account, prompt, cancel); 79 retval = (gchar*) tny_password_getter_get_password (pwdgetter, 80 tny_account_get_id (account), prompt, cancel); 80 81 g_object_unref (G_OBJECT (pwdgetter)); 81 82 … … 91 92 92 93 pwdgetter = tny_platform_factory_new_password_getter (platfact); 93 tny_password_getter_forget_password (pwdgetter, account);94 tny_password_getter_forget_password (pwdgetter, tny_account_get_id (account)); 94 95 g_object_unref (G_OBJECT (pwdgetter)); 95 96 trunk/libtinymail-olpc/tny-olpc-account-store.c
r1783 r1784 74 74 75 75 pwdgetter = tny_platform_factory_new_password_getter (platfact); 76 retval = (gchar*) tny_password_getter_get_password (pwdgetter, account, prompt, cancel); 76 retval = (gchar*) tny_password_getter_get_password (pwdgetter, 77 tny_account_get_id (account), prompt, cancel); 77 78 g_object_unref (G_OBJECT (pwdgetter)); 78 79 … … 88 89 89 90 pwdgetter = tny_platform_factory_new_password_getter (platfact); 90 tny_password_getter_forget_password (pwdgetter, account);91 tny_password_getter_forget_password (pwdgetter, tny_account_get_id (account)); 91 92 g_object_unref (G_OBJECT (pwdgetter)); 92 93 trunk/libtinymail/tny-password-getter.c
r1783 r1784 38 38 **/ 39 39 const gchar * 40 tny_password_getter_get_password (TnyPasswordGetter *self, TnyAccount *account, const gchar *prompt, gboolean *cancel)40 tny_password_getter_get_password (TnyPasswordGetter *self, const gchar *aid, const gchar *prompt, gboolean *cancel) 41 41 { 42 42 #ifdef DBC /* require */ 43 43 g_assert (TNY_IS_PASSWORD_GETTER (self)); 44 g_assert (TNY_IS_ACCOUNT (account));45 44 g_assert (TNY_PASSWORD_GETTER_GET_IFACE (self)->get_password_func != NULL); 46 45 #endif 47 46 48 return TNY_PASSWORD_GETTER_GET_IFACE (self)->get_password_func (self, a ccount, prompt, cancel);47 return TNY_PASSWORD_GETTER_GET_IFACE (self)->get_password_func (self, aid, prompt, cancel); 49 48 } 50 49 … … 57 56 **/ 58 57 void 59 tny_password_getter_forget_password (TnyPasswordGetter *self, TnyAccount *account)58 tny_password_getter_forget_password (TnyPasswordGetter *self, const gchar *aid) 60 59 { 61 60 #ifdef DBC /* require */ 62 61 g_assert (TNY_IS_PASSWORD_GETTER (self)); 63 g_assert (TNY_IS_ACCOUNT (account));64 62 g_assert (TNY_PASSWORD_GETTER_GET_IFACE (self)->forget_password_func != NULL); 65 63 #endif 66 64 67 TNY_PASSWORD_GETTER_GET_IFACE (self)->forget_password_func (self, a ccount);65 TNY_PASSWORD_GETTER_GET_IFACE (self)->forget_password_func (self, aid); 68 66 69 67 return; trunk/libtinymail/tny-password-getter.h
r1783 r1784 43 43 GTypeInterface parent; 44 44 45 const gchar* (*get_password_func) (TnyPasswordGetter *self, TnyAccount *account, const gchar *prompt, gboolean *cancel);46 void (*forget_password_func) (TnyPasswordGetter *self, TnyAccount *account);45 const gchar* (*get_password_func) (TnyPasswordGetter *self, const gchar *aid, const gchar *prompt, gboolean *cancel); 46 void (*forget_password_func) (TnyPasswordGetter *self, const gchar *aid); 47 47 48 48 }; … … 51 51 52 52 53 const gchar* tny_password_getter_get_password (TnyPasswordGetter *self, TnyAccount *account, const gchar *prompt, gboolean *cancel);54 void tny_password_getter_forget_password (TnyPasswordGetter *self, TnyAccount *account);53 const gchar* tny_password_getter_get_password (TnyPasswordGetter *self, const gchar *aid, const gchar *prompt, gboolean *cancel); 54 void tny_password_getter_forget_password (TnyPasswordGetter *self, const gchar *aid); 55 55 56 56 G_END_DECLS trunk/libtinymailui-gnome-keyring
- Property svn:ignore set to libtinymailui-gnome-keyring.a Makefile.in config.h .deps Makefile .libs .svnignore stamp-h3
trunk/libtinymailui-gnome-keyring/tny-gnome-keyring-password-getter.c
r1783 r1784 22 22 #include <glib/gi18n-lib.h> 23 23 24 #include <tny-account.h>25 26 24 #include <tny-gnome-keyring-password-getter.h> 27 25 … … 29 27 30 28 static const gchar* 31 tny_gnome_keyring_password_getter_get_password (TnyPasswordGetter *self, TnyAccount *account, const gchar *prompt, gboolean *cancel)29 tny_gnome_keyring_password_getter_get_password (TnyPasswordGetter *self, const gchar *aid, const gchar *prompt, gboolean *cancel) 32 30 { 33 31 gchar *retval = NULL; … … 38 36 gnome_keyring_get_default_keyring_sync (&keyring); 39 37 40 keyringret = gnome_keyring_find_network_password_sync ( 41 tny_account_get_user (account), 42 "Mail", tny_account_get_hostname (account), 43 "password", tny_account_get_proto (account), 38 keyringret = gnome_keyring_find_network_password_sync (aid, "Mail", 39 aid /* hostname */, 40 "password", aid /* proto */, 44 41 "PLAIN", 0, &list); 45 42 … … 51 48 (gnome_password_dialog_new 52 49 (_("Enter password"), prompt, 53 tny_account_get_user (account),50 NULL, 54 51 NULL, TRUE)); 55 52 … … 57 54 gnome_password_dialog_set_remember (dialog, 58 55 GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER); 56 59 57 gnome_password_dialog_set_readonly_username (dialog, TRUE); 60 gnome_password_dialog_set_username (dialog,61 tny_account_get_user (account)); 58 /* gnome_password_dialog_set_username (dialog, 59 tny_account_get_user (account)); */ 62 60 63 61 gnome_password_dialog_set_show_username (dialog, FALSE); … … 81 79 { 82 80 gnome_keyring_set_network_password_sync (keyring, 83 tny_account_get_user (account),84 "Mail", tny_account_get_hostname (account),85 "password", tny_account_get_proto (account),81 aid /* user */, 82 "Mail", aid /* hostname */, 83 "password", aid /* proto */, 86 84 "PLAIN", 0, retval, &item_id); 87 85 } … … 111 109 112 110 static void 113 tny_gnome_keyring_password_getter_forget_password (TnyPasswordGetter *self, TnyAccount *account)111 tny_gnome_keyring_password_getter_forget_password (TnyPasswordGetter *self, const gchar *aid) 114 112 { 115 113 GList *list=NULL; … … 121 119 122 120 keyringret = gnome_keyring_find_network_password_sync ( 123 tny_account_get_user (account),124 "Mail", tny_account_get_hostname (account),125 "password", tny_account_get_proto (account),121 aid /* user */, 122 "Mail", aid /* hostname */, 123 "password", aid /* proto */, 126 124 "PLAIN", 0, &list); 127 125 trunk/libtinymailui-gtk/tny-gtk-password-dialog.c
r1783 r1784 47 47 48 48 static const gchar* 49 tny_gtk_password_dialog_get_password (TnyPasswordGetter *self, TnyAccount *account, const gchar *prompt, gboolean *cancel)49 tny_gtk_password_dialog_get_password (TnyPasswordGetter *self, const gchar *aid, const gchar *prompt, gboolean *cancel) 50 50 { 51 51 TnyGtkPasswordDialogPriv *priv = TNY_GTK_PASSWORD_DIALOG_GET_PRIVATE (self); 52 52 GtkDialog *dialog = (GtkDialog *) self; 53 const gchar *accountid ;53 const gchar *accountid = aid; 54 54 const gchar *retval = NULL; 55 56 accountid = tny_account_get_id (account);57 55 58 56 if (G_UNLIKELY (!passwords)) … … 85 83 86 84 static void 87 tny_gtk_password_dialog_forget_password (TnyPasswordGetter *self, TnyAccount *account)85 tny_gtk_password_dialog_forget_password (TnyPasswordGetter *self, const gchar *aid) 88 86 { 89 87 if (G_LIKELY (passwords)) 90 88 { 91 const gchar *accountid = tny_account_get_id (account);89 const gchar *accountid = aid; 92 90 93 91 gchar *pwd = g_hash_table_lookup (passwords, accountid);
