static void modem_get_sim_ready (MMModem *modem, GAsyncResult *res, BroadbandDeviceInfo *info) { GHashTable *attrs; info->mm_sim = mm_modem_get_sim_finish (modem, res, NULL); if (!info->mm_sim) /* Ok, the modem may not need it actually */ return; /* Do nothing if we're not locked */ if (mm_modem_get_state (info->mm_modem) != MM_MODEM_STATE_LOCKED) return; /* If we have a device ID ask the keyring for any saved SIM-PIN codes */ if (mm_modem_get_device_identifier (info->mm_modem) && mm_modem_get_unlock_required (info->mm_modem) == MM_MODEM_LOCK_SIM_PIN) { attrs = secret_attributes_build (&mobile_secret_schema, "devid", mm_modem_get_device_identifier (info->mm_modem), NULL); secret_service_search (NULL, &mobile_secret_schema, attrs, SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS, info->cancellable, keyring_pin_check_cb, info); g_hash_table_unref (attrs); } else { /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); } /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); }
static void modem_get_sim_ready (MMModem *modem, GAsyncResult *res, BroadbandDeviceInfo *info) { info->mm_sim = mm_modem_get_sim_finish (modem, res, NULL); if (!info->mm_sim) /* Ok, the modem may not need it actually */ return; /* Do nothing if we're not locked */ if (mm_modem_get_state (info->mm_modem) != MM_MODEM_STATE_LOCKED) return; /* If we have a device ID ask the keyring for any saved SIM-PIN codes */ if (mm_modem_get_device_identifier (info->mm_modem) && mm_modem_get_unlock_required (info->mm_modem) == MM_MODEM_LOCK_SIM_PIN) { g_warn_if_fail (info->keyring_id == NULL); info->keyring_id = gnome_keyring_find_itemsv (GNOME_KEYRING_ITEM_GENERIC_SECRET, keyring_pin_check_cb, info, NULL, "devid", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, mm_modem_get_device_identifier (info->mm_modem), NULL); return; } /* Couldn't get a device ID, but unlock required; present dialog */ unlock_dialog_new (info->device, info); }
static void get_sim_ready (MMModem *modem, GAsyncResult *res, GetSimContext *ctx) { GError *error = NULL; ctx->sim = mm_modem_get_sim_finish (modem, res, &error); if (error) { g_printerr ("error: couldn't get sim '%s' at '%s': '%s'\n", ctx->sim_path, mm_modem_get_path (modem), error->message); exit (EXIT_FAILURE); } g_simple_async_result_set_op_res_gpointer ( ctx->result, ctx, (GDestroyNotify)get_sim_context_free); get_sim_context_complete (ctx); }