* strictly, we should sort providers with mcc=0 after the other ones.... but, we don't have
* that info here, so ignoring for now.
*/
-gint
+static gint
provider_sort_func (GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer user_data)
{
gchar *prov1, *prov2;
easysetup_provider_combo_box_fill (EasysetupProviderComboBox *combobox, ModestPresets *presets,
gint mcc)
{
+ g_return_if_fail (EASYSETUP_IS_PROVIDER_COMBO_BOX(combobox));
+
EasysetupProviderComboBoxPrivate *priv = PROVIDER_COMBO_BOX_GET_PRIVATE (combobox);
/* Remove any existing rows: */
while(iter_provider_names && *iter_provider_names && iter_provider_ids && *iter_provider_ids) {
const gchar* provider_name = *iter_provider_names;
const gchar* provider_id = *iter_provider_ids;
-
+
/* Prevent duplicate providers: */
if (g_slist_find_custom (provider_ids_used_already,
provider_id, (GCompareFunc)strcmp) == NULL) {
provider_ids_used_already = g_slist_prepend (
provider_ids_used_already, (gpointer)g_strdup (provider_id));
}
-
- ++iter_provider_names;
- ++iter_provider_ids;
- }
-
+
+ ++iter_provider_names;
+ ++iter_provider_ids;
+ }
+
/* Free the result of modest_presets_get_providers()
* as specified by its documentation: */
g_strfreev (provider_names);
/* TODO: We need a Logical ID for this text. */
GtkTreeIter iter;
gtk_list_store_prepend (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_ID, 0, MODEL_COL_NAME, _("mcen_va_serviceprovider_other"),
+ gtk_list_store_set (liststore, &iter,
+ MODEL_COL_ID, 0,
+ MODEL_COL_NAME, _("mcen_va_serviceprovider_other"),
-1);
/* Select the "Other" item: */
easysetup_provider_combo_box_get_active_provider_id (EasysetupProviderComboBox *combobox)
{
GtkTreeIter active;
+
+ g_return_val_if_fail (EASYSETUP_IS_PROVIDER_COMBO_BOX(combobox), NULL);
+
const gboolean found = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &active);
if (found) {
EasysetupProviderComboBoxPrivate *priv = PROVIDER_COMBO_BOX_GET_PRIVATE (combobox);
return NULL; /* Failed. */
}
+
+void
+easysetup_provider_combo_box_set_others_provider (EasysetupProviderComboBox *combobox)
+{
+ GtkTreeModel *model;
+ GtkTreeIter others_iter;
+
+ g_return_if_fail (EASYSETUP_IS_PROVIDER_COMBO_BOX(combobox));
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
+
+ if (gtk_tree_model_get_iter_first (model, &others_iter))
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &others_iter);
+}