X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-provider-picker.c;h=aef688c8b265eac09ebd168ae478c20d870929a8;hb=719b0c3a23ce0682122403d685dcedc1256a0549;hp=a8daf4c5a8ea0a7474d63715cec09723f979fd34;hpb=0f1fe981ed79b61b9b2d1abc2b5912e20caee50f;p=modest diff --git a/src/hildon2/modest-provider-picker.c b/src/hildon2/modest-provider-picker.c index a8daf4c..aef688c 100644 --- a/src/hildon2/modest-provider-picker.c +++ b/src/hildon2/modest-provider-picker.c @@ -136,7 +136,8 @@ modest_provider_picker_init (ModestProviderPicker *self) } ModestProviderPicker* -modest_provider_picker_new (void) +modest_provider_picker_new (HildonSizeType size, + HildonButtonArrangement arrangement) { ModestProviderPickerPrivate *priv; ModestProviderPicker *self; @@ -144,8 +145,8 @@ modest_provider_picker_new (void) GtkWidget *selector; self = g_object_new (MODEST_TYPE_PROVIDER_PICKER, - "arrangement", HILDON_BUTTON_ARRANGEMENT_VERTICAL, - "size", HILDON_SIZE_AUTO, + "arrangement", arrangement, + "size", size, NULL); priv = MODEST_PROVIDER_PICKER_GET_PRIVATE (self); @@ -239,24 +240,34 @@ modest_provider_picker_fill (ModestProviderPicker *self, registry = modest_runtime_get_protocol_registry (); provider_protos = modest_protocol_registry_get_by_tag (registry, MODEST_PROTOCOL_REGISTRY_PROVIDER_PROTOCOLS); - tmp = provider_protos; - while (tmp) { + for (tmp = provider_protos; tmp != NULL; tmp = g_slist_next (tmp)) { + GtkTreeIter iter; ModestProtocol *proto = MODEST_PROTOCOL (tmp->data); const gchar *name = modest_protocol_get_display_name (proto); /* only add store protocols, no need to duplicate them */ - if (modest_protocol_registry_protocol_type_has_tag (registry, - modest_protocol_get_type_id (proto), - MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS)) { - gtk_list_store_append (liststore, &iter); - gtk_list_store_set (liststore, &iter, - MODEL_COL_ID, modest_protocol_get_name (proto), - MODEL_COL_NAME, name, - MODEL_COL_ID_TYPE, MODEST_PROVIDER_PICKER_ID_PLUGIN_PROTOCOL, - -1); + if (!modest_protocol_registry_protocol_type_has_tag (registry, + modest_protocol_get_type_id (proto), + MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS)) + continue; + + if (modest_protocol_registry_protocol_type_has_tag + (registry, + modest_protocol_get_type_id (proto), + MODEST_PROTOCOL_REGISTRY_SINGLETON_PROVIDER_PROTOCOLS)) { + /* Check if there's already an account configured with this account type */ + if (modest_account_mgr_singleton_protocol_exists (modest_runtime_get_account_mgr (), + modest_protocol_get_type_id (proto))) + continue; } - tmp = g_slist_next (tmp); + + gtk_list_store_append (liststore, &iter); + gtk_list_store_set (liststore, &iter, + MODEL_COL_ID, modest_protocol_get_name (proto), + MODEL_COL_NAME, name, + MODEL_COL_ID_TYPE, MODEST_PROVIDER_PICKER_ID_PLUGIN_PROTOCOL, + -1); } g_slist_free (provider_protos);