From: Jose Dapena Paz Date: Wed, 1 Oct 2008 09:51:31 +0000 (+0000) Subject: * Fixes to touch selector usage of new pickers. X-Git-Tag: git_migration_finished~1175 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=0f1fe981ed79b61b9b2d1abc2b5912e20caee50f * Fixes to touch selector usage of new pickers. * Added new servertype picker, replacing the old easysetup combobox. * Now we use the new servertype picker in settings wizard. pmo-trunk-r5834 --- diff --git a/src/hildon2/Makefile.am b/src/hildon2/Makefile.am index f184fd2..66a652a 100644 --- a/src/hildon2/Makefile.am +++ b/src/hildon2/Makefile.am @@ -54,7 +54,7 @@ libmodest_ui_la_SOURCES= \ modest-easysetup-wizard-dialog.h modest-easysetup-wizard-dialog.c \ modest-country-picker.h modest-country-picker.c \ modest-provider-picker.h modest-provider-picker.c \ - modest-easysetup-servertype-combo-box.h modest-easysetup-servertype-combo-box.c \ + modest-servertype-picker.h modest-servertype-picker.c \ modest-icon-names.h \ modest-maemo-global-settings-dialog.c \ modest-maemo-global-settings-dialog.h \ diff --git a/src/hildon2/modest-easysetup-servertype-combo-box.c b/src/hildon2/modest-easysetup-servertype-combo-box.c deleted file mode 100644 index ab54656..0000000 --- a/src/hildon2/modest-easysetup-servertype-combo-box.c +++ /dev/null @@ -1,276 +0,0 @@ -/* Copyright (c) 2006, Nokia Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the Nokia Corporation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "modest-easysetup-servertype-combo-box.h" -#include -#include -#include -#include - -#include -#include /* For memcpy() */ - -/* Include config.h so that _() works: */ -#ifdef HAVE_CONFIG_H -#include -#endif - -G_DEFINE_TYPE (EasysetupServertypeComboBox, easysetup_servertype_combo_box, GTK_TYPE_COMBO_BOX); - -#define SERVERTYPE_COMBO_BOX_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX, EasysetupServertypeComboBoxPrivate)) - -typedef struct _EasysetupServertypeComboBoxPrivate EasysetupServertypeComboBoxPrivate; - -struct _EasysetupServertypeComboBoxPrivate -{ - GtkTreeModel *model; -}; - -static void -easysetup_servertype_combo_box_get_property (GObject *object, guint property_id, - GValue *value, GParamSpec *pspec) -{ - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -easysetup_servertype_combo_box_set_property (GObject *object, guint property_id, - const GValue *value, GParamSpec *pspec) -{ - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -easysetup_servertype_combo_box_dispose (GObject *object) -{ - if (G_OBJECT_CLASS (easysetup_servertype_combo_box_parent_class)->dispose) - G_OBJECT_CLASS (easysetup_servertype_combo_box_parent_class)->dispose (object); -} - -static void -easysetup_servertype_combo_box_finalize (GObject *object) -{ - EasysetupServertypeComboBoxPrivate *priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (object); - - g_object_unref (G_OBJECT (priv->model)); - - G_OBJECT_CLASS (easysetup_servertype_combo_box_parent_class)->finalize (object); -} - -static void -easysetup_servertype_combo_box_class_init (EasysetupServertypeComboBoxClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (EasysetupServertypeComboBoxPrivate)); - - object_class->get_property = easysetup_servertype_combo_box_get_property; - object_class->set_property = easysetup_servertype_combo_box_set_property; - object_class->dispose = easysetup_servertype_combo_box_dispose; - object_class->finalize = easysetup_servertype_combo_box_finalize; -} - -enum MODEL_COLS { - MODEL_COL_NAME = 0, /* a string */ - MODEL_COL_ID = 1 /* an int. */ -}; - -static void -easysetup_servertype_combo_box_init (EasysetupServertypeComboBox *self) -{ - EasysetupServertypeComboBoxPrivate *priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (self); - - /* Create a tree model for the combo box, - * with a string for the name, and an ID for the servertype. - * This must match our MODEL_COLS enum constants. - */ - priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT)); - - /* Setup the combo box: */ - GtkComboBox *combobox = GTK_COMBO_BOX (self); - gtk_combo_box_set_model (combobox, priv->model); - - /* Servertype column: - * The ID model column in not shown in the view. */ - GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combobox), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, - "text", MODEL_COL_NAME, NULL); -} - -static void -easysetup_servertype_combo_box_fill (EasysetupServertypeComboBox *combobox, - gboolean filter_providers) -{ - EasysetupServertypeComboBoxPrivate *priv; - GtkListStore *liststore; - ModestProtocolRegistry *protocol_registry; - GSList *remote_protocols, *node; - GtkTreeIter iter; - - /* Remove any existing rows: */ - priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (combobox); - protocol_registry = modest_runtime_get_protocol_registry (); - remote_protocols = modest_protocol_registry_get_by_tag (protocol_registry, MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS); - - liststore = GTK_LIST_STORE (priv->model); - gtk_list_store_clear (liststore); - - for (node = remote_protocols; node != NULL; node = g_slist_next (node)) { - ModestProtocol* protocol; - gboolean add = TRUE; - - protocol = (ModestProtocol *) node->data; - - /* Do not include the protocols that would be listed - in the providers combo */ - if (filter_providers) - if (modest_protocol_registry_protocol_type_is_provider (protocol_registry, - modest_protocol_get_type_id (protocol))) { - add = FALSE; - } - - if (add) { - gtk_list_store_append (liststore, &iter); - gtk_list_store_set (liststore, &iter, - MODEL_COL_ID, - modest_protocol_get_type_id (protocol), - MODEL_COL_NAME, - modest_protocol_get_display_name (protocol), - -1); - } - } - - g_slist_free (remote_protocols); -} - -EasysetupServertypeComboBox* -easysetup_servertype_combo_box_new (gboolean filter_providers) -{ - EasysetupServertypeComboBox *combo; - - combo = g_object_new (EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX, NULL); - - /* Fill the combo */ - easysetup_servertype_combo_box_fill (combo, filter_providers); - - return combo; -} - -/** - * Returns the selected servertype, - * or MODEST_PROTOCOL_REGISTRY_TYPE_INVALID if no servertype was selected. - */ -ModestProtocolType -easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBox *combobox) -{ - GtkTreeIter active; - gboolean found; - - found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active); - if (found) { - EasysetupServertypeComboBoxPrivate *priv; - ModestProtocolType servertype; - - priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (combobox); - - servertype = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; - gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &servertype, -1); - return servertype; - } - - return MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; /* Failed. */ -} - -/* This allows us to pass more than one piece of data to the signal handler, - * and get a result: */ -typedef struct -{ - EasysetupServertypeComboBox* self; - ModestProtocolType id; - gboolean found; -} ForEachData; - -static gboolean -on_model_foreach_select_id(GtkTreeModel *model, - GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) -{ - ModestProtocolType id = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; - ForEachData *state = (ForEachData*)(user_data); - - /* Select the item if it has the matching ID: */ - gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1); - if(id == state->id) { - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (state->self), iter); - - state->found = TRUE; - return TRUE; /* Stop walking the tree. */ - } - - return FALSE; /* Keep walking the tree. */ -} - -/** - * Selects the specified servertype, - * or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN if no servertype was selected. - */ -gboolean -easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestProtocolType servertype) -{ - EasysetupServertypeComboBoxPrivate *priv; - ForEachData *state; - gboolean result; - - priv = SERVERTYPE_COMBO_BOX_GET_PRIVATE (combobox); - - /* Create a state instance so we can send two items of data to the signal handler: */ - state = g_new0 (ForEachData, 1); - state->self = combobox; - state->id = servertype; - state->found = FALSE; - - /* Look at each item, and select the one with the correct ID: */ - gtk_tree_model_foreach (priv->model, &on_model_foreach_select_id, state); - - result = state->found; - - /* Free the state instance: */ - g_free(state); - - return result; -} - diff --git a/src/hildon2/modest-easysetup-servertype-combo-box.h b/src/hildon2/modest-easysetup-servertype-combo-box.h deleted file mode 100644 index bb7a6b4..0000000 --- a/src/hildon2/modest-easysetup-servertype-combo-box.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2006, Nokia Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the Nokia Corporation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _EASYSETUP_SERVERTYPE_COMBO_BOX -#define _EASYSETUP_SERVERTYPE_COMBO_BOX - -#include -#include "modest-protocol-registry.h" - -G_BEGIN_DECLS - -#define EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX easysetup_servertype_combo_box_get_type() - -#define EASYSETUP_SERVERTYPE_COMBO_BOX(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX, EasysetupServertypeComboBox)) - -#define EASYSETUP_SERVERTYPE_COMBO_BOX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX, EasysetupServertypeComboBoxClass)) - -#define EASYSETUP_IS_SERVERTYPE_COMBO_BOX(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX)) - -#define EASYSETUP_IS_SERVERTYPE_COMBO_BOX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX)) - -#define EASYSETUP_SERVERTYPE_COMBO_BOX_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - EASYSETUP_TYPE_SERVERTYPE_COMBO_BOX, EasysetupServertypeComboBoxClass)) - -typedef struct { - GtkComboBox parent; -} EasysetupServertypeComboBox; - -typedef struct { - GtkComboBoxClass parent_class; -} EasysetupServertypeComboBoxClass; - -GType easysetup_servertype_combo_box_get_type (void); - -EasysetupServertypeComboBox* easysetup_servertype_combo_box_new (gboolean filter_providers); - -ModestProtocolType easysetup_servertype_combo_box_get_active_servertype (EasysetupServertypeComboBox *combobox); - -gboolean easysetup_servertype_combo_box_set_active_servertype (EasysetupServertypeComboBox *combobox, ModestProtocolType servertype); - - -G_END_DECLS - -#endif /* _EASYSETUP_PROVIDER_COMBO_BOX */ diff --git a/src/hildon2/modest-easysetup-wizard-dialog.c b/src/hildon2/modest-easysetup-wizard-dialog.c index 3c98895..98961c3 100644 --- a/src/hildon2/modest-easysetup-wizard-dialog.c +++ b/src/hildon2/modest-easysetup-wizard-dialog.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -42,7 +41,7 @@ #include #include "modest-country-picker.h" #include "modest-provider-picker.h" -#include "modest-easysetup-servertype-combo-box.h" +#include "modest-servertype-picker.h" #include "widgets/modest-validating-entry.h" #include "modest-text-utils.h" #include "modest-conf.h" @@ -116,7 +115,7 @@ struct _ModestEasysetupWizardDialogPrivate GtkWidget *page_complete_easysetup; GtkWidget *page_custom_incoming; - GtkWidget *combo_incoming_servertype; + GtkWidget *incoming_servertype_picker; GtkWidget *caption_incoming; GtkWidget *entry_incomingserver; @@ -126,8 +125,6 @@ struct _ModestEasysetupWizardDialogPrivate GtkWidget *page_custom_outgoing; GtkWidget *entry_outgoingserver; - GtkWidget *combo_outgoing_security; - GtkWidget *combo_outgoing_auth; GtkWidget *checkbox_outgoing_smtp_specific; GtkWidget *button_outgoing_smtp_servers; @@ -193,7 +190,7 @@ create_subsequent_easysetup_pages (ModestEasysetupWizardDialog *self); static void set_default_custom_servernames(ModestEasysetupWizardDialog *dialog); -static void on_combo_servertype_changed(GtkComboBox *combobox, gpointer user_data); +static void on_servertype_selector_changed(HildonTouchSelector *selector, gint column, gpointer user_data); static gint get_port_from_protocol (ModestProtocolType server_type, @@ -322,7 +319,7 @@ on_account_country_selector_changed (HildonTouchSelector *widget, gint column, g priv->dirty = TRUE; - /* Fill the providers combo, based on the selected country: */ + /* Fill the providers picker, based on the selected country: */ if (priv->presets != NULL) { gint mcc = modest_country_picker_get_active_country_mcc ( MODEST_COUNTRY_PICKER (priv->account_country_picker)); @@ -332,7 +329,7 @@ on_account_country_selector_changed (HildonTouchSelector *widget, gint column, g } static void -on_account_serviceprovider_selector_changed (GtkComboBox *widget, gint column, gpointer user_data) +on_account_serviceprovider_selector_changed (HildonTouchSelector *widget, gint column, gpointer user_data) { ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); g_assert(self); @@ -392,12 +389,6 @@ create_page_account_details (ModestEasysetupWizardDialog *self) gtk_box_pack_start (GTK_BOX (box), priv->account_country_picker, FALSE, FALSE, MODEST_MARGIN_HALF); gtk_widget_show (priv->account_country_picker); - /* connect to country combo's changed signal, so we can fill the provider picker: */ - g_signal_connect (G_OBJECT (hildon_picker_button_get_selector - (HILDON_PICKER_BUTTON (priv->account_country_picker))), - "changed", - G_CALLBACK (on_account_country_selector_changed), self); - GtkWidget *separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, MODEST_MARGIN_HALF); gtk_widget_show (separator); @@ -410,12 +401,6 @@ create_page_account_details (ModestEasysetupWizardDialog *self) gtk_box_pack_start (GTK_BOX (box), priv->account_serviceprovider_picker, FALSE, FALSE, MODEST_MARGIN_HALF); gtk_widget_show (priv->account_serviceprovider_picker); - /* connect to providers combo's changed signal, so we can fill the email address: */ - g_signal_connect (G_OBJECT (hildon_picker_button_get_selector - (HILDON_PICKER_BUTTON (priv->account_serviceprovider_picker))), - "changed", - G_CALLBACK (on_account_serviceprovider_selector_changed), self); - /* The description widgets: */ priv->entry_account_title = GTK_WIDGET (modest_validating_entry_new ()); g_signal_connect(G_OBJECT(priv->entry_account_title), "changed", @@ -625,8 +610,8 @@ update_incoming_server_title (ModestEasysetupWizardDialog *self) priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE(self); protocol_registry = modest_runtime_get_protocol_registry (); - protocol_type = easysetup_servertype_combo_box_get_active_servertype ( - EASYSETUP_SERVERTYPE_COMBO_BOX (priv->combo_incoming_servertype)); + protocol_type = modest_servertype_picker_get_active_servertype ( + MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker)); /* This could happen when the combo box has still no active iter */ if (protocol_type != MODEST_PROTOCOL_REGISTRY_TYPE_INVALID) { @@ -648,14 +633,14 @@ static void update_incoming_server_security_choices (ModestEasysetupWizardDialog *self) { ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE(self); - EasysetupServertypeComboBox *server_type_combo; + ModestServertypePicker *server_type_picker; ModestProtocolType protocol_type; ModestSecurityOptionsView *view; - server_type_combo = - EASYSETUP_SERVERTYPE_COMBO_BOX (priv->combo_incoming_servertype); + server_type_picker = + MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker); protocol_type = - easysetup_servertype_combo_box_get_active_servertype (server_type_combo); + modest_servertype_picker_get_active_servertype (server_type_picker); /* Fill the combo with appropriately titled choices for all those protocols */ @@ -664,11 +649,11 @@ update_incoming_server_security_choices (ModestEasysetupWizardDialog *self) } static void -on_combo_servertype_changed(GtkComboBox *combobox, gpointer user_data) +on_servertype_selector_changed(HildonTouchSelector *selector, gint column, gpointer user_data) { ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE(self); - EasysetupServertypeComboBox *combo; + ModestServertypePicker *picker; ModestProtocolType protocol_type; priv->dirty = TRUE; @@ -677,8 +662,8 @@ on_combo_servertype_changed(GtkComboBox *combobox, gpointer user_data) update_incoming_server_title (self); /* Update security options if needed */ - combo = EASYSETUP_SERVERTYPE_COMBO_BOX (combobox); - protocol_type = easysetup_servertype_combo_box_get_active_servertype (combo); + picker = MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker); + protocol_type = modest_servertype_picker_get_active_servertype (picker); update_incoming_server_security_choices (self); gtk_widget_show (priv->incoming_security); @@ -703,7 +688,6 @@ create_page_custom_incoming (ModestEasysetupWizardDialog *self) GtkWidget *scrolled_window; GtkWidget *label; GtkSizeGroup *sizegroup; - GtkWidget *caption; priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE(self); protocol_registry = modest_runtime_get_protocol_registry (); @@ -728,12 +712,12 @@ create_page_custom_incoming (ModestEasysetupWizardDialog *self) sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); /* The incoming server widgets: */ - priv->combo_incoming_servertype = GTK_WIDGET (easysetup_servertype_combo_box_new (TRUE)); - caption = create_caption_new_with_asterisk (self, sizegroup, - _("mcen_li_emailsetup_type"), priv->combo_incoming_servertype, NULL, HILDON_CAPTION_MANDATORY); - gtk_widget_show (priv->combo_incoming_servertype); - gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF); - gtk_widget_show (caption); + priv->incoming_servertype_picker = GTK_WIDGET (modest_servertype_picker_new (TRUE)); + hildon_button_set_title (HILDON_BUTTON (priv->incoming_servertype_picker), _("mcen_li_emailsetup_type")); + g_signal_connect (G_OBJECT (priv->incoming_servertype_picker), "value-changed", + G_CALLBACK (on_picker_button_value_changed), self); + gtk_box_pack_start (GTK_BOX (box), priv->incoming_servertype_picker, FALSE, FALSE, MODEST_MARGIN_HALF); + gtk_widget_show (priv->incoming_servertype_picker); priv->entry_incomingserver = gtk_entry_new (); g_signal_connect(G_OBJECT(priv->entry_incomingserver), "changed", G_CALLBACK(on_easysetup_changed), self); @@ -755,8 +739,9 @@ create_page_custom_incoming (ModestEasysetupWizardDialog *self) /* Change the caption title when the servertype changes, * as in the UI spec: */ - g_signal_connect (G_OBJECT (priv->combo_incoming_servertype), "changed", - G_CALLBACK (on_combo_servertype_changed), self); + g_signal_connect (G_OBJECT (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (priv->incoming_servertype_picker))), + "changed", + G_CALLBACK (on_servertype_selector_changed), self); /* Remember when the servername was changed manually: */ g_signal_connect (G_OBJECT (priv->entry_incomingserver), "changed", @@ -771,8 +756,8 @@ create_page_custom_incoming (ModestEasysetupWizardDialog *self) FALSE, FALSE, MODEST_MARGIN_HALF); /* Set default selection */ - easysetup_servertype_combo_box_set_active_servertype ( - EASYSETUP_SERVERTYPE_COMBO_BOX (priv->combo_incoming_servertype), + modest_servertype_picker_set_active_servertype ( + MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker), MODEST_PROTOCOLS_STORE_POP); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), box); @@ -1039,6 +1024,12 @@ presets_idle (gpointer userdata) /* Fill the combo in an idle call, as it takes a lot of time */ modest_country_picker_load_data( MODEST_COUNTRY_PICKER (priv->account_country_picker)); + /* connect to country picker's changed signal, so we can fill the provider picker: */ + g_signal_connect (G_OBJECT (hildon_picker_button_get_selector + (HILDON_PICKER_BUTTON (priv->account_country_picker))), + "changed", + G_CALLBACK (on_account_country_selector_changed), self); + modest_country_picker_set_active_country_locale ( MODEST_COUNTRY_PICKER (priv->account_country_picker)); mcc = modest_country_picker_get_active_country_mcc ( @@ -1046,6 +1037,12 @@ presets_idle (gpointer userdata) modest_provider_picker_fill ( MODEST_PROVIDER_PICKER (priv->account_serviceprovider_picker), priv->presets, mcc); + /* connect to providers picker's changed signal, so we can fill the email address: */ + g_signal_connect (G_OBJECT (hildon_picker_button_get_selector + (HILDON_PICKER_BUTTON (priv->account_serviceprovider_picker))), + "changed", + G_CALLBACK (on_account_serviceprovider_selector_changed), self); + modest_provider_picker_set_others_provider (MODEST_PROVIDER_PICKER (priv->account_serviceprovider_picker)); } @@ -1123,7 +1120,7 @@ static void init_incoming_page (ModestEasysetupWizardDialogPrivate *priv) { priv->page_custom_incoming = NULL; - priv->combo_incoming_servertype = NULL; + priv->incoming_servertype_picker = NULL; priv->caption_incoming = NULL; priv->entry_incomingserver = NULL; priv->entry_user_email = NULL; @@ -1135,8 +1132,6 @@ init_outgoing_page (ModestEasysetupWizardDialogPrivate *priv) { priv->page_custom_outgoing = NULL; priv->entry_outgoingserver = NULL; - priv->combo_outgoing_security = NULL; - priv->combo_outgoing_auth = NULL; priv->checkbox_outgoing_smtp_specific = NULL; priv->button_outgoing_smtp_servers = NULL; priv->outgoing_security = NULL; @@ -1506,8 +1501,8 @@ set_default_custom_servernames (ModestEasysetupWizardDialog *self) */ if (priv->entry_user_email && ((priv->server_changes & MODEST_EASYSETUP_WIZARD_DIALOG_INCOMING_CHANGED) == 0)) { - const ModestProtocolType protocol_type = easysetup_servertype_combo_box_get_active_servertype ( - EASYSETUP_SERVERTYPE_COMBO_BOX (priv->combo_incoming_servertype)); + const ModestProtocolType protocol_type = modest_servertype_picker_get_active_servertype ( + MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker)); /* This could happen when the combo box has still no active iter */ if (protocol_type != MODEST_PROTOCOL_REGISTRY_TYPE_INVALID) { @@ -1898,8 +1893,8 @@ save_to_settings (ModestEasysetupWizardDialog *self) } else { /* Use custom pages because no preset was specified: */ store_hostname = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry_incomingserver) )); - store_protocol = easysetup_servertype_combo_box_get_active_servertype ( - EASYSETUP_SERVERTYPE_COMBO_BOX (priv->combo_incoming_servertype)); + store_protocol = modest_servertype_picker_get_active_servertype ( + MODEST_SERVERTYPE_PICKER (priv->incoming_servertype_picker)); modest_security_options_view_save_settings ( MODEST_SECURITY_OPTIONS_VIEW (priv->incoming_security), diff --git a/src/hildon2/modest-maemo-security-options-view.c b/src/hildon2/modest-maemo-security-options-view.c index 5d7dbde..0090aa4 100644 --- a/src/hildon2/modest-maemo-security-options-view.c +++ b/src/hildon2/modest-maemo-security-options-view.c @@ -37,7 +37,6 @@ #include "widgets/modest-validating-entry.h" #include "widgets/modest-serversecurity-combo-box.h" #include "widgets/modest-secureauth-combo-box.h" -#include "modest-easysetup-servertype-combo-box.h" #ifdef MODEST_HAVE_HILDON0_WIDGETS #include #include @@ -49,15 +48,6 @@ #define PORT_MIN 1 #define PORT_MAX 65535 -typedef struct _ModestMaemoSecurityOptionsViewPrivate ModestMaemoSecurityOptionsViewPrivate; -struct _ModestMaemoSecurityOptionsViewPrivate { -}; - -#define MODEST_MAEMO_SECURITY_OPTIONS_VIEW_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), \ - MODEST_TYPE_MAEMO_SECURITY_OPTIONS_VIEW, \ - ModestMaemoSecurityOptionsViewPrivate)) - static void modest_maemo_security_options_view_init (ModestMaemoSecurityOptionsView *obj); static void modest_maemo_security_options_view_finalize (GObject *obj); static void modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewClass *klass); @@ -476,7 +466,6 @@ modest_maemo_security_options_view_class_init (ModestMaemoSecurityOptionsViewCla modest_maemo_security_options_view_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (gobject_class, sizeof (ModestMaemoSecurityOptionsViewPrivate)); gobject_class->finalize = modest_maemo_security_options_view_finalize; MODEST_SECURITY_OPTIONS_VIEW_CLASS (klass)->load_settings = diff --git a/src/hildon2/modest-provider-picker.c b/src/hildon2/modest-provider-picker.c index f5763e4..a8daf4c 100644 --- a/src/hildon2/modest-provider-picker.c +++ b/src/hildon2/modest-provider-picker.c @@ -336,7 +336,7 @@ modest_provider_picker_get_active_id_type (ModestProviderPicker *self) selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON(self))); - if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (self), 0, &active)) { + if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &active)) { ModestProviderPickerPrivate *priv = MODEST_PROVIDER_PICKER_GET_PRIVATE (self); ModestProviderPickerIdType id_type; diff --git a/src/hildon2/modest-selector-picker.c b/src/hildon2/modest-selector-picker.c index 5fb4d86..7011653 100644 --- a/src/hildon2/modest-selector-picker.c +++ b/src/hildon2/modest-selector-picker.c @@ -198,8 +198,9 @@ modest_selector_picker_new (ModestPairList *pairs, GEqualFunc id_equal_func) GtkWidget *selector; selector = create_touch_selector (model); - gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter); - hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, &iter, TRUE); + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) { + hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, &iter, TRUE); + } g_object_unref (model); hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (obj), HILDON_TOUCH_SELECTOR (selector)); diff --git a/src/hildon2/modest-servertype-picker.c b/src/hildon2/modest-servertype-picker.c new file mode 100644 index 0000000..b7dd05b --- /dev/null +++ b/src/hildon2/modest-servertype-picker.c @@ -0,0 +1,286 @@ +/* Copyright (c) 2006, 2008 Nokia Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Nokia Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "modest-servertype-picker.h" +#include +#include +#include +#include + +#include +#include /* For memcpy() */ + +/* Include config.h so that _() works: */ +#ifdef HAVE_CONFIG_H +#include +#endif + +G_DEFINE_TYPE (ModestServertypePicker, modest_servertype_picker, HILDON_TYPE_PICKER_BUTTON); + +#define MODEST_SERVERTYPE_PICKER_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_SERVERTYPE_PICKER, ModestServertypePickerPrivate)) + +typedef struct _ModestServertypePickerPrivate ModestServertypePickerPrivate; + +struct _ModestServertypePickerPrivate +{ + GtkTreeModel *model; +}; + +static void +modest_servertype_picker_finalize (GObject *object) +{ + ModestServertypePickerPrivate *priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (object); + + g_object_unref (G_OBJECT (priv->model)); + + G_OBJECT_CLASS (modest_servertype_picker_parent_class)->finalize (object); +} + +static void +modest_servertype_picker_class_init (ModestServertypePickerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (ModestServertypePickerPrivate)); + + object_class->finalize = modest_servertype_picker_finalize; +} + +enum MODEL_COLS { + MODEL_COL_NAME = 0, /* a string */ + MODEL_COL_ID = 1 /* an int. */ +}; + +static void +modest_servertype_picker_init (ModestServertypePicker *self) +{ + ModestServertypePickerPrivate *priv; + + priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (self); + priv->model = NULL; + +} + +static gchar * +touch_selector_print_func (HildonTouchSelector *selector) +{ + GtkTreeIter iter; + if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &iter)) { + GtkTreeModel *model; + GValue value = {0,}; + + model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0); + gtk_tree_model_get_value (model, &iter, MODEL_COL_NAME, &value); + return g_value_dup_string (&value); + } + return NULL; +} + + +static void +modest_servertype_picker_fill (ModestServertypePicker *self, + gboolean filter_providers) +{ + ModestServertypePickerPrivate *priv; + GtkListStore *liststore; + ModestProtocolRegistry *protocol_registry; + GSList *remote_protocols, *node; + GtkTreeIter iter; + GtkWidget *selector; + + /* Remove any existing rows: */ + priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (self); + protocol_registry = modest_runtime_get_protocol_registry (); + remote_protocols = modest_protocol_registry_get_by_tag (protocol_registry, MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS); + + liststore = GTK_LIST_STORE (priv->model); + gtk_list_store_clear (liststore); + + for (node = remote_protocols; node != NULL; node = g_slist_next (node)) { + ModestProtocol* protocol; + gboolean add = TRUE; + + protocol = (ModestProtocol *) node->data; + + /* Do not include the protocols that would be listed + in the providers combo */ + if (filter_providers) + if (modest_protocol_registry_protocol_type_is_provider (protocol_registry, + modest_protocol_get_type_id (protocol))) { + add = FALSE; + } + + if (add) { + gtk_list_store_append (liststore, &iter); + gtk_list_store_set (liststore, &iter, + MODEL_COL_ID, + modest_protocol_get_type_id (protocol), + MODEL_COL_NAME, + modest_protocol_get_display_name (protocol), + -1); + } + } + + g_slist_free (remote_protocols); + + /* Choose first in list */ + selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (self))); + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->model), &iter)) { + hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, &iter, TRUE); + } +} + +ModestServertypePicker* +modest_servertype_picker_new (gboolean filter_providers) +{ + ModestServertypePicker *self; + ModestServertypePickerPrivate *priv; + GtkCellRenderer *renderer; + GtkWidget *selector; + + self = g_object_new (MODEST_TYPE_SERVERTYPE_PICKER, + "arrangement", HILDON_BUTTON_ARRANGEMENT_VERTICAL, + "size", HILDON_SIZE_AUTO, + NULL); + priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (self); + + /* Create a tree model, + * with a string for the name, and an ID for the servertype. + * This must match our MODEL_COLS enum constants. + */ + priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT)); + renderer = gtk_cell_renderer_text_new (); + g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); + + selector = hildon_touch_selector_new (); + hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (priv->model), + renderer, "text", MODEL_COL_NAME, NULL); + + hildon_touch_selector_set_model (HILDON_TOUCH_SELECTOR (selector), 0, GTK_TREE_MODEL (priv->model)); + hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector), touch_selector_print_func); + + hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector)); + + /* Fill the model */ + modest_servertype_picker_fill (self, filter_providers); + + return self; +} + +/** + * Returns the selected servertype, + * or MODEST_PROTOCOL_REGISTRY_TYPE_INVALID if no servertype was selected. + */ +ModestProtocolType +modest_servertype_picker_get_active_servertype (ModestServertypePicker *self) +{ + GtkTreeIter active; + gboolean found; + GtkWidget *selector; + + selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (self))); + found = hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &active); + if (found) { + ModestServertypePickerPrivate *priv; + ModestProtocolType servertype; + + priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (self); + + servertype = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; + gtk_tree_model_get (priv->model, &active, MODEL_COL_ID, &servertype, -1); + return servertype; + } + + return MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; /* Failed. */ +} + +/* This allows us to pass more than one piece of data to the signal handler, + * and get a result: */ +typedef struct +{ + ModestServertypePicker* self; + ModestProtocolType id; + gboolean found; +} ForEachData; + +static gboolean +on_model_foreach_select_id(GtkTreeModel *model, + GtkTreePath *path, GtkTreeIter *iter, gpointer user_data) +{ + ModestProtocolType id = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID; + ForEachData *state = (ForEachData*)(user_data); + GtkWidget *selector; + + /* Select the item if it has the matching ID: */ + gtk_tree_model_get (model, iter, MODEL_COL_ID, &id, -1); + if(id == state->id) { + selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (state->self))); + hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, iter, TRUE); + hildon_button_set_value (HILDON_BUTTON (state->self), + hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector))); + + state->found = TRUE; + return TRUE; /* Stop walking the tree. */ + } + + return FALSE; /* Keep walking the tree. */ +} + +/** + * Selects the specified servertype, + * or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN if no servertype was selected. + */ +gboolean +modest_servertype_picker_set_active_servertype (ModestServertypePicker *picker, ModestProtocolType servertype) +{ + ModestServertypePickerPrivate *priv; + ForEachData *state; + gboolean result; + + priv = MODEST_SERVERTYPE_PICKER_GET_PRIVATE (picker); + + /* Create a state instance so we can send two items of data to the signal handler: */ + state = g_new0 (ForEachData, 1); + state->self = picker; + state->id = servertype; + state->found = FALSE; + + /* Look at each item, and select the one with the correct ID: */ + gtk_tree_model_foreach (priv->model, &on_model_foreach_select_id, state); + + result = state->found; + + /* Free the state instance: */ + g_free(state); + + return result; +} + diff --git a/src/hildon2/modest-servertype-picker.h b/src/hildon2/modest-servertype-picker.h new file mode 100644 index 0000000..b8ea73a --- /dev/null +++ b/src/hildon2/modest-servertype-picker.h @@ -0,0 +1,79 @@ +/* Copyright (c) 2006, 2008 Nokia Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Nokia Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MODEST_SERVERTYPE_PICKER +#define _MODEST_SERVERTYPE_PICKER + +#include +#include "modest-protocol-registry.h" + +G_BEGIN_DECLS + +#define MODEST_TYPE_SERVERTYPE_PICKER modest_servertype_picker_get_type() + +#define MODEST_SERVERTYPE_PICKER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + MODEST_TYPE_SERVERTYPE_PICKER, ModestServertypePicker)) + +#define MODEST_SERVERTYPE_PICKER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + MODEST_TYPE_SERVERTYPE_PICKER, ModestServertypePickerClass)) + +#define MODEST_IS_SERVERTYPE_PICKER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + MODEST_TYPE_SERVERTYPE_PICKER)) + +#define MODEST_IS_SERVERTYPE_PICKER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + MODEST_TYPE_SERVERTYPE_PICKER)) + +#define MODEST_SERVERTYPE_PICKER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + MODEST_TYPE_SERVERTYPE_PICKER, ModestServertypePickerClass)) + +typedef struct { + HildonPickerButton parent; +} ModestServertypePicker; + +typedef struct { + HildonPickerButtonClass parent_class; +} ModestServertypePickerClass; + +GType modest_servertype_picker_get_type (void); + +ModestServertypePicker* modest_servertype_picker_new (gboolean filter_providers); + +ModestProtocolType modest_servertype_picker_get_active_servertype (ModestServertypePicker *picker); + +gboolean modest_servertype_picker_set_active_servertype (ModestServertypePicker *picker, ModestProtocolType servertype); + + +G_END_DECLS + +#endif /* _MODEST_SERVERTYPE_PICKER */